Prompt

Need a normalized accounting data model across vendors

Finance / Accounting Fintech1 observationLast seen Nov 3, 2026

Latest observation

Nov 3, 2026OpenAI APIWeb search: off

A good normalized accounting data model across vendors should separate:

  1. Source/vendor-specific raw data
  2. Canonical accounting entities
  3. Posting/journal mechanics
  4. Reference/master data
  5. Mapping and reconciliation metadata

Below is a practical vendor-agnostic model you can use for QuickBooks, Xero, NetSuite, SAP, Stripe, Bill.com, etc.


1. Core design principles

  • Keep raw source records immutable
    Store vendor payloads as-is for auditability.
  • Normalize into canonical tables
    Convert each vendor’s objects into a shared schema.
  • Use stable internal IDs
    Every entity should have an internal UUID plus source references.
  • Separate header vs lines
    Most accounting documents have a parent/header and child/line structure.
  • Model accounting entries as double-entry journals
    This is the most portable universal layer.
  • Allow multi-currency and multi-entity
    Essential for real-world accounting.
  • Support many-to-many mappings
    For accounts, tax codes, customers, vendors, products, etc.

2. Canonical entities

A. Organization / tenant

Represents the company or legal entity.

organization

  • organization_id (PK)
  • name
  • legal_name
  • base_currency
  • country
  • timezone
  • status
  • created_at
  • updated_at

B. Source system

Tracks which vendor the data came from.

source_system

  • source_system_id (PK)
  • organization_id (FK)
  • vendor_name (e.g. quickbooks, xero, netsuite)
  • external_account_id
  • auth_connection_id
  • created_at
  • updated_at

C. Raw ingested records

Store original objects exactly as received.

raw_record

  • raw_record_id (PK)
  • organization_id (FK)
  • source_system_id (FK)
  • entity_type (e.g. invoice, bill, journal_entry)
  • external_id
  • payload_json
  • payload_hash
  • ingested_at
  • source_updated_at
  • deleted_at nullable

3. Master data

A. Account / chart of accounts

account

  • account_id (PK)
  • organization_id (FK)
  • account_type
    Examples: asset, liability, equity, revenue, expense, cogs
  • account_subtype
  • account_code
  • name
  • parent_account_id nullable
  • is_active
  • is_system
  • currency_code nullable
  • created_at
  • updated_at

account_mapping

  • account_mapping_id (PK)
  • organization_id
  • source_system_id
  • external_account_id
  • account_id (FK)
  • confidence_score
  • mapping_status
  • created_at

B. Counterparties

Customers, vendors, employees, contractors.

party

  • party_id (PK)
  • organization_id
  • party_type
    customer | vendor | employee | contractor | other
  • legal_name
  • display_name
  • tax_id
  • email
  • phone
  • status
  • created_at
  • updated_at

party_mapping

  • party_mapping_id
  • organization_id
  • source_system_id
  • external_party_id
  • party_id
  • source_party_type
  • confidence_score

C. Products / services

item

  • item_id (PK)
  • organization_id
  • item_type
    inventory | service | non_inventory | expense | other
  • sku
  • name
  • description
  • income_account_id nullable
  • expense_account_id nullable
  • asset_account_id nullable
  • is_active
  • created_at
  • updated_at

4. Accounting transactions

A. Universal document header

A common header for financial documents.

document

  • document_id (PK)
  • organization_id
  • document_type
    invoice | bill | credit_note | vendor_credit | payment | receipt | journal_entry | deposit | transfer | estimate | purchase_order
  • document_number
  • status
    draft | open | paid | void | posted | partial
  • issue_date
  • due_date
  • posting_date
  • currency_code
  • exchange_rate
  • party_id nullable
  • reference_number
  • memo
  • source_system_id
  • external_id
  • created_at
  • updated_at
  • voided_at nullable

B. Universal document lines

document_line

  • document_line_id (PK)
  • document_id (FK)
  • line_number
  • line_type
    item | account | tax | discount | shipping | fee | adjustment | description
  • description
  • item_id nullable
  • account_id nullable
  • quantity nullable
  • unit_price nullable
  • amount
  • tax_code_id nullable
  • department_id nullable
  • class_id nullable
  • location_id nullable
  • project_id nullable
  • customer_id nullable
  • vendor_id nullable
  • created_at

C. Payments / settlements

You can model payments as documents or separate payment entities. For portability, documents work well.

If separate:

payment

  • payment_id (PK)
  • organization_id
  • payment_date
  • payment_method
  • currency_code
  • amount
  • party_id
  • applied_document_id nullable
  • source_system_id
  • external_id
  • status
  • created_at

5. General ledger layer

This is the most important normalized layer.

A. Journal entry

journal_entry

  • journal_entry_id (PK)
  • organization_id
  • entry_number
  • entry_date
  • posting_date
  • source_document_id nullable
  • source_system_id
  • external_id
  • memo
  • status
    draft | posted | reversed | void
  • created_at
  • updated_at

B. Journal lines

journal_line

  • journal_line_id (PK)
  • journal_entry_id (FK)
  • line_number
  • account_id (FK)
  • party_id nullable
  • debit_amount
  • credit_amount
  • currency_code
  • exchange_rate
  • amount_base_currency
  • description
  • tax_code_id nullable
  • department_id nullable
  • class_id nullable
  • location_id nullable
  • project_id nullable
  • document_line_id nullable
  • created_at

Notes

  • Every journal entry should balance: sum(debit) = sum(credit)
  • Store both transaction currency and base currency values
  • Keep links back to source docs and source lines

6. Tax and dimensions

A. Tax codes

tax_code

  • tax_code_id (PK)
  • organization_id
  • name
  • code
  • tax_type
  • rate
  • is_active
  • created_at

B. Tax lines

tax_line

  • tax_line_id
  • document_id
  • document_line_id nullable
  • tax_code_id
  • taxable_amount
  • tax_amount
  • jurisdiction
  • created_at

C. Analytical dimensions

Many vendors call these classes, departments, locations, segments, tracking categories, classes, tags.

dimension_type

  • dimension_type_id
  • organization_id
  • name
    department | class | location | customer | project | segment | tag
  • is_active

dimension_value

  • dimension_value_id
  • organization_id
  • dimension_type_id
  • name
  • code
  • parent_dimension_value_id nullable
  • is_active

document_line_dimension

  • document_line_dimension_id
  • document_line_id
  • dimension_type_id
  • dimension_value_id

journal_line_dimension

  • journal_line_dimension_id
  • journal_line_id
  • dimension_type_id
  • dimension_value_id

7. Reconciliation and mapping metadata

A. Entity mapping table

Use one generic mapping table instead of many if preferred.

entity_mapping

  • entity_mapping_id
  • organization_id
  • source_system_id
  • entity_type
  • external_id
  • internal_entity_type
  • internal_id
  • mapping_status
  • confidence_score
  • matched_by
  • created_at
  • updated_at

This can replace account_mapping, party_mapping, etc., if you want a single extensible table.

B. Sync tracking

sync_run

  • sync_run_id
  • organization_id
  • source_system_id
  • started_at
  • finished_at
  • status
  • records_read
  • records_written
  • records_failed
  • error_summary

sync_error

  • sync_error_id
  • sync_run_id
  • entity_type
  • external_id
  • error_code
  • error_message
  • raw_payload_json
  • created_at

8. Common vendor variations and how to normalize them

QuickBooks

  • Invoice, Bill, JournalEntry, Payment, Deposit
  • Uses Line arrays and references to AccountRef, CustomerRef, VendorRef

Xero

  • Invoice, Bill, CreditNote, Payment, ManualJournal
  • Uses LineItems, AccountCode, Contact

NetSuite

  • Has more complex transactions and segmentations
  • Often requires more robust handling of subsidiaries, classes, departments, locations
  • Keep parent-child relationships and dimension tables flexible

Stripe / payment processors

  • Transactions are not always accounting documents
  • Normalize into payment, fee, refund, payout, then journalize
  • Often need settlement batches and fees split out separately

9. Recommended minimum viable schema

If you want the smallest useful normalized model, start with:

  • organization
  • source_system
  • raw_record
  • account
  • party
  • item
  • document
  • document_line
  • journal_entry
  • journal_line
  • entity_mapping
  • sync_run
  • sync_error

That will cover most use cases.


10. Example normalized flow

Example: Vendor bill from Xero

  1. Ingest raw bill JSON into raw_record
  2. Map Contact to party
  3. Map AccountCode to account
  4. Create document with type = bill
  5. Create document_line rows for each line item
  6. Generate journal_entry
  7. Create balanced journal_line rows:
    • Dr Expense
    • Dr Tax receivable if applicable
    • Cr Accounts Payable

11. Important implementation details

  • Use UUIDs for internal keys
  • Keep external IDs and source system IDs
  • Use soft deletes for accounting records where source systems support voiding/deletion
  • Store effective dates and posting dates separately
  • Support versioning if upstream objects can change
  • Do not overwrite raw records
  • Preserve line ordering with line_number
  • Add audit columns:
    • created_at
    • updated_at
    • created_by
    • updated_by

12. Best-practice ERD summary

Core relationships

  • Organization 1—N SourceSystem
  • Organization 1—N Accounts / Parties / Items / Documents / JournalEntries
  • Document 1—N DocumentLines
  • JournalEntry 1—N JournalLines
  • SourceSystem N—N InternalEntity via EntityMapping
  • DocumentLine N—N Dimensions
  • JournalLine N—N Dimensions

If you want, I can also provide:

  1. a PostgreSQL DDL schema
  2. an ERD diagram in Mermaid
  3. a dbt-style dimensional model
  4. a canonical JSON schema for API ingestion

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.