RoboLedger: Ledger & Events

Create Event Handler

Define a rule that fires GL transactions when a matching event block is created with apply_handlers=True. Match criteria (event_type, event_category, match_source, match_agent_type, etc.) act as AND-joined filters — null fields match anything. The highest-priority matching handler wins. AI-suggested handlers (suggested_by='ai') require approval before they are eligible for matching.

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.

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

Request

  • Base URL: https://api.robosystems.ai (the document declares no server; this is the origin it was published from)
  • URL: https://api.robosystems.ai/extensions/roboledger/{graph_id}/operations/create-event-handler
  • Auth: one of:
    • API key in header X-API-Key
    • HTTP bearer

Path parameters

graph_idstring required

Headers

Idempotency-Keystring nullable

Request body

namestring required

Human-readable handler name (unique per graph).

descriptionstring nullable

Free-form description shown in admin UIs.

event_typestring required

Event type to match. Matches the event_type field on incoming events from create-event-block.

event_categorystring nullable

Optional category filter (e.g. 'expense', 'revenue').

match_sourcestring nullable

Match the event's source field (e.g. 'quickbooks', 'plaid'). Useful when the same event_type comes from multiple integrations.

match_agent_typestring nullable

Match agent-emitted events by agent_type.

match_resource_typestring nullable

Match resource-bound events by resource_type.

match_metadata_expressionobject nullable

JSONPath-style equality map against event.metadata, e.g. {"category": "payroll"} or {"metadata.category": "payroll"}

priorityinteger

Tiebreaker when multiple equally-specific handlers match. Higher = wins.

is_activeboolean

Inactive handlers are ignored at match time.

origin'hub' | 'tenant'

Provenance of the handler. tenant = author by graph owner; hub = platform-shipped template (immutable for tenants).

metadataobject

Free-form metadata stored alongside the handler.

Example request

{
  "event_type": "vendor_bill_received",
  "match_source": "quickbooks",
  "name": "QB Vendor Bill — Default Expense Posting",
  "priority": 0,
  "transaction_template": {
    "transactions": [
      {
        "entry_template": {
          "credit": {
            "amount": "{{ event.amount }}",
            "element_id": "elem_coa_accounts_payable"
          },
          "debit": {
            "amount": "{{ event.amount }}",
            "element_id": "elem_coa_office_supplies"
          }
        }
      }
    ]
  }
}

Response

Successful Response

operationstring required

Kebab-case operation name

operationIdstring required

op_-prefixed ULID for audit and SSE correlation

status'completed' | 'pending' | 'failed' required

Operation lifecycle state

atstring required

ISO-8601 UTC timestamp

createdBystring nullable

User ID that initiated the operation

idempotentReplayboolean

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

Changes

No recorded changes to this operation across all 1 revision of this API.