Browse the API reference

Create Event Block

post/extensions/roboledger/{graph_id}/operations/create-event-block

Part of Extensions: RoboLedger.

Persist a real-world business event. apply_handlers=False (default): capture-only, status='captured'. apply_handlers=True: resolves an event_handler, fires the template, creates GL entries atomically, status='classified'. Use preview-event-block to dry-run before committing. For journal_entry_recorded, whether the entry writes back to a connected source system follows source (schedule/manual publish; system does not) unless metadata.publish_to_source says otherwise — set it false for an alignment entry mirroring a change already made upstream, which would otherwise be applied twice.

Idempotency: supply an Idempotency-Key header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.

Authentication

Authenticate in any one of these ways — not all of them:

  • API key in the X-API-Key header.
  • Bearer token in the Authorization header.

Path parameters

NameTypeDescription
graph_idrequiredstringGraph Id

Header parameters

NameTypeDescription
Idempotency-KeyoptionalstringIdempotency-Key

Request body

Required, application/json.

FieldTypeDescription
event_typerequiredstring

Open vocabulary: 'invoice_issued' | 'contract_signed' | 'bank_transaction' | ...

event_categoryrequiredstring

REA classification. Economic categories (sales, purchase, financing, payroll, treasury, adjustment, recognition, other) require event_class='economic'. Support categories (control, approval, reconciliation, inquiry) require event_class='support'. The DB CHECK rejects mismatched pairings.

One of: sales, purchase, financing, payroll, treasury, adjustment, recognition, other, control, approval, reconciliation, inquiry

event_classoptionalstring

REA event class. 'economic' events change resources and drive GL postings; 'support' events are audit-trail / value-chain primitives (typically captured with apply_handlers=False).

One of: economic, support

Default: economic

event_actionoptionalstring

Canonical action verb refining `event_category`. Disambiguates concepts ERPs collapse: `transferAllRights` (ownership transfer, no physical movement) vs `transferCustody` (physical only, no rights transfer) — load-bearing for consignment, drop-shipping, marketplace settlement, escrow. Optional; null is valid for legacy events and during adapter rollout.

One of: produce, raise, consume, lower, use, cite, work, deliverService, pickup, dropoff, accept, transferCustody, transferAllRights, transfer, move, modify, combine, separate, copy

agent_idoptionalstring

ID of the counterparty agent (customer, vendor, employee, lender) involved in the event. `null` for internal-only events.

resource_typeoptionalstring

REA resource kind being exchanged. One of: `goods`, `services`, `money`, `right`, `obligation`, `information`, `labor`.

One of: goods, services, money, right, obligation, information, labor

resource_element_idoptionalstring

ID of the specific element being exchanged, when known (e.g. the cash account for a treasury movement, the inventory item for a sale).

occurred_atrequiredstring (date-time)

When the event happened in the real world

effective_atoptionalstring (date-time)

Accounting recognition date, if different from occurred_at

sourcerequiredstring

'manual' | 'system' | 'schedule', a connected provider name (e.g. 'quickbooks'), or a source_name registered via an 'external' connection. Validated against the graph's registered connections.

external_idoptionalstring

Source-system dedup key. (source, external_id) is enforced unique when external_id is provided, so retries from external adapters are idempotent at the DB level.

external_urloptionalstring

Deep link back to source-system record

amountoptionalinteger

Economic value of the event in **cents** of `currency`, signed. Sign convention follows the perspective of the entity that owns the graph: inflows positive, outflows negative. `null` for non-economic events (e.g. `event_class='support'`).

currencyoptionalstring

ISO 4217 currency code for `amount`.

Default: USD

descriptionoptionalstring

Free-text human-readable summary of the event.

metadataoptionalobject

Free-form payload, opaque to the event surface. When `apply_handlers=True`, the matched handler's metadata schema validates this dict — required keys depend on the handler registered for `event_type`. Use `preview-event-block` to discover the expected shape without writing.

dimension_idsoptionalstring[]

IDs of dimension members tagging this event (e.g. department, fund, project). Propagate to the GL entries produced by the handler.

obligated_by_event_idoptionalstring

Forward-materialization link: the event that scheduled or obligated this one (e.g. depreciation entries point at the asset_acquired event).

discharges_event_idoptionalstring

Settlement link: the obligation this event discharges (e.g. cash_received pointing at the originating sale_invoiced).

apply_handlersoptionalboolean

When True, resolves the event_type to a handler (Python registry first, then DSL) and fires it atomically with event creation.

Default: false

Example request

curl
curl -X POST "https://api.robosystems.ai/extensions/roboledger/{graph_id}/operations/create-event-block" \
  -H "X-API-Key: $ROBOSYSTEMS_API_KEY" \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Content-Type: application/json" \
  -d '{
  "agent_id": "ent_customer_acme",
  "amount": 250000,
  "currency": "USD",
  "description": "April consulting retainer — Acme Corp",
  "dimension_ids": [
    "dim_dept_consulting"
  ],
  "event_category": "sales",
  "event_class": "economic",
  "event_type": "invoice_issued",
  "external_id": "qb_inv_4521",
  "external_url": "https://app.qbo.intuit.com/app/invoice?txnId=4521",
  "metadata": {
    "invoice_number": "INV-2026-0421",
    "terms": "net_30"
  },
  "occurred_at": "2026-05-01T14:30:00Z",
  "resource_type": "services",
  "source": "quickbooks"
}'

Responses

200 Successful Response

FieldTypeDescription
operationrequiredstring

Kebab-case operation name

operationIdrequiredstring

op_-prefixed ULID for audit and SSE correlation

statusrequiredstring

Operation lifecycle state

One of: completed, pending, failed

resultoptionalEventBlockEnvelope

Command-specific result payload

EventBlockEnvelope fields
FieldTypeDescription
idrequiredstring

Event ID (`evt_*` ULID).

event_typerequiredstring

Open-vocabulary event type (e.g. `invoice_issued`, `bank_transaction`, `control_executed`).

event_categoryrequiredstring

REA category, scoped by `event_class` — economic (`sales`, `purchase`, `financing`, `payroll`, `treasury`, `adjustment`, `recognition`, `other`), support (`control`, `approval`, `reconciliation`, `inquiry`), or operational (`pipeline`, `engagement`, `schedule`, `other`) for occurrences that drive no GL — a lead, a lifecycle change, an outreach, a schedule setup.

statusrequiredstring

Lifecycle state. One of: `captured` (raw, pre-classification), `classified` (handler ran, GL pending), `committed` (GL entries posted), `pending` (committed but awaiting fulfillment of an obligation), `fulfilled` (obligation discharged — retractable while its ledger rows are still drafts), `voided` (canceled — terminal), `superseded` (replaced by a corrected event — terminal). See `UpdateEventBlockRequest.transition_to` for the valid transition graph.

occurred_atrequiredstring (date-time)

When the event happened in the real world (UTC).

effective_atoptionalstring (date-time)

Accounting recognition date, when different from `occurred_at`.

sourcerequiredstring

Capture source: `manual`, `system`, `schedule`, a connected provider name (e.g. `quickbooks`), or a registered external source_name. Used for adapter routing.

external_idoptionalstring

Source-system dedup key. Unique with `source` when set, so adapter retries are idempotent.

external_urloptionalstring

Deep link back to the source-system record.

amountoptionalinteger

Economic value in **cents** of `currency`, signed (inflows positive, outflows negative). `null` for non-economic events.

currencyrequiredstring

ISO 4217 currency code for `amount`.

descriptionoptionalstring

Free-text human-readable summary.

metadatarequiredobject

Free-form payload — handler-specific keys when the event ran through a handler, otherwise whatever the adapter captured.

is_reconciling_itemoptionalboolean

True when this event is a reconciling item: a source re-sync surfaced a changed upstream payload for an event whose GL is already posted (committed/fulfilled are immutable to sync) — the local books legitimately no longer mirror the source, and the difference awaits an explicit disposition (restate the affected months, or book a catch-up entry in the open period). The live payload and GL are untouched; the incoming payload is stashed in `metadata.drift_payload` with `metadata.drift_detected_at`.

Default: false

dimension_idsrequiredstring[]

Dimension-member IDs tagging this event (department, fund, project). Propagate to GL entries produced by the handler.

event_classrequiredstring

REA event class — `economic` (drives GL postings) or `support` (audit-trail / value-chain primitive, no GL impact).

event_actionoptionalstring

Canonical action verb refining `event_category`. Null when the source adapter or capture path didn't supply one.

One of: produce, raise, consume, lower, use, cite, work, deliverService, pickup, dropoff, accept, transferCustody, transferAllRights, transfer, move, modify, combine, separate, copy

agent_idoptionalstring

Counterparty agent ID, when the event involves one.

resource_typeoptionalstring

REA resource kind being exchanged (`goods`, `services`, `money`, `right`, `obligation`, `information`, `labor`).

resource_element_idoptionalstring

Specific element ID being exchanged, when known.

replaced_by_event_idoptionalstring

ID of the event that replaces this one. Set when this event was superseded (`status='superseded'`); points forward in the correction chain.

replaces_event_idoptionalstring

ID of the event this one replaces, when applicable. Points backward in the correction chain. Mirror of `replaced_by_event_id` on the predecessor.

obligated_by_event_idoptionalstring

Forward-materialization link — the event that scheduled or obligated this one (e.g. depreciation entries point at the originating `asset_acquired` event).

discharges_event_idoptionalstring

Settlement link — the obligation this event discharges (e.g. `cash_received` pointing at the originating `sale_invoiced`).

created_atrequiredstring (date-time)

Row creation timestamp (UTC).

created_byrequiredstring

ID of the user who captured the event. For adapter-sourced events, the system actor associated with the adapter.

atrequiredstring

ISO-8601 UTC timestamp

createdByoptionalstring

User ID that initiated the operation (null for legacy callers)

idempotentReplayoptionalboolean

True when this envelope came from the idempotency cache — the underlying command did not execute again. False on fresh executions.

Default: false

StatusMeaning
400Invalid request
401Authentication required
403Access denied
404Resource not found
409Idempotency-Key conflict — key reused with different body
422Validation error
429Rate limit exceeded
500Internal server error