Send an event
POST/v2/agents/{agentId}/events
Send a custom event from your own app to an agent, for example a cart left behind, so a mission can react to it.
Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.
Sends an event from your own system to an agent. Call it when something happens that the agent should know about, such as a customer abandoning a checkout or a payment failing. Missions can start from events like this, see Signals and events.
Request
POST /v2/agents/{agentId}/events
Path parameters:
| Name | Type | Required | Description |
|---|---|---|---|
agentId |
string | Yes | The ID of the agent, starting with agt_. |
Body fields:
| Name | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | The name of the event, for example checkout.abandoned. Use lowercase words separated by dots. |
userId |
string | No | The person the event is about, starting with usr_. Use the same value you send in chat requests. |
properties |
object | No | Extra data about the event, such as a cart total or an order number. Values can be strings, numbers, booleans or nested objects. |
occurredAt |
string | No | When it happened, as an ISO 8601 UTC time. Defaults to the time of the request. |
Events are accepted and processed in the background, so the response confirms receipt and not the outcome. When you send a userId, the event is linked to the conversations of that user, see User conversations.
Example request
curl -X POST https://api.askocto.co/v2/agents/agt_8f3k2m/events \
-H "Authorization: Bearer $OCTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "checkout.abandoned",
"userId": "usr_3b6t0z",
"properties": { "cartTotal": 89.5, "currency": "EUR", "items": 3 },
"occurredAt": "2026-03-20T14:12:00Z"
}'
const response = await fetch(
"https://api.askocto.co/v2/agents/agt_8f3k2m/events",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OCTO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "checkout.abandoned",
userId: "usr_3b6t0z",
properties: { cartTotal: 89.5, currency: "EUR", items: 3 },
occurredAt: "2026-03-20T14:12:00Z",
}),
},
)
const event = await response.json()
console.log(event.id, event.status)
Example response
A successful call returns 202 Accepted.
{
"id": "evt_6h2s9q",
"name": "checkout.abandoned",
"userId": "usr_3b6t0z",
"properties": { "cartTotal": 89.5, "currency": "EUR", "items": 3 },
"occurredAt": "2026-03-20T14:12:00Z",
"receivedAt": "2026-03-20T14:12:02Z",
"status": "accepted"
}
Response fields
| Name | Type | Description |
|---|---|---|
id |
string | The event ID, starting with evt_. |
name |
string | The event name you sent. |
userId |
string or null | The user the event is about, if you sent one. |
properties |
object | The data you sent. An empty object when you sent none. |
occurredAt |
string | When the event happened. |
receivedAt |
string | When Askocto received it. |
status |
string | accepted once the event is queued for processing. |
Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_request |
name is missing or empty, properties is not an object, or occurredAt is not an ISO 8601 time. |
| 401 | unauthorized |
The API key is missing, malformed or deleted. |
| 404 | not_found |
No agent has this ID in your workspace. |
| 429 | rate_limited |
Too many requests. Wait for the number of seconds in the Retry-After header. |