Browse the API reference

Promote Due Schedule Obligations

post/extensions/roboledger/{graph_id}/operations/promote-obligations

Part of Extensions: RoboLedger.

Promote matured pending schedule obligations (schedule_entry_due events whose period boundary has passed) to 'classified', and — when dispatch_handlers=true (default) — draft their closing entries in the same transaction. Also reaches stranded obligations: events already 'classified' (by an earlier flip-only sweep) whose closing entry was never drafted are dispatched in the same pass, and reported via stranded_count. This is the on-demand form of the background obligation-promotion sweep; run it before close-period when a schedule was just created or when you can't wait for the Dagster sensor. Idempotent: re-running skips already-classified obligations and reconciles to existing drafts.

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
dispatch_handlersoptionalboolean

When True (default), also fire the schedule_entry_due handler for each promoted obligation so the draft closing entry materializes immediately (autopilot). When False, flip status only (co-pilot) — the draft is created separately.

Default: true

Example request

curl
curl -X POST "https://api.robosystems.ai/extensions/roboledger/{graph_id}/operations/promote-obligations" \
  -H "X-API-Key: $ROBOSYSTEMS_API_KEY" \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Content-Type: application/json" \
  -d '{
  "dispatch_handlers": true
}'

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

resultoptionalPromoteObligationsResponse

Command-specific result payload

PromoteObligationsResponse fields
FieldTypeDescription
classified_countrequiredinteger

Matured obligations flipped pending → classified.

dispatched_countrequiredinteger

Obligations whose closing entry was drafted this run.

error_countrequiredinteger

Per-obligation handler errors (non-fatal).

stranded_countoptionalinteger

Matured obligations found already at 'classified' with no drafted closing entry. With dispatch_handlers=true they were drafted this run (included in dispatched_count); with dispatch_handlers=false they still have no draft — re-run with dispatch_handlers=true or void them.

Default: 0

classified_event_idsoptionalstring[]
stranded_event_idsoptionalstring[]

Event ids of the stranded obligations found this sweep.

errorsoptionalobject[]

Per-obligation errors as {event_id, error}; the sweep continues past them.

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