Create Event Block
/extensions/roboledger/{graph_id}/operations/create-event-blockPart of RoboLedger: Ledger & Events.
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. An invoice_issued or bill_received takes due_date, or terms_days (net N from occurred_at); with neither it is due on receipt. A later due date is a field correction on update-event-block.
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-Keyheader. - Bearer token in the
Authorizationheader.
Path parameters
| Name | Type | Description |
|---|---|---|
graph_idrequired | string | Graph Id Constraints: matches |
Header parameters
| Name | Type | Description |
|---|---|---|
Idempotency-Keyoptional | string | Idempotency-Key |
Request body
Required, application/json.
| Field | Type | Description |
|---|---|---|
entity_idoptional | string | The entity whose books the event lands in, by id; every GL row its handler writes follows it. Omit for the group parent. |
event_typerequired | string | Open vocabulary: 'invoice_issued' | 'contract_signed' | 'bank_transaction' | ... |
event_categoryrequired | string | 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: |
event_classoptional | string | 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: Default: |
event_actionoptional | string | Canonical action verb refining One of: |
agent_idoptional | string | ID of the counterparty agent (customer, vendor, employee, lender) involved in the event. |
resource_typeoptional | string | REA resource kind being exchanged. One of: One of: |
resource_element_idoptional | string | 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_atrequired | string (date-time) | When the event happened in the real world |
effective_atoptional | string (date-time) | Accounting recognition date, if different from occurred_at |
due_dateoptional | string (date) | When an obligation falls due: an |
terms_daysoptional | integer | Net terms in days from Constraints: 0–3650 |
sourcerequired | string | '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_idoptional | string | 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_urloptional | string | Deep link back to source-system record |
amountoptional | integer | Economic value of the event in **cents** of |
currencyoptional | string | ISO 4217 currency code for Default: |
descriptionoptional | string | Free-text human-readable summary of the event. |
metadataoptional | object | Free-form payload, opaque to the event surface. When |
dimension_idsoptional | string[] | Management dimension members tagging this event (department, class, location, project), one per axis. Every line its handler writes carries them on the axes the line does not tag itself. |
obligated_by_event_idoptional | string | Forward-materialization link: the event that scheduled or obligated this one (e.g. depreciation entries point at the asset_acquired event). |
discharges_event_idoptional | string | Settlement link: the obligation this event discharges (e.g. cash_received pointing at the originating sale_invoiced). |
document_idoptional | string | The stored document this event rests on, as evidence: the invoice PDF, the vendor bill, the receipt photo (upload it with create-document-upload and complete-document-upload). Must be a document on this graph. While the event is live, the document cannot be deleted. |
apply_handlersoptional | boolean | When True, resolves the event_type to a handler (Python registry first, then DSL) and fires it atomically with event creation. Default: |
Example request
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"
}'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 '{
"amount": -125000,
"apply_handlers": true,
"currency": "USD",
"description": "ACH out — Office rent May 2026",
"event_category": "treasury",
"event_class": "economic",
"event_type": "bank_transaction",
"external_id": "plaid_txn_abc123",
"metadata": {
"category": [
"Rent"
],
"merchant_name": "Westlake Properties LLC"
},
"occurred_at": "2026-05-03T00:00:00Z",
"source": "plaid"
}'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 '{
"description": "Monthly bank reconciliation completed",
"event_category": "control",
"event_class": "support",
"event_type": "control_executed",
"metadata": {
"control_id": "ctl_bank_recon_monthly",
"reconciled_balance": 4287500
},
"occurred_at": "2026-05-06T16:00:00Z",
"source": "manual"
}'Responses
200 Successful Response
| Field | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
operationrequired | string | Kebab-case operation name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
operationIdrequired | string | op_-prefixed ULID for audit and SSE correlation | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
statusrequired | string | Operation lifecycle state One of: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
resultoptional | EventBlockEnvelope | Command-specific result payload EventBlockEnvelope fields
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
atrequired | string | ISO-8601 UTC timestamp | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
createdByoptional | string | User ID that initiated the operation | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
idempotentReplayoptional | boolean | True when this envelope came from the idempotency cache — the underlying command did not execute again. False on fresh executions. Default: |
| Status | Meaning |
|---|---|
| 400 | Invalid request |
| 401 | Authentication required |
| 403 | Access denied |
| 404 | Resource not found |
| 409 | Idempotency-Key conflict — key reused with different body |
| 422 | Validation error |
| 429 | Rate limit exceeded |
| 500 | Internal server error |