Deliver a customer event to a Process
POST /v1/process-events
| Property | Value |
|---|---|
| Operation | deliver_process_event |
| Group | Processes |
| Scope | events:write |
| Route class | control |
| Idempotency | Idempotency-Key required: a retry with the same key replays the first answer |
| Audit | Audited event.emitted (mutation) |
| Released in | 1.62.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
The alias of POST /v1/events by Process and correlation key (1.62.0; workflows-and-processes.md section 9.6): the same request with the Process target required, under events:write and an Idempotency-Key, recorded and answered as create_event records and answers it.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the events:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -X POST "$VOCAL_API/v1/process-events" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"type": "custom.payment.received",
"process": {
"process_id": "prc_..."
}
}'const response = await fetch(`${process.env.VOCAL_API}/v1/process-events`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({
"type": "custom.payment.received",
"process": {
"process_id": "prc_..."
}
}),
});
console.log(response.status, await response.text());import os
import uuid
import requests
response = requests.post(
f"{os.environ['VOCAL_API']}/v1/process-events",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"type": "custom.payment.received",
"process": {
"process_id": "prc_...",
},
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
idempotency-key | header | string | yes | A client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response. |
Request body
Content type application/json, required: ProcessEventDeliveryRequest.
| Field | Type | Required | Description |
|---|---|---|---|
call_id | CallId | no | A Call of the key's environment, live or ended within 24 hours (a target), which records custom.received. |
data | map of any | no | A JSON object of at most 32 KiB (a target) as canonical JSON, stored as a content pair. Content. |
process | CustomEventProcessTargetInput | yes | |
type | CustomEventType | yes |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
202 | application/json | CustomEvent | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden, org_suspended |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | process_not_active, idempotency_in_progress, idempotency_key_reused |
422 | application/json | ErrorEnvelope | validation_failed |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 202 answer
The shape is CustomEvent.
| Field | Type | Required | Description |
|---|---|---|---|
call_id | CallId or null | yes | |
created_at | Timestamp | yes | |
id | EventId | yes | The id the event carries on every surface, assigned once in the request transaction: de-duplicate on it. |
livemode | boolean | yes | True for the live environment. |
object | "custom_event" | yes | |
process_event_id | ProcessEventId or null | yes | The Process event recorded for the Process target; null without one. |
process_id | ProcessInstanceId or null | yes | The instance the request named by id; null for a correlation key or none. |
type | CustomEventType | yes | |
workflow_id | WorkflowId or null | yes |