Chat API reference
Every Chat API endpoint, request and response, with examples.
This page lists every Chat API endpoint, field, status and error, the callback Entropix sends, and the headers your own tools receive on an end user's turn. For what the API is for and how to make a key, start with Chat API.
https://portal.entropixs.com/hooks/api/v1/ (your portal's own address)
Called with an agent's API key, made by an Admin
Basics
| Item | Value |
|---|---|
| Authentication | Authorization: Bearer eapi_… on every call except a file link. Only an agent's API key opens these endpoints, and an API key opens nothing else. |
| Request body | JSON, on POST /messages only. Unknown fields are ignored; a known field of the wrong type is 400. |
| Response body | JSON, with Content-Type: application/json, Cache-Control: no-store and X-Content-Type-Options: nosniff. |
| Ids | Entropix makes every id. Messages start with msg_, conversations with conv_. |
| Times | RFC 3339 in UTC, for example 2026-11-21T09:14:03.512Z. |
| End-user keys | Every call names the end user: end_user.id in the body of POST /messages, ?end_user= on every other call except a file link. Missing, it is 400 end_user_required. |
Endpoints
| Method and path | What it does | Success |
|---|---|---|
POST /hooks/api/v1/messages | Send a message, starting or continuing a conversation | 202 |
GET /hooks/api/v1/messages/{id} | Read a message and its answer, optionally waiting for it | 200 |
GET /hooks/api/v1/conversations/{id} | Read a conversation and its latest messages | 200 |
DELETE /hooks/api/v1/conversations/{id} | End a conversation | 204 |
GET /hooks/api/v1/files/{id} | Download a file an answer made, by its signed link | 200 |
Send a message
POST /hooks/api/v1/messages stores your message and answers at once. The agent answers in the background; read the answer with Get a message or take a callback.
Headers
| Header | Required | What it does |
|---|---|---|
Authorization | Yes | Bearer eapi_… |
Content-Type | Send it | application/json |
Idempotency-Key | No | Any printable ASCII with no spaces, at most 255 characters. A repeat of the same value on the same key within 24 hours stores nothing new: it answers 202 with the first message as it is now, and counts against no limit. |
Body
| Field | Type | Rules |
|---|---|---|
text | string, required | Not blank. At most 16 KiB and 4,096 characters, valid UTF-8, no control characters except newline and tab. A pasted credential is replaced by a note such as [credential removed: AWS secret key] before it is stored. |
conversation_id | string | Leave out to start a new conversation. To continue one, give its conv_… id. An id this key cannot reach is 404. If the conversation was ended, the message starts it again, fresh. |
end_user.id | string | Required on an end-user key. Your own id for the person, at most 128 characters. Required whenever end_user.name is sent. |
end_user.name | string | Optional, at most 80 characters. Shown on the portal as "<name> via API". |
metadata | object | Optional. Any JSON object of at most 2 KiB, stored and returned with the message. Entropix never acts on it. |
metadata.external_ref | string | Optional, at most 128 characters. On a message that starts a conversation, it becomes the conversation's external_ref. It never finds a conversation. |
The whole body is at most 128 KiB.
Answer
202 Accepted with the message object (including text and speaker) and a Location header holding its poll_url. A message sent while another of the same conversation is open stays queued until that one is finished.
This example uses an end-user key, so it names the end user. $ENTROPIX_KEY holds your key.
curl -sS -X POST https://portal.entropixs.com/hooks/api/v1/messages \
-H "Authorization: Bearer $ENTROPIX_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Which of my bookings are next week?",
"end_user": {"id": "u-42", "name": "Ana"}}'
{
"message_id": "msg_c4ca4238a0b923820dcc509a6f75849b",
"conversation_id": "conv_c81e728d9d4c2f636f067f89cc14862c",
"status": "queued",
"text": "Which of my bookings are next week?",
"speaker": "Ana via API",
"end_user": {"id": "u-42"},
"created_at": "2026-11-21T10:02:11.004Z",
"poll_url": "https://portal.entropixs.com/hooks/api/v1/messages/msg_c4ca4238a0b923820dcc509a6f75849b"
}
Get a message
GET /hooks/api/v1/messages/{id} returns the message object without text and speaker. Once it is answered it carries answer; once it failed, error.
| Query | What it does |
|---|---|
wait | Whole seconds from 0 to 30 (default 0). Holds the request open until the message is answered or failed, or the time is up, then returns it as it is. Anything else is 400. One key may hold at most 10 waiting requests at once; the eleventh is 429 rate_limited with Retry-After: 5. A request with no wait is never refused this way. |
end_user | Required on an end-user key: the end user the message was sent for. |
curl -sS "https://portal.entropixs.com/hooks/api/v1/messages/<message_id>?wait=30&end_user=u-42" \
-H "Authorization: Bearer $ENTROPIX_KEY"
The message object
| Field | When present | What it is |
|---|---|---|
message_id | Always | The message's id, msg_… |
conversation_id | Always | Its conversation's id, conv_… |
status | Always | queued, working, answered or failed |
text | Send and conversation answers | The message as stored |
speaker | Send and conversation answers | Who the portal shows as sending it: "<end_user.name> via API", else "<end_user.id> via API", else "<key name> via API" |
end_user | When the message named one | {"id": "…"}, as you sent it |
answer | Status answered | text (Markdown) and files, a list of {name, url, size}. url is a signed link, good for 10 minutes; read the message again for a fresh one. size is in bytes. unverified, when present, lists the claims the answer marks proven that the portal's check found no support for; at most 3, absent when none. No text is added to text for them. |
error | Status failed | Why, in plain words |
metadata | When you sent some | Your object, as sent |
created_at | Always | When the message was sent |
answered_at | Status answered or failed | When it finished |
poll_url | Always | This message's GET address |
waiting | Status queued or working, on an organisation that uses runners | no_runner_online (no runner is online; the message waits until one is) or waiting_for_runner (it waits for a free runner slot) |
Why a message fails
A failed message's error says why. These are the ones you may meet:
- The agent could not answer (for example, its model is not reachable). The words start with "I couldn't answer".
The conversation was ended before this message ran.Entropix did not finish an answer to this message within an hour, so it stopped waiting. Send it again.The person who made this API key can no longer use Entropix: ask an admin to make a new key.This key needs end_user.id on every message.<agent> has several clusters and the API can't pick one: its key's maker picks one in the portal's chat first.(a Kubernetes agent with more than one cluster; see Chat API troubleshooting)This conversation was closed after too many failed checks.(an end-user conversation whose verify step ran out of tries; see Who can use what)
Get a conversation
GET /hooks/api/v1/conversations/{id} returns the conversation and its latest messages, oldest first, each with text and speaker.
| Query | What it does |
|---|---|
limit | How many of the latest messages, from 1 to 100 (default 20). Anything else is 400. |
end_user | Required on an end-user key: the end user the conversation belongs to. |
| Field | What it is |
|---|---|
conversation_id | The conversation's id |
external_ref | The metadata.external_ref of the message that started it, if any |
end_user | {"id": "…"}, on an end-user key's conversation |
ended | true once it was ended |
created_at | When it started |
messages | Message objects since it last started. Empty while it is ended. |
End a conversation
DELETE /hooks/api/v1/conversations/{id} ends the conversation and answers 204 No Content. Messages still waiting behind its open message fail with The conversation was ended before this message ran. The next message sent with the same conversation_id starts it again as a fresh chat: the agent no longer sees the earlier turns, and GET shows only the new messages. The earlier history stays on the portal. On an end-user key, add ?end_user=.
Download a file
GET /hooks/api/v1/files/{id}?k=…&e=…&s=… is the link in answer.files[].url. Use it exactly as given, with no Authorization header: the link is signed. It works for 10 minutes, only while the key that read it is still live, and only for a file an answer of that key's agent and key family made. Anything else answers 404 not_found.
The file comes back with its own Content-Type, Content-Disposition: attachment with its name, X-Content-Type-Options: nosniff, Content-Security-Policy: default-src 'none'; sandbox and Cache-Control: private, no-store. Entropix keeps a file for 90 days.
Errors
Every refusal has the same body:
{"error": {"code": "rate_limited", "message": "this key sent its minute's limit of messages; try again in 42s"}}
| Status | code | Meaning |
|---|---|---|
| 400 | invalid_request | A field or query value broke a rule; the message says which |
| 400 | end_user_required | An end-user key's call named no end user: "This key needs end_user.id on every message." |
| 401 | unauthorized | No key, or not an API key Entropix made. Comes with WWW-Authenticate: Bearer realm="entropix-api". |
| 403 | forbidden | "this API key was revoked or replaced", or "this agent's API is turned off" (the agent is being removed) |
| 404 | not_found | "no such conversation, message or file for this key": it does not exist, or belongs to another agent, key family or end user |
| 413 | too_large | The body, text or metadata is over its limit |
| 429 | rate_limited | The key's limit (60 a minute, 1,000 a day) or its 10 waiting polls. See Retry-After. |
| 429 | end_user_rate_limited | This end user's limit (10 a minute, 200 a day). See Retry-After. |
| 503 | paused | Only on sending: the organisation runs its work on runners and none is online. Retry-After: 30. |
| 500 | internal | "the portal failed to answer; try again" |
Retry-After is in whole seconds. A message refused with 429 or 503 was not stored: send it again later, with the same Idempotency-Key if you use one.
Callbacks
A key made with a callback URL gets one signed POST for every message it sent, once the message is answered or failed, as long as the key is still live at that moment. You can poll as well.
The request
| Part | Value |
|---|---|
| Method and address | POST to the key's callback URL. Redirects are not followed. |
Content-Type | application/json |
User-Agent | Entropix-Callback/1 |
Entropix-Signature | t=<unix seconds>,v1=<hex> |
| Body | The message object, as GET returns it |
POST /entropix/answers HTTP/1.1
Content-Type: application/json
User-Agent: Entropix-Callback/1
Entropix-Signature: t=1795255339,v1=5f0c1e…
{"message_id":"msg_c4ca4238a0b923820dcc509a6f75849b","conversation_id":"conv_c81e728d9d4c2f636f067f89cc14862c","status":"answered","end_user":{"id":"u-42"},"answer":{"text":"You have one booking next week: …","files":[]},"created_at":"2026-11-21T10:02:11.004Z","answered_at":"2026-11-21T10:02:19.880Z","poll_url":"https://portal.entropixs.com/hooks/api/v1/messages/msg_c4ca4238a0b923820dcc509a6f75849b"}
Answering it
- Answer with any
2xxwithin 10 seconds. Do your own work after you answer. - A
408,429,5xx, a timeout or a connection error is tried again, with a wait that doubles each time: 1 minute, then 2, 4, 8 and 16 minutes. If you answer withRetry-Afterin seconds, Entropix waits at least that long, but never past the hour. It gives up one hour after the callback was queued, which with these waits is at most six tries. - Any other status (a
3xxor another4xx) gives up at once. - If the key is revoked before the callback goes out, it is not sent. If the key was rotated and its grace period ended before a queued callback went out, the callback goes to the new key's URL, signed with the new key's secret. A message answered after its key ended gets no callback; read it with the new key.
- Each try is signed again, with a fresh timestamp.
- Use
message_idto ignore a callback you have already handled.
Check the signature
The signature is HMAC-SHA256, keyed with the key's whole callback secret (whsec_…, prefix included), over the timestamp, a full stop and the raw body: "<t>." + body, written as lowercase hex. Check it on the raw bytes, before you parse the JSON, compare in constant time, and refuse a timestamp far from your own clock so an old callback cannot be replayed.
# Python 3
import hashlib, hmac, time
def verify(secret: str, header: str, body: bytes, tolerance: int = 300) -> bool:
parts = dict(p.strip().split("=", 1) for p in header.split(",") if "=" in p)
ts, sig = parts.get("t", ""), parts.get("v1", "")
if not ts.isdigit() or not sig:
return False
if abs(time.time() - int(ts)) > tolerance:
return False
want = hmac.new(secret.encode(), ts.encode() + b"." + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(want, sig)
// Node.js
const crypto = require("crypto");
function verify(secret, header, rawBody, toleranceSec = 300) {
const parts = Object.fromEntries(
header.split(",").map((p) => p.trim().split("=", 2)));
const ts = parts.t, sig = parts.v1;
if (!/^\d+$/.test(ts || "") || !sig) return false;
if (Math.abs(Date.now() / 1000 - Number(ts)) > toleranceSec) return false;
const want = crypto.createHmac("sha256", secret)
.update(ts + ".").update(rawBody).digest("hex");
return want.length === sig.length &&
crypto.timingSafeEqual(Buffer.from(want), Buffer.from(sig));
}
During a rotation's grace period, a callback for a message sent with the old key is signed with the old key's secret, and one for the new key with the new secret. Accept either secret until the grace period ends; after it, every callback is signed with the new secret.
Headers your tools receive on an end user's turn
When a turn comes from an end-user key, Entropix tells your own tool servers who is asking. These headers go on every request of the turn to an MCP tool server's own host, and on every http_request call the access block opens. The value always comes from the message your app sent, never from the model, and Entropix removes any header of the same name that a connection's settings would add, so it cannot be faked by configuration. Other turns (portal chat, channels, goals, reviews and system keys) send none of them.
| Header | Value | Sent |
|---|---|---|
Entropix-End-User | The message's end_user.id | Every request of an end user's turn |
Entropix-Caller | api-end-user | Every request of an end user's turn |
Entropix-Verified | true | Once the conversation passed its verify step |
Entropix-Verified-Id | The value the verify step kept | On http_request calls of a verified conversation |
Use them to filter what your tool returns to the person asking. Setting up the verify step and the tools end users may use is in Who can use what.
Related
- Chat API: keys, end users and a worked example.
- Who can use what
- Runners
- Webhooks and public endpoints