Skip to the content

Events API

Tell an assistant that something happened in your app with one HTTP request. The assistant then acts on the instructions you set up for that kind of event.

Where
Assistant menuConfigureEventsConnect your app
Permission
Needs Owner or admin, to create an events key
Time
8 min read
Markdown
01 / 04Create an events key. Name it after the app that will send events, then copy the key. It is shown only once.
  1. Create an events key. Name it after the app that will send events, then copy the key. It is shown only once.
  2. Send one event. One POST per event, with your key as a Bearer token.
  3. 202: stored. HeyServo keeps the event and answers at once. The assistant handles it in the background.
  4. Send it again: no double. The same id is answered with the first event and duplicate: true. Nothing runs twice.

How it works

Your app sends POST /v1/events with an event's type and data. HeyServo stores it, answers straight away, and the assistant handles it in the background, following the event types and instructions set up on its Events page. Your code never waits for the assistant.

  • The base address is your dashboard's address. For most accounts the endpoint is https://app.heyservo.ai/v1/events; the exact address is on ConfigureEventsConnect your app.
  • One events key belongs to one assistant. The key decides which assistant receives the event.
  • To hear back what the assistant did, use webhooks, or read the event with GET.

Authentication

Send an events key as a Bearer token: Authorization: Bearer <events key>. An events key is an API key whose purpose is Send events. Create one on the assistant's Connect your app tab, or in DevelopersAPI keys with that purpose. Owners and admins create keys.

  • Keep the key on your server. It is shown only once.
  • No request signature is needed: the key is the credential.
  • A key with any other purpose is refused with 401 wrong_key.

Send an event

curl -X POST https://app.heyservo.ai/v1/events \
  -H "Authorization: Bearer $HEYSERVO_EVENTS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "order.shipped",
    "id": "ord-1042-shipped",
    "data": {
      "order": "ORD-1042",
      "tracking_url": "https://track.example/1042",
      "items": ["Chocolate cake", "6 croissants"]
    },
    "contact": {
      "name": "Layla Hassan",
      "phone": "+971501234567",
      "email": "layla@example.com"
    },
    "occurred_at": "2026-11-23T09:30:00Z"
  }'
Replace the address with the one on your Connect your app tab.
{
  "id": "6f1c2a9e-…",
  "external_id": "ord-1042-shipped",
  "type": "order.shipped",
  "status": "queued",
  "reason": null,
  "reason_text": null,
  "test": false,
  "summary": null,
  "received_at": "2026-11-23T09:30:02Z",
  "run_after": null,
  "started_at": null,
  "finished_at": null,
  "duplicate": false
}
202 Accepted

The request body

A JSON object. Only type is required.

Body fields6 controls
typeText
Required. What happened, in your own words: user.signed_up, order.shipped. Letters, digits and . _ - : /, starting with a letter or digit. It is matched against the assistant's event types.
Limit 1 to 100 characters
idText
Optional. Your own id for the event. Sending the same id again returns the first event instead of running twice. You can send it as the Idempotency-Key header instead; when both are present, id is used.
Limit 200 printable characters
dataText
Optional. Any JSON object about the event. The assistant reads it as information, never as instructions.
Limit 8 levels deep, 2,000 values, strings up to 20,000 characters, 64 KB by default
contactText
Optional. The person the event is about: {name, phone, email}. whatsapp is accepted in place of phone. The phone must be international, like +971501234567.
occurred_atText
Optional. When it happened, as an ISO 8601 date and time.
testSwitch
Optional. true makes it a dry run: the assistant decides what to do and every tool only says what it would do.
Default false

Phone numbers and emails found in the event are noted, because by default the assistant may only contact people named in the event or already in your contacts. Put the person in contact or in data.

Sending an event twice

Give every event an id that is unique for that happening, such as your order number plus what happened (ord-1042-shipped). If your app retries after a timeout, the repeat is answered with HTTP 200, the first event and "duplicate": true, and nothing runs again. A new event needs a new id. Without an id, every request is a new event.

Responses

StatusCodeMeaning
202Stored. The assistant handles it in the background.
200A repeat of an id already sent: the first event, with duplicate: true.
400invalid_json, invalid_bodyThe body is not JSON, or not a JSON object.
400type_required, invalid_typeNo type, or one that breaks the rules.
400invalid_idThe id is too long or not printable.
400invalid_data, data_too_deep, data_too_complex, data_too_largedata is not an object, is nested too deep, has too many values, or a value is too long.
400invalid_contactcontact is not an object, the phone is not international, or the email is not valid.
400invalid_timeoccurred_at is not ISO 8601.
401unauthorizedNo key, or the key is invalid or revoked.
401wrong_keyThe key's purpose is not Send events.
413payload_too_largeThe body is over the data limit plus 16 KB for the rest of the event.
429rate_limitedToo many events from this key. Wait the Retry-After seconds (30).
503events_unavailableHeyServo has paused events for now. Wait the Retry-After seconds (300); events already stored run once they are back.
{
  "error": {
    "code": "invalid_contact",
    "message": "`contact.phone` must be in international form, e.g. +971501234567."
  }
}
Every error has the same shape
Event fields in a response11 controls
idText
HeyServo's id for the event.
external_idText
Your id, if you sent one.
typeText
The event's type.
statusChoice
Where it stands.
Options queuedrunningdoneignoredskippedfailedcancelled
reason, reason_textText
Why it was ignored, skipped, failed or cancelled, as a code and a sentence (see below).
testSwitch
Whether it is a dry run.
summaryText
When done: the assistant's note on what it did.
received_at, started_at, finished_atTime
When it arrived, started and finished.
run_afterTime
For a queued event with a delay: when it will run.
duplicateSwitch
On a POST: whether this id was already sent.
actionsList
On GET /v1/events/{id} only: what the assistant did or scheduled, each with action_id, tool, status, recipient, channel, run_at, conversation_id and error.
reasonreason_text
events_offEvents are switched off for this assistant.
platform_offEvents are paused on HeyServo.
daily_limitThe assistant reached its daily limit of events.
credits_exhaustedThe account was out of credits.
suspendedThe account is suspended.
unknown_typeNo event type matches, and unknown events are ignored.
type_ignoredThis event type is set to be ignored.
type_disabledThis event type is switched off.
cancelledCancelled before it ran.
failedThe assistant could not handle the event.
interruptedThe event was interrupted and could not be finished.
agent_missingThe assistant no longer exists.

Action statuses are scheduled, running, done, failed, skipped, cancelled and simulated (a test that sent nothing).

Read events back

Use the same events key. You only see events sent to that key's assistant.

RequestReturns
GET /v1/events/{id}One event by HeyServo's id, with its actions.
GET /v1/events/ext:{your id}One event by your own id, with its actions.
GET /v1/events?type=user.signed_up&status=done&limit=20{"events": [...]}. type and status are optional; limit is 1 to 100, 20 by default.
curl https://app.heyservo.ai/v1/events/ext:ord-1042-shipped \
  -H "Authorization: Bearer $HEYSERVO_EVENTS_KEY"

An unknown id answers 404 not_found; a status that is not one of the statuses above answers 400 invalid_status.

Hear back with webhooks

Instead of polling, add a webhook endpoint and subscribe to the event webhooks. They are never sent for test events.

WebhookSent when
event.processedAn event reaches its final status, with its actions when done.
event.action.completedOne of the assistant's actions for an event is done.
event.action.failedOne of its actions failed.
assistant.signalThe assistant used its Tell your app tool.

Limits and retention

Testing

  • Send "test": true for a dry run: the event shows in Activity with a Test badge, and its actions show as Test only. Events must be on for the assistant.
  • From the dashboard, Send test event runs a dry run even while events are off, so you can try your instructions first.
  • Use real-looking phone numbers and emails in tests to see who the assistant would contact.

Questions people ask

Keep going
Events API · HeyServo Docs