Aiva over API reference
Endpoints, callback events, headers, and error codes for the Aiva over API REST surface.
Reference for the REST surface behind Aiva over API. All endpoints are relative to:
https://assistify.chat/api/v1
Responses use one envelope:
// success
{ "status": "success", "data": { /* … */ } }
// error
{ "status": "error", "statusCode": 402, "code": "INSUFFICIENT_CREDITS", "message": "…" }A validation error adds errors, one entry per field with its field, message and code. Branch on code.
Authentication
Every request carries an API key as a Bearer token:
Authorization: Bearer ak_<keyId>_<secret>
Keys are created in the dashboard under Settings → Channels → API → Keys. The full key is shown once at creation and only a hash is stored; revoking a key stops it on the next request.
Scopes
| Scope | Grants |
|---|---|
messages:write | POST /v1/messages |
identity:verify | POST /v1/identity/verify |
conversations:read | GET /v1/conversations/:id |
A call with a key missing the required scope fails with 403 FORBIDDEN.
Rate limits
120 requests per 60 seconds per key (default). Responses to an authenticated request carry the key's state in both header families:
| Header | Meaning |
|---|---|
X-RateLimit-Limit | Requests allowed per window |
X-RateLimit-Remaining | Requests left in the current window |
X-RateLimit-Reset | When the window resets (unix seconds) |
RateLimit-Limit, RateLimit-Remaining | The same values in the IETF draft format |
RateLimit-Reset | Seconds until the window resets |
RateLimit-Policy | The limit and its window, for example 120;w=60 |
Every request first passes a limit of 120 per minute per IP address, shared by every key your server uses from that address. Exceeding either limit returns 429 RATE_LIMITED with Retry-After (seconds); the per-IP 429 carries only the RateLimit-* headers and does not appear in Logs.
Idempotency
POST /v1/messages requires an idempotencyKey (UUID):
- A retry with the same key returns the same
messageIdwithstatus: "duplicate", is never re-dispatched, and is never charged again. Concurrent duplicates collapse to one message, and the one that lost the race can answerqueuedwith the samemessageId. - The key is scoped to your workspace and the body is not compared: a reused key with different content returns the earlier message.
- Use a fresh UUID per logical message; reuse it only when retrying that exact message.
Endpoints
POST /v1/messages
Submit an end-user message. Scope: messages:write. Aiva processes it asynchronously; the reply arrives via callback or polling.
Body
| Field | Type | Required | Notes |
|---|---|---|---|
externalConversationId | string (1–200) | yes | Your stable conversation id. One conversation per id in your workspace. A closed conversation is not answered again: use a new id. |
content | string (1–5000) | yes | The end-user's message text. |
idempotencyKey | string (UUID) | yes | Retry-safe anchor. |
externalUserId | string (1–200) | no | Your stable end-user id. Enables identity and per-user spend caps. |
Other fields are ignored; the channel is always API.
Response 202
{ "status": "success", "data": {
"conversationId": "…",
"messageId": "…",
"status": "queued" // "queued" | "duplicate" | "skipped" (+ "reason" when skipped)
}}reason on a skipped message: agent_assigned or human_handoff (a teammate has the conversation), status_CLOSED (the conversation is closed), entitlement_denied (Aiva does not answer this workspace).
Errors: 400 VALIDATION_FAILED or BAD_REQUEST (malformed JSON), 401 UNAUTHORIZED, 402 INSUFFICIENT_CREDITS, 403 scope, access or STORE_SUSPENDED, 413 PAYLOAD_TOO_LARGE (over 1 MB), 429 USER_SPEND_CAP_REACHED, 429 RATE_LIMITED.
POST /v1/identity/verify
Initiate an identity verification ceremony. Scope: identity:verify. The API can only initiate; verification is completed by the end-user out-of-band and can never be asserted by a key.
Body
| Field | Type | Required | Notes |
|---|---|---|---|
externalUserId | string (1–200) | yes | The end-user to verify. |
method | "magic_link" | "oauth" | yes | oauth is not available here and returns status: "unsupported_here". |
email | string (email, up to 320) | for magic_link | Where the single-use link is sent. |
Response 202
{ "status": "success", "data": { "method": "magic_link", "status": "sent" } }status is not_sent with a reason when no email went out: rate-limited (3 links an hour for one user and address, 10 an hour from one IP address) or email-disabled. The link is valid for 15 minutes, and a new request replaces the previous link. The call creates the contact for externalUserId when there is none yet.
When the user completes the ceremony, an identity.verified event is pushed to every key that owns an API conversation for that user.
GET /v1/conversations/:externalConversationId
Read conversation state, who holds it and its message history. Scope: conversations:read. Use it to poll for replies when no callback is configured.
Response 200
{ "status": "success", "data": {
"externalConversationId": "order-4821",
"conversationId": "…",
"status": "OPEN",
"createdAt": "…",
"lastMessageAt": "…",
"team": { "id": "…", "name": "Support" },
"assignee": { "id": "…", "name": "Grace" }, // null while no teammate is responsible
"handoff": { "id": "…", "outcome": "OPEN", "dueAt": "2026-09-28T14:32:11.000Z" }, // null if never handed over
"messages": [
{ "id": "…", "seq": 1, "senderType": "VISITOR", "content": "…", "createdAt": "…" },
{ "id": "…", "seq": 2, "senderType": "AI", "content": "…", "createdAt": "…" }
]
}}status is OPEN, PENDING, RESOLVED or CLOSED. Text messages only, in seq order; files, images, internal notes and system events are excluded. Unknown id returns 404 NOT_FOUND.
handoff is the conversation's latest handoff to your team. Its outcome is OPEN while nobody has answered, ANSWERED once a teammate replied, WITHDRAWN when the conversation was resolved or given back to Aiva first, EXPIRED when it closed unanswered, and TRANSFERRED when a teammate moved it to another team, which then holds a handoff of its own. team is the team that holds the conversation: the one its website or channel belongs to, the one Aiva named for the request, or the one a teammate transferred it to (see Teams and routing). dueAt is when the team's response target passes: the target you set on the team page, counted in the hours set under Settings → Team → Hours when you set them. It is null for a team without a target, which is the default. It moves when automatic assignment gives the handoff to another teammate, who is owed the whole target again. An assignee id identifies a member of your workspace and is the same one agent.reply carries as agentId.
Callback events
Configured per key (an https callbackUrl set at creation). Each delivery is an HTTP POST with these headers:
| Header | Meaning |
|---|---|
X-Assistify-Event | Event name |
X-Assistify-Signature | sha256=<hex> HMAC of `${timestamp}.${rawBody}` with the key's callback secret |
X-Assistify-Timestamp | Unix seconds, signed into the HMAC |
X-Assistify-Delivery-Id | Stable per-delivery UUID, reused across retries. Deduplicate on it. |
Events
| Event | When | Body fields |
|---|---|---|
ai.reply | Aiva generated a reply | event, conversationId, messageId, seq, content, visibility, poweredBy, timestamp |
agent.reply | A teammate replied publicly, from the dashboard, the mobile app, Discord or Telegram | event, conversationId, messageId, seq, content, agentId, agentName, timestamp |
conversation.handoff | Aiva handed the conversation to your team, or could not answer | event, conversationId, reason, summary, nextStep, isUrgent, handoffId, timestamp |
identity.verified | An end-user completed verification | event, externalUserId, tier: "verified", timestamp |
test.ping | You pressed Send test on a key | event, message, keyId, timestamp |
conversationId in callback bodies is always your externalConversationId. visibility on ai.reply is "public" or "private": a private reply used a tool and may hold personal data, so render it only behind that user's authentication. agentId and agentName are null when the author is no longer a member of your workspace. summary and nextStep on a handoff are written for your team. There is no event for an assignment, a transfer, a resolution or a close: poll status to follow them.
Delivery semantics
- Respond 2xx within 5 seconds; a
4xxor5xxresponse or a timeout counts as a failure. - Failures are retried with exponential backoff (5 attempts). Delivery is degraded, never disabled: a broken endpoint does not switch off the channel, and exhausted deliveries stay in the dashboard Logs tab for 7 days, where they can be replayed.
- A replay from the Logs tab re-sends the original payload with a new delivery id.
- Callback URLs must be https and publicly resolvable. Redirects are not followed: a
3xxresponse, or a URL resolving to private or loopback address space, is recorded as blocked and not retried or replayed.
Identity model
| Tier | Meaning |
|---|---|
| anonymous | No externalUserId supplied; each message creates a new anonymous contact. |
| unverified | externalUserId supplied; asserted by the key, does not unlock personal tools. |
| verified | The end-user completed a verification ceremony; personal and account-scoped tools unlock. |
Personal-data tools are gated server-side on verified identity; a key cannot forge it.
Billing
Usage is billed per token from a prepaid credit wallet, the workspace owner's account balance (shown under Settings → Channels → API → Credits). API conversations do not count toward the plan's conversation allowance. Each request is gated before generation (insufficient balance fails closed with 402, nothing is charged) and settled once after generation. Idempotent retries and redeliveries never double-charge. Optional daily, weekly and monthly spend limits, for the workspace and per end user, return 429 USER_SPEND_CAP_REACHED when reached.
Errors
| HTTP | code | Cause |
|---|---|---|
| 400 | VALIDATION_FAILED | Bad or missing body field (for example a non-UUID idempotencyKey). errors names each field. |
| 400 | BAD_REQUEST | The body is not valid JSON. |
| 401 | UNAUTHORIZED | Missing, malformed, unknown, or revoked key. |
| 402 | INSUFFICIENT_CREDITS | Wallet cannot cover one full-size model call, or is below zero. Top up. |
| 403 | FORBIDDEN | Key lacks the required scope. |
| 403 | API_NOT_ENABLED | The public API is not available right now. |
| 403 | API_ACCESS_REQUIRED | Your workspace has no active API access. Request it in the dashboard. |
| 403 | API_ACCESS_REVOKED | Your workspace's API access was revoked. |
| 403 | STORE_SUSPENDED | The workspace is paused. |
| 404 | NOT_FOUND | Unknown externalConversationId. |
| 413 | PAYLOAD_TOO_LARGE | The body is over 1 MB. |
| 429 | USER_SPEND_CAP_REACHED | A spend limit of the workspace or of the end user is reached. |
| 429 | RATE_LIMITED | Per-key or per-IP rate limit. Honor Retry-After. |
| 500 | INTERNAL_ERROR | Something failed on our side. Retry with the same idempotencyKey. |