Browse the extensions reference

Update Event Handler

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

Part of RoboLedger: Ledger & Events.

Patch an event handler's match criteria, template, priority, or active state. Pass approve=true to approve an AI-suggested handler; approve=false to revoke approval. Only supplied fields are updated. Through an AI client, approve=true is refused, and a change to what the handler matches or books makes it a suggestion again, out of matching until a person approves it.

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

Constraints: matches ^(kg[a-f0-9]{16,}(?:_[a-zA-Z0-9]{1,20})?|sec(?:_[a-zA-Z0-9]{1,20})?|library)$

Header parameters

NameTypeDescription
Idempotency-KeyoptionalstringIdempotency-Key

Request body

Required, application/json.

FieldTypeDescription
event_handler_idrequiredstring

The handler to update.

nameoptionalstring

New name. Omit to leave unchanged.

descriptionoptionalstring

New description.

event_categoryoptionalstring
match_sourceoptionalstring
match_agent_typeoptionalstring
match_resource_typeoptionalstring
match_metadata_expressionoptionalobject
transaction_templateoptionalTransactionTemplate

Replacement template. Whole-template replace — no partial patch. Omit to leave unchanged.

TransactionTemplate fields
FieldTypeDescription
transactionsrequiredTransactionTemplateItem[]

At least one debit/credit entry pair

Constraints: at least 1 item

TransactionTemplateItem fields
FieldTypeDescription
entry_templaterequiredTransactionTemplateEntry

One balanced entry (debit + credit pair) — the inner shape of entry_template.

priorityoptionalinteger
is_activeoptionalboolean

Toggle activation. False removes the handler from match-time consideration without deleting it.

approveoptionalboolean

Approval shortcut: True stamps approved_by/approved_at to the current user; False clears both. Approving an AI-suggested handler also needs expected_updated_at.

expected_updated_atoptionalstring (date-time)

The handler's updated_at as shown when it was reviewed. Required with approve=true on an AI-suggested handler, so the approval covers exactly that version; a mismatch is refused with 409.

metadata_patchoptionalobject

Deep-merged into the existing handler.metadata. Pass {} to leave metadata unchanged.

Example request

curl · example 1 of 2
curl -X POST "https://api.robosystems.ai/extensions/roboledger/{graph_id}/operations/update-event-handler" \
  -H "X-API-Key: $ROBOSYSTEMS_API_KEY" \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Content-Type: application/json" \
  -d '{
  "event_handler_id": "evh_01HVF8T0M2YTAY3BBNRH0V0",
  "is_active": false
}'
curl · example 2 of 2
curl -X POST "https://api.robosystems.ai/extensions/roboledger/{graph_id}/operations/update-event-handler" \
  -H "X-API-Key: $ROBOSYSTEMS_API_KEY" \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Content-Type: application/json" \
  -d '{
  "approve": true,
  "event_handler_id": "evh_01HVF8T0M2YTAY3BBNRH0V0",
  "priority": 100
}'

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

resultoptionalEventHandlerResponse

Command-specific result payload

EventHandlerResponse fields
FieldTypeDescription
idrequiredstring

Handler id (hdl_-prefixed).

namerequiredstring

Human-readable handler name.

descriptionoptionalstring

What the handler is for.

event_typerequiredstring

The event type the handler matches.

event_categoryoptionalstring

Match on the event's category; null matches any.

match_sourceoptionalstring

Match on the event's source system; null matches any.

match_agent_typeoptionalstring

Match on the counterparty's role; null matches any.

match_resource_typeoptionalstring

Match on the resource type; null matches any.

match_metadata_expressionoptionalobject

Equality matches against the event's metadata.

transaction_templaterequiredobject

The GL rows the handler books: its DSL template, as JSON.

priorityrequiredinteger

Among handlers that match, the highest priority wins.

is_activerequiredboolean

Whether the handler takes part in matching at all.

originrequiredstring

hub for a platform-shipped handler, tenant otherwise.

suggested_byoptionalstring

ai when an AI client created the handler or last changed what it matches or books; null when a person did.

confidenceoptionalnumber

The suggesting AI's confidence, when it gave one.

approved_byoptionalstring

The user who approved an AI-suggested handler.

approved_atoptionalstring (date-time)

When it was approved.

awaiting_approvaloptionalboolean

True for an AI-suggested handler no one has approved: it takes no part in matching until a person approves it.

Default: false

created_atoptionalstring (date-time)

When it was created.

updated_atoptionalstring (date-time)

When it last changed.

created_byoptionalstring

The user who created it.

atrequiredstring

ISO-8601 UTC timestamp

createdByoptionalstring

User ID that initiated the operation

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