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

ScopeGrants
messages:writePOST /v1/messages
identity:verifyPOST /v1/identity/verify
conversations:readGET /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:

HeaderMeaning
X-RateLimit-LimitRequests allowed per window
X-RateLimit-RemainingRequests left in the current window
X-RateLimit-ResetWhen the window resets (unix seconds)
RateLimit-Limit, RateLimit-RemainingThe same values in the IETF draft format
RateLimit-ResetSeconds until the window resets
RateLimit-PolicyThe 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 messageId with status: "duplicate", is never re-dispatched, and is never charged again. Concurrent duplicates collapse to one message, and the one that lost the race can answer queued with the same messageId.
  • 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

FieldTypeRequiredNotes
externalConversationIdstring (1–200)yesYour stable conversation id. One conversation per id in your workspace. A closed conversation is not answered again: use a new id.
contentstring (1–5000)yesThe end-user's message text.
idempotencyKeystring (UUID)yesRetry-safe anchor.
externalUserIdstring (1–200)noYour 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

FieldTypeRequiredNotes
externalUserIdstring (1–200)yesThe end-user to verify.
method"magic_link" | "oauth"yesoauth is not available here and returns status: "unsupported_here".
emailstring (email, up to 320)for magic_linkWhere 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:

HeaderMeaning
X-Assistify-EventEvent name
X-Assistify-Signaturesha256=<hex> HMAC of `${timestamp}.${rawBody}` with the key's callback secret
X-Assistify-TimestampUnix seconds, signed into the HMAC
X-Assistify-Delivery-IdStable per-delivery UUID, reused across retries. Deduplicate on it.

Events

EventWhenBody fields
ai.replyAiva generated a replyevent, conversationId, messageId, seq, content, visibility, poweredBy, timestamp
agent.replyA teammate replied publicly, from the dashboard, the mobile app, Discord or Telegramevent, conversationId, messageId, seq, content, agentId, agentName, timestamp
conversation.handoffAiva handed the conversation to your team, or could not answerevent, conversationId, reason, summary, nextStep, isUrgent, handoffId, timestamp
identity.verifiedAn end-user completed verificationevent, externalUserId, tier: "verified", timestamp
test.pingYou pressed Send test on a keyevent, 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 4xx or 5xx response 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 3xx response, or a URL resolving to private or loopback address space, is recorded as blocked and not retried or replayed.

Identity model

TierMeaning
anonymousNo externalUserId supplied; each message creates a new anonymous contact.
unverifiedexternalUserId supplied; asserted by the key, does not unlock personal tools.
verifiedThe 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

HTTPcodeCause
400VALIDATION_FAILEDBad or missing body field (for example a non-UUID idempotencyKey). errors names each field.
400BAD_REQUESTThe body is not valid JSON.
401UNAUTHORIZEDMissing, malformed, unknown, or revoked key.
402INSUFFICIENT_CREDITSWallet cannot cover one full-size model call, or is below zero. Top up.
403FORBIDDENKey lacks the required scope.
403API_NOT_ENABLEDThe public API is not available right now.
403API_ACCESS_REQUIREDYour workspace has no active API access. Request it in the dashboard.
403API_ACCESS_REVOKEDYour workspace's API access was revoked.
403STORE_SUSPENDEDThe workspace is paused.
404NOT_FOUNDUnknown externalConversationId.
413PAYLOAD_TOO_LARGEThe body is over 1 MB.
429USER_SPEND_CAP_REACHEDA spend limit of the workspace or of the end user is reached.
429RATE_LIMITEDPer-key or per-IP rate limit. Honor Retry-After.
500INTERNAL_ERRORSomething failed on our side. Retry with the same idempotencyKey.