Send an event to waiting runs
Resumes every step of your project's active runs that waits for this event (`wait: {event, match}`, routine.schema.json) and whose `match` values are all in `data`, without knowing their run IDs: an order system sends `order.paid` with the order's ID, and the run waiting for that order continues. Each step completes with `{event, data, id, received_at, timed_out: false}`, journaled with its run like a signal. Events are not buffered: a step that starts waiting after the event does not see it, and an event no step waits for answers `delivered: 0`. Runs of other projects never see your events.
POST
/v1/routines/events
Resumes every step of your project's active runs that waits for this event (`wait: {event, match}`,
routine.schema.json) and whose `match` values are all in `data`, without knowing their run IDs: an order
system sends `order.paid` with the order's ID, and the run waiting for that order continues. Each step
completes with `{event, data, id, received_at, timed_out: false}`, journaled with its run like a signal.
Events are not buffered: a step that starts waiting after the event does not see it, and an event no step
waits for answers `delivered: 0`. Runs of other projects never see your events.
Authentication
Bearer Token (b3os_sk_ API key or b3os_pat_ token)
Request Body required
application/jsonname
string
REQUIRED
The event name `wait.event` names.
data
unknown
What `wait.match` is checked against, and the step's `data` output.
id
string
Your ID for the event, passed to the step's `id` output.
Responses
200
The steps the event resumed.
application/jsonobject
string
REQUIRED
Enum:
routine_eventname
string
REQUIRED
id
string | null
delivered
integer
REQUIRED
How many waiting steps the event resumed.
runs
object[]
REQUIRED
The runs and steps it resumed (the first 100).
Array of:
run_id
string
REQUIRED
step_id
string
REQUIRED
400
The request failed validation (`invalid_request`, `invalid_url`).
401
Missing, malformed, expired or revoked credentials (`unauthorized`).
403
Authenticated but not allowed (`forbidden`, `egress_denied`).
413
The request body exceeds this operation's limit.
415
The Content-Type is not accepted by this operation.
429
A rate, concurrency or quota limit applies (`rate_limited`, `concurrency_limited`, `quota_exceeded`).
500
Something failed inside B3OS (`internal`). Retry with backoff.
503
The node or the product is not available right now (`node_unavailable`, `product_unavailable`, `capacity_unavailable`).
curl -X POST 'https://beta-api.b3os.org/v1/routines/events' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "name": "order.paid", "id": "evt_3PqZ8a2eZvKYlo2C1x9b", "data": { "order_id": "ord_7731", "amount": 4900 }}'
const response = await fetch('https://beta-api.b3os.org/v1/routines/events', { method: 'POST', headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" }, body: JSON.stringify({ "name": "order.paid", "id": "evt_3PqZ8a2eZvKYlo2C1x9b", "data": { "order_id": "ord_7731", "amount": 4900 } })});const data = await response.json();console.log(data);
import requestsheaders = { 'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://beta-api.b3os.org/v1/routines/events', headers=headers, json={ "name": "order.paid", "id": "evt_3PqZ8a2eZvKYlo2C1x9b", "data": { "order_id": "ord_7731", "amount": 4900 }})print(response.json())
200
Response
{ "object": "routine_event", "name": "order.paid", "id": "evt_3PqZ8a2eZvKYlo2C1x9b", "delivered": 1, "runs": [ { "run_id": "run_01m6f0re3gzz9kvb26hebdcd0x", "step_id": "paid" } ]}
API Playground
Try this endpoint
POST
/v1/routines/events