Workflow record callback
The events OpenRelay POSTs to a workflow record's callback, and the answers it accepts: the next requests to run, a pause, or the outcome. A workflow record is a batch record whose body carries openrelay.workflow. OpenRelay POSTs an event to its workflow.url, runs the requests the answer returns, and POSTs their results as the next event, until the callback answers completed or failed. The URL is the record's own, not a registered webhook. The request carries the record's workflow.authorization value verbatim as its Authorization header, and Content-Type application/json; it is not signed. Each event is delivered up to four times, with pauses of 1, 2 and 3 seconds between attempts and each attempt bounded by callback_timeout_ms. A timeout, a connection error, a 429 or a 5xx answer is retried, and so is a redirect, which is never followed. When all four attempts fail, the record fails with workflow_callback_unreachable and the rest of the batch keeps running. Any other non-2xx answer fails the record with workflow_callback_rejected.
application/json- body
One event OpenRelay POSTs to a workflow record's workflow.url, with the record's workflow.authorization value as the Authorization header. A serialized event is at most 2 MiB (2097152 bytes), context and results included; when a step's results would make it larger, the event is not sent and the record fails with workflow_invalid_response, with the requests that ran still billed.
event_id*stringDeterministic id of this event. A retried delivery, or the same event sent again after a batch worker resumes the record from its last saved step, carries the same event_id, so key your state on it and give a repeated event the same answer.
^wf_evt_[0-9a-f]{32}$event*stringstart is the record's first event. results follows a continue answer: every request of that step finished, and results holds their outcomes. wait follows a wait answer, once the pause is over.
"start""results""wait"workflow_id*stringThe batch id and the record's custom_id, joined as <batch_id>:<custom_id>.
record_id*stringThe record's custom_id.
step*integerCallback answers of continue or wait consumed so far, starting at 0.
0 <= valueattempt*integerAlways step + 1. It does not count deliveries: a retried delivery of an event carries the same attempt.
1 <= valuecontext?unknownThe record's workflow.context, unchanged. Absent when the record sets none.
results?array<>On a results event: one entry per request of the previous step, in the order the answer returned them. Absent on start and wait events.
Retried, as one of the event's four delivery attempts.
One event OpenRelay POSTs to a workflow record's workflow.url, with the record's workflow.authorization value as the Authorization header. A serialized event is at most 2 MiB (2097152 bytes), context and results included; when a step's results would make it larger, the event is not sent and the record fails with workflow_invalid_response, with the requests that ran still billed.
{ "event_id": "wf_evt_8b2e4f6a1c3d5e7f9a0b2c4d6e8f0a1b", "event": "results", "workflow_id": "batch_9f8e7d6c5b4a:contract-42", "record_id": "contract-42", "step": 1, "attempt": 2, "context": { "contractId": "contract-42" }, "results": [ { "id": "payment", "stage_id": "payment", "attempt": 1, "custom_id": "payment", "status_code": 200, "body": { "choices": [ { "message": { "content": "Net 30." } } ] }, "usage": { "input_tokens": 11820, "output_tokens": 140 } } ]}Replace a batch's metadata POST
Replace the batch's metadata map with the one you send; the whole map is overwritten, so include every pair you want to keep. Send an empty object to clear it. Metadata is opaque customer data, not lifecycle state, so it is editable at any time including after the batch is terminal. Returns the updated batch.
Overview
Async jobs: requests delivered within 1 hour (20% off the Sync price) or within 24 hours (50% off), with their results paged while the job runs. Served by the inference endpoint (inference.openrelay.inc). These endpoints return 404 for an organization Async is not turned on for.