Submit a batch

  POST /ledger/v1/events/batch
  

Headers

HeaderRequired
X-Tenant-IDyes

Request body

events holds 1–10 000 items:

  {
  "events": [
    {
      "eventType": "SalesInvoice",
      "date": "2026-01-31",
      "documentReference": "INV-2026-0001",
      "description": "January invoice",
      "accountingEntries": [
        { "accountCode": "1500-receivables", "entryType": "DEBIT",  "amount": 125000, "currency": "EUR" },
        { "accountCode": "3000-sales",       "entryType": "CREDIT", "amount": 100000, "currency": "EUR" },
        { "accountCode": "2700-vat-out",     "entryType": "CREDIT", "amount": 25000,  "currency": "EUR" }
      ]
    }
  ]
}
  
FieldTypeConstraints
eventsarrayrequired, 1–10 000 items
events[].eventTypestringrequired
events[].datedaterequired, yyyy-MM-dd
events[].documentReferencestring≤ 255 chars; unique per tenant
events[].descriptionstringoptional
events[].accountingEntriesarrayrequired, non-empty; same shape as business events
events[].metadataobjectoptional

Responses

The response always reports how many items were accepted and lists per-item errors:

  {
  "accepted": 9998,
  "errors": [
    { "documentReference": "INV-2026-0042", "index": 41,
      "messages": ["entries do not balance: debits=125000 credits=100000"] },
    { "documentReference": "INV-2026-0007", "index": -1,
      "messages": ["document reference already exists"] }
  ]
}
  
StatusMeaning
202Batch accepted (accepted > 0); any failures listed in errors
409A documentReference already exists for the tenant (index: -1 marks DB-level duplicates)
422Validation failures — unbalanced items or duplicate references within the batch
400Missing or invalid fields

index is the item’s 0-based position in the submitted array.