Build a fully custom chat integration for your support agent: start conversations, send customer messages and poll for AI (or human) replies. Everything the hosted chat page can do over JSON.
The API is available on the Professional plan. Each support agent has its own API token, found under Integrations on the agent’s page in your dashboard.
Base URL
https:/ / handover.support/ api/ v1
Authentication
Every request must include your agent’s secret API token as a Bearer header:
Authorization: Bearer YOUR_API_TOKEN
The token identifies both your organisation and the specific agent, so no other credentials are needed. Keep it secret: anyone holding it can read and write that agent’s API conversations. You can rotate it at any time from the agent’s Integrations section (the old token stops working immediately).
How a conversation works
AI answers are generated asynchronously, typically within a few seconds. The flow is:
-
POST /conversations– create a conversation. The response includes the agent’s greeting. -
POST /conversations/{id}/messages– send the customer’s message. -
GET /conversations/{id}/messages?after={last_message_id}– poll every 1–2 seconds until a new message with"role": "ai"(or"human"/"system") appears.
Conversations may be handed over to a team member – watch the conversation status field. Messages sent to a conversation that is waiting_for_human or with_human_agent are delivered to the team rather than answered by the AI.
Languages
Customers can write in any language. When the agent has Multilingual Support enabled (the default), the AI answers in the customer’s language, and replies written by human team members are automatically delivered in it too – your integration does not need to do anything. The detected language appears as an ISO 639-1 code in the conversation’s language field (null until the first clear detection).
The agent’s own working language is primary_language on the agent endpoint (with multilingual indicating whether the feature is on) – useful if you want to show your own “write in any language” hint when a visitor’s locale differs from it.
Conversation status values
| Status | Meaning |
|---|---|
active |
The AI is answering |
waiting_ |
Handed over, waiting for a team member |
with_ |
A team member is replying |
resolved |
Closed (sending a new message reopens it) |
archived |
Closed permanently |
Awaiting values
While a person is involved (waiting_for_human or with_human_agent), the conversation’s awaiting field says who owes the next reply. It is null at all other times.
| Awaiting | Meaning |
|---|---|
team |
Pending: the team owes the customer a reply. Set by a customer message, a handover or a reopen |
customer |
With customer: the team has replied and is waiting for the customer. Set by a team reply |
The team can also set it by hand. The next customer message or team reply sets it again.
Message roles
| Role | Meaning |
|---|---|
customer |
The end customer (messages you send) |
ai |
The AI agent |
human |
A human team member |
system |
Status notices (handovers, resolutions, and the out-of-office notice when the team has office hours and is closed) |
Endpoints
Get agent details
GET / api/ v1/ agent
Returns the agent’s name, greeting, conversation starters, availability and branding – useful for rendering your own chat UI.
curl https://handover.support/api/v1/agent \
-H "Authorization: Bearer YOUR_API_TOKEN"
{
"name": "Acme Support",
"description": "Helps with orders and returns",
"greeting_message": "Hi! How can I help you today?",
"conversation_starters": ["How do I return an item?"],
"available": true,
"allow_human_handoff": true,
"primary_language": "en",
"multilingual": true,
"chat_url": "https://acme.handover.support",
"branding": {
"accent_color": "#1D4ED8",
"background_color": "#F8FAFC",
"text_color": "#0F172A",
"font_family": "'Inter', ui-sans-serif, system-ui, sans-serif"
}
}
Create a conversation
POST / api/ v1/ conversations
| Parameter | Type | Required | Description |
|---|---|---|---|
customer_email |
string | No | Lets your team recognise the customer and builds their profile history |
customer_name |
string | No | Shown to your team alongside the conversation |
context |
object | No | Customer details from your app, as labels and text values (see below) |
language |
string | No | The customer’s language as an ISO 639-1 code (such as fr), if you already know it |
curl -X POST https://handover.support/api/v1/conversations \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"customer_email": "[email protected]", "customer_name": "Jo", "language": "fr",
"context": {"plan": "Monthly", "renews_on": "1 December 2026", "device": "iPhone app",
"page": "https://example.com/account"}}'
Customer details (context)
Send what your team would otherwise have to ask: the customer’s plan, its renewal date, the device and the page they came from. Your team sees the details under Customer Details in the conversation header, and links open in a new tab. The AI also sees them, so it can answer questions such as “when does my plan renew?” from your facts. It still cannot change anything.
- A flat object: each value is text (numbers and true/false become text). Lists and nested objects are refused.
- At most 20 details. Labels up to 40 characters, values up to 500.
- Labels show as written, with
_and-as spaces:renews_onshows as “Renews on”. - Empty values are dropped. The details are set once, when the conversation is created, and come back in every conversation response as
context.
Language (language)
Without it, the language is detected from the customer’s first message. With it, a handover or a team reply sent before the customer writes is already in their language. Detection still takes over once they write. An unsupported code is refused with 422.
Returns 201 Created:
{
"id": "0b8f6a2e-6c1d-4d0a-9a4e-1f2b3c4d5e6f",
"status": "active",
"awaiting": null,
"title": "Acme Support Support Conversation",
"customer_email": "[email protected]",
"customer_name": "Jo",
"language": null,
"context": {},
"handover_details": {},
"created_at": "2026-07-20T12:00:00Z",
"messages": [
{ "id": 101, "role": "ai", "content": "Hi! How can I help you today?", "confidence": null, "quick_replies": [], "prompt": null, "created_at": "2026-07-20T12:00:00Z" }
]
}
The id is the conversation identifier used in all further requests.
Get a conversation
GET / api/ v1/ conversations/ {id}
Returns the conversation envelope plus the full customer-visible transcript (same shape as the create response). Internal team notes are never included.
Send a message
POST / api/ v1/ conversations/ {id}/ messages
| Parameter | Type | Required | Description |
|---|---|---|---|
content |
string | Yes | The customer’s message text |
curl -X POST https://handover.support/api/v1/conversations/{id}/messages \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"content": "How do I return an item?"}'
Returns 201 Created with the stored message and the conversation’s current status:
{
"message": { "id": 102, "role": "customer", "content": "How do I return an item?", "confidence": null, "quick_replies": [], "prompt": null, "created_at": "2026-07-20T12:00:05Z" },
"conversation": { "id": "0b8f6a2e-...", "status": "active" }
}
Sending a message to a resolved conversation reopens it. While the conversation is waiting_for_human the customer side is locked, as on the hosted chat: the message is refused with 409 and code awaiting_human until a member of the team joins.
List messages (poll for replies)
GET / api/ v1/ conversations/ {id}/ messages?after={message_id}
| Parameter | Type | Required | Description |
|---|---|---|---|
after |
integer | No | Only return messages with an id greater than this. Omit for the full transcript |
curl "https://handover.support/api/v1/conversations/{id}/messages?after=102" \
-H "Authorization: Bearer YOUR_API_TOKEN"
{
"conversation": { "id": "0b8f6a2e-...", "status": "active" },
"messages": [
{ "id": 103, "role": "ai", "content": "You can return any item within 30 days...", "confidence": 0.92, "quick_replies": ["Start a return"], "prompt": null, "created_at": "2026-07-20T12:00:09Z" }
]
}
Poll every 1–2 seconds after sending a message. An AI reply usually arrives within a few seconds; replies from human team members can arrive at any time while a conversation is open.
quick_replies are short suggested follow-ups you can render as tappable buttons; send the chosen text back as a normal message.
prompt is a question the hosted chat shows as buttons under the message (see Prompts). It is null on most messages.
Prompts
Some messages ask the customer something. The hosted chat shows buttons under them; prompt gives you the same question as data, so you can draw your own buttons. The question itself is already in content, in the customer’s language. A prompt never contains internal data.
type |
Asked when | Fields | Answer with |
|---|---|---|---|
email_copy |
The conversation resolves and the customer has an email address. The copy goes out with the resolution email, so this message says so (“A copy of this conversation is on its way to [email protected]”) and its answer is already "sent". Older conversations may still carry an unanswered offer |
answer: null (unanswered), "yes", "no" or "sent" (already emailed, show no buttons) |
Answer a prompt |
resolved |
Under an AI answer when the customer says their issue is solved (“Shall I mark this conversation as resolved?”). Never under a team member’s reply: once a person handles the conversation, the team decides when to resolve it |
answer: null (unanswered), "yes", "no" or "timeout" (nobody answered, so the conversation closed itself) |
Answer a prompt |
rating |
The conversation resolves: “How would you rate the help you received?” |
scale: [1, 2, 3, 4, 5]. rating: null or the rating given. comment_wanted: true after a poor rating (1 or 2) with no comment yet; ask “What went wrong?” |
Rate a conversation |
new_chat |
The customer asks an unrelated question after their earlier issue was resolved | none | Nothing to send. Offer a “Start a new chat” button that creates a new conversation. If the customer keeps typing here, the chat continues as usual |
{ "id": 120, "role": "ai", "content": "Glad that worked. Shall I mark this conversation as resolved?", "confidence": 0.92, "quick_replies": [],
"prompt": { "type": "resolved", "answer": null }, "created_at": "2026-07-20T12:04:00Z" }
{ "id": 124, "role": "ai", "content": "How would you rate the help you received?", "confidence": null, "quick_replies": [],
"prompt": { "type": "rating", "scale": [1, 2, 3, 4, 5], "rating": null, "comment_wanted": false }, "created_at": "2026-07-20T12:06:00Z" }
Show buttons while answer (or rating) is null. Once it is set, show the outcome instead, so a reload never offers the same question twice. Like quick_replies, the hosted chat shows resolved and new_chat buttons under the newest message only, and hides them once the conversation moves on.
Replace the message in place. Polling with ?after= returns only new messages. It never sends a message again when its prompt is answered. The answer endpoints below return the updated message: replace your copy of the message with the same id.
List conversations
GET / api/ v1/ conversations?customer_email={email}&before={cursor}
Newest first, 50 per page. Use this to show a customer their conversation history in your own UI.
| Parameter | Type | Required | Description |
|---|---|---|---|
customer_email |
string | No | Only conversations belonging to this customer (guest or account email) |
before |
integer | No | The cursor from the previous page, for older conversations |
{
"conversations": [ { "id": "0b8f6a2e-...", "status": "resolved", "title": "Cancel Monthly Subscription", "...": "..." } ],
"has_more": false,
"cursor": 118
}
Request a human
POST / api/ v1/ conversations/ {id}/ request_human
Escalates the conversation to your team, exactly like the “Ask for a person” button on the hosted chat. Optional body: { "reason": "..." }. Idempotent – calling it while a human is already involved changes nothing.
When the agent has Details to collect before handover and the conversation does not contain them yet, the AI first asks the customer for the missing ones in an AI message, and status stays active. The customer’s next message completes the handover (after 10 minutes without an answer, it completes anyway). The collected details appear in the conversation’s handover_details, label to value (null when not given).
Returns 403 with code handover_disabled when the agent’s Allow Human Handover setting is off.
Resolve a conversation
POST / api/ v1/ conversations/ {id}/ resolve
Closes the conversation as the customer (your “mark as solved” button). Idempotent. Sending a new message later reopens it. Resolving after a human has replied also feeds the knowledge-learning pipeline, just like the hosted chat.
Email a copy of the conversation
POST / api/ v1/ conversations/ {id}/ transcript
Emails a PDF copy of the conversation (customer-visible messages only, never internal notes). Optional body: { "email": "[email protected]" } to send it somewhere other than the customer’s address. Returns 202 with { "sent_to": "..." }; the email follows within a minute.
Customers also get a copy automatically when a conversation is resolved, so you only need this for extra copies.
Returns 422 with code no_email when the conversation has no customer email and none was given, 422 with invalid_email for a malformed address, and 429 with rate_limited after 3 copies in a day for the same conversation or address.
Rate an AI answer
POST / api/ v1/ conversations/ {id}/ messages/ {message_id}/ feedback
Body: { "helpful": true } or { "helpful": false } – the thumbs up/down signal behind the agent’s quality reporting. Only ai role messages can be rated (404 otherwise). As on the hosted chat, false also hands the conversation to your team when the agent allows human handover; the response includes the conversation’s new status.
Answer a prompt
POST / api/ v1/ conversations/ {id}/ messages/ {message_id}/ answer
Body: { "answer": "yes" } or { "answer": "no" }. Answers the email_copy or resolved prompt on that message, exactly like the hosted chat’s buttons. It is not a chat message, so it never reopens a resolved conversation.
-
email_copy,"yes": the transcript is emailed as a PDF to the conversation’scustomer_email. Your app signed the customer in before it sent that address, so Handover treats the address as verified and sends no confirmation link. -
resolved,"yes": resolves the conversation, as Resolve a conversation does. - Any answer other than
"yes"is a decline: nothing is sent and nothing closes. - One answer only. A second call changes nothing and returns the answer already recorded.
curl -X POST https://handover.support/api/v1/conversations/{id}/messages/120/answer \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"answer": "yes"}'
Returns the updated message (replace it in place) and the conversation’s status:
{
"message": { "id": 120, "role": "ai", "content": "Glad that worked. Shall I mark this conversation as resolved?", "confidence": 0.92, "quick_replies": [],
"prompt": { "type": "resolved", "answer": "yes" }, "created_at": "2026-07-20T12:04:00Z" },
"conversation": { "id": "0b8f6a2e-...", "status": "resolved" }
}
Returns 404 when the message has no email_copy or resolved prompt, and 422 when answer is missing.
Rate a conversation
POST / api/ v1/ conversations/ {id}/ rating
Answers the rating prompt, exactly like the hosted chat’s 1-5 buttons. It never reopens the conversation.
| Parameter | Type | Required | Description |
|---|---|---|---|
rating |
integer | Yes, first | 1 (poor) to 5 (excellent). The first rating stands |
comment |
string | No | Send in a second call when the prompt’s comment_wanted is true (“What went wrong?”). Up to 2,000 characters, one comment only |
curl -X POST https://handover.support/api/v1/conversations/{id}/rating \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"rating": 2}'
Returns the updated rating message (replace it in place) and the conversation’s status:
{
"message": { "id": 124, "role": "ai", "content": "How would you rate the help you received?", "confidence": null, "quick_replies": [],
"prompt": { "type": "rating", "scale": [1, 2, 3, 4, 5], "rating": 2, "comment_wanted": true }, "created_at": "2026-07-20T12:06:00Z" },
"conversation": { "id": "0b8f6a2e-...", "status": "resolved" }
}
Then send the comment:
curl -X POST https://handover.support/api/v1/conversations/{id}/rating \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"comment": "The answer came too late."}'
Returns 404 when the conversation has not asked for a rating. Returns 422 for a rating outside 1-5, a second rating, a comment before a rating, or a second comment.
Errors
All errors use the same JSON envelope:
{ "error": { "code": "unauthorized", "message": "Invalid API token." } }
| HTTP status | Code | Meaning |
|---|---|---|
| 400 | bad_request |
A required parameter is missing |
| 401 | unauthorized |
Missing or invalid API token |
| 403 | forbidden |
The agent is inactive or the plan does not include the API |
| 403 | handover_disabled |
The agent’s Allow Human Handover setting is off |
| 404 | not_found |
Unknown conversation id (or not owned by this agent), or nothing to answer |
| 409 | awaiting_human |
The conversation is waiting for a member of the team; the customer cannot send messages until they join |
| 409 | merged |
The conversation was merged into another one; send messages to that conversation (its id is in the message) |
| 422 | unprocessable |
Validation failed (details in message) |
| 429 | – | Rate limited – slow down and retry after a short wait |
Rate limits
API requests are limited to 120 requests per minute per token. Polling once per second per open conversation sits comfortably within this. If you receive a 429, back off and retry after a few seconds.
Minimal client example
const BASE = "https://handover.support/api/v1";
const HEADERS = {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
};
async function ask(question) {
const conversation = await (await fetch(`${BASE}/conversations`, {
method: "POST", headers: HEADERS, body: JSON.stringify({})
})).json();
const sent = await (await fetch(`${BASE}/conversations/${conversation.id}/messages`, {
method: "POST", headers: HEADERS, body: JSON.stringify({ content: question })
})).json();
// Poll until a reply newer than our message arrives
let after = sent.message.id;
while (true) {
await new Promise(resolve => setTimeout(resolve, 1500));
const { messages } = await (await fetch(
`${BASE}/conversations/${conversation.id}/messages?after=${after}`,
{ headers: HEADERS }
)).json();
const reply = messages.find(m => m.role !== "customer");
if (reply) return reply.content;
if (messages.length) after = messages[messages.length - 1].id;
}
}