Chatonio

This is taking longer than usual.

Chatonio

Messages

July 7, 2026 113 viewsChatonio API

List messages

Returns the messages in a conversation in chronological order (oldest first). Internal operator notes are never included.

GET/api/v1/conversations/{id}/messages/

List messages in a conversation (cursor-paginated, oldest first).

Response

200Success
{
  "results": [
    {
      "id": "a1000000-0000-4000-8000-000000000001",
      "conversation_id": "3f2b1c9a-7d4e-4b21-9c33-0a1b2c3d4e5f",
      "thread_id": null,
      "sender_type": "CLIENT",
      "sender_user_id": null,
      "content": "Where is my order?",
      "is_internal_note": false,
      "reply_to_id": null,
      "created_at": "2026-07-01T10:30:00+00:00",
      "attachments": []
    },
    {
      "id": "b2d7e410-3c88-4a15-9f60-7d8e9a0b1c2d",
      "conversation_id": "3f2b1c9a-7d4e-4b21-9c33-0a1b2c3d4e5f",
      "thread_id": null,
      "sender_type": "OPERATOR",
      "sender_user_id": "7c1e5a02-9b43-4f18-8a77-2d6e0f4b9c81",
      "content": "It shipped this morning \u2014 tracking below.",
      "is_internal_note": false,
      "reply_to_id": null,
      "created_at": "2026-07-01T10:40:00+00:00",
      "attachments": []
    }
  ],
  "next_cursor": null,
  "has_more": false
}

The message object

  • id, conversation_id, thread_id (usually null).
  • sender_type — CLIENT (the customer), OPERATOR, AI, or SYSTEM.
  • sender_user_id — the id of the teammate who sent it; null when it came from the customer, the AI or the system, or was sent under the API key’s own identity.
  • content — the message text.
  • is_internal_note — always false here.
  • reply_to_id — id of the message this replies to, or null.
  • created_at — ISO-8601.
  • attachments — array of { id, filename, content_type, size, download_url }. download_url is a signed link to the file. It works for 15 minutes without an API key, so anyone who has it can download the file: don’t store or share it. After that it returns 403 link_expired; fetch the message again for a fresh one (see Get one message).

Get one message

Returns one message, with fresh download links for its files. Call it when a message.created webhook tells you a message has attachments: the webhook lists the files but carries no links. Needs the read scope.

GET/api/v1/conversations/{id}/messages/{message_id}/

Retrieve one message, with fresh attachment links.

Responses

200Success
{
  "id": "a1000000-0000-4000-8000-000000000001",
  "conversation_id": "3f2b1c9a-7d4e-4b21-9c33-0a1b2c3d4e5f",
  "thread_id": null,
  "sender_type": "CLIENT",
  "sender_user_id": null,
  "content": "Here is my receipt.",
  "is_internal_note": false,
  "reply_to_id": null,
  "created_at": "2026-07-01T10:30:00+00:00",
  "attachments": [
    {
      "id": "e4f1c2d3-5b6a-4c7d-8e9f-0a1b2c3d4e5f",
      "filename": "receipt.png",
      "content_type": "image/png",
      "size": 48213,
      "download_url": "https://chatonio.com/attachments/…/e4f1c2d3-5b6a-4c7d-8e9f-0a1b2c3d4e5f/download/?exp=…&sig=…"
    }
  ]
}
404Not found
{ "detail": "message_not_found" }

Send a message

Delivers a message to the customer through the conversation’s channel. The message is recorded as an OPERATOR message tagged as sent via the API. It appears live in the operator dashboard. To send files, see Send files below.

POST/api/v1/conversations/{id}/messages/

Send a message into an existing conversation.

Request

Body
{
  "content": "Your refund of $20.00 has been processed.",
  "reply_to_message_id": null,
  "sender_user_id": null
}

Responses

201Created
{
  "id": "b2d7e410-3c88-4a15-9f60-7d8e9a0b1c2d",
  "conversation_id": "3f2b1c9a-7d4e-4b21-9c33-0a1b2c3d4e5f",
  "thread_id": null,
  "sender_type": "OPERATOR",
  "sender_user_id": null,
  "content": "Your refund of $20.00 has been processed.",
  "is_internal_note": false,
  "reply_to_id": null,
  "created_at": "2026-07-01T10:41:00+00:00",
  "attachments": []
}
400Closed
{ "detail": "conversation_closed" }

Body fields

  • content — required; the message text (max 4096 characters).
  • reply_to_message_id — optional; id of a message in the same conversation to reply to.
  • sender_user_id — optional; attribute the message to a teammate instead of the key itself. See Who the message is from below.

Send files

Sends one to five files as one message, with text if you like. The request is multipart/form-data, not JSON: add one files part per file. It needs the write scope. The files reach the customer through the conversation’s channel, the same way as files an operator attaches in the dashboard.

POST/api/v1/conversations/{id}/messages/upload/

Send files, with optional text, into an existing conversation.

Request

curl
curl https://chatonio.com/api/v1/conversations/3f2b1c9a-7d4e-4b21-9c33-0a1b2c3d4e5f/messages/upload/ \
  -H "Authorization: Bearer csk_live_your_key_here" \
  -F "content=Here is your invoice." \
  -F "files=@invoice.pdf" \
  -F "files=@label.png"

Responses

201Created
{
  "id": "c9e2a7f1-4d3b-4e6a-9b18-2f3e4d5c6b7a",
  "conversation_id": "3f2b1c9a-7d4e-4b21-9c33-0a1b2c3d4e5f",
  "thread_id": null,
  "sender_type": "OPERATOR",
  "sender_user_id": null,
  "content": "Here is your invoice.",
  "is_internal_note": false,
  "reply_to_id": null,
  "created_at": "2026-07-01T10:42:00+00:00",
  "attachments": [
    {
      "id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d",
      "filename": "invoice.pdf",
      "content_type": "application/pdf",
      "size": 182044,
      "download_url": "https://chatonio.com/attachments/…/5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d/download/?exp=…&sig=…"
    },
    {
      "id": "6b7c8d9e-0f1a-4b2c-9d3e-4f5a6b7c8d9e",
      "filename": "label.png",
      "content_type": "image/png",
      "size": 61530,
      "download_url": "https://chatonio.com/attachments/…/6b7c8d9e-0f1a-4b2c-9d3e-4f5a6b7c8d9e/download/?exp=…&sig=…"
    }
  ]
}
400Refused file
{ "detail": "Executable files are not allowed", "code": "blocked_type" }

Form fields

  • files — one part per file, up to 5. Each file can be up to 50 MB, and one request can carry about 50 MB in all, so send large files in separate requests.
  • content — optional; text sent with the files (max 4096 characters).
  • reply_to_message_id and sender_user_id — optional, the same as for a text message.

The response is the new message, with a download_url for each file.

When a file is refused

Every file is checked before anything is sent. If one is refused, nothing is sent, not even the text, and the response is 400 with the reason in detail and a machine-readable code, for example:

  • file_too_large — the file is over 50 MB.
  • blocked_type — executables, scripts and installers (.exe, .bat, .js, .apk and similar), disk images, and Office files with macros such as .docm. These are always refused.
  • empty_file, invalid_image, invalid_pdf — an empty file, or an image or PDF that is damaged or fails our checks.

More than five files returns 400 too_many_attachments. If the files would take the project over its plan’s storage limit, the response is 403 with error_type: plan_limit_exceeded, and again nothing is sent.

Allowed file types does not apply here: it limits what customers can attach, and files sent through the API count as an operator’s.

Who the message is from

A message sent through the API is recorded as an OPERATOR message with no human behind it, so you decide whose name and picture the customer sees. There are two options, and you choose per message.

From the key itself (default)

Each API key has a sender name and an optional picture, set on the Developer page. Send without naming anyone and the customer sees those — for example a key called Order Bot appears as “Order Bot”. If you leave the sender name blank, the key’s own name is used, so a message is never anonymous.

From one of your teammates

Pass sender_user_id and the message is attributed to that person instead — their name and avatar, exactly as if they had typed it in the dashboard. This is what you want when you are relaying replies your agents wrote somewhere else.

{
  "content": "Your refund has been processed.",
  "sender_user_id": "7c1e5a02-9b43-4f18-8a77-2d6e0f4b9c81"
}

Get the ids from GET /api/v1/operators/. The person must be a member of the same project; anyone else returns 400 sender_user_not_a_project_member. Either way the acting key is recorded, so you keep an audit trail.

You cannot pass a free-form name or picture on a message. Attribution is an id so that it can be checked — otherwise any key could impersonate a named operator to your customers.

Names in other languages

The sender name can have a per-language version, like your AI assistant’s name and your operators’ nicknames. Customers see the name for their conversation’s language; a language you have not filled in falls back to the base name. Add them on the Developer page, under the key’s identity.

A key's sender identity, with a per-language name

Notes & limits

  • Sending to a CLOSED conversation returns 400 conversation_closed.
  • Group (Telegram group) conversations are not supported in v1 (400 group_conversations_not_supported).
  • An empty content returns 400 content_required; with Send files, only when no file is attached either.
  • Rate limit: 60 requests/minute per API key for text messages, and a separate 10 requests/minute for Send files.

Was this article helpful?