Prompt

I'm building an ERP connector and need a normalized accounting data model

Finance / Accounting Fintech1 observationLast seen Nov 3, 2026

Latest observation

Nov 3, 2026OpenAI APIWeb search: off

Below is a practical normalized accounting data model you can use as the core of an ERP connector. It’s designed to absorb data from multiple ERPs and map them into a consistent internal schema while preserving source-system fidelity.

I’ll organize it around the main accounting domains:

  1. Core master data
  2. Chart of accounts
  3. Organizations / legal entities
  4. Journal entries
  5. Subledger documents
  6. Tax / dimensions / currency
  7. AP / AR
  8. Payments
  9. Fixed assets
  10. Controls / audit / source mapping

1) Design principles

For ERP connectors, the model should:

  • Be source-agnostic: no assumptions about one ERP’s exact structure.
  • Be normalized: avoid repeating attributes across documents and lines.
  • Preserve source references: every record should map back to the original ERP object IDs.
  • Support multi-entity, multi-currency, multi-ledger.
  • Handle ledger postings and subledger documents separately.
  • Be compatible with incremental sync and idempotent imports.

A good pattern is:

  • Reference tables for master data
  • Document header/line tables for transactional records
  • Posting tables for accounting impacts
  • Mapping tables for source-system alignment

2) Core entities

A. source_system

Represents the connected ERP instance.

source_system (
  id                UUID PK,
  vendor            TEXT,          -- SAP, NetSuite, Oracle, Dynamics, etc.
  instance_name     TEXT,
  environment      TEXT,          -- prod, sandbox
  tenant_id         TEXT,
  created_at       TIMESTAMP,
  updated_at       TIMESTAMP
)

B. legal_entity

A company or legal reporting entity.

legal_entity (
  id                UUID PK,
  source_system_id  UUID FK,
  source_key        TEXT,          -- source ERP unique ID
  name              TEXT,
  code              TEXT,
  registration_no   TEXT,
  country_code      TEXT,
  base_currency_id  UUID FK,
  parent_entity_id   UUID FK NULL,
  active            BOOLEAN,
  created_at        TIMESTAMP,
  updated_at        TIMESTAMP,
  UNIQUE(source_system_id, source_key)
)

C. fiscal_calendar

Optional but useful for period-based reporting.

fiscal_calendar (
  id                UUID PK,
  legal_entity_id   UUID FK,
  name              TEXT,
  start_month       INT,
  start_day         INT,
  pattern           TEXT,         -- 4-4-5, monthly, quarterly
  timezone          TEXT
)

D. fiscal_period

fiscal_period (
  id                UUID PK,
  fiscal_calendar_id UUID FK,
  period_name       TEXT,
  period_no         INT,
  start_date        DATE,
  end_date          DATE,
  status            TEXT,         -- open, closed, locked
  UNIQUE(fiscal_calendar_id, period_no)
)

3) Currency and exchange rates

A. currency

currency (
  id                UUID PK,
  iso_code          CHAR(3) UNIQUE,
  name              TEXT,
  minor_units       INT
)

B. exchange_rate

exchange_rate (
  id                UUID PK,
  source_system_id  UUID FK,
  from_currency_id  UUID FK,
  to_currency_id    UUID FK,
  rate_date         DATE,
  rate_type         TEXT,         -- spot, average, historical
  rate              DECIMAL(18,8),
  UNIQUE(source_system_id, from_currency_id, to_currency_id, rate_date, rate_type)
)

4) Chart of accounts

A. account

A normalized GL account.

account (
  id                UUID PK,
  source_system_id  UUID FK,
  legal_entity_id   UUID FK NULL,   -- null if global COA shared across entities
  source_key        TEXT,
  account_code      TEXT,
  account_name      TEXT,
  account_type      TEXT,           -- asset, liability, equity, income, expense
  account_subtype   TEXT,           -- cash, ap_ar, cogs, etc.
  parent_account_id UUID FK NULL,
  is_postable       BOOLEAN,
  active            BOOLEAN,
  created_at        TIMESTAMP,
  updated_at        TIMESTAMP,
  UNIQUE(source_system_id, source_key)
)

B. account_mapping

Useful when the source account must map to a canonical internal one.

account_mapping (
  id                UUID PK,
  source_system_id  UUID FK,
  source_account_id UUID FK,
  target_account_id UUID FK,
  mapping_type      TEXT,           -- direct, rule-based
  effective_from    DATE,
  effective_to      DATE NULL
)

5) Dimensions / segments

ERPs often use cost centers, departments, locations, classes, projects, etc. Normalize them as generic dimensions.

A. dimension_type

dimension_type (
  id                UUID PK,
  source_system_id  UUID FK,
  source_key        TEXT,
  name              TEXT,          -- Department, Cost Center, Project
  code              TEXT,
  UNIQUE(source_system_id, source_key)
)

B. dimension_value

dimension_value (
  id                UUID PK,
  dimension_type_id UUID FK,
  source_key        TEXT,
  code              TEXT,
  name              TEXT,
  parent_value_id   UUID FK NULL,
  active            BOOLEAN,
  UNIQUE(dimension_type_id, source_key)
)

C. document_line_dimension

Many-to-many association between a transaction line and its dimensions.

document_line_dimension (
  id                UUID PK,
  document_line_id  UUID FK,
  dimension_type_id UUID FK,
  dimension_value_id UUID FK
)

6) Journal entries

This is the backbone of accounting normalization.

A. journal_entry

Header-level posting object.

journal_entry (
  id                UUID PK,
  source_system_id  UUID FK,
  legal_entity_id   UUID FK,
  source_key        TEXT,
  entry_number      TEXT,
  entry_date        DATE,
  posting_date      DATE,
  description       TEXT,
  status            TEXT,          -- draft, posted, reversed
  source_document_type TEXT,       -- invoice, bill, payment, manual, etc.
  source_document_id TEXT,
  created_at        TIMESTAMP,
  updated_at        TIMESTAMP,
  UNIQUE(source_system_id, source_key)
)

B. journal_entry_line

journal_entry_line (
  id                UUID PK,
  journal_entry_id   UUID FK,
  line_no           INT,
  account_id        UUID FK,
  description       TEXT,
  debit_amount      DECIMAL(18,2) DEFAULT 0,
  credit_amount     DECIMAL(18,2) DEFAULT 0,
  currency_id       UUID FK,
  exchange_rate     DECIMAL(18,8) NULL,
  amount_foreign    DECIMAL(18,2) NULL,
  base_amount       DECIMAL(18,2) NULL,
  tax_amount        DECIMAL(18,2) NULL,
  source_line_key   TEXT,
  UNIQUE(journal_entry_id, line_no)
)

Optional normalization:

Use a single signed amount instead of debit/credit if your analytics layer prefers it:

amount_signed = debit_amount - credit_amount

7) Subledger documents

You’ll usually want source documents separate from ledger postings.

A. Generic document

A parent table for invoices, bills, credit notes, receipts, etc.

document (
  id                UUID PK,
  source_system_id  UUID FK,
  legal_entity_id   UUID FK,
  source_key        TEXT,
  document_type     TEXT,        -- invoice, bill, credit_note, journal, PO, etc.
  document_number   TEXT,
  document_date     DATE,
  posting_date      DATE NULL,
  due_date          DATE NULL,
  status            TEXT,
  currency_id       UUID FK,
  total_amount      DECIMAL(18,2),
  tax_amount        DECIMAL(18,2),
  net_amount        DECIMAL(18,2),
  counterparty_id   UUID FK NULL,
  source_created_at  TIMESTAMP NULL,
  source_updated_at  TIMESTAMP NULL,
  UNIQUE(source_system_id, source_key)
)

B. document_line

document_line (
  id                UUID PK,
  document_id       UUID FK,
  line_no           INT,
  line_type         TEXT,        -- item, service, tax, discount, freight
  description       TEXT,
  quantity          DECIMAL(18,6),
  unit_price        DECIMAL(18,6),
  net_amount        DECIMAL(18,2),
  tax_amount        DECIMAL(18,2),
  gross_amount      DECIMAL(18,2),
  account_id        UUID FK NULL,
  tax_code_id       UUID FK NULL,
  source_line_key   TEXT,
  UNIQUE(document_id, line_no)
)

C. document_posting

Links a subledger document to generated journal entries.

document_posting (
  id                UUID PK,
  document_id       UUID FK,
  journal_entry_id   UUID FK,
  posting_type       TEXT,      -- original, adjustment, reversal
  UNIQUE(document_id, journal_entry_id)
)

8) Counterparties

Unified entity for customers, vendors, employees, etc.

A. counterparty

counterparty (
  id                UUID PK,
  source_system_id  UUID FK,
  source_key        TEXT,
  counterparty_type TEXT,      -- customer, vendor, employee, other
  name              TEXT,
  code              TEXT,
  tax_id            TEXT NULL,
  active            BOOLEAN,
  created_at        TIMESTAMP,
  updated_at        TIMESTAMP,
  UNIQUE(source_system_id, source_key)
)

B. Optional contact details

counterparty_address (
  id                UUID PK,
  counterparty_id   UUID FK,
  address_type      TEXT,      -- billing, shipping, headquarters
  line1             TEXT,
  line2             TEXT,
  city              TEXT,
  region            TEXT,
  postal_code       TEXT,
  country_code      TEXT
)

9) Accounts receivable / accounts payable

If you want clean normalization, keep AP/AR open-item documents separate from generic documents.

A. ap_invoice

ap_invoice (
  id                UUID PK,
  document_id       UUID FK UNIQUE,
  supplier_id       UUID FK,
  invoice_number    TEXT,
  invoice_date      DATE,
  due_date          DATE,
  status            TEXT
)

B. ar_invoice

ar_invoice (
  id                UUID PK,
  document_id       UUID FK UNIQUE,
  customer_id       UUID FK,
  invoice_number    TEXT,
  invoice_date      DATE,
  due_date          DATE,
  status            TEXT
)

C. ap_ar_open_item

Use one table to track receivable/payable balances.

open_item (
  id                UUID PK,
  source_system_id  UUID FK,
  legal_entity_id   UUID FK,
  document_id       UUID FK,
  counterparty_id   UUID FK,
  open_item_type    TEXT,      -- ap, ar
  original_amount   DECIMAL(18,2),
  open_amount       DECIMAL(18,2),
  currency_id       UUID FK,
  due_date          DATE,
  status            TEXT,      -- open, partially_paid, paid, written_off
  UNIQUE(source_system_id, document_id)
)

10) Payments

A. payment

payment (
  id                UUID PK,
  source_system_id  UUID FK,
  legal_entity_id   UUID FK,
  source_key        TEXT,
  payment_number    TEXT,
  payment_date      DATE,
  amount            DECIMAL(18,2),
  currency_id       UUID FK,
  payment_method    TEXT,
  status            TEXT,     -- pending, cleared, failed, voided
  counterparty_id   UUID FK NULL,
  bank_account_id   UUID FK NULL,
  UNIQUE(source_system_id, source_key)
)

B. payment_application

Links payment to invoices/open items.

payment_application (
  id                UUID PK,
  payment_id        UUID FK,
  open_item_id      UUID FK,
  applied_amount    DECIMAL(18,2),
  applied_date      DATE
)

11) Tax

A. tax_code

tax_code (
  id                UUID PK,
  source_system_id  UUID FK,
  source_key        TEXT,
  code              TEXT,
  name              TEXT,
  tax_type          TEXT,      -- vat, sales_tax, gst, withholding
  rate              DECIMAL(9,6),
  active            BOOLEAN,
  UNIQUE(source_system_id, source_key)
)

B. tax_line

If you want tax breakdowns independent of documents.

tax_line (
  id                UUID PK,
  document_id       UUID FK,
  tax_code_id       UUID FK,
  taxable_amount    DECIMAL(18,2),
  tax_amount        DECIMAL(18,2),
  line_no           INT
)

12) Fixed assets

A. fixed_asset

fixed_asset (
  id                UUID PK,
  source_system_id  UUID FK,
  legal_entity_id   UUID FK,
  source_key        TEXT,
  asset_number      TEXT,
  name              TEXT,
  acquisition_date  DATE,
  acquisition_cost  DECIMAL(18,2),
  salvage_value     DECIMAL(18,2),
  useful_life_months INT,
  status            TEXT,     -- active, disposed, fully_depreciated
  UNIQUE(source_system_id, source_key)
)

B. asset_depreciation

asset_depreciation (
  id                UUID PK,
  fixed_asset_id    UUID FK,
  depreciation_date DATE,
  amount            DECIMAL(18,2),
  journal_entry_id   UUID FK NULL
)

13) Source mapping and auditability

This is critical for connectors.

A. source_record

Use this to track every imported source object.

source_record (
  id                UUID PK,
  source_system_id  UUID FK,
  object_type       TEXT,      -- invoice, account, journal_entry, payment, etc.
  source_key        TEXT,
  raw_payload       JSONB,
  hash              TEXT,
  first_seen_at     TIMESTAMP,
  last_seen_at      TIMESTAMP,
  UNIQUE(source_system_id, object_type, source_key)
)

B. sync_cursor

For incremental sync checkpoints.

sync_cursor (
  id                UUID PK,
  source_system_id  UUID FK,
  object_type       TEXT,
  cursor_value      TEXT,
  updated_at       TIMESTAMP,
  UNIQUE(source_system_id, object_type)
)

14) Recommended minimal canonical model

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

  • source_system
  • legal_entity
  • currency
  • account
  • counterparty
  • document
  • document_line
  • journal_entry
  • journal_entry_line
  • payment
  • open_item
  • tax_code
  • dimension_type
  • dimension_value
  • source_record

That’s enough for most ERP integrations.


15) Relationships overview

A simplified relationship map:

  • legal_entity → owns accounts, documents, journal entries, payments
  • document → has many document_line
  • document → may generate one or more journal_entry
  • journal_entry → has many journal_entry_line
  • counterparty → linked to documents, open items, payments
  • payment → applies to one or more open_item
  • dimension_value → attached to document lines or journal lines
  • source_record → tracks raw source object for every canonical entity

16) Implementation advice

Use stable canonical IDs

Assign your own UUIDs internally, and keep source IDs in source_key.

Store source payloads

Even if normalized, keep raw JSON for traceability and debugging.

Avoid overloading document tables

If something is specific to AP or AR, prefer a specialized table linked 1:1 to the generic document.

Don’t force every ERP field into the canonical schema

Keep an extension JSON column if needed:

  • document.metadata
  • journal_entry.metadata
  • counterparty.metadata

Use mapping tables for transformations

Especially for:

  • accounts
  • tax codes
  • dimensions
  • payment methods
  • document types

17) Example canonical flow

Example: an AP invoice from ERP source.

  1. Import raw invoice into source_record
  2. Upsert counterparty
  3. Upsert document
  4. Insert document_line
  5. Upsert tax_line and tax_code
  6. Create linked journal_entry
  7. Insert journal_entry_line
  8. Create/update open_item
  9. Mark sync cursor advanced

18) If you want API-friendly JSON shape

Here’s a practical canonical invoice payload:

{
  "source_system_id": "uuid",
  "legal_entity_id": "uuid",
  "document_type": "invoice",
  "source_key": "erp-12345",
  "document_number": "INV-2024-0091",
  "document_date": "2024-09-15",
  "due_date": "2024-10-15",
  "currency": "USD",
  "counterparty": {
    "source_key": "vendor-88",
    "name": "Acme Supplies"
  },
  "lines": [
    {
      "line_no": 1,
      "description": "Office chairs",
      "quantity": 10,
      "unit_price": 120.00,
      "net_amount": 1200.00,
      "tax_code": "VAT20",
      "dimensions": {
        "department": "Sales",
        "cost_center": "CC100"
      }
    }
  ],
  "totals": {
    "net_amount": 1200.00,
    "tax_amount": 240.00,
    "total_amount": 1440.00
  }
}

If you want, I can also provide one of these next:

  1. A full SQL DDL schema for PostgreSQL
  2. An ER diagram-style relationship map
  3. A more opinionated canonical model for AP/AR only
  4. A mapping template for SAP / NetSuite / Dynamics / Oracle

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.