Chat API
Let your own systems and apps talk to an agent: keys, system and end-user modes, polling and callbacks.
The Chat API lets your own systems talk to one of your agents over HTTP: a support desk, a CRM, an internal tool or an app your customers use. You make an API key for the agent, your system posts a message with it, and it gets the agent's answer by asking again (polling) or by a signed callback to an address you choose. Each conversation is an ordinary chat of the agent, so it uses the agent's know-how and tools, and shows up in traces, usage and the audit log.
Before you start
- Have an agent that answers well in the portal chat first. The API gives the same agent the same know-how; it does not make it smarter. See Chat in the portal.
- Decide who will call with the key: one of your systems calling for itself, or an app's server calling for its signed-in users. You pick this when you make the key and cannot change it later.
- If you want answers pushed to you, have a public
https://address ready for the callback. Without one, your system polls. - Background job agents have no API card.
Pick a key type
Every key is a system key or an end-user key. The form calls this Who calls with it.
| System | End user | |
|---|---|---|
| For | A backend, job or script calling for itself | An app's server calling for its signed-in users |
end_user.id | Optional. It only names who is speaking and counts toward that person's limit. | Required on every call. A conversation belongs to the end user who started it. |
| Memory | Learns from these chats only if you tick Let memory learn from these chats (off by default) | Never learns from these chats |
| Tools in a turn | The agent's Runs freely tools | A closed set: the built-in file, chart and developer tools, know-how, and only the tools a skill's access block opens (Who can use what) |
Use an end-user key whenever the people typing are not your own staff. A system key's turns can use every Runs freely tool the agent has, and its conversations are not separated by person.
Make a key
- Open the agent, choose the Connections tab and scroll to Channels. The API row says how many live keys the agent has. Choose Make a key (or Keys and calls).
- Choose Create a key.
- In Name, name the system that will call with it, such as "Support desk". At most 60 characters. Calls show under this name.
- Under Who calls with it, choose System or End user.
- For a system key, tick Let memory learn from these chats only if the agent should learn facts from what callers say. See Memory.
- Optionally, enter a Callback URL: a public
https://address that will receive each answer. It must be a public host name or address (notlocalhostor a private network), carry no user name or password, and be at most 2,048 characters. Leave it blank to poll. - Choose Create key.
The page shows Your new key: Support desk with the key, which starts with eapi_. If you gave a callback URL, it also shows the callback secret, which starts with whsec_. Copy both now. They are shown once and never again: Entropix keeps only a hash of the key and an encrypted copy of the secret. The keys table then shows the key by its name and last four characters, for example eapi_…ab12.
An agent has at most five working keys, a rotated key still in its grace period included. With five, the card says This agent has 5 keys: revoke one to make another. The callback URL cannot be changed on a key; make a new key to use a new address.
How a conversation works
- Your system sends
POST /hooks/api/v1/messageswith the key inAuthorization: Bearer eapi_…and a JSON body withtext. With noconversation_id, this starts a new conversation. - Entropix answers at once with
202 Accepted: the newmessage_id, theconversation_id(it starts withconv_; Entropix makes it, never you),statusqueued, and apoll_url. - The agent works on the answer in the background. The message's status goes from
queuedtoworkingtoansweredorfailed. - Your system gets the answer one of two ways:
- Poll:
GETthepoll_url. Add?wait=30to hold the request open for up to 30 seconds until the answer is ready. - Callback: if the key has a callback URL, Entropix posts the finished message there, signed. See Callbacks.
- Poll:
- To continue the same conversation, send the next message with the same
conversation_id. The agent sees the earlier turns, as in the portal chat. - When the conversation is over, send
DELETE /hooks/api/v1/conversations/{id}. The next message with that id starts a fresh conversation; the history stays on the portal.
A conversation belongs to the agent and the key that started it. A key's family is the key and every key rotated from it: they share their conversations, and any other key, even of the same agent, gets 404 for them.
A conversation answers one message at a time. If you send a second message while the first is still open, it waits (status queued) and runs as soon as the first is finished, in the order you sent them.
A worked example
Here a support desk with a system key asks the agent about a ticket, polls for the answer, asks a follow-up and ends the conversation. Put the key in an environment variable first: export ENTROPIX_KEY='<your-key>'. In the commands, replace <message_id> and <conversation_id> with the ids the first answer gave you.
1. Send the first message. The Idempotency-Key header is optional: if the request is repeated with the same value within 24 hours, Entropix returns the first message instead of making a second one.
curl -sS -X POST https://portal.entropixs.com/hooks/api/v1/messages \
-H "Authorization: Bearer $ENTROPIX_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: ticket-4812-1" \
-d '{"text": "A customer says checkout fails with error 502 since this morning. What changed?",
"metadata": {"external_ref": "T-4812"}}'
HTTP/1.1 202 Accepted
Location: https://portal.entropixs.com/hooks/api/v1/messages/msg_3c59dc048e8850243be8079a5c74d079
{
"message_id": "msg_3c59dc048e8850243be8079a5c74d079",
"conversation_id": "conv_8f14e45fceea167a5a36dedd4bea2543",
"status": "queued",
"text": "A customer says checkout fails with error 502 since this morning. What changed?",
"speaker": "Support desk via API",
"metadata": {"external_ref": "T-4812"},
"created_at": "2026-11-21T09:14:03.512Z",
"poll_url": "https://portal.entropixs.com/hooks/api/v1/messages/msg_3c59dc048e8850243be8079a5c74d079"
}
2. Wait for the answer. The request returns as soon as the message is answered or failed, or after 30 seconds with its current status. If it is still queued or working, ask again.
curl -sS "https://portal.entropixs.com/hooks/api/v1/messages/<message_id>?wait=30" \
-H "Authorization: Bearer $ENTROPIX_KEY"
{
"message_id": "msg_3c59dc048e8850243be8079a5c74d079",
"conversation_id": "conv_8f14e45fceea167a5a36dedd4bea2543",
"status": "answered",
"answer": {
"text": "The payments service was deployed at 07:40 UTC. Its health check now times out …",
"files": []
},
"metadata": {"external_ref": "T-4812"},
"created_at": "2026-11-21T09:14:03.512Z",
"answered_at": "2026-11-21T09:14:21.087Z",
"poll_url": "https://portal.entropixs.com/hooks/api/v1/messages/msg_3c59dc048e8850243be8079a5c74d079"
}
3. Ask a follow-up in the same conversation.
curl -sS -X POST https://portal.entropixs.com/hooks/api/v1/messages \
-H "Authorization: Bearer $ENTROPIX_KEY" \
-H "Content-Type: application/json" \
-d '{"conversation_id": "<conversation_id>",
"text": "Who should the ticket go to?"}'
4. Read the whole conversation, then end it.
curl -sS https://portal.entropixs.com/hooks/api/v1/conversations/<conversation_id> \
-H "Authorization: Bearer $ENTROPIX_KEY"
curl -sS -X DELETE https://portal.entropixs.com/hooks/api/v1/conversations/<conversation_id> \
-H "Authorization: Bearer $ENTROPIX_KEY"
The DELETE answers 204 No Content. The card's Example fold shows a shorter version of this with your portal's own address. Every field, status and error is in the Chat API reference.
End users
An end-user key is for an app whose own users type the messages. Your app's server holds the key (never put it in a browser or a mobile app) and names the signed-in user on every call.
- Name the user on every message. Send
"end_user": {"id": "u-42", "name": "Ana"}. Theidis your own stable id for the person (at most 128 characters); thenameis optional (at most 80) and is how the person shows in the message'sspeakerand in the card's Last calls ("Ana via API"). A message with noend_user.idis refused with400 end_user_required. - Name the user on reads too. Add
?end_user=u-42toGETa message or a conversation and toDELETEa conversation. - Each conversation belongs to one user. A conversation is bound to the end user who started it. Asking for it with another user's id answers
404, exactly as if it did not exist, so one user can never read or continue another's chat. - Nothing is learned. End-user chats never feed the agent's memory. The agent still uses the facts it already has.
- Each user has a limit. One end user may send at most 10 messages a minute and 200 a day, across the keys of one key family. Past it, that user gets
429 end_user_rate_limited; other users are not affected. - The tools are closed. An end-user turn gets only the built-in
make_file,make_chart,devtoolsandnetchecktools (those that are on for the agent), the agent's know-how, and the connection tools that the agent's skill opens with an access block. It never gets memory or log reads, code or shell, cloud tools, repository tools, or web requests unless the access block openshttp_request. With a live end-user key, the card says End users get N tools before checking and M after. Set this up in Who can use what.
A system key may send end_user too. Then it only sets the speaker's name and counts toward that person's limit; it does not bind the conversation to anyone.
What an API turn can do
An API conversation is plain chat at member level. The card says it in one line: Calls act as the person who made the key, at most as a member; they never approve anything.
- It acts as the key's maker. Each turn runs as the person who made the key that sent the message, with their access capped at Member: an admin's key acts as a member.
- Runs freely tools only. The agent may call only tools set to Runs freely. Asks first tools are not offered at all.
- No goals. A message starting with
goal:is plain text. Start goals in the portal or a channel; see Goals. - No approvals. Typing "yes" or "approve" in an API message is only text; it never approves a pending action. See Approve actions.
- No proposals. The agent cannot propose a memory change or a know-how change from an API conversation.
- No helpers. The agent cannot ask other agents from an API conversation.
If the key's maker can no longer use Entropix, the turn acts as the person who made the key that started the conversation. If neither can, the message fails with The person who made this API key can no longer use Entropix: ask an admin to make a new key.
Rotate, revoke and switch learning
Each live key in the table has Rotate and Revoke; a system key also has a learning switch under For. All three need an Admin.
Rotate a key
- Choose Rotate on the key's row.
- Under The old key keeps working, choose Stop it now, 1 hour (the default), 6 hours or 24 hours.
- Choose Rotate, then copy the new key (and the new callback secret, if the key has a callback URL) from The new key for Support desk.
The new key keeps the old one's name, type, learning switch and callback URL, and it can reach every conversation the old key started. The old key's state reads Ends with a UTC time, then Replaced. During the grace period each callback is signed with the secret of the key that sent the message, so accept both secrets until the old key ends. A callback queued in the grace period but tried after it ends is signed with the new secret. A message sent with the old key and answered after the old key ended gets no callback: poll for it with the new key.
Revoke a key
- Choose Revoke on the key's row.
- Tick The system using this key stops working at once. and choose Revoke.
The card says Key revoked: calls with it are refused from now on. Calls with the key answer 403 forbidden, and callbacks it had not yet sent are dropped. An ended key stays in the table for a week.
Turn learning on or off
On a live system key, choose Let memory learn or Stop learning. Turning learning on applies to the key's new chats only: Memory now learns from this key's new chats. An end-user key has no switch.
How it works
| Limit | Value | Past it |
|---|---|---|
| Messages per key | 60 a minute and 1,000 a day | 429 rate_limited with Retry-After |
| Messages per end user | 10 a minute and 200 a day | 429 end_user_rate_limited with Retry-After |
| Message text | 16 KiB and 4,096 characters | 413 too_large |
metadata | A JSON object of at most 2 KiB | 413 too_large |
| Waiting polls held open at once, per key | 10 | 429 rate_limited with Retry-After: 5 |
| Longest poll wait | 30 seconds | 400 invalid_request |
| Working keys per agent | 5 | No Create a key button |
| Time to answer | 1 hour | The message fails and the next one runs |
- Pasted credentials are removed. If a message holds something that looks like a credential (a private key, an access key, a known token), Entropix replaces it with a note such as
[credential removed: AWS secret key]before it stores the message or a model reads it. - Stuck messages fail. A message still unanswered an hour after it reached the front of its conversation fails with
Entropix did not finish an answer to this message within an hour, so it stopped waiting. Send it again.Messages waiting behind it then run. - Files. When the agent makes a file or chart, the answer lists it under
answer.fileswith a signed download link that works for 10 minutes. Poll the message again for a fresh link. - Where it shows. The card's Last calls table lists the last 20 messages (when, key, from, conversation, state, time taken), never their text. In the portal, an API conversation's chat head reads "from Support desk via API", and Home's Activity shows "Support desk via API". Each answer has its trace (see See how an answer was made), and the turns count in Usage.
- Audit. Making, rotating and revoking a key and switching learning are recorded in the audit log, and so is every
POSTandDELETEcall (method, address, ids and status, never the text). Reads are not recorded. - Runners. If your organisation runs its work on runners, API turns and callbacks run there too. While no runner is online, a new message answers
503 pausedwithRetry-After: 30, and a message already waiting carries"waiting": "no_runner_online". - On Settings › Channels. The API card there counts the organisation's live keys and the agents that hold them, for example "3 live keys on 2 agents", and links to Agents. Keys are always made on the agent.
What you can and can't do
- Give any agent except a background job agent up to five working keys.
- Poll with a wait of up to 30 seconds, or take a signed callback.
- Keep each of your app's users in their own conversations, with their own limits.
- Attach your own
metadata(and anexternal_ref) to each message. - Retry safely with an
Idempotency-Key. - Rotate a key with up to 24 hours of overlap.
- Start a goal, approve an action or have the agent propose changes through the API.
- Use Asks first tools in an API conversation.
- Choose your own conversation ids, or look one up by
external_ref. - Read a key or callback secret again after it is shown.
- Change a key's type or callback URL after it is made.
- Use an API key anywhere but
/hooks/api/v1/, or any other credential there.
Troubleshooting
- API keys can't be made on this portal yet. The Entropix team needs to set a secret key.
- The server has no secret key to seal callback secrets and sign file links with. On the hosted portal, contact Entropix. On a server you run, set
ENTROPIX_SECRET_KEY; see Configuration. - "the callback URL must start with https://" or "the callback URL must be a public host"
- Create key refused the callback URL. Use a public
https://address your system serves, or leave the field blank and poll. 401 unauthorized: "send an agent's API key as Authorization: Bearer eapi_…"- The header is missing, or the value is not a key Entropix made. A personal access token, a runner credential or a session is not an API key.
403 forbidden: "this API key was revoked or replaced"- The key was revoked, or it was rotated and its grace period is over. Use the new key.
404 not_foundon a conversation you just used- The id belongs to another key, another agent or, on an end-user key, another end user. Check
?end_user=matches the user who started it. - A failed message's
errorsays "… 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 several clusters needs a cluster chosen. The person who made the key picks one in the agent's portal chat; API turns then use it.
- A failed message's
errorsays "The conversation was ended before this message ran." - The conversation was ended with
DELETEwhile this message was waiting. Send it again; it starts a fresh conversation.
Related
- Chat API reference: every endpoint, field and error.
- Who can use what: open tools to end users safely.
- Channels: how they work
- Runs freely or Asks first
- Memory
- Webhooks and public endpoints
- Runners