# Agents API

Your agents, for your own apps and systems

- Version 1.0.0, OpenAPI 3.2.1
- Base URL: `https://hados.io/api/v1`
- Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers.
- Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser.
- Every answer carries `Request-Id` — The request's ID, as a problem's `request_id` and our logs name it
- [OpenAPI document](https://hados.io/api/v1/openapi.json)
- [Interactive reference](https://hados.io/api/docs)

Every call comes from your server with one of your API keys, made in the console, and names the
person it acts for: someone signed in to your app, with `X-User-ID`, or a visitor who isn't, with
`X-Visitor-ID`, each with the ID your app keeps for them. Never put a key in a browser or an app
people download.

**Embed sessions**: the embed on your pages calls the same routes for one person with an embed
session, `es_…`, in place of a key. `POST /embed/sessions` gives one, with no credential, for a
visitor or for the user named by a token from your identity provider or signing key. A session is its own person, so its calls
send no `X-User-ID` or `X-Visitor-ID`; `GET /me` is that person, with a user's own
`/me/files` and the person's own `/me/connections`. The people's routes, `/users/…` and `/visitors/…`, stay
your servers', with a key. [Put an agent on your site](/api/docs/embed) shows the embed in each of
its forms, for each use case and each identity provider.

**People**: a person is made the first time a call names them. Tell the agent who they are with
`PUT /users/{id}` or `PUT /visitors/{id}`: their name, email, language and time zone, all
optional. Erasing a person erases their conversations too. [Let people connect their accounts](/api/docs/sign-in)
explains how your people are known, in the embed and here, and how they connect their own accounts.

**Agents**: the agents shared through the API, as their published version in use shows them.
An agent for signed-in people only refuses visitors.

**Conversations**: each person's own, with one agent each; no call reaches anyone else's. A
message starts the agent's turn, or joins the turn under way. Every turn runs the agent's
version in use as the turn starts, and is a resource of its own: what became of it, and what it
used. Once an agent stops being shared, its people can still list, read, rename and delete their
conversations with it, and change nothing else.

**Files**: a person attaches a file to a conversation, its bytes as the body, and sends it with a
message by its ID once it's read; the agent gives files back the same way. Someone signed in to
your app also keeps the files the agent kept for them across conversations, and a home in each
agent's sandboxes; a visitor keeps only each conversation's.

**Webhooks**: your servers hear when a person's turn begins and ends and when a conversation
waits for its person, without holding a stream open: each event is signed and sent as Standard
Webhooks 1.0 describes, to the endpoints set up in the console.

**What people see**: everything the API answers is safe to show the person as it is: their words
and the agent's, files, what became of a turn in words for them, never how the agent works
inside. A turn's `usage` is for your own billing and monitoring, and comes only with a key.

**Answers**: a call answers the resource itself, as JSON. A new conversation, and a person a
`PUT` makes, is `201 Created` with its `Location`; a message and a retry, which start work, are
`202 Accepted` with what became of the message; a delete is `204 No Content`; everything else
`200`. IDs are 24 hexadecimal characters and timestamps Unix milliseconds. Nothing is cached:
every answer is `Cache-Control: no-store`.

**Problems**: every refusal and failure is a problem detail (RFC 9457), as
`application/problem+json`: its `type`, a page saying what it means and what to do, its
`title`, `status` and `detail`, a stable `code` to branch on, the request's `request_id`, and
for a request that isn't valid, `errors`, naming each member at fault by its JSON Pointer
(`pointer`), query parameter (`parameter`) or header (`header`). A method an address doesn't take
is `405 method_not_allowed`, its `Allow` header listing those it does. The codes are the `Problem`
schema's, and `/problems` lists them, each linked to its page.

**Request IDs**: every answer names its request in `Request-Id`, the ID in a problem's
`request_id` and in our logs. Quote it when you ask about a call. An ID you send is not used.

**Idempotency**: send each message and each retry with an `Idempotency-Key` header, a key of
your own for the request, sent as a Structured Fields string (`Idempotency-Key: "8e03978e"`, a
bare value is taken too), 1 to 100 visible ASCII characters; a new conversation, a file, a stop
and a background job's stop take one too.
A key is the person's within what it's sent to, a conversation for its messages and retries and
an agent for the conversations started with it, and it holds while that conversation lives. The
same request sent again with its key answers what the first did, marked
`Idempotent-Replayed: true`, and is taken once; another request with the key is
`422 idempotency_key_reused`; the same while the first is still being answered is
`409 idempotency_key_in_use`. Only a success is kept: a refusal or a failure leaves the key
unused, to send again once whatever refused it has changed.

**Lists** page by keyset: `limit`, 1 to 100 and 20 by default, and `cursor`, the
`next_cursor` of the slice before, answered as `{data, has_more, next_cursor}`, `data` never
null and `next_cursor` null on the last slice. A cursor is opaque. A person's conversations
are newest message first, so a conversation a message arrives in moves to the front, ahead of
a walk already past it.

**Coming back later**: a `503` says how many seconds to wait in `Retry-After`, and so does a
`409 idempotency_key_in_use`.

## Contents

- [People](#people) — The people your app names, and what the agent is told about them
  - [PUT /users/{id}](#put-usersid) — Tell the agent who a user is
  - [GET /users/{id}](#get-usersid) — A user
  - [DELETE /users/{id}](#delete-usersid) — Erase a user
  - [PUT /visitors/{id}](#put-visitorsid) — Tell the agent who a visitor is
  - [GET /visitors/{id}](#get-visitorsid) — A visitor
  - [DELETE /visitors/{id}](#delete-visitorsid) — Erase a visitor
  - [GET /users/{id}/photo](#get-usersidphoto) — A user's photo
  - [PUT /users/{id}/photo](#put-usersidphoto) — Give a user's photo
  - [DELETE /users/{id}/photo](#delete-usersidphoto) — Take a user's photo away
  - [GET /users/{id}/files](#get-usersidfiles) — A user's kept files
  - [GET /users/{id}/files/{file}](#get-usersidfilesfile) — A kept file
  - [DELETE /users/{id}/files/{file}](#delete-usersidfilesfile) — Delete a kept file
  - [GET /users/{id}/files/{file}/content](#get-usersidfilesfilecontent) — Download a kept file
  - [POST /users/{id}/files/{file}/download-link](#post-usersidfilesfiledownload-link) — Get a link to download a kept file
  - [GET /users/{id}/files/{file}/preview](#get-usersidfilesfilepreview) — A kept picture's smaller copy
  - [GET /users/{id}/homes](#get-usersidhomes) — A user's homes
  - [DELETE /users/{id}/homes/{agent}](#delete-usersidhomesagent) — Clear a home
- [Agents](#agents) — The agents shared through the API, or with an embed session those whose embed is on
  - [GET /agents](#get-agents) — The agents you may reach
  - [GET /agents/{id}](#get-agentsid) — One agent
- [Conversations](#conversations) — A person's conversations with an agent, their messages and their turns
  - [GET /agents/{id}/conversations](#get-agentsidconversations) — The person's conversations with an agent
  - [POST /agents/{id}/conversations](#post-agentsidconversations) — Start a conversation with an agent
  - [GET /conversations](#get-conversations) — The person's conversations
  - [GET /conversations/{id}](#get-conversationsid) — A conversation
  - [PATCH /conversations/{id}](#patch-conversationsid) — Rename a conversation
  - [DELETE /conversations/{id}](#delete-conversationsid) — Delete a conversation
  - [GET /conversations/{id}/messages](#get-conversationsidmessages) — A conversation's history
  - [POST /conversations/{id}/messages](#post-conversationsidmessages) — Send a message
  - [POST /conversations/{id}/stop](#post-conversationsidstop) — Stop the turn under way
  - [POST /conversations/{id}/waiting/{message}/steer](#post-conversationsidwaitingmessagesteer) — Steer the turn under way with a waiting message
  - [POST /conversations/{id}/waiting/{message}/send](#post-conversationsidwaitingmessagesend) — Send a held message
  - [DELETE /conversations/{id}/waiting/{message}](#delete-conversationsidwaitingmessage) — Remove a waiting message
  - [POST /conversations/{id}/retry](#post-conversationsidretry) — Try the last turn again
  - [POST /conversations/{id}/resume](#post-conversationsidresume) — Answer what the turn waits on
  - [POST /conversations/{id}/apps/{activity}/context](#post-conversationsidappsactivitycontext) — Tell the model what an app shows
  - [POST /conversations/{id}/pause](#post-conversationsidpause) — Pause the turn under way
  - [POST /conversations/{id}/continue](#post-conversationsidcontinue) — Continue the turn the person paused
  - [GET /conversations/{id}/stream](#get-conversationsidstream) — Follow a conversation live
  - [POST /agents/{id}/agui](#post-agentsidagui) — Run the agent as AG-UI's HttpAgent does
  - [GET /conversations/{id}/turns](#get-conversationsidturns) — A conversation's turns
  - [GET /turns/{id}](#get-turnsid) — A turn
  - [GET /conversations/{id}/processes](#get-conversationsidprocesses) — A conversation's background jobs
  - [POST /conversations/{id}/processes/{n}/stop](#post-conversationsidprocessesnstop) — Stop a background job
  - [GET /conversations/{id}/tasks](#get-conversationsidtasks) — A conversation's tasks
  - [POST /conversations/{id}/tasks/{task}/cancel](#post-conversationsidtaskstaskcancel) — Cancel a task
- [Files](#files) — The files a person attaches to a conversation and the agent gives them
  - [GET /downloads/{tenant}/{secret}](#get-downloadstenantsecret) — Download a file through its link
  - [GET /conversations/{id}/files](#get-conversationsidfiles) — A conversation's files
  - [POST /conversations/{id}/files](#post-conversationsidfiles) — Attach a file
  - [POST /conversations/{id}/files/check](#post-conversationsidfilescheck) — Ask whether a file would be kept, before sending it
  - [GET /conversations/{id}/files/{file}](#get-conversationsidfilesfile) — A file
  - [DELETE /conversations/{id}/files/{file}](#delete-conversationsidfilesfile) — Delete a file
  - [GET /conversations/{id}/files/{file}/content](#get-conversationsidfilesfilecontent) — Download a file
  - [POST /conversations/{id}/files/{file}/download-link](#post-conversationsidfilesfiledownload-link) — Get a link to download a file
  - [GET /conversations/{id}/files/{file}/preview](#get-conversationsidfilesfilepreview) — A picture's smaller copy
- [Documents](#documents) — This document and the problems' pages
  - [GET /openapi.json](#get-openapijson) — This document
  - [GET /api/docs](#get-apidocs) — The reference
  - [GET /api/docs.md](#get-apidocsmd) — The reference in Markdown
  - [GET /api/docs/embed](#get-apidocsembed) — Put an agent on your site
  - [GET /api/docs/embed.md](#get-apidocsembedmd) — Put an agent on your site, in Markdown
  - [GET /api/docs/sign-in](#get-apidocssign-in) — Let people connect their accounts
  - [GET /api/docs/sign-in.md](#get-apidocssign-inmd) — Let people connect their accounts, in Markdown
  - [GET /api/docs/chat-app](#get-apidocschat-app) — Your chat app
  - [GET /api/docs/chat-app.md](#get-apidocschat-appmd) — Your chat app, in Markdown
  - [GET /llms.txt](#get-llmstxt) — The reference's index for coding agents
  - [GET /problems](#get-problems) — Every problem
  - [GET /problems/{code}](#get-problemscode) — A problem's page
- [Embed](#embed) — The embed's sessions, and the person a session is
  - [POST /embed/sessions](#post-embedsessions) — A session for the embed
  - [POST /preview](#post-preview) — A preview of your chat app
  - [GET /me](#get-me) — The session's person
  - [PATCH /me](#patch-me) — Set the session's user's time zone
  - [GET /me/about](#get-meabout) — The session's user's About you
  - [PUT /me/about](#put-meabout) — Write the session's user's About you
  - [GET /me/photo](#get-mephoto) — The session's user's photo
  - [PUT /me/photo](#put-mephoto) — Give the session's user's photo
  - [DELETE /me/photo](#delete-mephoto) — Take the session's user's photo away
  - [DELETE /me/conversations](#delete-meconversations) — Delete every one of the session's person's conversations
  - [GET /me/search](#get-mesearch) — Search the session's person's conversations
  - [PUT /me/pins/{kind}/{id}](#put-mepinskindid) — Pin an agent or a conversation
  - [DELETE /me/pins/{kind}/{id}](#delete-mepinskindid) — Unpin an agent or a conversation
  - [GET /me/files](#get-mefiles) — The session's user's kept files
  - [GET /me/files/{file}](#get-mefilesfile) — One of the session's user's kept files
  - [DELETE /me/files/{file}](#delete-mefilesfile) — Delete one of the session's user's kept files
  - [GET /me/files/{file}/content](#get-mefilesfilecontent) — Download one of the session's user's kept files
  - [POST /me/files/{file}/download-link](#post-mefilesfiledownload-link) — Get a link to download one of the session's user's kept files
  - [GET /me/files/{file}/preview](#get-mefilesfilepreview) — A smaller copy of one of the session's user's kept pictures
  - [GET /me/connections](#get-meconnections) — The session's person's connections
  - [PATCH /me/connections/{connector}](#patch-meconnectionsconnector) — Change one of the session's person's connection
  - [DELETE /me/connections/{connector}](#delete-meconnectionsconnector) — Remove one of the session's person's connections
  - [POST /me/connect](#post-meconnect) — Connect an account from the chat
  - [GET /me/connectors](#get-meconnectors) — List the accounts the person may connect
- [Connections](#connections) — The accounts a person connects for an agent to use as them, and the pages that connect them
  - [GET /users/{id}/connections](#get-usersidconnections) — A user's connections
  - [PATCH /users/{id}/connections/{connector}](#patch-usersidconnectionsconnector) — Change a user's connection
  - [DELETE /users/{id}/connections/{connector}](#delete-usersidconnectionsconnector) — Remove a connection
  - [GET /visitors/{id}/connections](#get-visitorsidconnections) — A visitor's connections
  - [PATCH /visitors/{id}/connections/{connector}](#patch-visitorsidconnectionsconnector) — Change a visitor's connection
  - [DELETE /visitors/{id}/connections/{connector}](#delete-visitorsidconnectionsconnector) — Remove a visitor's connection
  - [GET /users/{id}/connectors](#get-usersidconnectors) — List the accounts a user may connect
  - [POST /users/{id}/connections/{connector}/link](#post-usersidconnectionsconnectorlink) — Make a link for a user to connect an account
  - [GET /connect/link/{tenant}/{token}](#get-connectlinktenanttoken) — An app's connect link's page
  - [POST /connect/link/{tenant}/{token}](#post-connectlinktenanttoken) — Continue an app's connect link
  - [GET /connect/{tenant}/{item}/{secret}](#get-connecttenantitemsecret) — A connect link
  - [POST /connect/{tenant}/{item}/{secret}](#post-connecttenantitemsecret) — Continue a connect link
  - [GET /connect/start/{tenant}/{id}](#get-connectstarttenantid) — A chat's connect start page
  - [GET /connect/callback](#get-connectcallback) — The connect callback
  - [POST /connect/finish](#post-connectfinish) — Finish a connect
- [Memory](#memory) — What each agent remembers of the people signed in to your app, when its team turns memory on: short notes it keeps as it chats, each person's own with each agent, and its earlier conversations with them, which it looks back on.
  - [GET /users/{id}/memory](#get-usersidmemory) — A user's agents that remember them
  - [DELETE /users/{id}/memory](#delete-usersidmemory) — Forget what every agent remembers of a user
  - [GET /users/{id}/memory/{agent}](#get-usersidmemoryagent) — What an agent remembers of them
  - [PATCH /users/{id}/memory/{agent}](#patch-usersidmemoryagent) — Turn an agent's memory of them off or on
  - [DELETE /users/{id}/memory/{agent}](#delete-usersidmemoryagent) — Forget everything an agent remembers of them
  - [GET /users/{id}/memories](#get-usersidmemories) — What an agent remembers of them
  - [GET /users/{id}/memories/{memory}](#get-usersidmemoriesmemory) — A memory
  - [DELETE /users/{id}/memories/{memory}](#delete-usersidmemoriesmemory) — Forget a memory
  - [GET /me/memory](#get-mememory) — The session's user's agents that remember them
  - [DELETE /me/memory](#delete-mememory) — Forget what every agent remembers of the session's user
  - [GET /me/memory/{agent}](#get-mememoryagent) — What an agent remembers of them
  - [PATCH /me/memory/{agent}](#patch-mememoryagent) — Turn an agent's memory of them off or on
  - [DELETE /me/memory/{agent}](#delete-mememoryagent) — Forget everything an agent remembers of them
  - [GET /me/memories](#get-mememories) — What an agent remembers of them
  - [GET /me/memories/{memory}](#get-mememoriesmemory) — A memory
  - [DELETE /me/memories/{memory}](#delete-mememoriesmemory) — Forget a memory
  - [GET /conversations/{id}/memory-asks](#get-conversationsidmemory-asks) — A conversation's changes to memory
  - [POST /conversations/{id}/memory-asks/{ask}](#post-conversationsidmemory-asksask) — Answer a change to memory
- [Admin](#admin) — Your chat app's admin area, for the people your chat app made admins, signed in to it on its own address: its people, invitations, groups, sign-in rules, usage and activity.
  - [GET /admin/people](#get-adminpeople) — The chat app's people
  - [GET /admin/people/{id}](#get-adminpeopleid) — A person
  - [PATCH /admin/people/{id}](#patch-adminpeopleid) — Change a person's role or groups
  - [DELETE /admin/people/{id}](#delete-adminpeopleid) — Remove a person
  - [POST /admin/people/{id}/suspend](#post-adminpeopleidsuspend) — Suspend a person
  - [POST /admin/people/{id}/restore](#post-adminpeopleidrestore) — Restore a suspended person
  - [GET /admin/invitations](#get-admininvitations) — The chat app's invitations
  - [POST /admin/invitations](#post-admininvitations) — Invite people
  - [POST /admin/invitations/{id}/resend](#post-admininvitationsidresend) — Resend an invitation
  - [DELETE /admin/invitations/{id}](#delete-admininvitationsid) — Revoke an invitation
  - [GET /admin/groups](#get-admingroups) — The chat app's groups
  - [POST /admin/groups](#post-admingroups) — Make a group
  - [PATCH /admin/groups/{id}](#patch-admingroupsid) — Rename or describe a group
  - [DELETE /admin/groups/{id}](#delete-admingroupsid) — Delete a group
  - [GET /admin/groups/{id}/agents](#get-admingroupsidagents) — The agents this group sees
  - [PUT /admin/groups/{id}/agents](#put-admingroupsidagents) — Choose the agents this group sees
  - [GET /admin/sign-in](#get-adminsign-in) — How people join and sign in
  - [PATCH /admin/sign-in](#patch-adminsign-in) — Change how people join and sign in
  - [GET /admin/sign-in/providers](#get-adminsign-inproviders) — Your identity providers
  - [POST /admin/sign-in/providers](#post-adminsign-inproviders) — Add an identity provider
  - [POST /admin/sign-in/providers/read](#post-adminsign-inprovidersread) — Read an identity provider
  - [GET /admin/sign-in/setup](#get-adminsign-insetup) — What to set up at any identity provider
  - [GET /admin/sign-in/providers/{id}](#get-adminsign-inprovidersid) — An identity provider
  - [PUT /admin/sign-in/providers/{id}/sso](#put-adminsign-inprovidersidsso) — Set up single sign-on
  - [DELETE /admin/sign-in/providers/{id}/sso](#delete-adminsign-inprovidersidsso) — End single sign-on
  - [POST /admin/sign-in/providers/{id}/sso/check](#post-adminsign-inprovidersidssocheck) — Check single sign-on's client again
  - [POST /admin/sign-in/providers/{id}/sso/test](#post-adminsign-inprovidersidssotest) — Test single sign-on
  - [GET /admin/sign-in/providers/{id}/sso/tests/{test}](#get-adminsign-inprovidersidssoteststest) — A single sign-on test
  - [GET /admin/usage](#get-adminusage) — The chat app's last 30 days
  - [GET /admin/activity](#get-adminactivity) — What changed about people, groups and sign-in
- [Webhooks](#webhooks) — Your servers hear of people's conversations as they change, without holding a stream open.
  - [turn.created](#turncreated) — A turn began
  - [turn.ended](#turnended) — A turn ended
  - [conversation.waiting](#conversationwaiting) — A conversation waits for its person
  - [webhook.test](#webhooktest) — A test
- [Schemas](#schemas)
- [Put an agent on your site](#put-an-agent-on-your-site)
- [Let people connect their accounts](#let-people-connect-their-accounts)
- [Your chat app](#your-chat-app)
- [Problems](#problems)

## People

The people your app names, and what the agent is told about them

### PUT /users/{id}

Tell the agent who a user is

Someone signed in to your app, by your ID for them, made if they're new. A field left out
stays as it was; `null` clears it. No body makes them with nothing known.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Body (optional): [PersonPut](#personput)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The person | [Person](#person) |
| 201 | The person, made by this call; header `Location`: Where the resource it made is | [Person](#person) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /users/{id}

A user

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The person | [Person](#person) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /users/{id}

Erase a user

The person and their conversations are gone at once, each turn under way ended; within a day
everything they held is erased: their conversations' messages and files, their kept files and
their homes. Their ID can come back as someone new.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PUT /visitors/{id}

Tell the agent who a visitor is

Someone using your site or app without signing in, by an ID your app keeps for them, made
if they're new. A field left out stays as it was; `null` clears it. No body makes them with nothing known.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Body (optional): [PersonPut](#personput)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The person | [Person](#person) |
| 201 | The person, made by this call; header `Location`: Where the resource it made is | [Person](#person) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /visitors/{id}

A visitor

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The person | [Person](#person) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /visitors/{id}

Erase a visitor

The person and their conversations are gone at once, each turn under way ended; within a day
everything they held is erased: their conversations' messages and files. Their ID can come back
as someone new.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /users/{id}/photo

A user's photo

The picture the user gave of themselves, a JPEG, PNG or WebP image, kept in the tenant's storage and never by
anything between them and the page. A visitor keeps none (`sign_in_required`); none given is `photo_not_found`.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The person's photo; header `Cache-Control`: `private, no-store` | `image/jpeg`, `image/png` or `image/webp` |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Files can't be kept or read right now (`files_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### PUT /users/{id}/photo

Give a user's photo

The body is the image: a JPEG, PNG or WebP by its bytes, at most 5 MB. It replaces the one before, which is
released. Anything else is `photo_invalid`; past 5 MB, `photo_too_large`.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Body (required): `image/jpeg`, `image/png` or `image/webp`

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 413 | A photo past 5 MB (`photo_too_large`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Files can't be kept or read right now (`files_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### DELETE /users/{id}/photo

Take a user's photo away

The photo is released; with none, there's nothing to do.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /users/{id}/files

A user's kept files

The files the agent kept for someone signed in to your app across their conversations, when they asked it
to, newest first. A visitor keeps only each conversation's files.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `limit` | query | integer | no | How many rows a slice holds; 1 to 100; default `20` |
| `cursor` | query | string | no | The `next_cursor` of the slice before; leave it out for the first |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | A slice of the user's kept files | [KeptFileList](#keptfilelist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /users/{id}/files/{file}

A kept file

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `file` | path | [ID](#id) | yes | A kept file's ID; another person's is not found |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The kept file | [KeptFile](#keptfile) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /users/{id}/files/{file}

Delete a kept file

Gone from their kept files at once; the conversations it came from keep their own.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `file` | path | [ID](#id) | yes | A kept file's ID; another person's is not found |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /users/{id}/files/{file}/content

Download a kept file

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `file` | path | [ID](#id) | yes | A kept file's ID; another person's is not found |
| `Range` | header | string | no | One byte range, such as `bytes=1048576-`, to resume a download; several, or one malformed, get the whole file |
| `If-Range` | header | string | no | The `ETag` the download began with, so another file is sent whole rather than in part |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The file's bytes, in its own type, with their length; header `Content-Disposition`: `attachment` or `inline`, with the file's name; header `Accept-Ranges`: `bytes`: a `Range` gets that part of the file; header `ETag`: The file's digest, quoted, for a resume's `If-Range`; the agent's own text has none | `*/*` |
| 206 | The part of the file the `Range` asked for; header `Content-Disposition`: `attachment` or `inline`, with the file's name; header `Content-Range`: The part sent and the file's length, as `bytes 0-1023/4096`; `bytes */4096` past its end; header `ETag`: The file's digest, quoted, for a resume's `If-Range`; the agent's own text has none | `*/*` |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 416 | The `Range` starts past the file's end (`range_not_satisfiable`); header `Content-Range`: The part sent and the file's length, as `bytes 0-1023/4096`; `bytes */4096` past its end | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /users/{id}/files/{file}/download-link

Get a link to download a kept file

A link the person's browser saves the kept file from by itself, `GET /downloads/{tenant}/{secret}`, as a
conversation's file's link is: hand it to them rather than passing the bytes through your servers. It opens
for five minutes, with no key, for this file read as this person.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `file` | path | [ID](#id) | yes | A kept file's ID; another person's is not found |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 201 | Where a browser saves the file from, and until when | [DownloadLink](#downloadlink) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Files can't be kept or read right now (`files_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### GET /users/{id}/files/{file}/preview

A kept picture's smaller copy

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `file` | path | [ID](#id) | yes | A kept file's ID; another person's is not found |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The picture's smaller copy; header `Content-Disposition`: `attachment` or `inline`, with the file's name | `image/jpeg` or `image/png` |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /users/{id}/homes

A user's homes

A user's home in each agent's sandboxes: what they installed and made there, kept between their
conversations with the agent, one for each agent that kept one.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The user's homes, in one slice | [HomeList](#homelist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /users/{id}/homes/{agent}

Clear a home

Their next conversation with the agent starts with an empty home.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `agent` | path | [ID](#id) | yes | The agent whose sandboxes kept the home |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

## Agents

The agents shared through the API, or with an embed session those whose embed is on

### GET /agents

The agents you may reach

With an API key, the agents shared through the API, oldest first; with an embed session, those whose embed is
on, oldest first, or a preview's own agent; on a chat app's address, those in it the person sees, in the order
its team set, the one new chats start with marked `default`. With a person named, each says whether they may
use it.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `limit` | query | integer | no | How many rows a slice holds; 1 to 100; default `20` |
| `cursor` | query | string | no | The `next_cursor` of the slice before; leave it out for the first |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | A slice of the agents | [AgentList](#agentlist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /agents/{id}

One agent

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | An agent's ID; one not shared through the API is not found, and with an embed session one whose embed is off is `embed_off` |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The agent | [Agent](#agent) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

## Conversations

A person's conversations with an agent, their messages and their turns

### GET /agents/{id}/conversations

The person's conversations with an agent

Newest message first. The agent must be shared through the API and open to the person.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | An agent's ID; one not shared through the API is not found, and with an embed session one whose embed is off is `embed_off` |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `limit` | query | integer | no | How many rows a slice holds; 1 to 100; default `20` |
| `cursor` | query | string | no | The `next_cursor` of the slice before; leave it out for the first |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | A slice of the person's conversations | [ConversationList](#conversationlist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /agents/{id}/conversations

Start a conversation with an agent

The person's new conversation, with nothing said yet; send its first message next. Sent
with an `Idempotency-Key`, a start sent again is the conversation the first made. With an
embed session, `form` names the form it's shown in, else the session's is.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | An agent's ID; one not shared through the API is not found, and with an embed session one whose embed is off is `embed_off` |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Idempotency-Key` | header | [IdempotencyKey](#idempotencykey) | no | Your key for this request, a Structured Fields string; the same request sent again with it answers what the first did |

Body (optional): [ConversationStart](#conversationstart)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 201 | The new conversation; sent again with its Idempotency-Key, the one the first made, replayed; header `Location`: Where the resource it made is; header `Idempotent-Replayed`: `true` on an answer kept from the first request sent with its Idempotency-Key | [Conversation](#conversation) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 422 | The Idempotency-Key was sent with another request (`idempotency_key_reused`) | [Problem](#problem) as `application/problem+json` |
| 429 | The embed's anonymous traffic is past one of its limits (`rate_limited`): its visitors' sessions, conversations, messages, connects and files, and the sessions pages ask for with a user token. Send it again after `Retry-After` seconds.; header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /conversations

The person's conversations

Newest message first, with every agent, shared now or not; `agent` keeps one agent's.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `agent` | query | [ID](#id) | no | An agent's ID, to list only the conversations with it |
| `limit` | query | integer | no | How many rows a slice holds; 1 to 100; default `20` |
| `cursor` | query | string | no | The `next_cursor` of the slice before; leave it out for the first |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | A slice of the person's conversations | [ConversationList](#conversationlist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /conversations/{id}

A conversation

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The conversation | [Conversation](#conversation) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PATCH /conversations/{id}

Rename a conversation

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |

Body (required): [Rename](#rename)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The conversation | [Conversation](#conversation) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /conversations/{id}

Delete a conversation

Its turn under way ends, it's gone from the person's conversations at once, and its requests' keys go with it.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /conversations/{id}/messages

A conversation's history

The conversation as the person sees it, as AG-UI 1.0's messages: their words, the agent's
with their citations, what the agent did as each stretch's `steps` activity, its thoughts
among them, the files it gave as `file` activities, one for each turn and file, each change
to what it remembers of the person as a `memory` activity, each surface it shows that's
still open as an `a2ui-surface` activity, whole as it stands now, where the turn that first
showed it put it (a closed one isn't in the history), each app a connector's tool showed as
an `mcp-apps` activity, and its `plan`, as the stream
shows them. The newest page comes first, its messages oldest first; `next_cursor` reads
the page before it, and stays
where it was as the conversation grows. A page can hold fewer messages than `limit` with
more before it: an app no longer shown, or past what one page sends of apps, is left out of
the page it falls in. Steps and the plan show from the level `progress`
up, the parts a thought names from `thinking`, and each call, what it was sent and what came
back, with each summary the conversation kept and the agent's pins and notes, at `everything`
alone; the answers level shows none of them. The
level is the agent's for the way the call came (`view` on the agent), or the lower of it
and `view=`. Files, changes to memory, surfaces and apps always show. A thought's words never do.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |
| `limit` | query | integer | no | How many messages a page holds; 1 to 200; default `50` |
| `cursor` | query | string | no | The `next_cursor` of the slice before; leave it out for the first |
| `view` | query | `answers`, `progress`, `thinking` or `everything` | no | Ask to see less of the agent's work: `answers`, `progress`, `thinking` or `everything`. The lower of this and the agent's level for the way the call came is shown; a higher one is lowered, never an error. A word that is no level is `invalid_request`. |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | A page of the conversation's history | [MessageList](#messagelist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/messages

Send a message

With no turn under way, the message starts one. With one under way, `auto`, the default,
has the agent read it at its next step, or, while the agent waits on a question, ends that
turn and starts one with this message; `queue` waits for the turn after; `interrupt` stops
the turn and starts one with this message. At most 20 messages wait.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |
| `Idempotency-Key` | header | [IdempotencyKey](#idempotencykey) | yes | Your key for this request, a Structured Fields string; the same request sent again with it is taken once |

Body (required): [SendMessage](#sendmessage)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 202 | What became of the message, its turn's address in `Location` once it's in one; sent again with its Idempotency-Key, the first's answer, replayed; header `Location`: Where the resource it made is; header `Idempotent-Replayed`: `true` on an answer kept from the first request sent with its Idempotency-Key | [MessageResult](#messageresult) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 413 | The page's context is larger than 8 KB, or a pressed button's is larger than 8 KB as sent or 16 KB as the agent reads it (`context_too_large`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 422 | The Idempotency-Key was sent with another request (`idempotency_key_reused`) | [Problem](#problem) as `application/problem+json` |
| 429 | The embed's anonymous traffic is past one of its limits (`rate_limited`): its visitors' sessions, conversations, messages, connects and files, and the sessions pages ask for with a user token. Send it again after `Retry-After` seconds.; header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/stop

Stop the turn under way

The turn ends at once, and none of the person's messages starts after it: those that waited, for
the turn after or to steer this one, are held in the conversation's `waiting`, each to send or
remove. A task's late result that waited starts its own turn, as it would have a moment
later. Sent with an `Idempotency-Key`, a stop sent again answers the turn the first stopped.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Idempotency-Key` | header | [IdempotencyKey](#idempotencykey) | no | Your key for this request, a Structured Fields string; the same request sent again with it answers what the first did |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The turn the stop ended; sent again with its Idempotency-Key, the first's answer, replayed; header `Idempotent-Replayed`: `true` on an answer kept from the first request sent with its Idempotency-Key | [StoppedTurn](#stoppedturn) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 422 | The Idempotency-Key was sent with another request (`idempotency_key_reused`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/waiting/{message}/steer

Steer the turn under way with a waiting message

A message sent with `mode` `queue` waits for the turn after; this makes it steer the turn the
person saw under way, named by `turn`, which reads it at its next step, exactly once. A turn
paused on the person reads it once it goes on, and still waits. `turn` is the turn's ID, or a
stretch's `runId` as the stream names it (`<turn>.2`). A message that already started its turn
or was read is refused (`message_taken`); one whose turn ended first is too (`turn_ended`), and
waits first instead, so it starts the next turn and steers no other, unless a stop held it: then
it stays held, to start when it's sent (`message_held`).

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `message` | path | string | yes | The waiting message's `client_message_id`; at most 100 characters |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |
| `Idempotency-Key` | header | [IdempotencyKey](#idempotencykey) | no | Your key for this request, a Structured Fields string; the same request sent again with it answers what the first did |

Body (required): object

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 202 | The conversation as it is now, with what it still waits on, and in `Location` the turn the answers went to, none when they all went to tasks; sent again with its Idempotency-Key, the first's answer, replayed; header `Location`: Where the resource it made is; header `Idempotent-Replayed`: `true` on an answer kept from the first request sent with its Idempotency-Key | [Conversation](#conversation) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 422 | The Idempotency-Key was sent with another request (`idempotency_key_reused`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/waiting/{message}/send

Send a held message

A stop holds the messages that waited (`held`); this sends one: with no turn under way it starts
one, named in `Location`, and with one under way it steers it, read at its next step. Like a
steer, it leaves a turn paused on the person as it is: the turn reads it once it goes on. A
message no longer waiting is refused (`message_taken`), and one a stop didn't hold is too
(`message_not_held`): it waits for the turn under way, to steer or remove.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `message` | path | string | yes | The waiting message's `client_message_id`; at most 100 characters |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |
| `Idempotency-Key` | header | [IdempotencyKey](#idempotencykey) | no | Your key for this request, a Structured Fields string; the same request sent again with it answers what the first did |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 202 | The conversation as it is now, with what it still waits on, and in `Location` the turn the answers went to, none when they all went to tasks; sent again with its Idempotency-Key, the first's answer, replayed; header `Location`: Where the resource it made is; header `Idempotent-Replayed`: `true` on an answer kept from the first request sent with its Idempotency-Key | [Conversation](#conversation) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 422 | The Idempotency-Key was sent with another request (`idempotency_key_reused`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### DELETE /conversations/{id}/waiting/{message}

Remove a waiting message

Takes a message out of what waits, queued, steering or held, its files free to go with another.
One that already started its turn or was read is refused (`message_taken`).

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `message` | path | string | yes | The waiting message's `client_message_id`; at most 100 characters |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/retry

Try the last turn again

The conversation's last message is answered again as a new turn, once the last turn failed or was stopped and no turn is under way.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |
| `Idempotency-Key` | header | [IdempotencyKey](#idempotencykey) | yes | Your key for this request, a Structured Fields string; the same request sent again with it is taken once |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 202 | What became of the message, its turn's address in `Location` once it's in one; sent again with its Idempotency-Key, the first's answer, replayed; header `Location`: Where the resource it made is; header `Idempotent-Replayed`: `true` on an answer kept from the first request sent with its Idempotency-Key | [MessageResult](#messageresult) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 422 | The Idempotency-Key was sent with another request (`idempotency_key_reused`) | [Problem](#problem) as `application/problem+json` |
| 429 | The embed's anonymous traffic is past one of its limits (`rate_limited`): its visitors' sessions, conversations, messages, connects and files, and the sessions pages ask for with a user token. Send it again after `Retry-After` seconds.; header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/resume

Answer what the turn waits on

AG-UI 1.0's resume: an entry for each interrupt answered, `resolved` with a `payload` that
keeps to its `responseSchema`, or `cancelled`. A confirmation resolved with `approved: true`
goes ahead, and with `false` (and a `note` the agent reads, which only a `false` carries) or
cancelled doesn't; a form
resolved is sent with its values, and cancelled is declined; a page resolved with
`done: true` is done; the person's own pause (`chat:paused`) resolved goes on, and cancelled
stops the turn. Every entry is checked before any is answered, so one at fault answers none;
the turn goes on once nothing it waits on is left open. Sent with an `Idempotency-Key`, a
resume sent again answers what the first did.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |
| `Idempotency-Key` | header | [IdempotencyKey](#idempotencykey) | no | Your key for this request, a Structured Fields string; the same request sent again with it answers what the first did |

Body (required): [ResumeRequest](#resumerequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 202 | The conversation as it is now, with what it still waits on, and in `Location` the turn the answers went to, none when they all went to tasks; sent again with its Idempotency-Key, the first's answer, replayed; header `Location`: Where the resource it made is; header `Idempotent-Replayed`: `true` on an answer kept from the first request sent with its Idempotency-Key | [Conversation](#conversation) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 413 | The page's context is larger than 8 KB, or a pressed button's is larger than 8 KB as sent or 16 KB as the agent reads it (`context_too_large`) | [Problem](#problem) as `application/problem+json` |
| 422 | The Idempotency-Key was sent with another request (`idempotency_key_reused`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/apps/{activity}/context

Tell the model what an app shows

What an app shown in the person's chat tells the model it shows them now (MCP Apps'
`ui/update-model-context`), kept until the person's next message, which carries it to the
model: its text parts, then its `structuredContent` as JSON, set apart as the app's words and
never instructions. Each overwrites the app's last; one with neither clears it. The next
message carries what apps told since the last one did, newest first, three frames' at most (a
frame is one app shown under one call), each once; what the rest told since the last message is
let go unread. At most 4,000 characters as the model reads them, its angle brackets escaped
(`app_context_too_large`); a part that isn't text is `invalid_request`; an activity the
conversation doesn't show, or whose connector no longer shows its apps, is `app_not_found`. It
shares the bound on an app's reads (`too_many_app_requests`).

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `activity` | path | string | yes | The app's `mcp-apps` activity |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |

Body (required): [AppContextRequest](#appcontextrequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 413 | The page's context is larger than 8 KB, or a pressed button's is larger than 8 KB as sent or 16 KB as the agent reads it (`context_too_large`) | [Problem](#problem) as `application/problem+json` |
| 429 | The embed's anonymous traffic is past one of its limits (`rate_limited`): its visitors' sessions, conversations, messages, connects and files, and the sessions pages ask for with a user token. Send it again after `Retry-After` seconds.; header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/pause

Pause the turn under way

The turn pauses at its next step, after any action already under way, and its run ends with
the interrupt `chat:paused`; continue, or resume that interrupt, sends it on. A turn already
paused is answered as it is.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |
| `Idempotency-Key` | header | [IdempotencyKey](#idempotencykey) | no | Your key for this request, a Structured Fields string; the same request sent again with it answers what the first did |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 202 | The conversation as it is now, with what it still waits on, and in `Location` the turn the answers went to, none when they all went to tasks; sent again with its Idempotency-Key, the first's answer, replayed; header `Location`: Where the resource it made is; header `Idempotent-Replayed`: `true` on an answer kept from the first request sent with its Idempotency-Key | [Conversation](#conversation) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 422 | The Idempotency-Key was sent with another request (`idempotency_key_reused`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/continue

Continue the turn the person paused

The paused turn goes on from where it stopped. A turn waiting on the person's answers is
`interrupts_pending`: answer them with resume.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |
| `Idempotency-Key` | header | [IdempotencyKey](#idempotencykey) | no | Your key for this request, a Structured Fields string; the same request sent again with it answers what the first did |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 202 | The conversation as it is now, with what it still waits on, and in `Location` the turn the answers went to, none when they all went to tasks; sent again with its Idempotency-Key, the first's answer, replayed; header `Location`: Where the resource it made is; header `Idempotent-Replayed`: `true` on an answer kept from the first request sent with its Idempotency-Key | [Conversation](#conversation) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 422 | The Idempotency-Key was sent with another request (`idempotency_key_reused`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /conversations/{id}/stream

Follow a conversation live

The conversation as it happens, as AG-UI 1.0 events over server-sent events: the person's
words and the agent's as it writes them, what it's doing, what it's thinking about when its
agent shows it, the files it gives (one `file` activity for each turn and file), the
surfaces it shows (one `a2ui-surface` activity for each, at every level), the apps its
connectors' tools show (one `mcp-apps` activity for each call, at every level), citations,
and anything it waits on the person for. At the level `answers`, where no steps come, what
it's doing is one line, `CUSTOM` `chat:working`: show the newest in place of the one before,
and clear it when the agent's text comes or the run ends. At the level `everything`, each
call comes as AG-UI's `TOOL_CALL_START`, `TOOL_CALL_ARGS` and `TOOL_CALL_END` as the agent
makes it, under the step whose `call` names it, and `TOOL_CALL_RESULT` once it's done, so an
AG-UI client draws them as it draws any tool call; a command's output as it runs, an `output`
activity that `ACTIVITY_DELTA` grows; each summary the conversation kept; and the agent's pins
and notes as they change. A turn is one AG-UI run until it waits for the
person, and the next once they answer: its `runId` is the turn's ID, then `<turn>.2` and
on. Each ends in `RUN_FINISHED`, its outcome `success`, `cancelled` for a Stop or a question
left unanswered, or `interrupt` with what it waits for, or in `RUN_ERROR` with code `failed`
and words for the person. A run that ends its turn also says how in `metadata.chat.outcome`,
the turn's `outcome` as `GET /turns/{id}` gives it: `answered`, `quiet`, `stopped`, `limit`
or `expired` on `RUN_FINISHED`, `failed` on `RUN_ERROR`; one that waits for the person says
none. It may be absent from an end the stream couldn't follow, such as a run that ended
while the stream was away and is told again without its end: read AG-UI's own outcome
then. A `RUN_FINISHED` `success` with `metadata.chat.waiting` true and no outcome ended no
turn: it waits on nothing the person can answer here, and its turn's end comes later. A
`quiet` turn, whose `metadata.chat.quiet` is true too, wrote nothing: a background job's
end the agent had nothing new to tell of. A turn that ends while it waits for the
person, its question unanswered (`expired`), stopped or failed, ends in a run of its own,
the turn's next `runId`, which starts and ends at once: what it waited for no longer waits.
Nothing comes between runs. What a task still running asks the person is a run of its
own, its `runId` the question's, that ends at once in `interrupt`: it comes after a turn's run
under way, and again on each reconnect while it's open, so show one card per interrupt `id`.

Each commit's last event carries the commit's number as its `id`, and a run's end carries
the newest commit and the run, `12:<runId>`; send the last `id` back as `Last-Event-ID` to
go on from there. A reconnect that missed something gets the conversation whole in one
`MESSAGES_SNAPSHOT`, inside a run, whose `timestamp` is when that copy was made; inside a run
under way, the run's `RUN_STARTED` `timestamp` is when that part of the turn began, so the
difference of the two, both the server's times, is how long it has worked, whatever the
client's clock says. One to a conversation at rest whose last `id` wasn't the
newest run's end gets that run's start and end again, so a client cut off before it learns
how the turn ended; one that missed nothing gets nothing until the next turn. The stream
opens with `retry: 1000` and ends after 9 minutes, and the client reconnects; keep-alives
are comments every 15 seconds.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |
| `Last-Event-ID` | header | [StreamCursor](#streamcursor) | no | The `id` of the last event the client has, which the stream goes on from |
| `after` | query | [StreamCursor](#streamcursor) | no | The `id` the stream goes on from, for a client that can't send `Last-Event-ID` |
| `view` | query | `answers`, `progress`, `thinking` or `everything` | no | Ask to see less of the agent's work: `answers`, `progress`, `thinking` or `everything`. The lower of this and the agent's level for the way the call came is shown; a higher one is lowered, never an error. A word that is no level is `invalid_request`. |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The conversation's events, as server-sent events | a stream of events whose `data` is [StreamEvent](#streamevent) as `text/event-stream` |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### POST /agents/{id}/agui

Run the agent as AG-UI's HttpAgent does

AG-UI 1.0's HTTP transport, for an AG-UI client such as `@ag-ui/client`'s `HttpAgent`: a
`RunAgentInput` in, and out, as server-sent events, the one run it starts or resumes, from
its `RUN_STARTED` to its end, after which the stream closes. The events are the stream's
(`GET /conversations/{id}/stream`), the run named by the client's `threadId` and `runId`.

`threadId` names the conversation: one of the person's with this agent by its ID, or by a
thread ID your app chose, which a new conversation keeps. The person's new message is the
last of `messages` when it's theirs, its `id` its own and its text the words (a part that
isn't text is `attachments_not_supported`: attach files through the conversation's files);
a message the conversation already has, by its `id` or by the `client_message_id` the
server's copy carries in `metadata.chat`, is never sent twice, so the history a client sends
on every run is safe to send. That history is also the client's copy: a run whose copy isn't
the conversation's (a reply it lacks, an answer cut short, a surface whose `a2ui_operations`
leave it otherwise than it stands, or one the agent has closed) starts with the conversation
whole in a `MESSAGES_SNAPSHOT`, and a surface whose `a2ui-surface` activity the copy lacks comes
whole when it changes, never as a delta. `resume` answers what the turn waits on, as
`POST /conversations/{id}/resume` does, and as 1.0 asks, a run while it waits needs an
entry for each of its interrupts (`interrupts_pending`); a task's question is a run of its
own and holds nothing up. A turn already under way is `conversation_busy`, unless the run's
answers send it on: follow it on the stream, or steer it with `POST /conversations/{id}/messages`.
An entry giving the answer its interrupt has already is no change. `RUN_STARTED` names the
conversation in `metadata.chat.conversation_id`.

`runId` is the run's key: the same run sent again follows what it started, as it stands
now, and is marked `Idempotent-Replayed`; a run whose last message went already does the same. A run that
starts nothing, its answers all for tasks or its stop ending the turn, ends at once. The
stream ends in `RUN_FINISHED`, or `RUN_ERROR` with code `failed` and words for the person,
or `stream_ended` when it closes before the run does (after 9 minutes at most): the turn
goes on, on the conversation's stream.

Of `forwardedProps`, the run reads `a2uiClientCapabilities`, what the person's app draws, kept with the run's
new message as on `POST /conversations/{id}/messages`, and `a2uiAction`, a button the person pressed in a
surface the agent showed (`userAction`, CopilotKit's name for it, when `a2uiAction` is absent). A pressed button
goes with the person's new message, its words the message's when the message has none; with no new message of
the person's, or beside one the conversation holds already, it is the message, named by the `runId`, its words the
button's `userMessage`: a button is never dropped. It starts a turn as any new message does, so one pressed while
a turn is under way is `conversation_busy`; a surface the conversation never showed, or closed since, or a
button it doesn't show sending that event, is `invalid_action`. `forwardedProps.app` (`{"activity": …}`) marks the
person's new message as sent for them by an app in their chat (MCP Apps' `ui/message`): the activity must be one
of the conversation's `mcp-apps` activities whose connector still shows its apps (`invalid_app`), and the message
comes back with `metadata.chat.app`, `{activity, from}`. `tools`, `context`, `state`, what else `forwardedProps`
holds and `parentRunId` are taken and left: the agent's tools are the ones its builder chose.

**An app's requests.** A connector's app shown in the person's chat (an `mcp-apps` activity) asks its host for its
server through this endpoint, as CopilotKit's renderer does: `forwardedProps.__proxiedMCPRequest` is
`{serverId or serverHash, method, params, activity}`, `serverId` and `serverHash` the activity's (both given, they
must agree), `activity` the activity a call belongs to (when absent, the newest kept result of that connector in
the conversation names it, whichever of its apps that was: a connector with two apps sees the call under the
other's activity if that one showed last). With it the
request is that and nothing else: `messages` are left, no turn starts, and the `threadId` must be a conversation
of this person with this agent, else `conversation_not_found`; no conversation is made. Only four methods are
taken; anything else is `method_not_allowed_for_apps`, before anything is read. The connector must have shown an
app in this conversation and still show its apps, else `app_not_found`. The run starts with `RUN_STARTED` and ends
with `RUN_FINISHED`, whose `result` is MCP's:
- `ping`, and `notifications/message` (a log line of at most 8,000 characters as JSON, taken and kept nowhere):
  `{}`.
- `resources/read` `{uri}`: the document this conversation kept for that connector and address, `{contents:
  [{uri, mimeType: "text/html;profile=mcp-app", text, _meta: {ui: {csp: {connectDomains, resourceDomains,
  frameDomains, baseUriDomains}, prefersBorder}}}]}`, `frameDomains` always empty since an app frames nothing;
  the connector's server is never asked. An address the conversation kept no document for is
  `app_not_found`.
- `tools/call` `{name, arguments}`: the call made for the person through the agent's rules, as the agent's own
  call would go, under the `runId` as its key. Its `result` is the tool's `CallToolResult` as it came; a call that
  ended without one (declined, never confirmed, not run, may have run, too large, a tool that can't be used from
  here, no account) is `{isError: true, content: [{type: "text", text}]}`, its words for the app; a call that asks
  first or needs the person's sign-in ends with `outcome: {type: "interrupt", interrupts}`, each as a turn's pause
  gives it with `metadata.chat.app` naming the activity, `{activity}`. Send the same request with `resume` to answer it
  (`resume` alone does too): that call runs or is declined and this run ends as above; an answer given already,
  by the person or their sign-in, changes nothing and still ends with the call's end; one the conversation moved
  on from is `interrupt_expired`; beside the request of another call, a read, a ping or a log line it is
  `invalid_request` at `/resume`, and carrying a new message of the person's it is `invalid_request` at
  `/messages`. A call may be `conversation_busy` (a turn, or another app's call, under way: an app's call waiting
  on its person is moved on from), `too_many_app_calls` (30 a minute, every request that starts, answers or
  follows an app's call counted, the same `runId` sent again included: a `tools/call` before the call it names
  is read, once a thread named by your own key is found; a resume alone once the interrupt it answers is found
  to be an app's call's), `app_tool_not_offered`, `app_tool_unavailable` (a tool the agent has turned off),
  `app_other_connector`, `apps_not_shown`, `app_arguments_invalid` or `idempotency_key_reused`.

An app's call waiting on its person never holds the conversation up: a new message of the person's on this
endpoint needs no entry for its interrupt and moves on from it (its call cancelled, an answer after
`interrupt_expired`), then starts its turn; a call still running is `conversation_busy`, as a turn is.

Reads, pings, log lines and an app's contexts (`POST /conversations/{id}/apps/{activity}/context`) share a bound
of 120 a minute for a person in a conversation (`too_many_app_requests`). While a call runs, its stream sends a
keep-alive comment every 15 seconds and reads the call as the call's own events say it changed; it ends after the
tool's own time limit and a minute for the call to be taken up, never past 9 minutes (a response can't outlast
the server's 10-minute write deadline), with `RUN_ERROR` `{"code": "stream_ended"}` after its `RUN_STARTED`: the
call goes on, and the end's `message` says so in words fit to show a person. A client given that end sends the
same request with the same `runId` again: it follows the same call, to its end, or answers that end at once if
the call ended meanwhile. A call can take a while: it may wait up to an hour for one of the tenant's turns to
free, then run for its tool's own limit (ten minutes at most). So a host follows a call until it ends, for 71
minutes at most from its first send; it pauses before sending again when a response ended at once (a second,
doubling to thirty), since each follow counts against the 30 calls a minute; and it stops following when the
app's frame leaves. A lost connection loses no call: for a call, or an answer to one, a send that failed, a
stream that ended with no end event at all, or a body that broke is followed as `stream_ended` is, the same
request again, paced the same way, within the same 71 minutes, since the run's key keeps its one call. A
refusal, and any other end, is the answer at once; a read, a ping or a log line that loses its connection
fails at once, as nothing runs on behind it.

**Your own app as the app's host.** A CopilotKit app, or any AG-UI client, hosts a connector's app as MCP Apps
asks: it gets the app on the stream, an `mcp-apps` activity whose content holds the `resourceUri`, the
`serverId` and `serverHash`, the `toolInput`, the tool's `result` and a `frame` with the policy the document
declared; it reads the document with `resources/read`, runs it, and sends what the app asks (its calls, its
reads, its log lines, its pings) here, as above, a run each, following a call that outlasts its response as
above and no longer than its frame. A message the app sends for the person goes as their
new message with `forwardedProps.app`, and what it tells the model to `POST
/conversations/{id}/apps/{activity}/context`. Your app sandboxes the app itself: run it in a frame of another
origin than your page's, with `sandbox="allow-scripts allow-same-origin"` and a content security policy built
from the declared domains and nothing looser. CopilotKit's renderer has no card for a call that asks first: such
a call ends with an interrupt its renderer reads as an empty result, so answer it from your own card.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | An agent's ID; one not shared through the API is not found, and with an embed session one whose embed is off is `embed_off` |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |
| `view` | query | `answers`, `progress`, `thinking` or `everything` | no | Ask to see less of the agent's work: `answers`, `progress`, `thinking` or `everything`. The lower of this and the agent's level for the way the call came is shown; a higher one is lowered, never an error. A word that is no level is `invalid_request`. |

Body (required): [RunAgentInput](#runagentinput)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The run's events, as server-sent events, until its end; header `Idempotent-Replayed`: `true` on an answer kept from the first request sent with its Idempotency-Key | a stream of events whose `data` is [StreamEvent](#streamevent) as `text/event-stream` |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 413 | The page's context is larger than 8 KB, or a pressed button's is larger than 8 KB as sent or 16 KB as the agent reads it (`context_too_large`) | [Problem](#problem) as `application/problem+json` |
| 422 | The Idempotency-Key was sent with another request (`idempotency_key_reused`) | [Problem](#problem) as `application/problem+json` |
| 429 | The embed's anonymous traffic is past one of its limits (`rate_limited`): its visitors' sessions, conversations, messages, connects and files, and the sessions pages ask for with a user token. Send it again after `Retry-After` seconds.; header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### GET /conversations/{id}/turns

A conversation's turns

Each turn the agent took in it, newest first, with what became of it and what it used.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |
| `limit` | query | integer | no | How many rows a slice holds; 1 to 100; default `20` |
| `cursor` | query | string | no | The `next_cursor` of the slice before; leave it out for the first |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | A slice of the conversation's turns | [TurnList](#turnlist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /turns/{id}

A turn

A message's `202` names its turn here, in `Location`, once the message is in one.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A turn's ID; one of anyone else's conversations is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The turn | [Turn](#turn) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /conversations/{id}/processes

A conversation's background jobs

What the agent left running in the background for the person, such as a long build or a server, and those
that ended in the last day, newest first. A job's end reaches the agent on its own.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The conversation's background jobs, in one slice | [ProcessList](#processlist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/processes/{n}/stop

Stop a background job

The stop is under way; the job's `state` says `stopping` until it has `stopped`.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `n` | path | integer | yes | A background job's number in its conversation; at least 1 |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Idempotency-Key` | header | [IdempotencyKey](#idempotencykey) | no | Your key for this request, a Structured Fields string; the same request sent again with it answers what the first did |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 202 | The job, stopping; sent again with its Idempotency-Key, the first's answer, replayed; header `Idempotent-Replayed`: `true` on an answer kept from the first request sent with its Idempotency-Key | [Process](#process) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 422 | The Idempotency-Key was sent with another request (`idempotency_key_reused`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### GET /conversations/{id}/tasks

A conversation's tasks

The actions the agent started that run on after its turn, such as a long report another
system makes, still running or ended in the last day without its result. A task named in
words, in the request's language (`Accept-Language`), by its own ID. One that asks the person something shows it among the conversation's
`interrupts`, and on the stream as a run of its own that ends with that interrupt; answer it
with resume. A task's result opens a turn of its own.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Accept-Language` | header | string | no | The language the response's words are said in: a step's title, a turn's `words`, a question the agent waits on the person with. The API speaks English (`en-US`, which any `en` tag reads as) and Simplified Chinese (`zh-CN`, which any `zh` tag reads as). The language is chosen in this order: the highest-weighted tag of this header that the API speaks, else the language recorded for the person, else English. What the person, the agent or a connector wrote stays as written, and a problem's `detail` stays English. The response sends `Vary: Accept-Language`.; for example `zh-CN,zh;q=0.9,en;q=0.8` |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The conversation's tasks, in one slice | [TaskList](#tasklist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/tasks/{task}/cancel

Cancel a task

The task ends cancelled, the system it runs on told; its result would open no turn.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `task` | path | [ID](#id) | yes | A task's ID, as the conversation's tasks list it |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Idempotency-Key` | header | [IdempotencyKey](#idempotencykey) | no | Your key for this request, a Structured Fields string; the same request sent again with it answers what the first did |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The task, cancelled; sent again with its Idempotency-Key, the first's answer, replayed; header `Idempotent-Replayed`: `true` on an answer kept from the first request sent with its Idempotency-Key | [Task](#task) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 422 | The Idempotency-Key was sent with another request (`idempotency_key_reused`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

## Files

The files a person attaches to a conversation and the agent gives them

### GET /downloads/{tenant}/{secret}

Download a file through its link

The file a link from `POST /conversations/{id}/files/{file}/download-link`,
`POST /users/{id}/files/{file}/download-link` or `POST /me/files/{file}/download-link` names, read again as
its person, as an attachment with its name and length, sent as `application/octet-stream` so nothing on the
way compresses it, never to show as a page: a browser saves it by itself, with its own progress. It takes no
key or session. One byte `Range` is answered with that part, and with `If-Range` only while the file is the one its
`ETag` named, so a download that broke off resumes where it stopped. A link that no longer opens, five minutes
on or once its person can't read the file, is `download_link_expired`; a browser is told why in a sentence, as
text, and a client that asks for JSON gets each refusal as a problem.

No key.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `tenant` | path | string | yes | The tenant whose link it is |
| `secret` | path | string | yes | The secret that opens the link |
| `Range` | header | string | no | One byte range, such as `bytes=1048576-`, to resume a download; several, or one malformed, get the whole file |
| `If-Range` | header | string | no | The `ETag` the download began with, so another file is sent whole rather than in part |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The file's bytes, in its own type, with their length; header `Content-Disposition`: `attachment` or `inline`, with the file's name; header `Accept-Ranges`: `bytes`: a `Range` gets that part of the file; header `ETag`: The file's digest, quoted, for a resume's `If-Range`; the agent's own text has none | `*/*` |
| 206 | The part of the file the `Range` asked for; header `Content-Disposition`: `attachment` or `inline`, with the file's name; header `Content-Range`: The part sent and the file's length, as `bytes 0-1023/4096`; `bytes */4096` past its end; header `ETag`: The file's digest, quoted, for a resume's `If-Range`; the agent's own text has none | `*/*` |
| 404 | The link no longer opens (`download_link_expired`), or the file was deleted since it was made (`file_not_found`): in a sentence to a browser, as a problem to a client that asks for JSON | `text/plain` or [Problem](#problem) as `application/problem+json` |
| 416 | The `Range` starts past the file's end (`range_not_satisfiable`); header `Content-Range`: The part sent and the file's length, as `bytes 0-1023/4096`; `bytes */4096` past its end | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Files can't be kept or read right now (`files_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### GET /conversations/{id}/files

A conversation's files

The files the person attached and the files the agent gave them, newest first.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `limit` | query | integer | no | How many rows a slice holds; 1 to 100; default `20` |
| `cursor` | query | string | no | The `next_cursor` of the slice before; leave it out for the first |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | A slice of the conversation's files | [FileList](#filelist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/files

Attach a file

The body is the file itself, at most 500 MB, sent with its `Content-Length`, and its name goes
in `X-File-Name`, percent-encoded UTF-8. A conversation keeps any file but a program: pictures,
documents such as PDF, Word, PowerPoint and Excel, text files, archives, recordings and any
other kind, each as its name and its bytes say, and at most 100 files. A message may carry a
file still being read: its turn waits for it. A file goes with a message by its `id` in the
message's `files` as soon as it's kept, whatever its `state`: `reading` while it's read,
`ready` once read, or `failed`, its `failure` saying why. Sent with an `Idempotency-Key`, a
file sent again is attached once. An embed session whose agent's embed has Attachments off is refused
(`403 attachments_off`, "This chat takes no files."), its preview too; your chat app and your API keys never are.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `X-File-Name` | header | string | yes | The file's name, percent-encoded UTF-8, such as `Q3%20report.pdf`; at least 1 character |
| `Idempotency-Key` | header | [IdempotencyKey](#idempotencykey) | no | Your key for this request, a Structured Fields string; the same request sent again with it answers what the first did |

Body (required): `*/*` — The file's bytes, its type in `Content-Type`

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 201 | The file, attached and being read; sent again with its Idempotency-Key, the first's answer, replayed; header `Location`: Where the resource it made is; header `Idempotent-Replayed`: `true` on an answer kept from the first request sent with its Idempotency-Key | [File](#file) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 411 | The body was sent without its length (`length_required`) | [Problem](#problem) as `application/problem+json` |
| 413 | The body is larger than the call takes (`body_too_large`) | [Problem](#problem) as `application/problem+json` |
| 415 | The file isn't a kind a conversation keeps, or isn't what its name says (`file_unsupported`) | [Problem](#problem) as `application/problem+json` |
| 422 | The Idempotency-Key was sent with another request (`idempotency_key_reused`) | [Problem](#problem) as `application/problem+json` |
| 429 | The embed's anonymous traffic is past one of its limits (`rate_limited`): its visitors' sessions, conversations, messages, connects and files, and the sessions pages ask for with a user token. Send it again after `Retry-After` seconds.; header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Files can't be kept or read right now (`files_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/files/check

Ask whether a file would be kept, before sending it

The body is the file's first bytes, at most 64 KB (the first 4 KB are all that's read), its name in
`X-File-Name` and its whole size in `X-File-Size`. The answer is the upload's own: 204 when it would keep
the file, else the problem the upload would give, from its name, its size, the conversation, a visitor's
day and the kind its bytes are. Ask before sending a large file, so one that would be refused is refused at
once rather than after it has all arrived. Nothing is kept, and nothing of a visitor's day is counted.
An embed session whose agent's embed has Attachments off is refused as its upload is (`403 attachments_off`).

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `X-File-Name` | header | string | yes | The file's name, percent-encoded UTF-8, such as `Q3%20report.pdf`; at least 1 character |
| `X-File-Size` | header | integer (int64) | yes | The whole file's size, in bytes; at least 1 |

Body (required): `*/*` — The file's first bytes

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 413 | The body is larger than the call takes (`body_too_large`) | [Problem](#problem) as `application/problem+json` |
| 415 | The file isn't a kind a conversation keeps, or isn't what its name says (`file_unsupported`) | [Problem](#problem) as `application/problem+json` |
| 429 | The embed's anonymous traffic is past one of its limits (`rate_limited`): its visitors' sessions, conversations, messages, connects and files, and the sessions pages ask for with a user token. Send it again after `Retry-After` seconds.; header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /conversations/{id}/files/{file}

A file

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `file` | path | [ID](#id) | yes | A file's ID; another conversation's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The file | [File](#file) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /conversations/{id}/files/{file}

Delete a file

The person's or the agent's; a message that carried it still names it.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `file` | path | [ID](#id) | yes | A file's ID; another conversation's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /conversations/{id}/files/{file}/content

Download a file

The file as it was attached or given, as an attachment with its name, never to show as a page. A person's
browser saves it best through its link, from `POST /conversations/{id}/files/{file}/download-link`.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `file` | path | [ID](#id) | yes | A file's ID; another conversation's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |
| `Range` | header | string | no | One byte range, such as `bytes=1048576-`, to resume a download; several, or one malformed, get the whole file |
| `If-Range` | header | string | no | The `ETag` the download began with, so another file is sent whole rather than in part |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The file's bytes, in its own type, with their length; header `Content-Disposition`: `attachment` or `inline`, with the file's name; header `Accept-Ranges`: `bytes`: a `Range` gets that part of the file; header `ETag`: The file's digest, quoted, for a resume's `If-Range`; the agent's own text has none | `*/*` |
| 206 | The part of the file the `Range` asked for; header `Content-Disposition`: `attachment` or `inline`, with the file's name; header `Content-Range`: The part sent and the file's length, as `bytes 0-1023/4096`; `bytes */4096` past its end; header `ETag`: The file's digest, quoted, for a resume's `If-Range`; the agent's own text has none | `*/*` |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 416 | The `Range` starts past the file's end (`range_not_satisfiable`); header `Content-Range`: The part sent and the file's length, as `bytes 0-1023/4096`; `bytes */4096` past its end | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Files can't be kept or read right now (`files_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/files/{file}/download-link

Get a link to download a file

A link a browser saves the file from by itself, `GET /downloads/{tenant}/{secret}`, with its own progress,
speed, pause and resume, and the file never held in a page. It takes no key or session, so hand it to the
person rather than passing the bytes through your servers: it opens for five minutes, for this file read
as this person while they still can, and a download it started goes on past then.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `file` | path | [ID](#id) | yes | A file's ID; another conversation's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 201 | Where a browser saves the file from, and until when | [DownloadLink](#downloadlink) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /conversations/{id}/files/{file}/preview

A picture's smaller copy

A ready picture, re-encoded at most 1,568 pixels on its longer side, to show inline. A file that will never
have one, not a picture, a picture too large to show small or one that couldn't be read, is 404
`preview_unavailable`; a picture still being read is 404 `file_not_found` until it's read.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `file` | path | [ID](#id) | yes | A file's ID; another conversation's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The picture's smaller copy; header `Content-Disposition`: `attachment` or `inline`, with the file's name | `image/jpeg` or `image/png` |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

## Documents

This document and the problems' pages

### GET /openapi.json

This document

No key.

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The API's OpenAPI document | object |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /api/docs

The reference

This document's reference in a browser, where a call can be tried with a key that stays in
the page. A client asking for `text/markdown` before `text/html` gets the reference in
Markdown, as `/api/docs.md` serves it.

At `https://hados.io/api/docs`, apart from the base URL.

No key.

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The reference's page, or the reference in Markdown | `text/html` or `text/markdown` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /api/docs.md

The reference in Markdown

Every call with its parameters, body and answers, every schema and every problem, in one
Markdown file for coding agents and anyone reading without a browser.

At `https://hados.io/api/docs.md`, apart from the base URL.

No key.

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The reference | `text/markdown` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /api/docs/embed

Put an agent on your site

The embed's guide in a browser: an agent on your pages with a couple of lines of frontend
code, in each of its forms, for each use case and each kind of sign-in. A client asking for
`text/markdown` before `text/html` gets the guide in Markdown, as `/api/docs/embed.md`
serves it.

At `https://hados.io/api/docs/embed`, apart from the base URL.

No key.

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The guide's page, or the guide in Markdown | `text/html` or `text/markdown` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /api/docs/embed.md

Put an agent on your site, in Markdown

The embed's guide in one Markdown file, for coding agents and anyone reading without a browser.

At `https://hados.io/api/docs/embed.md`, apart from the base URL.

No key.

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The guide | `text/markdown` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /api/docs/sign-in

Let people connect their accounts

The guide to your people's own accounts, in a browser: what a person meets when an agent needs
one of their accounts, how your agents know the people signed in to your app, what your own MCP
server serves so they can connect to it, each identity provider's setup and what goes wrong. A
client asking for `text/markdown` before `text/html` gets the guide in Markdown, as
`/api/docs/sign-in.md` serves it.

At `https://hados.io/api/docs/sign-in`, apart from the base URL.

No key.

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The guide's page, or the guide in Markdown | `text/html` or `text/markdown` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /api/docs/sign-in.md

Let people connect their accounts, in Markdown

The guide to your people's own accounts in one Markdown file, for coding agents and anyone reading without a browser.

At `https://hados.io/api/docs/sign-in.md`, apart from the base URL.

No key.

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The guide | `text/markdown` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /api/docs/chat-app

Your chat app

The guide to your people's own app for your agents, at an address of yours: opening it, who
can join, how people sign in, single sign-on, people, groups and the admin area, the agents in
it, the routes it uses and what goes wrong. A client asking for `text/markdown` before
`text/html` gets the guide in Markdown, as `/api/docs/chat-app.md` serves it.

At `https://hados.io/api/docs/chat-app`, apart from the base URL.

No key.

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The guide's page, or the guide in Markdown | `text/html` or `text/markdown` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /api/docs/chat-app.md

Your chat app, in Markdown

The guide to your chat app in one Markdown file, for coding agents and anyone reading without a browser.

At `https://hados.io/api/docs/chat-app.md`, apart from the base URL.

No key.

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The guide | `text/markdown` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /llms.txt

The reference's index for coding agents

The API's llms.txt (llmstxt.org), linking the reference, this document and the problems.

At `https://hados.io/llms.txt`, apart from the base URL.

No key.

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The index | `text/plain` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /problems

Every problem

Every problem the API answers, each linked to its page.

At `https://hados.io/problems`, apart from the base URL.

No key.

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The problems' index | `text/html` |

### GET /problems/{code}

A problem's page

What a problem means and what to do about it; every problem's `type` is its page.

At `https://hados.io/problems/{code}`, apart from the base URL.

No key.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `code` | path | [ProblemCode](#problemcode) | yes | A problem's code, as its `code` and the end of its `type` name it |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The problem's page | `text/html` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |

## Embed

The embed's sessions, and the person a session is

### POST /embed/sessions

A session for the embed

Asked for by the embed's frame, with no credential: a session for one person with the agent
named, its embed on. With a `user_token` from your identity provider or signing key, the person is the user it names,
told the token's name, email, language and time zone, and the session ends with the token, an
hour at most; a token that doesn't verify is refused, never taken as a visitor, and an agent for signed-in
people whose embed takes only some sign-ins refuses one through any other (`403 sign_in_not_accepted`), telling
no one. Without one, a visitor is made at an agent anyone may use, told the page's `details`, and the session
lasts 30 days from its last use. The session is answered here alone. Visitor sessions are limited from
each address and in all, and sessions asked for with a token from each address; a visitor's
conversations, messages and files are limited too, and past a limit the call is `429 rate_limited`.

No key.

Body (required): [EmbedSessionRequest](#embedsessionrequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 201 | The session, made by this call | [EmbedSession](#embedsession) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | The user token didn't verify (`user_token_invalid`) | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 429 | The embed's anonymous traffic is past one of its limits (`rate_limited`): its visitors' sessions, conversations, messages, connects and files, and the sessions pages ask for with a user token. Send it again after `Retry-After` seconds.; header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /preview

A preview of your chat app

Your chat app's own, on its address and with no credential: a team member's preview code, made in the console's
Deliver → Chat app, for an hour's session of the app as a person would see it, open or not. A code works once,
within a minute of being made, and on its own app's address alone. The API's host has no such route.

No key.

Body (required): [ChatAppPreviewRequest](#chatapppreviewrequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 201 | The session, made by this call | [EmbedSession](#embedsession) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | The preview code was spent, is past its minute, or is no code of this app's (`preview_invalid`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /me

The session's person

Who an embed session is for, and whether a page's details told them.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The session's person | [Me](#me) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PATCH /me

Set the session's user's time zone

A signed-in person's time zone alone, an IANA zone: left out changes nothing, and `""` clears it. Their name,
language and email are their account's. A visitor has none to set (`sign_in_required`).

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Body (required): [MePatch](#mepatch)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The session's person | [Me](#me) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /me/about

The session's user's About you

What a signed-in person wrote about themselves for agents: what to call them, about them and how they like
answers, with the switch that lets agents use it. Until they write, the switch is on and the rest is empty. A
visitor keeps none (`sign_in_required`).

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | What the person wrote about themselves for agents | [About](#about) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PUT /me/about

Write the session's user's About you

About you, kept whole: a field left out is empty, and the switch is on unless `on` is false. Each field is
trimmed. What to call them is one line; the others keep their lines. A field past its length or holding another
control character is refused, naming it.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Body (required): [AboutPut](#aboutput)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | What the person wrote about themselves for agents | [About](#about) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /me/photo

The session's user's photo

The picture the signed-in person gave of themselves, a JPEG, PNG or WebP image, kept in the tenant's storage and never by
anything between them and the page. A visitor keeps none (`sign_in_required`); none given is `photo_not_found`.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The person's photo; header `Cache-Control`: `private, no-store` | `image/jpeg`, `image/png` or `image/webp` |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Files can't be kept or read right now (`files_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### PUT /me/photo

Give the session's user's photo

The body is the image: a JPEG, PNG or WebP by its bytes, at most 5 MB. It replaces the one before, which is
released. Anything else is `photo_invalid`; past 5 MB, `photo_too_large`.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Body (required): `image/jpeg`, `image/png` or `image/webp`

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 413 | A photo past 5 MB (`photo_too_large`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Files can't be kept or read right now (`files_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### DELETE /me/photo

Take the session's user's photo away

The photo is released; with none, there's nothing to do.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /me/conversations

Delete every one of the session's person's conversations

Every conversation of the person an embed session is, with every agent and every way in, at once, as `DELETE
/conversations/{id}` deletes one: each turn under way ends, running tasks are cancelled, sandboxes are let go,
and its waiting changes to memory and its pins go. What agents remember of them stays.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /me/search

Search the session's person's conversations

The person's own conversations, with every agent and every way in, that the words they and the agent said, or
a conversation's title, match: every word typed, best first, each with a snippet of what was said around the
words and each match's range in its characters (Unicode code points), start inclusive, end exclusive. A turn's
words are searchable once it ends; a conversation made before search came is found from its next turn. Never a
step, a tool's output or the agent's thinking.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `q` | query | string | yes | The words to search for; at least 1 character |
| `limit` | query | integer | no | How many to answer, 1 to 50; 1 to 50; default `20` |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The person's conversations the words found, best first | [SearchHitList](#searchhitlist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### PUT /me/pins/{kind}/{id}

Pin an agent or a conversation

Pins an agent your way in offers, or one of the session's user's own conversations, first among their pins;
pinning one already pinned changes nothing. A user keeps at most 50 (`too_many_pins`); a conversation that's
gone and an agent deleted let go of their pins. Anything else is missing (`agent_not_found`, `conversation_not_found`), naming
nothing of it. A visitor keeps none (`sign_in_required`).

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `kind` | path | `agent` or `conversation` | yes |  |
| `id` | path | string | yes | The agent's or the conversation's ID |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /me/pins/{kind}/{id}

Unpin an agent or a conversation

Takes one of the session's user's pins away; one they haven't pinned is `pin_not_found`.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `kind` | path | `agent` or `conversation` | yes |  |
| `id` | path | string | yes | The agent's or the conversation's ID |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /me/files

The session's user's kept files

As `GET /users/{id}/files`, for the user an embed session is; a visitor keeps none (`sign_in_required`).

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | no | How many rows a slice holds; 1 to 100; default `20` |
| `cursor` | query | string | no | The `next_cursor` of the slice before; leave it out for the first |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | A slice of the user's kept files | [KeptFileList](#keptfilelist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /me/files/{file}

One of the session's user's kept files

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | path | [ID](#id) | yes | A kept file's ID; another person's is not found |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The kept file | [KeptFile](#keptfile) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /me/files/{file}

Delete one of the session's user's kept files

Gone from their kept files at once; the conversations it came from keep their own.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | path | [ID](#id) | yes | A kept file's ID; another person's is not found |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /me/files/{file}/content

Download one of the session's user's kept files

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | path | [ID](#id) | yes | A kept file's ID; another person's is not found |
| `Range` | header | string | no | One byte range, such as `bytes=1048576-`, to resume a download; several, or one malformed, get the whole file |
| `If-Range` | header | string | no | The `ETag` the download began with, so another file is sent whole rather than in part |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The file's bytes, in its own type, with their length; header `Content-Disposition`: `attachment` or `inline`, with the file's name; header `Accept-Ranges`: `bytes`: a `Range` gets that part of the file; header `ETag`: The file's digest, quoted, for a resume's `If-Range`; the agent's own text has none | `*/*` |
| 206 | The part of the file the `Range` asked for; header `Content-Disposition`: `attachment` or `inline`, with the file's name; header `Content-Range`: The part sent and the file's length, as `bytes 0-1023/4096`; `bytes */4096` past its end; header `ETag`: The file's digest, quoted, for a resume's `If-Range`; the agent's own text has none | `*/*` |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 416 | The `Range` starts past the file's end (`range_not_satisfiable`); header `Content-Range`: The part sent and the file's length, as `bytes 0-1023/4096`; `bytes */4096` past its end | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Files can't be kept or read right now (`files_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### POST /me/files/{file}/download-link

Get a link to download one of the session's user's kept files

A link the browser saves the kept file from by itself, `GET /downloads/{tenant}/{secret}`, as a
conversation's file's link is: five minutes, with no session, for this file read as this user.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | path | [ID](#id) | yes | A kept file's ID; another person's is not found |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 201 | Where a browser saves the file from, and until when | [DownloadLink](#downloadlink) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /me/files/{file}/preview

A smaller copy of one of the session's user's kept pictures

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `file` | path | [ID](#id) | yes | A kept file's ID; another person's is not found |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The picture's smaller copy; header `Content-Disposition`: `attachment` or `inline`, with the file's name | `image/jpeg` or `image/png` |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /me/connections

The session's person's connections

As `GET /users/{id}/connections`, for the person an embed session is, a user or a visitor.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The user's connections, in one slice | [ConnectionList](#connectionlist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PATCH /me/connections/{connector}

Change one of the session's person's connection

Whether the account's actions that change something ask the person first, and actions taken
back from those it takes without asking, named by the words `always_allowed` shows. Words that
name no such action change nothing.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `connector` | path | [ID](#id) | yes | The connector the account is on, as the connection's `connector_id` names it |

Body (required): [ConnectionChange](#connectionchange)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The connection as it is now | [Connection](#connection) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### DELETE /me/connections/{connector}

Remove one of the session's person's connections

The account's tokens are withdrawn where its server allows, and a user's next call on it asks
them to connect it again (`chat:connect`); a visitor connects no account again.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `connector` | path | [ID](#id) | yes | The connector the account is on, as the connection's `connector_id` names it |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /me/connect

Connect an account from the chat

The embed's chat asks for a connect bound to the window it opens for the person's sign-in:
it makes a binding, 32 random bytes, sends the `chat:connect` interrupt and the binding's
SHA-256, and opens the window on `url`, the start page, which serves once within 10 minutes.
It posts the binding to that window, to this host's origin alone; the sign-in finishes only
in a window holding it, so a link copied out of the chat connects no one else's account. The
interrupt must be the session's person's and open. Only a user connects an account: a
visitor's is `cant_connect`.

From the person's menu, with no interrupt, it names the agent the chat shows and one of the
connectors `GET /me/connectors` lists instead: `connector_not_offered` for any other, and for
a visitor, who has none.

`lang` is the chat's language: the start page and the callback's page speak it, and so does
the `detail` of a connect's refusal (`cant_connect`, `service_unavailable`); every other
refusal's `detail` stays in English. With none, the pages speak the browser's.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Body (required): [BoundConnectRequest](#boundconnectrequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | Where the chat opens its window | [BoundConnect](#boundconnect) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The interrupt was answered (`interrupt_answered`) or is no longer open (`interrupt_expired`), or the connector can't sign people in until your team changes something, or the person is a visitor (`cant_connect`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### GET /me/connectors

List the accounts the person may connect

The accounts the session's person may connect at the agent the chat shows, from their menu:
its connectors on each person's own login, with how the person's account stands. Only a user
connects an account, so a visitor's list is empty.

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `agent` | query | [ID](#id) | yes | The agent the chat shows |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The accounts, in the agent's order | [ConnectableList](#connectablelist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

## Connections

The accounts a person connects for an agent to use as them, and the pages that connect them

### GET /users/{id}/connections

A user's connections

The accounts a user connected for agents' tools to use as them, a connector once each:
whether each works or needs signing in again (`reconnect`), and the actions it takes
without asking. A visitor's are at `GET /visitors/{id}/connections`.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The user's connections, in one slice | [ConnectionList](#connectionlist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PATCH /users/{id}/connections/{connector}

Change a user's connection

Whether the account's actions that change something ask the person first, and actions taken
back from those it takes without asking, named by the words `always_allowed` shows. Words that
name no such action change nothing.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `connector` | path | [ID](#id) | yes | The connector the account is on, as the connection's `connector_id` names it |

Body (required): [ConnectionChange](#connectionchange)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The connection as it is now | [Connection](#connection) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### DELETE /users/{id}/connections/{connector}

Remove a connection

The account's tokens are withdrawn where its server allows, and its next call asks the
person to connect it again (`chat:connect`).

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `connector` | path | [ID](#id) | yes | The connector the account is on, as the connection's `connector_id` names it |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /visitors/{id}/connections

A visitor's connections

As `GET /users/{id}/connections`, for a visitor. Only a user connects an account, so a
visitor's are only those they still have, which end when they're erased, or 30 days after
their last use.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The user's connections, in one slice | [ConnectionList](#connectionlist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PATCH /visitors/{id}/connections/{connector}

Change a visitor's connection

Whether the account's actions that change something ask the person first, and actions taken
back from those it takes without asking, named by the words `always_allowed` shows. Words that
name no such action change nothing.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `connector` | path | [ID](#id) | yes | The connector the account is on, as the connection's `connector_id` names it |

Body (required): [ConnectionChange](#connectionchange)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The connection as it is now | [Connection](#connection) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### DELETE /visitors/{id}/connections/{connector}

Remove a visitor's connection

The account's tokens are withdrawn where its server allows. A visitor connects no account
again: only a user does.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `connector` | path | [ID](#id) | yes | The connector the account is on, as the connection's `connector_id` names it |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /users/{id}/connectors

List the accounts a user may connect

The accounts the user may connect at an agent, from your app's own menu: its connectors on each
person's own login, with how the user's account stands.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `agent` | query | [ID](#id) | yes | The agent the user connects at |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The accounts, in the agent's order | [ConnectableList](#connectablelist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### POST /users/{id}/connections/{connector}/link

Make a link for a user to connect an account

A link your app opens for the user to connect this account at the agent, from your own menu,
with no turn waiting on it. It serves once, within 10 minutes: its page says whose chat it's
for, and its Continue sends them to their sign-in, bound to that page's window. When it ends,
the page posts `{"type": "chat:connect", "status": "connected"}` (or `not_connected`) to the
window that opened it; read the user's connectors again to see it. `connector_not_offered` for an
account the agent doesn't connect for them.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `connector` | path | [ID](#id) | yes | The connector the account is on, as the connection's `connector_id` names it |

Body (required): [ConnectLinkRequest](#connectlinkrequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 201 | The link and when it closes | [ConnectLink](#connectlink) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The conversation's state refuses the call (`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `too_many_files`, `file_sent`, `file_name_taken`), the person's pins are full (`too_many_pins`), or a request with its Idempotency-Key is still being answered (`idempotency_key_in_use`, with `Retry-After`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### GET /connect/link/{tenant}/{token}

An app's connect link's page

The page of a link from `POST /users/{id}/connections/{connector}/link`: it says whose chat it's
for and which account, and starts nothing until its Continue. Used, closed, or for an account
the agent no longer connects for them, it's a page saying the link is no longer open. It speaks
the first of English and Simplified Chinese the browser's `Accept-Language` asks, English
otherwise, and so do the pages of the sign-in its Continue starts.

No key.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `tenant` | path | string | yes |  |
| `token` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The page naming whose chat it's for, with Continue | `text/html` |
| 410 | A page saying the link is no longer open | `text/html` |

### POST /connect/link/{tenant}/{token}

Continue an app's connect link

The page's Continue, with the hash of the binding its window made: it uses the link once and
sends the person to their provider's sign-in, with no referrer. One another site sends is
answered with the page, and one without the hash with a page saying it needs JavaScript.

No key.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `tenant` | path | string | yes |  |
| `token` | path | string | yes |  |

Body (optional): object as `application/x-www-form-urlencoded`

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The link's page, for a Continue another site sent | `text/html` |
| 302 | To the provider's sign-in; header `Location` | none |
| 400 | A page saying it needs JavaScript, for a Continue without the binding's hash | `text/html` |
| 410 | A page saying the link is no longer open | `text/html` |

### GET /connect/{tenant}/{item}/{secret}

A connect link

A `chat:connect` interrupt's `metadata.chat.url`: open it in a window of its own for the
person. Opening it starts nothing: its page says whose chat it's for, by the name your app
told for the person, with which agent and which account it connects, and goes on when they
choose Continue. That page is the guard against a link reaching someone else, who would
connect their own account to the person's chat: open the link only for the person, and keep
it as private as the conversation. The page binds the sign-in to its own window, with
JavaScript, so it finishes there alone: the provider's address it goes on to connects
nothing anywhere else. It needs no key, and is the person's alone while the interrupt is
open; one no longer open is a page that says so. A link from any chat but your app's, such
as the embed's, is opened from that chat alone: anywhere else its page says so. Its pages, and
the sign-in's its Continue starts, speak the first of English and Simplified Chinese the
browser's `Accept-Language` asks, English otherwise.

No key.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `tenant` | path | string | yes |  |
| `item` | path | string | yes |  |
| `secret` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The page saying whose chat it's for, with Continue; for any chat but your app's, a page saying to open it from the chat | `text/html` |
| 410 | A page saying the link is no longer open | `text/html` |
| 503 | A page saying whose chat it is can't be read just now; header `Retry-After`: How many seconds to wait before sending it again | `text/html` |

### POST /connect/{tenant}/{item}/{secret}

Continue a connect link

The link's page's Continue, its form carrying the hash of the binding the page made in its
window: the person's sign-in starts bound to that window and they go to their provider's,
with no referrer, so the link's secret goes nowhere. Only the page itself goes on: a Continue
sent from another site's page is answered with the page, for the person to choose, and one
without the hash with a page saying it needs JavaScript. A link from any chat but your app's
is answered with the page saying to open it from the chat.

No key.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `tenant` | path | string | yes |  |
| `item` | path | string | yes |  |
| `secret` | path | string | yes |  |

Body (optional): object as `application/x-www-form-urlencoded`

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The link's page, for a Continue another site sent, or the page saying to open it from its chat | `text/html` |
| 302 | To the provider's sign-in; header `Location` | none |
| 400 | A page saying it needs JavaScript, for a Continue without the binding's hash | `text/html` |
| 409 | A page saying the account can't be connected until the tenant's team changes something, such as the connector's app, or for a visitor, who connects no account | `text/html` |
| 410 | A page saying the link is no longer open | `text/html` |
| 503 | A page saying the sign-in couldn't start just now; header `Retry-After`: How many seconds to wait before sending it again | `text/html` |

### GET /connect/start/{tenant}/{id}

A chat's connect start page

Where a chat opens its connect window, from `POST /me/connect`'s `url`: it serves once,
within 10 minutes. The page takes the binding only from a window at the chat's own origins,
kept when the connect started: this host's for the embed, and your chat app's addresses for
your chat app. That window posts `{type: "chat:connect-binding", binding}`; the page keeps the
binding in the window's session storage for the callback, answers
`{type: "chat:connect-bound"}` to the window that sent it, and sends the person to their
provider's sign-in. A fragment in its address is erased unread. With no binding in 60 seconds
it says to open the sign-in from the chat, with a Close button. It speaks the language the
chat's connect sent (`lang`), else the browser's, and wears your brand. Opened again, or never
made, it's a page saying the link is no longer open.

No key.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `tenant` | path | string | yes |  |
| `id` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The page that takes the chat's binding and goes on to the provider | `text/html` |
| 410 | A page saying the link is no longer open | `text/html` |

### GET /connect/callback

The connect callback

Where the provider sends the person back: a page that finishes the sign-in from their window,
sending what the provider's answer carries, with the binding the window kept, to
`POST /connect/finish`, and says whether their account connected, in the language the
sign-in started in and your brand. Connected, it says so for a moment and closes its window,
or, where the browser keeps the window open, says it can be closed; not connected, it says
why, with a Close button. When the window that opened it can still reach it, the page tells
it with `postMessage({type: "chat:connect", status: "connected" | "not_connected"})`, and
one not connected closes at once; most providers isolate their sign-in pages, which cuts
that reach, so follow the conversation's stream, where the turn goes on once the account is
connected. A connector with its own OAuth client needs this address registered with its
provider too.

No key.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `code` | query | string | no |  |
| `state` | query | string | no |  |
| `iss` | query | string | no |  |
| `error` | query | string | no |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The page that finishes the sign-in and says whether the account connected | `text/html` |
| 400 | A page saying the account wasn't connected, for a provider's error or an answer with no code | `text/html` |

### POST /connect/finish

Finish a connect

The callback page's own call, with no key: it finishes the person's sign-in with what the
provider's answer carried and the binding its window kept. A sign-in finishes only with the
binding of the window it started in (`connect_open_from_chat` otherwise), once, within 10
minutes (`sign_in_expired`). Every refusal's `detail` is in the person's words and in the
language the sign-in started in, else the one `Accept-Language` asks, for the page to show.

No key.

Body (required): [ConnectFinishRequest](#connectfinishrequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The account connected | [ConnectFinished](#connectfinished) |
| 400 | A body to fix (`invalid_request`), a sign-in used or past its time (`sign_in_expired`), or a sign-in the provider didn't finish (`connect_failed`) | [Problem](#problem) as `application/problem+json` |
| 403 | A sign-in finished without the binding of the window it started in (`connect_open_from_chat`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

## Memory

What each agent remembers of the people signed in to your app, when its team turns memory on: short notes it keeps
as it chats, each person's own with each agent, and its earlier conversations with them, which it looks back on.
They see each change, delete what's kept, forget everything and turn it off for an agent, and once a conversation
has read something from outside it, a change waits for their word. Forgetting everything leaves their
conversations, each theirs to delete.

### GET /users/{id}/memory

A user's agents that remember them

Each agent that remembers anything of someone signed in to your app, or whose switch they moved, with how many memories it keeps of them and how many changes wait for their word, in one slice. A visitor keeps no memory.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The agents that remember the person, in one slice | [MemoryAgentList](#memoryagentlist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /users/{id}/memory

Forget what every agent remembers of a user

Every agent's memories of someone signed in to your app, and the changes waiting for their word, at once. Each
agent's switch stays as they set it, and their earlier conversations stay. A visitor keeps no memory.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /users/{id}/memory/{agent}

What an agent remembers of them

Whether the agent remembers people now, the person's switch for it, and how many memories and waiting changes it keeps of them.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `agent` | path | [ID](#id) | yes | The agent whose memory of the person this is |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | What the agent keeps of the person | [MemoryAgent](#memoryagent) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PATCH /users/{id}/memory/{agent}

Turn an agent's memory of them off or on

Off, the agent neither reads nor keeps anything of them, its earlier conversations with them included, and what it kept stays until they delete it; its answers go on as before. On again, it reads what it kept from their next turn. An agent whose team turned its memory off has no switch (`memory_unused`).

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `agent` | path | [ID](#id) | yes | The agent whose memory of the person this is |

Body (required): [MemorySwitch](#memoryswitch)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | What the agent keeps of the person | [MemoryAgent](#memoryagent) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | What the agent remembers refuses the change: an answer already given (`memory_ask_answered`), a memory gone since (`memory_gone`), 200 memories kept already (`memory_full`), a name taken (`memory_taken`), a memory its rules refuse (`memory_name`, `memory_too_long`, `memory_never_kept`), or a switch for an agent that doesn't remember people now (`memory_unused`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /users/{id}/memory/{agent}

Forget everything an agent remembers of them

Every memory the agent keeps of them goes at once, and so do the changes waiting for their word.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `agent` | path | [ID](#id) | yes | The agent whose memory of the person this is |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /users/{id}/memories

What an agent remembers of them

Each memory one agent keeps of them, newest first, in the agent's words: a memory is a short note of one thing, at most 2,000 characters.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `agent` | query | [ID](#id) | yes | The agent whose memories to list |
| `limit` | query | integer | no | How many rows a slice holds; 1 to 100; default `20` |
| `cursor` | query | string | no | The `next_cursor` of the slice before; leave it out for the first |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | A slice of what the agent remembers of the person, newest first | [MemoryList](#memorylist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /users/{id}/memories/{memory}

A memory

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `memory` | path | [ID](#id) | yes | A memory's ID; another person's is not found |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The memory | [Memory](#memory-1) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /users/{id}/memories/{memory}

Forget a memory

The agent no longer remembers it, from its next turn.

Authentication: `Authorization: Bearer <token>` — One of your API keys, `ak_…`, made in the console. Keep it on your servers..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | Your ID for the person, 1 to 200 characters, percent-encoded in the path; at least 1 character |
| `memory` | path | [ID](#id) | yes | A memory's ID; another person's is not found |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /me/memory

The session's user's agents that remember them

As `GET /users/{id}/memory`, for the user an embed session is; a visitor keeps none (`sign_in_required`).

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The agents that remember the person, in one slice | [MemoryAgentList](#memoryagentlist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /me/memory

Forget what every agent remembers of the session's user

As `DELETE /users/{id}/memory`, for the user an embed session is: each agent's switch stays; a visitor keeps
none (`sign_in_required`).

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /me/memory/{agent}

What an agent remembers of them

As `GET /users/{id}/memory/{agent}`, for the user an embed session is; a visitor keeps none (`sign_in_required`).

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `agent` | path | [ID](#id) | yes | The agent whose memory of the person this is |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | What the agent keeps of the person | [MemoryAgent](#memoryagent) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PATCH /me/memory/{agent}

Turn an agent's memory of them off or on

As `PATCH /users/{id}/memory/{agent}`, for the user an embed session is; a visitor keeps none (`sign_in_required`).

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `agent` | path | [ID](#id) | yes | The agent whose memory of the person this is |

Body (required): [MemorySwitch](#memoryswitch)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | What the agent keeps of the person | [MemoryAgent](#memoryagent) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | What the agent remembers refuses the change: an answer already given (`memory_ask_answered`), a memory gone since (`memory_gone`), 200 memories kept already (`memory_full`), a name taken (`memory_taken`), a memory its rules refuse (`memory_name`, `memory_too_long`, `memory_never_kept`), or a switch for an agent that doesn't remember people now (`memory_unused`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /me/memory/{agent}

Forget everything an agent remembers of them

As `DELETE /users/{id}/memory/{agent}`, for the user an embed session is; a visitor keeps none (`sign_in_required`).

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `agent` | path | [ID](#id) | yes | The agent whose memory of the person this is |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /me/memories

What an agent remembers of them

As `GET /users/{id}/memories`, for the user an embed session is; a visitor keeps none (`sign_in_required`).

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `agent` | query | [ID](#id) | yes | The agent whose memories to list |
| `limit` | query | integer | no | How many rows a slice holds; 1 to 100; default `20` |
| `cursor` | query | string | no | The `next_cursor` of the slice before; leave it out for the first |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | A slice of what the agent remembers of the person, newest first | [MemoryList](#memorylist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /me/memories/{memory}

A memory

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `memory` | path | [ID](#id) | yes | A memory's ID; another person's is not found |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The memory | [Memory](#memory-1) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /me/memories/{memory}

Forget a memory

As `DELETE /users/{id}/memories/{memory}`, for the user an embed session is; a visitor keeps none (`sign_in_required`).

Authentication: `Authorization: Bearer <token>` — An embed session, `es_…`, from `POST /embed/sessions`, for one person; the embed's own, in a browser..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `memory` | path | [ID](#id) | yes | A memory's ID; another person's is not found |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /conversations/{id}/memory-asks

A conversation's changes to memory

Once a conversation has read something from outside it, such as a page, a web page, a file
or a tool's result, a change the agent makes to what it remembers waits for the person to
confirm its exact words: these, waiting or answered, oldest first, in one slice. One unanswered
for 7 days goes. The stream shows each as it comes, and every change made at once, as a
`memory` activity; a conversation read alone carries those still waiting in `memory_asks`.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The conversation's changes to memory, in one slice | [MemoryAskList](#memoryasklist) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /conversations/{id}/memory-asks/{ask}

Answer a change to memory

The person's answer, once: `save` makes the change as the agent wrote it, `false` drops it.
Only the person answers: show them its words and send what they choose, never what someone
typed in the chat. A change that can't be made any more is refused in words, and waits still.

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | [ID](#id) | yes | A conversation's ID; anyone else's is not found |
| `ask` | path | [ID](#id) | yes | A change to memory's ID; another conversation's is not found |
| `X-User-ID` | header | string | no | Someone signed in to your app, by your ID for them; a conversation's calls name the person with this or `X-Visitor-ID`, with an API key alone; 1 to 200 characters |
| `X-Visitor-ID` | header | string | no | Someone who isn't signed in, by an ID your app keeps for them, with an API key alone; 1 to 200 characters |

Body (required): [MemoryAnswer](#memoryanswer)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The change to memory, answered | [MemoryAsk](#memoryask) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | A suspended account (`tenant_suspended`), a visitor where only someone signed in may be (`sign_in_required`), an embed session's person signed in through a sign-in the agent doesn't take (`sign_in_not_accepted`), or a file sent through an embed session to an agent whose embed takes none (`attachments_off`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | What the agent remembers refuses the change: an answer already given (`memory_ask_answered`), a memory gone since (`memory_gone`), 200 memories kept already (`memory_full`), a name taken (`memory_taken`), a memory its rules refuse (`memory_name`, `memory_too_long`, `memory_never_kept`), or a switch for an agent that doesn't remember people now (`memory_unused`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

## Admin

Your chat app's admin area, for the people your chat app made admins, signed in to it on its own address: its
people, invitations, groups, sign-in rules, usage and activity. Every route checks the admin's role; where your
rules ask two-step of admins, an admin sets it up first, and a change asks a sign-in from the last hour.

### GET /admin/people

The chat app's people

Newest first, a page at a time. `q` matches names and the address; `role`, `status`, `group` and `way` filter,
each with `q` too. `way` is how they sign in: `password`, `passkey`, `two_step` (an authenticator) or `code`,
neither a password nor a passkey.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `q` | query | string | no |  |
| `role` | query | `admin` or `user` | no |  |
| `status` | query | `active` or `suspended` | no |  |
| `group` | query | string | no | A group's ID; the people in it |
| `way` | query | `password`, `passkey`, `code` or `two_step` | no |  |
| `page` | query | integer | no | The page, from 1; at least 1 |
| `page_size` | query | integer | no | How many a page holds, 20 unless asked, 100 at most; 1 to 100 |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | A page of the chat app's people | object |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### GET /admin/people/{id}

A person

The person and how they sign in.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The person and how they sign in | [AdminPersonDetail](#adminpersondetail) |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PATCH /admin/people/{id}

Change a person's role or groups

A role, groups (the whole list), or both, each checked before either changes. An admin can't change their own
role (`not_yourself`); a group your chat app doesn't hold changes nothing (`group_unknown`).

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Body (required): [AdminPersonPatch](#adminpersonpatch)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The person | [AdminPerson](#adminperson) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The state of your people or identity providers refuses it (`not_yourself`, `group_exists`, `too_many_groups`, `last_group`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_busy`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 422 | A group your chat app doesn't hold, so nothing changed (`group_unknown`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /admin/people/{id}

Remove a person

Erases the person and everything they hold, their conversations, memories, files and homes, then their account,
at once. An admin can't remove themselves (`not_yourself`).

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The state of your people or identity providers refuses it (`not_yourself`, `group_exists`, `too_many_groups`, `last_group`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_busy`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /admin/people/{id}/suspend

Suspend a person

Shuts them out at once, every sign-in of theirs ended. An admin can't suspend themselves (`not_yourself`).

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The person | [AdminPerson](#adminperson) |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The state of your people or identity providers refuses it (`not_yourself`, `group_exists`, `too_many_groups`, `last_group`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_busy`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /admin/people/{id}/restore

Restore a suspended person

They can sign in again.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The person | [AdminPerson](#adminperson) |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /admin/invitations

The chat app's invitations

Newest first, each saying whether it lapsed; `q` matches the address.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `q` | query | string | no |  |
| `role` | query | `admin` or `user` | no |  |
| `expired` | query | boolean | no |  |
| `page` | query | integer | no | The page, from 1; at least 1 |
| `page_size` | query | integer | no | How many a page holds, 20 unless asked, 100 at most; 1 to 100 |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | A page of the chat app's invitations | object |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |
| 503 | Turns can't run right now (`agents_unavailable`), search is unavailable (`search_unavailable`), or the service is unavailable (`service_unavailable`); header `Retry-After`: How many seconds to wait before sending it again | [Problem](#problem) as `application/problem+json` |

### POST /admin/invitations

Invite people

Up to 100 addresses, each emailed in your chat app's name with a link to its sign-up for 14 days, each account
joining `groups` when it signs up. An address it can't invite is skipped with why: `invalid`, `has_account`,
`invited` (resend it), `rate_limited` (300 invitation emails an hour) or `too_many_pending`.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Body (required): [AdminInviteRequest](#admininviterequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | What was invited, and why each other address wasn't | [AdminInvited](#admininvited) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 422 | A group your chat app doesn't hold, so nothing changed (`group_unknown`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /admin/invitations/{id}/resend

Resend an invitation

Another 14 days, emailed again, at most once a minute (`invitation_just_sent`); never to an address that has an
account by now (`has_account`).

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The invitation | [AdminInvitation](#admininvitation) |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The state of your people or identity providers refuses it (`not_yourself`, `group_exists`, `too_many_groups`, `last_group`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_busy`) | [Problem](#problem) as `application/problem+json` |
| 429 | The hour's invitations are spent (`too_many_invitations`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /admin/invitations/{id}

Revoke an invitation

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /admin/groups

The chat app's groups

Every group by name, each with how many of your people are in it.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | Every group, by name | object |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /admin/groups

Make a group

A name of 1 to 60 characters, your chat app's alone whatever its case (`group_exists`), and a description of at
most 280; at most 100 groups (`too_many_groups`).

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Body (required): [AdminGroupRequest](#admingrouprequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 201 | The group, made by this call; header `Location`: Where the resource it made is | [AdminGroup](#admingroup) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 409 | The state of your people or identity providers refuses it (`not_yourself`, `group_exists`, `too_many_groups`, `last_group`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_busy`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PATCH /admin/groups/{id}

Rename or describe a group

A member left out stays as it is; never another group's name.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Body (required): [AdminGroupRequest](#admingrouprequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The group | [AdminGroup](#admingroup) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The state of your people or identity providers refuses it (`not_yourself`, `group_exists`, `too_many_groups`, `last_group`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_busy`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /admin/groups/{id}

Delete a group

The group comes off its people and its agents; an agent it alone narrowed leaves the chat app rather than become
everyone's, and is named in `agents_off`.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The group was deleted; the agents that left the chat app with it | [AdminGroupDeleted](#admingroupdeleted) |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /admin/groups/{id}/agents

The agents this group sees

The agents your agency put in the chat app, by name, each narrowed to this group (`sees`) or every account's
(`everyone`).

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The chat app's agents as this group sees them | object |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PUT /admin/groups/{id}/agents

Choose the agents this group sees

The whole list, among the chat app's agents: this group goes on each agent named and comes off each other. An
agent every account sees, named here, is then this group's and its other groups' alone. An agent this group
alone narrows can't lose it (`last_group`), which would make it everyone's: nothing changes.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Body (required): [AdminGroupAgentsRequest](#admingroupagentsrequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The chat app's agents as this group sees them | object |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The state of your people or identity providers refuses it (`not_yourself`, `group_exists`, `too_many_groups`, `last_group`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_busy`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /admin/sign-in

How people join and sign in

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | How people join and sign in | [AdminSignInRules](#adminsigninrules) |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PATCH /admin/sign-in

Change how people join and sign in

A member left out stays as it is, and `domains` replaces the whole list. A change that would leave no way to sign
in is refused, naming the member; another admin's change saved first answers `sign_in_busy`.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Body (required): [AdminSignInPatch](#adminsigninpatch)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | How people join and sign in | [AdminSignInRules](#adminsigninrules) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 409 | The state of your people or identity providers refuses it (`not_yourself`, `group_exists`, `too_many_groups`, `last_group`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_busy`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /admin/sign-in/providers

Your identity providers

The identity providers your people sign in with, oldest first: each one's issuer, its kind, whether single sign-on
can work through it (`sso_ready`, else what it lacks) and its single sign-on, never its secret.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | Your identity providers, oldest first | object |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /admin/sign-in/providers

Add an identity provider

Its domain, its address or its discovery document's address: the document and its keys are read before it's
kept (`issuer_unreachable`), for single sign-on alone, its `sso` set up empty and off, or, with `client_id` and
`secret`, holding that OAuth client, checked at the provider's token endpoint before anything is kept. One whose document lacks
what single sign-on needs (an authorization endpoint, a token endpoint, and openid where it lists scopes) isn't
kept (`sso_unsupported`). An issuer is added once (`issuer_taken`), and your chat app keeps at most 5
(`too_many_issuers`).

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Body (required): [AdminProviderRequest](#adminproviderrequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 201 | The identity provider, added by this call; header `Location`: Where the resource it made is | [AdminProvider](#adminprovider) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 409 | The state of your people or identity providers refuses it (`not_yourself`, `group_exists`, `too_many_groups`, `last_group`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_busy`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 422 | The identity provider's discovery document or keys didn't answer as they must (`issuer_unreachable`), or its document lacks what single sign-on needs (`sso_unsupported`), so nothing was added | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /admin/sign-in/providers/read

Read an identity provider

Reads an identity provider as an add would, keeping nothing: its issuer, its kind, whether single sign-on can work
through it, what to set up at it (the redirect URIs and scopes) and the claims its document lists. For a form
that shows what it found before you save (`issuer_unreachable` when there's nothing to read). Keeping nothing,
it never asks a sign-in of the last hour, as a change does.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Body (required): [AdminProviderRequest](#adminproviderrequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The identity provider as read, nothing kept | [AdminProviderRead](#adminproviderread) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 422 | The identity provider's discovery document or keys didn't answer as they must (`issuer_unreachable`), or its document lacks what single sign-on needs (`sso_unsupported`), so nothing was added | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /admin/sign-in/setup

What to set up at any identity provider

What single sign-on asks of any identity provider: the redirect URIs to add at it and the scopes to allow. For a
form that has read no provider yet, such as one whose endpoints are typed in.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | What single sign-on asks of any identity provider | [AdminSSOSetup](#adminssosetup) |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /admin/sign-in/providers/{id}

An identity provider

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The identity provider | [AdminProvider](#adminprovider) |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### PUT /admin/sign-in/providers/{id}/sso

Set up single sign-on

A member left out stays as it is, a change of nothing writes nothing, and `secret` is never answered, only
whether one is kept (`has_secret`). The client is checked at the provider's token endpoint once it has both its
ID and its secret and whenever either changes, and single sign-on turns on only once it works
(`sso_not_working`); a client changed for one that doesn't work turns it off. Each email domain is one
provider's (`sso_domain_taken`), `required` and `make_accounts` need a domain, and `group_map` names your
groups (`group_unknown`). Other changes to it saved first, again and again, are `sso_busy`.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Body (required): [AdminSSORequest](#adminssorequest)

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The identity provider | [AdminProvider](#adminprovider) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The state of your people or identity providers refuses it (`not_yourself`, `group_exists`, `too_many_groups`, `last_group`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_busy`) | [Problem](#problem) as `application/problem+json` |
| 415 | The body isn't application/json (`unsupported_media_type`) | [Problem](#problem) as `application/problem+json` |
| 422 | A group your chat app doesn't hold, so nothing changed (`group_unknown`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### DELETE /admin/sign-in/providers/{id}/sso

End single sign-on

A provider you added for single sign-on goes with it, unless your agency's site took it on meanwhile; one the site
also signs your people in with keeps that.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 204 | Done | none |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The state of your people or identity providers refuses it (`not_yourself`, `group_exists`, `too_many_groups`, `last_group`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_busy`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /admin/sign-in/providers/{id}/sso/check

Check single sign-on's client again

Asks the provider's token endpoint about the client and keeps what it found in `works` and `check_words`,
leaving single sign-on on or off as it was. A provider with no client yet is a request to fix.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The identity provider | [AdminProvider](#adminprovider) |
| 400 | A request to fix (`invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`) | [Problem](#problem) as `application/problem+json` |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The state of your people or identity providers refuses it (`not_yourself`, `group_exists`, `too_many_groups`, `last_group`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_busy`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### POST /admin/sign-in/providers/{id}/sso/test

Test single sign-on

A test of the provider's single sign-on, on or off, while your chat app is open or closed: its ID, and the link
that starts it, to open in a window. The person signs in at the provider; nothing is made or changed. A provider
whose client isn't set up, or that lacks what the flow uses, is `sso_not_working`.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 201 | The test, begun by this call | [AdminSSOTestStarted](#adminssoteststarted) |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 409 | The state of your people or identity providers refuses it (`not_yourself`, `group_exists`, `too_many_groups`, `last_group`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_busy`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /admin/sign-in/providers/{id}/sso/tests/{test}

A single sign-on test

Waiting until the person has signed in at the provider, then what it read of them and what would happen: `sign_in`
their account, `link` the account with their email, `make` one, or `refuse` with the reason. Kept fifteen
minutes; another provider's, or one lapsed, is `sso_test_not_found`.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `test` | path | string | yes |  |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The test | [AdminSSOTest](#adminssotest) |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 404 | Nothing of yours there (`not_found`, `agent_not_found`, `embed_off`, `person_not_found`, `conversation_not_found`, `run_not_found`, `file_not_found`, `preview_unavailable`, `home_not_found`, `process_not_found`, `pin_not_found`, `invitation_not_found`, `group_not_found`, `issuer_not_found`, `sso_test_not_found`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /admin/usage

The chat app's last 30 days

Its active people, conversations and turns, by day and by its busiest agents; never what anything cost.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | The chat app's last 30 days | [AdminUsage](#adminusage) |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

### GET /admin/activity

What changed about people, groups and sign-in

Newest first, whoever made the change: an admin by their account, your agency's team as the setup team.
Nothing about agents or keys.

Authentication: `Authorization: Bearer <token>` — A person's sign-in to your chat app, on its own address; the admin area takes an admin's..

Parameters:

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `page` | query | integer | no | The page, from 1; at least 1 |
| `page_size` | query | integer | no | How many a page holds, 20 unless asked, 100 at most; 1 to 100 |

Answers:

| Status | Means | Body |
| --- | --- | --- |
| 200 | A page of what changed | object |
| 401 | A missing, revoked or wrong key (`api_key_invalid`), or an embed session that isn't good (`session_invalid`) or has ended (`session_expired`); header `WWW-Authenticate`: `Bearer`, with `error="invalid_token"` when a bearer token was sent and refused | [Problem](#problem) as `application/problem+json` |
| 403 | Not the chat app's admin (`admin_only`), an admin who must set up two-step first (`two_step_required`), or a change whose sign-in is over an hour old (`recent_sign_in_required`) | [Problem](#problem) as `application/problem+json` |
| 500 | Our fault (`internal_error`); send it again, with its Idempotency-Key where it takes one | [Problem](#problem) as `application/problem+json` |

## Webhooks

Your servers hear of people's conversations as they change, without holding a stream open. An
owner or a manager of your team sets up an endpoint in the console, its URL and the events it
takes, and finds its secret there. Each event is a `POST` of JSON to the endpoint, as Standard
Webhooks 1.0 sends it, saying what happened and to whom by the API's IDs and yours for the
person; read the rest through the API with your key.

**Answering**: answer any `2xx` within 15 seconds, then do the work. A redirect, any other
status or no answer in time fails the attempt, and the event is sent again no sooner than 5
seconds, 5 minutes, 30 minutes, 2, 5, 10, 14, 20 and 24 hours after the attempt before: ten
attempts over about three days. After a `429` or a `503`, it's sent again no sooner than
`Retry-After` says, up to a day. `410 Gone` turns the endpoint off at once, and so does failing
every attempt for three days; your team's owners and managers are told by email. An endpoint
turned on again takes the events that come next; what failed goes again only when it's resent
from the console.

**At least once, in no set order**: an event can come twice, and after one that happened later.
`webhook-id` is the same on every attempt at an event: take each once, and read what's current
through the API.

**Verifying**: check that each event came from us before you act on it, with one of Standard
Webhooks' libraries (standardwebhooks.com) given your endpoint's secret, or as they do:

1. Keep the body's bytes exactly as they came, before any JSON parsing, and read
   `webhook-id`, `webhook-timestamp` and `webhook-signature`.
2. Refuse a `webhook-timestamp` more than five minutes from your clock's.
3. Decode what follows `whsec_` in your secret from base64: that's the key.
4. Compute the HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{body}` under the key, and
   encode it as base64.
5. Take the event when one of the entries in `webhook-signature`, separated by spaces, is
   `v1,` and yours, compared in constant time. For a day after the secret is rotated, each
   event is signed under both secrets, so the one replaced still verifies while you move to
   the new one.

### turn.created

A turn began

A person's turn exists: for their message, at once or after it waited for the turn before it,
for a retry, or for a task's or a background job's result the agent answers on its own. Read
it with `GET /turns/{id}`, and follow it with `GET /conversations/{conversation_id}/stream`.

Sent as `POST` to your endpoint.

Headers:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `webhook-id` | string | yes | The event's ID, the same on every attempt and at every endpoint; take each event once; matching `^evt_[0-9a-f]{24}$` |
| `webhook-timestamp` | integer (int64) | yes | When this attempt was sent, in Unix seconds |
| `webhook-signature` | string | yes | `v1,` and the base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{body}` under your endpoint's secret; for a day after the secret is rotated, one under each, separated by a space |

Body (required): [TurnCreatedEvent](#turncreatedevent)

What to answer:

| Status | Means | Body |
| --- | --- | --- |
| 2XX | Taken; answer within 15 seconds, before the work it starts | none |
| 410 | The endpoint is gone; it's turned off at once and sent nothing more | none |
| default | Any other answer, or none within 15 seconds; the event is sent again later | none |

### turn.ended

A turn ended

A person's turn ended, whatever became of it. Read its `outcome` with `GET /turns/{id}`, and
what the agent said with `GET /conversations/{conversation_id}/messages`; a `quiet` turn said nothing new.

Sent as `POST` to your endpoint.

Headers:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `webhook-id` | string | yes | The event's ID, the same on every attempt and at every endpoint; take each event once; matching `^evt_[0-9a-f]{24}$` |
| `webhook-timestamp` | integer (int64) | yes | When this attempt was sent, in Unix seconds |
| `webhook-signature` | string | yes | `v1,` and the base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{body}` under your endpoint's secret; for a day after the secret is rotated, one under each, separated by a space |

Body (required): [TurnEndedEvent](#turnendedevent)

What to answer:

| Status | Means | Body |
| --- | --- | --- |
| 2XX | Taken; answer within 15 seconds, before the work it starts | none |
| 410 | The endpoint is gone; it's turned off at once and sent nothing more | none |
| default | Any other answer, or none within 15 seconds; the event is sent again later | none |

### conversation.waiting

A conversation waits for its person

The agent waits on the person: to confirm what it would do, fill in a form, open a page,
connect an account, or answer a task's question. Read what it waits for in the conversation's
`interrupts` with `GET /conversations/{id}`, and answer with
`POST /conversations/{id}/resume`. A pause the person asks for isn't announced: your app asked
for it.

Sent as `POST` to your endpoint.

Headers:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `webhook-id` | string | yes | The event's ID, the same on every attempt and at every endpoint; take each event once; matching `^evt_[0-9a-f]{24}$` |
| `webhook-timestamp` | integer (int64) | yes | When this attempt was sent, in Unix seconds |
| `webhook-signature` | string | yes | `v1,` and the base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{body}` under your endpoint's secret; for a day after the secret is rotated, one under each, separated by a space |

Body (required): [ConversationWaitingEvent](#conversationwaitingevent)

What to answer:

| Status | Means | Body |
| --- | --- | --- |
| 2XX | Taken; answer within 15 seconds, before the work it starts | none |
| 410 | The endpoint is gone; it's turned off at once and sent nothing more | none |
| default | Any other answer, or none within 15 seconds; the event is sent again later | none |

### webhook.test

A test

Sent from the console to see how the endpoint answers; `data.id` is the endpoint's. Answer it as
any event. A test changes nothing: it's sent whether the endpoint is on or off, and its `410`
doesn't turn it off.

Sent as `POST` to your endpoint.

Headers:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `webhook-id` | string | yes | The event's ID, the same on every attempt and at every endpoint; take each event once; matching `^evt_[0-9a-f]{24}$` |
| `webhook-timestamp` | integer (int64) | yes | When this attempt was sent, in Unix seconds |
| `webhook-signature` | string | yes | `v1,` and the base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{body}` under your endpoint's secret; for a day after the secret is rotated, one under each, separated by a space |

Body (required): [WebhookTestEvent](#webhooktestevent)

What to answer:

| Status | Means | Body |
| --- | --- | --- |
| 2XX | Taken; answer within 15 seconds, before the work it starts | none |
| 410 | The endpoint is gone; it's turned off at once and sent nothing more | none |
| default | Any other answer, or none within 15 seconds; the event is sent again later | none |

## Schemas

### AdminGroupRef

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `name` | string | yes |  |

### AdminPerson

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `email` | string | yes |  |
| `first_name` | string | yes |  |
| `last_name` | string | yes |  |
| `display_name` | string | yes |  |
| `role` | `admin` or `user` | yes |  |
| `groups` | array of [AdminGroupRef](#admingroupref) | yes | The groups they're in, by name |
| `status` | `active` or `suspended` | yes |  |
| `created_at` | integer (int64) | yes |  |
| `last_login_at` | integer (int64) | yes |  |
| `last_active_at` | integer (int64) | yes | When they last used the chat app; 0 for never |

### AdminPersonDetail

Type: all of [AdminPerson](#adminperson) and object.

### AdminPersonPatch

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `role` | `admin` or `user` | no |  |
| `groups` | array of string | no | The groups' IDs, the whole list |

### AdminInvitation

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `email` | string | yes |  |
| `role` | `admin` or `user` | yes |  |
| `groups` | array of [AdminGroupRef](#admingroupref) | yes | The groups the account joins, by name |
| `inviter_name` | string | yes |  |
| `created_at` | integer (int64) | yes |  |
| `expires_at` | integer (int64) | yes |  |
| `last_sent_at` | integer (int64) | yes |  |
| `expired` | boolean | yes | Past its 14 days; it admits no one until it's resent |

### AdminInviteRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `emails` | array of string | yes | at most 100 items |
| `role` | `admin` or `user` | yes |  |
| `groups` | array of string | no | The IDs of the groups each account joins |

### AdminInvited

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `invited` | array of [AdminInvitation](#admininvitation) | yes |  |
| `skipped` | array of objects | yes |  |
| `skipped[].email` | string | yes |  |
| `skipped[].reason` | `invalid`, `has_account`, `invited`, `rate_limited` or `too_many_pending` | yes |  |

### AdminGroup

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `name` | string | yes |  |
| `description` | string | yes |  |
| `members` | integer | yes | How many of your people are in it |
| `created_at` | integer (int64) | yes |  |
| `updated_at` | integer (int64) | yes |  |

### AdminGroupRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | no | at most 60 characters |
| `description` | string | no | at most 280 characters |

### AdminGroupDeleted

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `deleted` | `true` | yes |  |
| `agents_off` | array of [AdminGroupRef](#admingroupref) | yes | The agents it alone narrowed, which left the chat app |

### AdminGroupAgent

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `name` | string | yes |  |
| `sees` | boolean | yes | Narrowed to this group |
| `everyone` | boolean | yes | Every account sees it |

### AdminGroupAgentsRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agents` | array of string | yes | The agents' IDs, the whole list |

### AdminSignInRules

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `join` | `invited`, `domains` or `anyone` | yes |  |
| `domains` | array of string | yes |  |
| `methods` | object | yes |  |
| `methods.code` | boolean | yes |  |
| `methods.password` | boolean | yes |  |
| `methods.passkey` | boolean | yes |  |
| `two_step` | `off`, `admins` or `everyone` | yes |  |
| `updated_at` | integer (int64) | yes |  |

### AdminSignInPatch

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `join` | `invited`, `domains` or `anyone` | no |  |
| `domains` | array of string | no |  |
| `methods` | object | no |  |
| `methods.code` | boolean | no |  |
| `methods.password` | boolean | no |  |
| `methods.passkey` | boolean | no |  |
| `two_step` | `off`, `admins` or `everyone` | no |  |

### AdminProvider

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `issuer` | string | yes | The issuer, as its discovery document names it |
| `provider` | object | yes | The identity provider its address is known as, `oidc` for any other |
| `provider.id` | string | yes |  |
| `provider.name` | string | yes |  |
| `sso_ready` | boolean | yes | Its discovery document offers what single sign-on uses: an authorization endpoint, a token endpoint, and openid where it lists scopes |
| `sso_lacks` | `unread`, `authorization_endpoint`, `token_endpoint` or `openid` | no | What it lacks when it isn't ready; `unread` until its document is read |
| `sso` | one of [AdminSSO](#adminsso) or any or null | yes | Its single sign-on; none until it's set up |
| `sso_redirect_uris` | array of string | yes | Where the chat app takes single sign-on's answers, each to add at the provider as a redirect URI |
| `sso_scopes` | array of string | yes | What single sign-on asks the provider, `openid email profile` and the groups claim's scope where the provider lists it |
| `claims_supported` | array of string | no | The claims its document says its tokens may carry, for choosing the groups claim |
| `endpoints` | object | no | Where it signs people in, read from its discovery document or typed in |
| `endpoints.authorization_endpoint` | string | yes |  |
| `endpoints.token_endpoint` | string | yes |  |
| `endpoints.userinfo_endpoint` | string | yes |  |
| `endpoints_manual` | boolean | no | Its endpoints were typed in rather than read from a discovery document |

### AdminSSO

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `on` | boolean | yes | Your people sign in with it; on only once its client works |
| `client_id` | string | yes |  |
| `has_secret` | boolean | yes | A secret is kept; it's never answered |
| `domains` | array of string | yes | The email domains whose people it signs in |
| `required` | boolean | yes | Its domains' people sign in with it alone |
| `make_accounts` | boolean | yes | A person at its domains gets an account on their first sign-in |
| `groups_claim` | string | yes | The claim its ID tokens list a person's groups in; empty for none |
| `group_map` | array of [AdminSSOGroup](#adminssogroup) | yes |  |
| `checked_at` | integer (int64) | yes | When its client was last checked; 0 never |
| `works` | boolean | yes | Its token endpoint accepted the client when last checked |
| `check_words` | string | yes | What the last check found, in words |
| `check_result` | ``, `accepted`, `refused`, `unreached`, `answered`, `unread`, `authorization_endpoint`, `token_endpoint` or `openid` | yes | What the last check found, as a code to say in your own words: the token endpoint accepted the client, refused it, couldn't be reached or answered otherwise (`check_answer`), or the provider lacks what single sign-on needs. Empty before a check. |
| `check_answer` | string | no | What the token endpoint answered when the result is `answered`, its status and any error code, such as `500 server_error` |

### AdminSSOGroup

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `value` | string | yes | A value of its groups claim; at most 200 characters |
| `group_id` | string | yes | The group it puts a person in |

### AdminSSORequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `on` | boolean | no |  |
| `client_id` | string | no | at most 255 characters |
| `secret` | string | no | at most 1024 characters; write-only |
| `domains` | array of string | no | Each typed with its @ or in its own script if you like; kept as DNS names it; at most 20 items |
| `required` | boolean | no |  |
| `make_accounts` | boolean | no |  |
| `groups_claim` | string | no | at most 100 characters |
| `group_map` | array of [AdminSSOGroup](#adminssogroup) | no | A value may put people in several groups, each pair counted once; a map needs `groups_claim`; at most 50 items |

### AdminSSOTestStarted

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `url` | string (uri) | yes | Where the test starts, on your chat app's address |

### AdminSSOTest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `state` | `waiting` or `done` | yes |  |
| `would` | `sign_in`, `link`, `make` or `refuse` | no |  |
| `reason` | string | no | Why it would refuse, a code your chat app's sign-in page says in words |
| `read` | object | no |  |
| `read.subject` | string | yes | The provider's ID for the person |
| `read.email` | string | yes |  |
| `read.email_verified` | boolean | yes | The provider vouches for the email |
| `read.name` | string | yes |  |
| `read.groups` | array of string | yes |  |
| `read.userinfo` | `read` or `unusable` | no | What came of asking the provider's UserInfo endpoint for what the ID token lacked; absent when it wasn't asked |

### AdminProviderRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `issuer` | string | yes | Its domain, its address or its discovery document's address |
| `client_id` | string | no | An add only, with `secret`. Single sign-on's OAuth client at the provider, kept with it in this one request; at most 255 characters |
| `secret` | string | no | An add only, with `client_id`. The OAuth client's secret, never answered; at most 1024 characters; write-only |
| `manual` | object | no | Endpoints typed in for an OpenID Connect provider that publishes no discovery document, by the document's member names: read instead of a discovery document, the issuer kept exactly as given (its ID tokens' `iss`), the keys read from `jwks_uri` at once and on every read again. `jwks_uri` is required; single sign-on also needs `authorization_endpoint` and `token_endpoint`. Each is an http or https address with no user name, password or fragment; it may carry a query (RFC 6749 §3.1), which the flow keeps. |
| `manual.authorization_endpoint` | string | no | at most 2048 characters |
| `manual.token_endpoint` | string | no | at most 2048 characters |
| `manual.userinfo_endpoint` | string | no | at most 2048 characters |
| `manual.jwks_uri` | string | yes | at most 2048 characters |

### AdminProviderRead

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `issuer` | string | yes | Its issuer, as its document names it |
| `provider` | object | yes | The identity provider its address is known as, `oidc` for any other |
| `provider.id` | string | yes |  |
| `provider.name` | string | yes |  |
| `sso_ready` | boolean | yes | Single sign-on can work through it |
| `sso_lacks` | string | no | What it lacks for single sign-on, when it isn't ready |
| `sso_redirect_uris` | array of string | yes | Where the chat app takes single sign-on's answers, each to add at the provider as a redirect URI |
| `sso_scopes` | array of string | yes | What single sign-on asks the provider |
| `claims_supported` | array of string | yes | The claims its document says its tokens may carry |

### AdminSSOSetup

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `sso_redirect_uris` | array of string | yes | Where the chat app takes single sign-on's answers, each to add at the provider as a redirect URI |
| `sso_scopes` | array of string | yes | What single sign-on asks the provider |

### AdminUsage

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `from` | integer (int64) | yes |  |
| `to` | integer (int64) | yes |  |
| `people` | integer | yes |  |
| `conversations` | integer | yes |  |
| `turns` | integer | yes |  |
| `days` | array of objects | yes |  |
| `days[].day` | string | yes | A UTC day, such as 2026-11-01 |
| `days[].people` | integer | yes |  |
| `days[].conversations` | integer | yes |  |
| `days[].turns` | integer | yes |  |
| `agents` | array of objects | yes | The busiest agents, the most turns first; a deleted agent's name is empty |
| `agents[].id` | string | yes |  |
| `agents[].name` | string | yes |  |
| `agents[].turns` | integer | yes |  |
| `agents[].conversations` | integer | yes |  |

### AdminActivity

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `action` | string | yes | What changed, such as `person.role_changed`, `group.created` or `sign_in.changed` |
| `actor` | object | yes |  |
| `actor.kind` | `account`, `setup_team`, `provider` or `other` | yes | An admin's account, your agency's team, your identity provider setting a person's groups as they signed in, or another, such as your app |
| `actor.id` | string | no | An admin's account's ID |
| `actor.name` | string | yes | Their name when they acted |
| `target_label` | string | no | Who or what it changed, as it was named then |
| `meta` | object of string | yes |  |
| `created_at` | integer (int64) | yes |  |

### ID

Type: string; matching `^[0-9a-f]{24}$`.

### StreamCursor

An event's `id` as the stream sent it: a commit's number, or after a run's end the newest
commit and that run's `runId`.

Type: string; matching `^(0|[1-9][0-9]*)(:[0-9a-f]{24}(\.([2-9]|[1-9][0-9]+))?)?$`; for example `12`.

### IdempotencyKey

A Structured Fields string holding 1 to 100 visible ASCII characters, or those characters bare

Type: string; at least 1 character; for example `"8e03978e-40d5-43e8-bc93-6894a57f9324"`.

### Person

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `user` or `visitor` | yes |  |
| `id` | string | yes | Your ID for them |
| `name` | string | yes |  |
| `email` | string | yes |  |
| `language` | string | yes | A BCP 47 tag, such as de or pt-BR |
| `time_zone` | string | yes | An IANA zone, such as Europe/Berlin |
| `created_at` | integer (int64) | yes |  |
| `last_seen_at` | integer (int64) | yes | When a call last named them, to the minute |

### PersonPut

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string or null | no | at most 120 characters |
| `email` | string (email) or null | no |  |
| `language` | string or null | no |  |
| `time_zone` | string or null | no |  |

### MePatch

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `time_zone` | string | no | An IANA zone, such as Europe/Berlin; `""` clears it |

### About

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `on` | boolean | yes | Whether agents use it |
| `call` | string | yes | What agents should call them; at most 60 characters |
| `about` | string | yes | About them; at most 1500 characters |
| `answers` | string | yes | How agents should answer them; at most 1500 characters |
| `updated_at` | integer (int64) | yes | When they last wrote it, in Unix milliseconds; 0 until then |

### AboutPut

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `on` | boolean | no | default `true` |
| `call` | string | no | at most 60 characters |
| `about` | string | no | at most 1500 characters |
| `answers` | string | no | at most 1500 characters |

### ChatAppPreviewRequest

A preview code from the console's Deliver → Chat app, as its link carries it.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | yes | The `preview` parameter of the link the console opened. |

### EmbedSessionRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agent` | [ID](#id) | yes |  |
| `form` | [EmbedForm](#embedform) | yes |  |
| `user_token` | string | no | A token from your identity provider or signing key for someone signed in, as the console's Access → Single sign-on page sets it up |
| `details` | object | no | What the page says of a visitor, each kept as the page's words; one that isn't valid is left out, and with a user token all are |
| `details.name` | string | no |  |
| `details.email` | string | no |  |
| `details.language` | string | no | A BCP 47 tag, such as de or pt-BR |
| `details.time_zone` | string | no | An IANA zone, such as Europe/Berlin |

### BoundConnectRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `item` | [ID](#id) | no | The `chat:connect` interrupt's `id`; left out for a connect from the person's menu |
| `agent` | [ID](#id) | no | For a connect from the menu, the agent the chat shows |
| `connector` | [ID](#id) | no | For a connect from the menu, one of the connectors `GET /me/connectors` lists |
| `binding_hash` | string | yes | The SHA-256 of the binding's text, base64url without padding; the binding itself never leaves the chat's window but to the start page; 43 characters; matching `^[A-Za-z0-9_-]{43}$` |
| `lang` | string | no | The chat's language, `en-US` or `zh-CN`, which the window's pages and a connect's refusal (`cant_connect`, `service_unavailable`) speak: any Chinese tag is `zh-CN`, and any other English; for example `zh-CN` |

### Connectable

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `connector_id` | [ID](#id) | yes |  |
| `connector` | string | yes | The connector's name |
| `state` | `connected` or `reconnect` | no | How the person's account stands; left out when they haven't connected one |

### ConnectLinkRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agent` | [ID](#id) | yes | The agent the person connects at |

### ConnectLink

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string (uri) | yes | The link to open for the person, once |
| `expires_at` | integer (int64) | yes | When it closes, Unix milliseconds |

### ConnectableList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [Connectable](#connectable) | yes |  |

### BoundConnect

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string (uri) | yes | The start page, where the chat opens its window, once, within 10 minutes |

### ConnectFinishRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | yes | The provider's answer's `code` |
| `state` | string | yes | The provider's answer's `state` |
| `iss` | string | no | The provider's answer's `iss`, when it sent one |
| `binding` | string | no | The binding the window kept, which its page or its chat gave it |

### ConnectFinished

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `connector` | string | yes | The connector whose account connected |

### EmbedForm

The form the embed shows in

One of `bubble`, `inline` or `page`.

### EmbedSession

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `session` | string | yes | The session, `es_…`, sent as `Authorization: Bearer es_…`; answered here alone |
| `expires_at` | integer (int64) | yes | When it ends; a visitor's moves on as it's used |
| `person` | [SessionPerson](#sessionperson) | yes |  |

### SessionPerson

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `user` or `visitor` | yes |  |
| `id` | string | yes | Your ID for a user; for a visitor, the embed's own, `v_…` |
| `name` | string | yes |  |

### Me

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `user` or `visitor` | yes |  |
| `id` | string | yes | Your ID for a user; for a visitor, the embed's own, `v_…` |
| `name` | string | yes |  |
| `language` | string | yes | A BCP 47 tag, such as de or pt-BR |
| `time_zone` | string | yes | An IANA zone, such as Europe/Berlin |
| `told_by` | `page` | no | `page` when a page's details told them who they are |
| `role` | `admin` or `user` | no | A chat app account's role; an admin sees the admin area. A visitor, a preview and a person your app names have none. |
| `pins` | array of [Pin](#pin) | yes | What a signed-in user pinned, newest first; a visitor's are none; at most 50 items |
| `photo` | boolean | yes | Whether a signed-in user gave a photo, read at `/me/photo`; a visitor's is false |

### SearchHit

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `conversation` | object | yes |  |
| `conversation.id` | [ID](#id) | yes |  |
| `conversation.title` | string | yes |  |
| `conversation.agent_id` | [ID](#id) | yes |  |
| `conversation.channel` | [EventChannel](#eventchannel) | yes |  |
| `conversation.last_message_at` | integer (int64) | yes |  |
| `snippet` | object | yes |  |
| `snippet.text` | string | yes | What was said around the words, cropped with `…`; its start when only the title matched |
| `snippet.marks` | array of array of integer | yes | Each match's range in `text`, in characters, start inclusive and end exclusive |

### SearchHitList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [SearchHit](#searchhit) | yes | at most 50 items |

### Pin

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `agent` or `conversation` | yes |  |
| `id` | string | yes |  |
| `at` | integer (int64) | yes | When they pinned it, in Unix milliseconds |

### ConversationStart

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `form` | [EmbedForm](#embedform) | no | With an embed session, the form the conversation is shown in, the session's when left out; unused with an API key |

### Agent

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | [ID](#id) | yes |  |
| `name` | string | yes |  |
| `title` | string | yes | One line people read beside the name, such as Client onboarding; empty when it has none; at most 40 characters |
| `description` | string | yes |  |
| `avatar_url` | string | yes |  |
| `starter_prompts` | array of string | yes |  |
| `access` | `signed_in` or `anyone` | yes | `signed_in` refuses visitors; `anyone` admits them |
| `memory` | boolean | yes | Whether it remembers the signed-in people it talks to, each person's own memory, which they see and change |
| `view` | `answers`, `progress`, `thinking` or `everything` | yes | What people see of its work through the way this call came, `answers` (its answers alone), `progress` (its steps and plan too), `thinking` (the headings of its thoughts too) or `everything` (each call too); `view=` on a stream, history or run asks for less |
| `usable` | boolean | no | Whether the person the call names may use it; absent when it names no one |
| `default` | boolean | no | On a chat app's address, true for the agent its new chats start with; absent on every other agent |
| `abilities` | object | yes | What it can do, for the person to read |
| `abilities.web` | boolean | yes | It searches the web and reads its pages |
| `abilities.computer` | boolean | yes | It has a computer of its own, where it makes files and runs code; every agent reads the files people attach |
| `abilities.memory` | boolean | yes | It remembers the signed-in people it talks to |
| `abilities.interactive` | boolean | yes | It can show choices, cards with buttons or a small form beside its reply, for the person to pick from or act on, where the person's app can draw one |
| `abilities.connectors` | array of objects | yes | The tools it uses, by name |
| `abilities.connectors[].name` | string | yes |  |

### WaitingMessage

A message of the person's that the conversation hasn't taken yet

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `client_message_id` | string | yes | Its ID, the one the message was sent with |
| `text` | string | yes |  |
| `mode` | `steer` or `queue` | yes | `steer` while it waits to steer the turn under way, read at its next step; `queue` while it waits for the turn after |
| `held` | boolean | no | Held by a stop, it starts only when sent |
| `files` | array of [ID](#id) | no | The conversation's files it carries, by their IDs |
| `at` | integer (int64) | yes |  |

### Conversation

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | [ID](#id) | yes |  |
| `agent_id` | [ID](#id) | yes |  |
| `title` | string | yes | Empty until the agent names it after its first turn, or the person renames it |
| `channel` | [EventChannel](#eventchannel) | yes |  |
| `created_at` | integer (int64) | yes |  |
| `last_message_at` | integer (int64) | yes |  |
| `turns` | integer | yes | How many turns it has taken |
| `state` | `idle`, `working` or `waiting` | yes | `working` while a turn is under way, `waiting` while the agent waits on the person, else `idle` |
| `waiting` | array of [WaitingMessage](#waitingmessage) | no | The person's messages still waiting, oldest first, on a conversation read alone or after a change to it; absent from lists. |
| `interrupts` | array of [Interrupt](#interrupt) | no | What its turn and its tasks still running wait on the person for, on a conversation read alone or after a resume, a pause or a continue; absent from lists, where `state` says `waiting` for a turn's. |
| `memory_asks` | array of [MemoryAsk](#memoryask) | no | The changes to memory waiting for the person's word, oldest first, on a conversation read alone; absent from lists. Answer each with `POST /conversations/{id}/memory-asks/{ask}`. |

### MemoryAgent

What one agent keeps of a person

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agent_id` | [ID](#id) | yes |  |
| `agent_name` | string or null | yes | The agent's name; null once it's deleted, when what it kept goes within a day |
| `remembers` | boolean | yes | Whether the agent remembers people now; when its team turned memory off, what it kept stays to delete |
| `off` | boolean | yes | The person turned the agent's memory of them off |
| `memories` | integer | yes | How many memories it keeps of them |
| `asks` | integer | yes | How many of its changes to memory wait for their word |

### MemoryAgentList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [MemoryAgent](#memoryagent) | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string or null | yes |  |

### Memory

One thing an agent remembers of a person, in its words

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | [ID](#id) | yes |  |
| `agent_id` | [ID](#id) | yes |  |
| `text` | string | yes | Its words, its first line saying what it's about; at most 2000 characters |
| `created_at` | integer (int64) | yes |  |
| `updated_at` | integer (int64) | yes |  |

### MemoryList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [Memory](#memory-1) | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string or null | yes |  |

### MemoryAsk

A change to memory waiting for the person's word, or answered

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | [ID](#id) | yes |  |
| `change` | `save`, `update`, `rename`, `forget` or `forget_all` | yes | Remember something new, change a memory, rename one, forget one, or forget everything |
| `words` | string | yes | The words to save, or the memory's words as they stand for a rename or a forget; empty for forget_all |
| `new_name` | string | no | A rename's new name |
| `why` | `tool`, `web`, `command`, `file`, `page`, `earlier` or `conversation` | yes | What the conversation read from outside it, which makes changes wait for the person: a tool's result, the web, a command's output, a file, the page, a conversation from before memory counted it, or an earlier conversation of theirs with the agent |
| `state` | `waiting`, `saved` or `declined` | yes |  |
| `created_at` | integer (int64) | yes |  |
| `answered_at` | integer (int64) | no |  |
| `expires_at` | integer (int64) | yes | When it goes, unanswered |

### MemoryAskList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [MemoryAsk](#memoryask) | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string or null | yes |  |

### MemorySwitch

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `off` | boolean | yes |  |

### MemoryAnswer

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `save` | boolean | yes | Save makes the change; false drops it |

### RunAgentInput

AG-UI 1.0's run request; what else it carries is taken and left

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `threadId` | string | yes | The conversation, by its ID or a thread ID of your own; 1 to 100 characters; matching `^[!-~]+$` |
| `runId` | string | yes | This run's own ID, and its key; 1 to 100 characters; matching `^[!-~]+$` |
| `messages` | array of objects | yes | The conversation as the client holds it; the person's new message last |
| `messages[].id` | string | yes | at most 100 characters |
| `messages[].role` | string | yes |  |
| `messages[].content` | any | no | The words, or parts of type `text` |
| `forwardedProps` | object or null | no | What the client forwards; the run reads these members, and takes and leaves the rest |
| `forwardedProps.a2uiClientCapabilities` | [A2UIClientCapabilities](#a2uiclientcapabilities) | no |  |
| `forwardedProps.a2uiAction` | [A2UIAction](#a2uiaction) | no |  |
| `forwardedProps.userAction` | [A2UIAction](#a2uiaction) | no |  |
| `forwardedProps.app` | [AppMark](#appmark) | no |  |
| `forwardedProps.__proxiedMCPRequest` | [AppRequest](#apprequest) | no |  |
| `resume` | array of objects | no | Answers to what the turn, or an app's call, waits on |
| `resume[].interruptId` | string | yes |  |
| `resume[].status` | `resolved` or `cancelled` | yes |  |
| `resume[].payload` | any | no | For `resolved`, the answer its interrupt's `responseSchema` describes |

### AppMark

The app in the person's chat that sent the message for them

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `activity` | string | yes | Its `mcp-apps` activity's ID, `app-` and 24 hexadecimal digits |

### AppRequest

What a connector's app asks its host for its server, as CopilotKit's renderer forwards it

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `serverId` | string | no | The activity's `serverId`; this or `serverHash` names the connector |
| `serverHash` | string | no | The activity's `serverHash` |
| `method` | `tools/call`, `resources/read`, `notifications/message` or `ping` | yes |  |
| `params` | any | no | MCP's params: `{uri}` for a read, `{name, arguments}` for a call, the log line for a message |
| `activity` | string | no | The activity a call belongs to; the newest of its connector when absent |

### AppContextRequest

What an app tells the model it shows (MCP Apps' `ui/update-model-context`); neither member clears it

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `content` | array of objects | no | MCP's content blocks, of type `text` alone |
| `content[].type` | `text` | yes |  |
| `content[].text` | string | yes |  |
| `structuredContent` | object | no | What it shows as data, read as JSON after the text |

### ResumeRequest

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `resume` | array of objects | yes | at least 1 item |
| `resume[].interruptId` | string | yes | The interrupt's `id` |
| `resume[].status` | `resolved` or `cancelled` | yes |  |
| `resume[].payload` | any | no | For `resolved`, the answer its interrupt's `responseSchema` describes |
| `context` | [PageContext](#pagecontext) | no |  |

### Rename

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `title` | string | yes | 1 to 200 characters |

### SendMessage

Some text, files, or both

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | no | at most 32000 characters |
| `files` | array of [ID](#id) | no | The conversation's files the person attached, by their IDs, in the order they go, read or still being read; each goes with one message |
| `mode` | `auto`, `queue` or `interrupt` | no | default `auto` |
| `client_message_id` | string | no | Your ID for the message, which the conversation shows it by; the Idempotency-Key when left out; at most 100 characters |
| `context` | [PageContext](#pagecontext) | no |  |
| `a2uiClientCapabilities` | [A2UIClientCapabilities](#a2uiclientcapabilities) | no |  |
| `a2uiAction` | [A2UIAction](#a2uiaction) | no |  |
| `app` | [AppMark](#appmark) | no |  |

### A2UIClientCapabilities

What the person's app draws, as A2UI's renderer says it: its catalogs by version, 2 KB at most. An app that
lists A2UI 1.0's basic catalog, `https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json`, under `1.0`
draws the small forms and choices an agent with interactive answers may show; one that lists another catalog or
version, or none, doesn't. Sent, it stays the conversation's until a message says otherwise; leaving it out, or
`null`, leaves it as it was. A conversation whose app never said draws nothing. Another shape is
`invalid_request`.

Type: object of object or null; for example `{"1.0":{"supportedCatalogIds":["https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json"]}}`.

### A2UIAction

A button the person pressed in a surface the agent showed, as A2UI's renderer sends it. The message's words are
its `text`, or when it has none the button's `userMessage`: a message from a button always has words
(`invalid_action` without). The agent reads the button and its `context` beside the words, as data from the
person's app and never as instructions; the person sees their words, and their message names the surface and the
button's name (`metadata.chat.action`). A surface the conversation never showed, or closed since, is
`invalid_action`, as are a `sourceComponentId` that isn't one of its Buttons, a `name` other than the event
that Button sends, and a member of another shape; a `context` past 8 KB as sent, or past 16 KB as the agent
reads it with its angle brackets escaped, is `context_too_large`.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | The button's event name, as the agent wrote it; 1 to 128 characters |
| `surfaceId` | string | yes | The surface it was pressed in, one the conversation holds open; 1 to 128 characters |
| `sourceComponentId` | string | yes | The component pressed; 1 to 128 characters |
| `context` | object or null | no | What the button sends with it, as the surface resolved it: 8 KB at most as sent, and 16 KB at most as the agent reads it, its angle brackets escaped. Kept compacted and otherwise as sent, duplicate keys and all. |
| `userMessage` | string or null | no | The words the person said by pressing it, held to a message's rules; null, or blank, is none; at most 32000 characters |
| `timestamp` | any | no | When it was pressed, as the renderer says; the message's time is the server's |

### PageContext

What the page says the person is looking at, for the agent to read as the page's words: a JSON object of
8 KB at most, as sent and as kept with its angle brackets escaped, its members strings, numbers, booleans or
objects of them, two levels at most, a null member left out. Sent through an embed session, the agent weighs
it as no surer than what the person types, since it comes from their browser. Sent, it stays the conversation's page until another replaces it; `null` clears it, and leaving it
out leaves it as it was. The agent resolves "this order" from it and confirms before acting on it; the person
never sees it.

Type: object of any of string, number or boolean or null or object of string, number or boolean or null or null; for example `{"order":"SO-1042","page":"Orders","status":"awaiting payment"}`.

### MessageResult

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | `started`, `steering` or `queued` | yes | `started` a turn; `steering` the turn under way, which reads it next; `queued` for the turn after |
| `run_id` | [RunID](#runid) | no |  |

### RunID

The turn the message is in, once there is one; a queued message has none until its turn starts

Type: string; matching `^[0-9a-f]{24}$`.

### StoppedTurn

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `run_id` | string | yes | The turn the stop ended; matching `^[0-9a-f]{24}$` |

### AgentList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [Agent](#agent) | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string or null | yes | The cursor for the next slice; null on the last |

### ConversationList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [Conversation](#conversation) | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string or null | yes | The cursor for the next slice; null on the last |

### DownloadLink

A link a browser saves one file from by itself, with no credential, until it expires

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string (uri-reference) | yes | The link, `GET /downloads/{tenant}/{secret}`: the API's address, or a path on your chat app's own |
| `expires_at` | integer (int64) | yes | When it stops opening, in Unix milliseconds; a download it started goes on |

### File

A file of a conversation, the person's or the agent's

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | [ID](#id) | yes |  |
| `name` | string | yes | Its name, which holds the folders the agent put it in, such as `reports/q3.md`; a file the person attaches is at the top. It downloads under the part after the last `/` |
| `kind` | `picture`, `document`, `text`, `archive`, `recording` or `other` | yes | An archive, a recording or another kind is kept as it is; the agent opens it when it works on it |
| `content_type` | string | yes |  |
| `size` | integer (int64) | yes | Its size in bytes |
| `by` | `person` or `agent` | yes | `person` for a file the person attached, `agent` for one the agent gave them |
| `state` | `reading`, `ready` or `failed` | yes | `reading` while it's read, `ready` once read, or `failed`; a message may carry it in any of them |
| `failure` | string | no | Why it failed, in words to show the person |
| `pages` | integer | no | A document's pages |
| `width` | integer | no | A picture's width, upright |
| `height` | integer | no | A picture's height, upright |
| `sent` | boolean | yes | Whether it went with a message |
| `created_at` | integer (int64) | yes |  |
| `updated_at` | integer (int64) | yes |  |

### FileList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [File](#file) | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string or null | yes | The cursor for the next slice; null on the last |

### KeptFile

A file the agent kept for a user across their conversations

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | [ID](#id) | yes |  |
| `name` | string | yes | Its name, which holds the folders the agent put it in, such as `reports/q3.md`. It downloads under the part after the last `/` |
| `kind` | `picture`, `document`, `text`, `archive`, `recording` or `other` | yes |  |
| `content_type` | string | yes |  |
| `size` | integer (int64) | yes |  |
| `by` | `person` or `agent` | yes | `person` for a file they attached, `agent` for one the agent made or gave: written, saved on its computer, or returned by a connector's tool as a picture, a sound or a file |
| `pages` | integer | no |  |
| `width` | integer | no |  |
| `height` | integer | no |  |
| `created_at` | integer (int64) | yes |  |
| `updated_at` | integer (int64) | yes |  |

### KeptFileList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [KeptFile](#keptfile) | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string or null | yes | The cursor for the next slice; null on the last |

### Home

A user's home in an agent's sandboxes

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agent_id` | [ID](#id) | yes |  |
| `size` | integer (int64) | yes | Its size in bytes when it was last kept |
| `full` | boolean | yes | Its last save found it past its size limit, so nothing new was kept until it's smaller |
| `created_at` | integer (int64) | yes |  |
| `updated_at` | integer (int64) | yes | When it was last kept |

### ConnectionChange

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `asks_first` | boolean | no | Whether its actions that change something ask the person first |
| `always_allowed_remove` | array of string | no | Actions to take back from those it takes without asking, as `always_allowed` words them |

### Connection

An account a user connected for agents' tools to use as them

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `connector_id` | [ID](#id) | yes |  |
| `connector` | string | yes | The connector's name |
| `status` | `connected` or `reconnect` | yes | Whether it works, or needs signing in again (its next call asks with `chat:connect`) |
| `account` | string | no | The account's name, when the provider gave one |
| `connected_at` | integer (int64) | yes |  |
| `used_at` | integer (int64) | no | When a call last went out on it |
| `asks_first` | boolean | yes | Whether its calls that change something ask the person first |
| `always_allowed` | array of string | yes | The actions it takes without asking, in words |
| `renews` | boolean | no | Whether it renews by itself; when false, the person signs in again once its access ends, about an hour at some providers |

### ConnectionList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [Connection](#connection) | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string or null | yes |  |

### HomeList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [Home](#home) | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string or null | yes |  |

### Process

A job the agent left running in the background

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `number` | integer | yes | Its number in the conversation |
| `state` | `running`, `stopping`, `ended`, `stopped` or `failed` | yes | `running`, `stopping` once asked to stop, or once it ended: `ended` by itself, `stopped`, or `failed` |
| `started_at` | integer (int64) | yes |  |
| `ended_at` | integer (int64) | no |  |

### Task

An action the agent started that runs on after its turn, named in words

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | [ID](#id) | yes |  |
| `title` | string | yes | The action and the system it runs on, such as "Make a report on Reports", in the request's language (`Accept-Language`); "A task" when that system is gone, and for every task where the agent shows `answers` to the way you came |
| `status` | `working`, `input_required`, `completed`, `failed`, `cancelled` or `lapsed` | yes | `working`, or `input_required` while it waits on the person; once ended, `completed`, `failed`, `cancelled`, or `lapsed` when it ran past its time or its system lost it |
| `running` | boolean | yes |  |
| `started_at` | integer (int64) | yes |  |
| `ended_at` | integer (int64) | no |  |

### TaskList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [Task](#task) | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string or null | yes |  |

### ProcessList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [Process](#process) | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string or null | yes |  |

### Turn

One turn of the agent's, from the message that started it to its last words

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | [ID](#id) | yes |  |
| `conversation_id` | [ID](#id) | yes |  |
| `state` | `queued`, `working`, `waiting` or `ended` | yes | `queued` behind the turn before, `working`, `waiting` on the person, or `ended` |
| `outcome` | `answered`, `quiet`, `stopped`, `limit`, `failed` or `expired` | no | What became of it, once it ended: `answered`; `quiet`, a background job's end the agent had nothing new to tell of, so it wrote nothing; `stopped` by the person or a new message; `limit`, stopped at one of the agent's limits, its last words saying so; `failed`, to try again; `expired`, a question to the person left unanswered |
| `words` | string | no | The outcome in words to show the person, for every outcome but `answered` and `quiet` |
| `version` | integer | no | The agent's version the turn ran |
| `created_at` | integer (int64) | yes |  |
| `started_at` | integer (int64) | no |  |
| `finished_at` | integer (int64) | no |  |
| `usage` | [TurnUsage](#turnusage) | no |  |

### TurnUsage

What the turn used, for your own billing and monitoring; it comes only with an API key, never to an embed session or the person

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `input_tokens` | integer (int64) | yes |  |
| `cached_tokens` | integer (int64) | yes | The input tokens read from the model's cache |
| `output_tokens` | integer (int64) | yes |  |
| `reasoning_tokens` | integer (int64) | yes |  |
| `cost` | string | yes | The turn's cost as a decimal, in `currency`, such as `"0.001234567"`; for example `0.001234567` |
| `currency` | string | no | An ISO 4217 code, such as `USD` |

### TurnList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [Turn](#turn) | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string or null | yes | The cursor for the next slice; null on the last |

### MessageList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of [Message](#message) | yes |  |
| `has_more` | boolean | yes |  |
| `next_cursor` | string or null | yes | The cursor of the page before; null on the oldest |

### Message

A message of the conversation as AG-UI 1.0 has it: the person's (`user`), the agent's
(`assistant`), or an `activity`: `steps`, what the agent did in one stretch of a turn,
`{state, steps: [{kind, title, group, state, name, connector, tool, ms, headings, call, cut}], messages:
[{id, after}]}`, where a step's `title` is in the request's language and reads its finished
form once the step is done ("Read q3.pdf"), and its `group`, its words while it runs, is the
same for steps a client may show as one line and doesn't change with its state: neither is
an identity; a step that used a connector's tool names both in `connector` and `tool`, for a
client of your own to use (the chat app and the embed draw neither); a step of kind
`thought` is the agent thinking, with how long it
took in `ms` once it's whole and, when its agent shows its thinking, the parts its model
named in `headings`, never its words; and `messages` places each of the stretch's
messages, the person's and the agent's, among its steps, after how many, so a client can
show what the agent said along the way inside its work and split the work where the person
steered it; `plan`, its checklist, `{tasks: [{text, done}]}`; `file`, a file it gave,
`{file_id, name, kind, size}`; or `memory`, a change to what it remembers of the person,
`{change, words, memory_id, ask_id}`: `change` is `save`, `update`, `rename`, `forget` or
`forget_all`, `words` the memory's words after it or, for a forget, before; `memory_id`
the memory it left, to forget with `DELETE /users/{id}/memories/{memory}`; and `ask_id`,
when the change waits for the person's word, the change to answer with
`POST /conversations/{id}/memory-asks/{ask}`; or `a2ui-surface`, a surface the agent shows
the person beside its words, at every level, `{a2ui_operations: [...]}`, A2UI v1.0's
messages over its basic catalog for a client that draws it itself: in a copy, one
`createSurface` holding the surface whole as it stands now. Its `id` is `ui-`, the turn
that first showed it, `-` and the surface's own `surfaceId`: one activity for the surface's
whole life, where that turn put it, however many later turns change it. Draw it there, among
the turn's messages in their order: the agent shows, then writes, so the words that follow a
surface are written as standing under it, and those before it as above. A surface the agent
closed isn't in a copy. A picture or a recording it shows is a file of the conversation,
its address `file:` and the file's ID, read through the conversation's own file routes. Or
`mcp-apps`, an app a connector's tool showed, at every level, its `id` `app-` and 24 hex
digits, `{resourceUri, serverId, serverHash, toolInput, result, frame: {policy, border,
from}}` as the stream's event describes it.

At the level `everything`, the agent's message also lists the calls it made in `toolCalls`,
and each call's result is a `tool` message, `{id, toolCallId, content}`, whose
`metadata.chat` says how the call ended; a step of its `steps` activity names its call in
`call` and, when what the call was sent was cut, its full length in `cut`, whether or not
a result ever comes. A call shows what the person may read of what it was sent and what came
back, each cut at 20,000 characters: never the platform's words to the agent, its
descriptions of its tools or a skill's text, and every internal address in the person's
terms. A call's ID, `call-` and 16 hex digits, and its result's message's, `t-` and 16, are
this stream's own names for them, the same live, in the history and on a reconnect: never
the model's own ID. Four more activities come at `everything` alone: `summary`, a summary
the conversation kept where it did, `{summary, ms}`, its text and, when it was timed, how
long it took (`ms` is optional), never its tokens; `pins` and `notes`, the agent's own,
`{text}`, as they stand now, where each was first written; and, in a copy the stream sends
while a command runs, `output`, `{state: "running", chunks, cut}`, the command's output so
far as one chunk. The history never holds an `output`: a command's result holds its output.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `role` | `user`, `assistant`, `activity` or `tool` | yes |  |
| `content` | string or object | no | The words, an activity's content, or a call's result as JSON text, empty when none of it shows |
| `toolCalls` | array of [ToolCall](#toolcall) | no | At the level `everything`, the calls the agent's message made |
| `toolCallId` | string | no | The call a `tool` message is the result of |
| `activityType` | `steps`, `plan`, `file`, `memory`, `output`, `summary`, `pins`, `notes`, `a2ui-surface` or `mcp-apps` | no |  |
| `metadata` | object | no |  |
| `metadata.chat` | [MessageChat](#messagechat) | no |  |

### ToolCall

A call the agent made, at the level `everything`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `type` | `function` | yes |  |
| `function` | object | yes |  |
| `function.name` | string | yes | A connector's tool by its own name, such as `shop.lookup_order`; any other by its step's words while it runs, in the request's language, such as "Reading q3.pdf" |
| `function.arguments` | string | yes | What the call was sent, as JSON text, `{}` when none of it shows |

### MessageChat

What the API adds to a message

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `client_message_id` | string | no | The ID the person's message was sent with |
| `files` | array of [MessageFile](#messagefile) | no | The files the person's message carries |
| `action` | object | no | On the person's message from a button they pressed in a surface the agent showed, at every level: the surface and the button's event name. What else the button sent is the agent's to read, never shown. |
| `action.surfaceId` | string | yes |  |
| `action.name` | string | yes |  |
| `steered` | boolean | no | On the person's message, at every level: true once the turn under way read it while it worked. A message that began its turn, or one a Stop held that the turn never read, has none. |
| `citations` | array of [Citation](#citation) | no | What the agent's message cites, by the numbers it writes. Through an embed session whose agent's embed has Sources off, each citation is its `n` alone, so the answer's markers still match; your chat app and your API keys get them whole. Only citations are withheld: the steps follow the level the embed shows. |
| `state` | `done`, `failed`, `not_done`, `unknown`, `running` or `stopped` | no | On a call's result, at the level `everything`: how the call ended. `not_done` is a call the agent couldn't make as it asked, `unknown` one whose outcome nobody knows, `running` one still going, such as a command run as a background job, and `stopped` a command that was stopped. A command that exited is `done`, whatever its `exit`. |
| `ms` | integer | no | On a call's result, how long the call ran, in milliseconds, when it was timed |
| `exit` | integer | no | On a command's result, the code it exited with |
| `job` | integer | no | On a command's result, the background job it runs as |
| `cut` | object | no | On a call's result, when what it shows was cut, the full length in characters of what it was sent, what came back, or both |
| `cut.args` | integer | no |  |
| `cut.result` | integer | no |  |

### EventChat

What the API adds to a stream's event

Type: all of [MessageChat](#messagechat) and object.

### MessageFile

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `file_id` | string | no |  |
| `name` | string | yes |  |
| `kind` | `picture`, `document`, `text`, `archive`, `recording` or `other` | yes |  |

### Citation

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `n` | integer | yes | The number the agent's words cite it by |
| `title` | string | no | The section, the Q&A entry's question, or the page's title |
| `source` | string | no | The document's name |
| `location` | string | no | Where in the document, such as "page 12" or a section's path |
| `url` | string (uri) | no | A web page's address |

### WorkingLine

The `value` of `CUSTOM` `chat:working`: the one line the level `answers` shows of the work
under way, in place of the steps the other levels show.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | [WorkingKind](#workingkind) | yes |  |
| `title` | string | yes | The kind of work in plain words, to show as it is, such as "Searching" or "Reading"; never a file's, a connector's or a tool's name |

### WorkingKind

The kind of work under way: searching knowledge (`search`), reading a document (`read`),
searching the web (`web`), using a connector (`tool`), writing a file (`write`), thinking
(`thought`), or any other work (`work`).

One of `search`, `read`, `web`, `tool`, `write`, `thought` or `work`.

### StreamEvent

One AG-UI 1.0 event: `RUN_STARTED` (`threadId`, `runId`, `protocolVersion`),
`RUN_FINISHED` (`threadId`, `runId`, `outcome`, `metadata.chat.outcome` when it ended the turn,
and `metadata.chat.quiet` when the turn wrote nothing), `RUN_ERROR` (`message`, the words for the
person; `code`, for a client of your own to branch on, which the chat app and the embed never show;
`metadata.chat.outcome`),
`TEXT_MESSAGE_START` (`messageId`, `role`, the person's `metadata.chat`),
`TEXT_MESSAGE_CONTENT` (`messageId`, `delta`), `TEXT_MESSAGE_END` (`messageId`),
`ACTIVITY_SNAPSHOT` (`messageId`, `activityType`, `content`, `replace`), `MESSAGES_SNAPSHOT`
(`messages`), or `CUSTOM`: `chat:citations` (`value: {message_id, citations}`);
`chat:working` (`value: {kind, title}`, a `WorkingLine`), sent at the level `answers` alone,
where no steps come: the work under way as one line, the current words only, told again
when they change and in no snapshot and no history page; or `chat:reading`
(`value: {files}`), the names of the person's files the turn waits to read, then `[]` once
it has, at every level. The person's message the turn under way read while it worked says so
in its `TEXT_MESSAGE_START`'s `metadata.chat.steered`, at every level. A
thought is a step of its stretch's `steps` activity alone, its
words never sent: no reasoning event comes.

At the level `everything` alone, each call too: `TOOL_CALL_START` (`toolCallId`,
`toolCallName`, `parentMessageId`, the agent's message that made it), `TOOL_CALL_ARGS`
(`toolCallId`, `delta`: what it was sent as JSON text, in one delta) and `TOOL_CALL_END`
(`toolCallId`) together as the agent makes it, then `TOOL_CALL_RESULT` (`messageId`,
`toolCallId`, `content`: what came back as JSON text, empty when none of it shows, `role`
`tool`, and `metadata.chat` with how it ended: `state`, `ms`, a command's `exit` and `job`,
and `cut` when either was cut) once it's done. `toolCallName` is a connector's tool's own
name, or for any other its step's words in the request's language, as a `ToolCall` names it.
`toolCallId` is the stream's own name for the call, the one its step's `call` and the
history give it, never the model's own ID.
A command's output as it runs is the activity `output`, `{state: "running", chunks, cut}`,
its `messageId` `o-` and its call's `toolCallId`: when the person first gets it, `chunks`
holds the output so far as one chunk; after that, `ACTIVITY_DELTA` (`messageId`,
`activityType`, `patch`) adds each new piece to the end of `chunks` (`add /chunks/-`), so
nothing is sent twice, and adds `/cut` once it reaches the 65,536 characters that stream; a
chunk `…` stands where some never came. The output is `chunks` joined. When the call's
result comes, or the run ends without one (a Stop, a failure), one last
`{state: "done"}`, with no chunks: the result, when it comes, holds the output. A client may
drop an output once it says `done`, as a person joining and the history never hold one. A
kept summary is the activity `summary`, `{summary, ms}`, `ms` when it was timed, and the
agent's pins and notes the activities `pins` and `notes`, `{text}`, each sent whole again
as it changes.

At every level, a surface the agent shows the person beside its words, choices, cards with
buttons or a small form, for a client that draws it itself: the activity `a2ui-surface`,
its `messageId` `ui-`, the turn that first showed it, `-` and the surface's own
`surfaceId`, its content `{a2ui_operations: [...]}`, A2UI v1.0's messages over its basic
catalog, which a client feeds its A2UI renderer in order. Shown, it is an
`ACTIVITY_SNAPSHOT` holding one `createSurface` with the surface whole. A change, in that
turn or a later one, is an `ACTIVITY_DELTA` on the same activity whose patch appends each
of the change's own messages (`updateComponents`, `updateDataModel`) to
`a2ui_operations` (`add /a2ui_operations/-`), so what the person typed stays wherever the
change doesn't write; a close is one appending A2UI's `deleteSurface`. A surface shown again
after its close in the same turn is a snapshot of the same activity, replacing it whole;
in a later turn, a new activity. A join's catch-up (`MESSAGES_SNAPSHOT`) and the history
hold each open surface once, whole as it stands, where the turn that first showed it put
it, and no closed one; what changes after a join comes as deltas on that copy. A picture or
a recording a surface shows is a file of the conversation, its address `file:` and the
file's ID, read through the conversation's own file routes. A surface's messages come as
the checker stamped them: media as `file:<id>`, the same at every level; no address of the
agent's own is in one.

At every level, an app a connector's tool showed when the agent called it (an MCP App, on a
connector your team set to show its apps): the activity `mcp-apps`, one
`ACTIVITY_SNAPSHOT` for each call, where its call's result is, live, in a join's catch-up
and in the history alike. Its `messageId` is `app-` and 24 hex digits, the same everywhere,
which names the app when it asks for a call of its own. Its content is MCP Apps' as
CopilotKit's renderer reads it: `resourceUri`, the app's `ui://` address; `serverId`, the
connector's ID, as `/me/connections/{connector}` takes it; `serverHash`, the SHA-256 of
the tenant's ID, `/` and the connector's ID, in lowercase hex, the same for the connector in
every conversation; `toolInput`, the call's arguments, `{}` for none; `result`, the tool's
`CallToolResult` as its server gave it; both exactly as they were kept, numbers and the
order of keys as written, but where a string or key in one holds an address of the agent's
own: that one comes with each such address in your terms, as the agent's other calls show
it, its keys in order of their names and its numbers as written, a key written twice keeping
its last value. Where a key read so would read like another key of its object, no activity
comes for that call, since the app would take one key's value for the other's. And `frame`,
what a client that runs the app itself needs:
`policy`, the sources the app's document declared, `{connect, resource, frame, base}`, each
a list of `https://host` (or `wss://host` in `connect`) sources, every list there, empty for
none, and `frame` always empty: an app frames nothing, whatever its document declares, so
its own code can't open other sites inside it; `border`, the app's own word on a border
around it, absent when it gave none; and
`from`, the connector's name, to label it with. No activity comes, and nothing is said, for a
call whose app is no longer kept with the conversation, or whose connector was deleted or no
longer shows its apps: turning that off takes its apps out of the stream and the history,
past calls included. A catch-up or a page of the history holds the newest calls' apps, as
long as their results add up to at most 2,000,000 characters; older ones come without.

In the chat app, the embed and the console's Playground, which always draw it, the agent is told that such a
tool's result is shown to the person as an interactive view, so it doesn't draw the same again and may make a
call for itself alone, for which no activity comes. Through this API it is told nothing of the view, since
nothing says your app draws the activity: it writes its answer as if the person saw its words alone. So draw
each `mcp-apps` activity where it stands in the stream, beside what the agent writes.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | `RUN_STARTED`, `RUN_FINISHED`, `RUN_ERROR`, `TEXT_MESSAGE_START`, `TEXT_MESSAGE_CONTENT`, `TEXT_MESSAGE_END`, `ACTIVITY_SNAPSHOT`, `ACTIVITY_DELTA`, `MESSAGES_SNAPSHOT`, `CUSTOM`, `TOOL_CALL_START`, `TOOL_CALL_ARGS`, `TOOL_CALL_END` or `TOOL_CALL_RESULT` | yes |  |
| `timestamp` | integer | no | When what it tells of happened, in Unix milliseconds |
| `threadId` | string | no |  |
| `runId` | string | no |  |
| `protocolVersion` | `1.0` | no |  |
| `outcome` | [Outcome](#outcome) | no |  |
| `message` | string | no |  |
| `code` | `failed` | no |  |
| `messageId` | string | no |  |
| `role` | `user`, `assistant` or `tool` | no |  |
| `delta` | string | no |  |
| `toolCallId` | string | no |  |
| `toolCallName` | string | no |  |
| `parentMessageId` | string | no |  |
| `activityType` | `steps`, `plan`, `file`, `memory`, `output`, `summary`, `pins`, `notes`, `a2ui-surface` or `mcp-apps` | no |  |
| `patch` | array of objects | no | On `ACTIVITY_DELTA`, the change to the activity's content as an RFC 6902 patch: for an `output`, `add` to `/chunks/-` with a chunk of text, or `add` to `/cut` with `true`, once; for an `a2ui-surface`, `add` to `/a2ui_operations/-` with each A2UI message to apply, in order |
| `patch[].op` | `add` | yes |  |
| `patch[].path` | `/chunks/-`, `/cut` or `/a2ui_operations/-` | yes |  |
| `patch[].value` | string, boolean or object | yes | A chunk of the output's text for `/chunks/-`; `true` for `/cut`; one A2UI v1.0 message for `/a2ui_operations/-` |
| `content` | object or string | no | An activity's content, or a call's result as JSON text |
| `replace` | boolean | no |  |
| `messages` | array of [Message](#message) | no |  |
| `name` | `chat:citations`, `chat:working` or `chat:reading` | no |  |
| `value` | any of [WorkingLine](#workingline) or object | no | What the event carries: `chat:citations` `{message_id, citations}`, `chat:working` a `WorkingLine`, `chat:reading` `{files}`. |
| `metadata` | object | no |  |
| `metadata.chat` | [EventChat](#eventchat) | no |  |

### Outcome

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | `success`, `cancelled` or `interrupt` | yes |  |
| `interrupts` | array of [Interrupt](#interrupt) | no |  |

### Interrupt

Something a turn waits on the person for: a yes to an action (`confirmation`, its call's
details in `metadata.chat.details`; on their own account, `always` allows it from then
on, and is refused on any other), details to fill in (`input_required`, its form as
`responseSchema`), a page to open (`chat:open_page`, at `metadata.chat.url`), their own
account to connect (`chat:connect`: open `metadata.chat.url`, a connect link, for them to
sign in; the turn goes on once they have, and resuming it then changes nothing; `metadata.chat.reconnect`
is true when they sign in again, and `metadata.chat.more_access` when the account needs more access, which
only a new sign-in asking for it gives, as the link's does: until then, `connected: true` is `not_connected`,
though the account works), or the person's own pause (`chat:paused`), which goes on when they continue.
Answer each with `POST /conversations/{id}/resume`. One an app's call waits on (a `confirmation` or a
`chat:connect`) names the app's activity in `metadata.chat.app`, `{activity}`, the object a message an app sent
carries with its `from`: it's among the conversation's `interrupts` while it waits, never on its stream, and the
app's request sent again with `resume` answers it and its call's end.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `reason` | `confirmation`, `input_required`, `chat:open_page`, `chat:connect` or `chat:paused` | yes |  |
| `message` | string | no |  |
| `responseSchema` | object | no | The JSON Schema an answer keeps to. A form's is an object whose properties are its fields, written in the order they were asked in, which is the order to show them in, each with a `title` and, where it has one, a `description` and the `default` it starts with: a string (`format` `email`, `uri` or `date`; `password` with `writeOnly` for a secret), a number or an integer with its bounds, a boolean, a choice as `oneOf` of `{const, title}` (each with a `description` where the option has a line of its own; `anyOf` with a plain string beside them where the person may write an answer of their own), or a choice of several as an `array` whose `items.anyOf` holds the options, as many as `minItems` and `maxItems` allow, answered with a list of the `const`s picked. |
| `expiresAt` | string (date-time) | no |  |
| `metadata` | object | no |  |
| `metadata.chat` | object | no |  |
| `metadata.chat.app` | object | no | The app whose call waits on this, by its activity's ID |
| `metadata.chat.app.activity` | string | yes |  |

### EventPerson

The person an event is about, by your ID for them

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `user` or `visitor` | yes |  |
| `id` | string | yes | Your ID for them |

### EventChannel

The way the conversation came, through the API, the embed or your chat app

One of `api`, `embed` or `chat_app`.

### TurnEventData

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | [ID](#id) | yes | The turn's |
| `conversation_id` | [ID](#id) | yes |  |
| `agent_id` | [ID](#id) | yes |  |
| `person` | [EventPerson](#eventperson) | yes |  |
| `channel` | [EventChannel](#eventchannel) | yes |  |

### ConversationEventData

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | [ID](#id) | yes | The conversation's |
| `agent_id` | [ID](#id) | yes |  |
| `person` | [EventPerson](#eventperson) | yes |  |
| `channel` | [EventChannel](#eventchannel) | yes |  |

### TestEventData

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | [ID](#id) | yes | The endpoint's |

### TurnCreatedEvent

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | `turn.created` | yes |  |
| `timestamp` | string (date-time) | yes | When it happened, in UTC to the millisecond |
| `data` | [TurnEventData](#turneventdata) | yes |  |

### TurnEndedEvent

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | `turn.ended` | yes |  |
| `timestamp` | string (date-time) | yes | When it happened, in UTC to the millisecond |
| `data` | [TurnEventData](#turneventdata) | yes |  |

### ConversationWaitingEvent

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | `conversation.waiting` | yes |  |
| `timestamp` | string (date-time) | yes | When it happened, in UTC to the millisecond |
| `data` | [ConversationEventData](#conversationeventdata) | yes |  |

### WebhookTestEvent

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | `webhook.test` | yes |  |
| `timestamp` | string (date-time) | yes | When it happened, in UTC to the millisecond |
| `data` | [TestEventData](#testeventdata) | yes |  |

### ProblemCode

A problem's stable code. `invalid_request`, `person_required`, `person_conflict`,
`idempotency_key_required` and `idempotency_key_invalid` are a request to fix;
`api_key_invalid` a key to fix; `session_invalid` and `session_expired` an embed session to ask for
again, and `user_token_invalid` a user token to refresh; `person_header_not_here` a person header to
leave out beside a session; `tenant_suspended`, `sign_in_required` and `sign_in_not_accepted` refusals of who
is calling, `attachments_off` a file sent to an embed that takes none, and
`chat_app_closed` a chat app not yet open; `admin_only`, `two_step_required` and `recent_sign_in_required`
the admin area's, for an admin with two-step, signed in within the hour to change something, and its
`invitation_just_sent`, `has_account`, `sign_in_busy`, `group_exists`, `too_many_groups`, `last_group`,
`not_yourself`, `group_unknown` and `too_many_invitations` the state of the chat app's people and groups, and
`issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_unsupported`, `sso_busy` and
`issuer_unreachable` the state of its identity providers;
`embed_off` an agent whose embed isn't open; the `*_not_found` codes and `not_found` nothing of yours there; `download_link_expired` a download link to ask for again;
`answer_invalid` a resume's payload to fix; `photo_invalid` and `photo_too_large` a photo to choose again;
`attachments_not_supported` a run's message to
send as text; `invalid_action` a pressed button to fix; `method_not_allowed` another method;
`conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `message_taken`, `turn_ended`,
`message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `task_not_running`, `interrupt_answered`, `interrupt_expired`, `nothing_to_pause`,
`not_paused`, `interrupts_pending` and `idempotency_key_in_use` a conversation's state; `not_connected` an
account not ready yet, which its person hasn't connected, or hasn't allowed the more access its card asks;
`too_many_files`, `file_sent` and `file_name_taken` its files' state; `too_many_pins` the person's pins;
`memory_ask_answered`, `memory_gone`,
`memory_full`, `memory_taken`, `memory_name`, `memory_too_long`, `memory_never_kept` and `memory_unused`
what the agent remembers;
`length_required`, `body_too_large`, `context_too_large`, `unsupported_media_type` and `file_unsupported` a
body to fix; `range_not_satisfiable` a download's range to fix; `idempotency_key_reused` a key to change; `internal_error` our fault;
`rate_limited`, `agents_unavailable`, `files_unavailable`, `search_unavailable` and `service_unavailable` a wait of
`Retry-After` seconds; `connect_open_from_chat`, `sign_in_expired`, `connect_failed` and `cant_connect` a
connect that connected nothing, in the person's words.

One of `invalid_request`, `person_required`, `person_conflict`, `person_header_not_here`, `idempotency_key_required`, `idempotency_key_invalid`, `answer_invalid`, `attachments_not_supported`, `method_not_allowed_for_apps`, `app_arguments_invalid`, `invalid_app`, `invalid_action`, `sign_in_expired`, `connect_failed`, `api_key_invalid`, `session_invalid`, `session_expired`, `preview_invalid`, `user_token_invalid`, `tenant_suspended`, `chat_app_closed`, `sign_in_required`, `sign_in_not_accepted`, `attachments_off`, `site_not_allowed`, `admin_only`, `two_step_required`, `recent_sign_in_required`, `connect_open_from_chat`, `app_other_connector`, `app_tool_not_offered`, `app_tool_unavailable`, `not_found`, `app_not_found`, `person_not_found`, `pin_not_found`, `issuer_not_found`, `sso_test_not_found`, `photo_invalid`, `photo_too_large`, `photo_not_found`, `agent_not_found`, `embed_off`, `conversation_not_found`, `run_not_found`, `file_not_found`, `download_link_expired`, `preview_unavailable`, `home_not_found`, `process_not_found`, `interrupt_not_found`, `connector_not_offered`, `task_not_found`, `connection_not_found`, `memory_not_found`, `memory_ask_not_found`, `invitation_not_found`, `group_not_found`, `method_not_allowed`, `conversation_busy`, `too_many_waiting`, `nothing_to_stop`, `apps_not_shown`, `message_taken`, `turn_ended`, `message_held`, `message_not_held`, `run_not_retryable`, `process_not_running`, `task_not_running`, `interrupt_answered`, `interrupt_expired`, `nothing_to_pause`, `not_paused`, `interrupts_pending`, `not_connected`, `cant_connect`, `memory_ask_answered`, `memory_gone`, `memory_full`, `memory_taken`, `memory_name`, `memory_too_long`, `memory_never_kept`, `memory_unused`, `too_many_pins`, `too_many_files`, `file_sent`, `file_name_taken`, `invitation_just_sent`, `has_account`, `sign_in_busy`, `group_exists`, `too_many_groups`, `last_group`, `issuer_taken`, `too_many_issuers`, `sso_domain_taken`, `sso_not_working`, `sso_unsupported`, `sso_busy`, `not_yourself`, `idempotency_key_in_use`, `length_required`, `body_too_large`, `context_too_large`, `app_context_too_large`, `unsupported_media_type`, `file_unsupported`, `range_not_satisfiable`, `issuer_unreachable`, `group_unknown`, `idempotency_key_reused`, `too_many_invitations`, `too_many_app_calls`, `too_many_app_requests`, `rate_limited`, `internal_error`, `agents_unavailable`, `service_unavailable`, `app_calls_unavailable`, `app_requests_unavailable`, `files_unavailable` or `search_unavailable`.

### ProblemField

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `detail` | string | yes |  |
| `pointer` | string | no | The body member at fault, as a JSON Pointer |
| `parameter` | string | no | The query parameter at fault |
| `header` | string | no | The header at fault |

### Problem

A problem detail (RFC 9457)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | string (uri) | yes | The problem's page, which says what it means and what to do |
| `title` | string | yes |  |
| `status` | integer | yes |  |
| `detail` | string | no |  |
| `code` | [ProblemCode](#problemcode) | yes |  |
| `request_id` | string | no | The request's ID, as its answer's `Request-Id` names it |
| `errors` | array of [ProblemField](#problemfield) | no | Each member at fault, for `invalid_request` |

## Put an agent on your site

One of your agents on your website or your app, with a couple of lines of frontend code. It comes in three forms, a
chat bubble, an inline chat and a page of its own, and you can use more than one at once: a bubble on every page and an
inline chat on your help page. One set of settings and one look apply to all of them, set on the agent's embed in your
console, where its live preview shows each form as you change it.

Before a page can show it: turn the agent's embed on, list your sites, and publish a version. People always reach the
agent's version in use. Each line below names the agent by its ID, `YOUR_AGENT_ID` here; the agent's embed in the
console gives you these lines with its own ID filled in.

### A chat bubble

A launcher in a corner of every page that opens a chat window over it. Put these two lines in your site's layout:

```html
<script src="https://hados.io/embed.js" async></script>
<agent-chat agent="YOUR_AGENT_ID" mode="bubble"></agent-chat>
```

The window is 400 by 640 pixels, 480 by 760 when the bubble is large, and the whole screen on a phone. The launcher, its
label, its corner and its teaser come from the agent's embed settings; `position` and `launcher` override them on a page.

### An inline chat

The chat in a box of your page, such as a help page's column. It takes the height you give it, 600 pixels when none, and
never less than 360:

```html
<script src="https://hados.io/embed.js" async></script>
<agent-chat agent="YOUR_AGENT_ID" style="height: 640px"></agent-chat>
```

With no script at all, a plain iframe does the same for visitors. A page can't hand an iframe a signed-in person's
token, so an agent for signed-in people only says "Sign in to chat." in one.

```html
<iframe
  src="https://hados.io/embed/YOUR_AGENT_ID"
  title="Chat with Your agent"
  style="width: 100%; height: 640px; border: 0"
  allow="clipboard-write"
></iframe>
```

### A page of its own

A link that opens the chat full screen, to share anywhere a link goes. Turn the agent's page on in its embed settings.
It's for an agent anyone may use: a link carries no one's sign-in, so an agent for signed-in people only says "Sign in
to chat" there.

```text
https://hados.io/embed/YOUR_AGENT_ID
```

### The element

`<agent-chat>`, which the script defines, takes these attributes:

| Attribute | What it does |
|---|---|
| `agent` | The agent's ID. Required. |
| `mode` | `bubble` for a bubble; an inline chat when left out. |
| `theme` | `light`, `dark` or `system`, over the embed's own. |
| `lang` | The chat's own words, `en-US` or `zh-CN`, over each person's browser's language until they choose one in its menu. `visitor-language` only tells the agent. |
| `position` | `bottom-right` or `bottom-left`: the bubble's corner. |
| `launcher` | `none` hides the bubble's launcher, for a page that opens it from its own button. |
| `open` | The bubble's window is open while it's set. |
| `conversation` | A conversation's ID, opened when the chat starts. |
| `token-url` | A path on your page's own origin that answers the signed-in person's token, read with your page's cookies: for a session behind a cookie (A signing key, below). `getUserToken` wins when both are set. |
| `visitor-name`, `visitor-email`, `visitor-language`, `visitor-time-zone` | What your page knows of a visitor, told to the agent as your page's words, never as proof of who they are. |

Its properties are `getUserToken`, a function that answers the signed-in person's token (below), and `context`, what the
person is looking at: a JSON object of strings, numbers and booleans, or objects of them one level down, 8 KB at most,
sent with their next message after it changes; `null` clears it. Its methods are `open()`, `close()` and `toggle()`,
for the bubble's window.

It tells your page what happens with events on the element:

| Event | When | `detail` |
|---|---|---|
| `chat-ready` | The chat is up and knows who the person is | |
| `chat-open`, `chat-close` | The bubble's window opened or closed | |
| `chat-conversation` | A conversation opened | `{ id }` |
| `chat-turn-ended` | A turn of the agent's ended | `{ conversation, turn, outcome }`, its outcome below |
| `chat-sign-in` | The agent is for signed-in people and your page gave no one's token | |
| `chat-error` | The chat can't work here, or can't now | `{ code }`, below |

A turn's `outcome` says how it ended:

- `answered`: the agent answered; its words are in the chat.
- `quiet`: a background job's end the agent had nothing new to tell of: it wrote nothing, so there's nothing new to
  read.
- `stopped`: the person stopped it, or a message they sent did; the chat offers to try it again.
- `limit`: it stopped at one of the agent's limits, its last words saying so; the chat offers to try it again.
- `failed`: it couldn't answer this time; the chat offers to try it again.
- `expired`: it asked the person something that went unanswered, and stopped waiting; there's nothing to try again.

TypeScript declarations for the element are at `https://hados.io/embed.d.ts`.

### Its language

The chat speaks English and Simplified Chinese. Each person reads it in their browser's language and can change it in
its menu. Give the element `lang` to set it for your page, until they choose one in its menu:

```html
<agent-chat agent="YOUR_AGENT_ID" mode="bubble" lang="zh-CN"></agent-chat>
```

A page of its own and an iframe take it in their address: `https://hados.io/embed/YOUR_AGENT_ID?lang=zh-CN`. It sets the chat's
own words, its buttons and notices, not the agent's answers, which follow its instructions and the person's messages.

### Your sites

The embed runs only on the sites listed on the agent's embed, each an origin: its scheme, its host and its port, such as
`https://docs.acme.com` or `http://erp.corp:8080`. `https://*.acme.com` stands for any name below `acme.com`. On a page
of any other origin there's no chat, and the element tells it `chat-error` with `site_not_allowed`.

### Ask the docs

A knowledge agent on a public documentation site, answering visitors with its sources. Put the bubble in the site's
layout, and the inline chat on the help page, its box as tall as the page allows:

```html
<script src="https://hados.io/embed.js" async></script>
<agent-chat agent="YOUR_AGENT_ID" mode="bubble"></agent-chat>
```

Visitors need nothing more. A page may tell the agent who a visitor is with the `visitor-` attributes; it never has to.

### A copilot in your business system

An agent beside the people using your app, acting for the signed-in user through connectors on their own accounts,
each signed in once from the card the agent shows ([Let people connect their accounts](https://hados.io/api/docs/sign-in) explains
how). Hand it the user's token (Signed-in people, below), tell it what they are looking at, and open it from your own
button:

```js
const chat = document.querySelector('agent-chat')
chat.context = {
  page: 'Orders',
  order: 'SO-1042',
  status: 'awaiting payment',
}
```

```html
<script src="https://hados.io/embed.js" async></script>
<agent-chat
  agent="YOUR_AGENT_ID"
  mode="bubble"
  launcher="none"
></agent-chat>
<button type="button" id="ask-ai">Ask AI</button>
<script>
  const chat = document.querySelector('agent-chat')
  const button = document.getElementById('ask-ai')
  button.addEventListener('click', () => chat.toggle())
</script>
```

The agent reads the context as your page's words, maybe out of date, so it confirms before it acts on them.

### Support on a customer portal

Public pages and a signed-in area of one site. The same bubble goes on every page: visitors chat before they sign in,
and once they have, your page's token makes them your user, whose conversations follow them on every device.

### An internal tool

An intranet app on a private address, such as `http://erp.corp:8080`. List that origin among the agent's sites, and the
embed works there as it does for a copilot.

### A chat to share

The agent's page of its own, with nothing to install: its link in an email, a QR code or a post opens the chat full
screen on any device. It's for an agent anyone may use.

### Signed-in people

Hand the element the token your identity provider already keeps in the page, and the person chats as your user. Their
token is checked against your identity provider, added once in your console under Access → Sign-in, before they chat, and asked for
again before the session it made ends; it's never stored. The user is the one your servers name with `X-User-ID` through
the API: the token's `sub`, or the claim you choose. Sign-in fills in Okta's `uid` and Entra ID's `oid`, since their
`sub` isn't the one ID a person keeps. Add your identity provider in Sign-in, then its line below to your embed code. A
page that keeps no token, with a session behind a cookie, adds `token-url` to its chat's element instead, naming a path
on its own origin (A signing key, below).

[Let people connect their accounts](https://hados.io/api/docs/sign-in) tells the whole story: how your agents know your people,
what a person meets as they connect their own accounts, what your own MCP server serves so they can, and how to set up
each identity provider in its own console.

Give your identity provider its audience in Sign-in: the app your tokens are for. A token is judged by its `aud`,
which must hold it; a token with no `aud`, by its `azp`; one with neither, by its `client_id`. So a token your identity
provider signs for another of its apps opens no session, and that app's users never chat as yours. An identity provider
with no audience takes no token.

#### Auth0

Give your Auth0 client an `audience`, your API's identifier, so `getTokenSilently()` answers a signed token rather than
an opaque one, and give your identity provider the same audience in Sign-in.

```js
const chat = document.querySelector('agent-chat')
chat.getUserToken = () => auth0.getTokenSilently()
```

#### Okta

Register a custom authorization server's address, such as `https://acme.okta.com/oauth2/default`: your org's own
access tokens can't be checked. Sign-in reads the person from `uid`, Okta's user ID, which never changes: a token's
`sub` is their login, which can. The line renews the token when it's due.

```js
const chat = document.querySelector('agent-chat')
chat.getUserToken = () => oktaAuth.getOrRenewAccessToken()
```

#### Entra ID

Your API's access tokens must be version 2: [Let people connect their accounts](https://hados.io/api/docs/sign-in) says how, under
Entra ID. Sign-in reads the person from `oid`, the same in every app of your tenant. MSAL needs the signed-in account
set as its active account.

```js
// Your API's scope, as Expose an API shows it in its app registration
const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => {
  const result = await msal.acquireTokenSilent({
    scopes: ['YOUR_API_SCOPE'],
  })
  return result.accessToken
}
```

#### Keycloak

The line renews the token first when it ends within 30 seconds.

```js
const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => {
  await keycloak.updateToken(30)
  return keycloak.token
}
```

#### Cognito

Hand over the ID token, whose audience is your app client's ID: Cognito's access tokens carry none.

```js
// With Amplify: import { fetchAuthSession } from 'aws-amplify/auth'
const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => {
  const { tokens } = await fetchAuthSession()
  return tokens?.idToken?.toString()
}
```

#### Clerk

Its audience is your site's address, its origin, such as `https://acme.com`: Clerk's session tokens carry no `aud`, and
name the site that asked for them in `azp`. With a JWT template that adds an `aud`, such as Convex's `convex`, its
audience is what that `aud` holds, since a token with an `aud` is judged by it alone.

```js
const chat = document.querySelector('agent-chat')
chat.getUserToken = () => Clerk.session.getToken()
```

#### Supabase

The project's tokens are checked against the keys it publishes, which it does once it signs with its asymmetric JWT
signing keys; a project still on the legacy shared secret publishes none, and it can't be added.

```js
const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => {
  const { data } = await supabase.auth.getSession()
  return data.session.access_token
}
```

#### Firebase

```js
const chat = document.querySelector('agent-chat')
chat.getUserToken = () => firebase.auth().currentUser.getIdToken()
```

#### Logto

Give Sign-in your Logto tenant's address, such as `https://acme.logto.app/oidc`, or its custom domain's: one host
everywhere, since each of Logto's domains is an issuer of its own. Its audience is your API resource's indicator, the API
identifier your page asks Logto for a token for. Logto's access tokens carry no name or email: add them as custom token
claims in Logto, or have your server tell the agents through `PUT /users/{id}`.

```js
// Your API resource’s indicator, as Logto’s API resources show it
const chat = document.querySelector('agent-chat')
chat.getUserToken = () =>
  logtoClient.getAccessToken('https://api.acme.com')
```

#### Any OpenID Connect identity provider

```js
// Any OpenID Connect identity provider: its ID or access token,
// here with oidc-client-ts
const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => (await userManager.getUser())?.id_token
```

#### A signing key

For an app that keeps no token in the page, such as a session behind a cookie: make a signing key in Sign-in. Your
server signs a token for the signed-in user with it, HS256 with the key's ID as its `kid` and an hour at most, with the
key's secret as `CHAT_SIGNING_KEY`, and answers it at a path of your site. In Node:

```js
// npm install jsonwebtoken
import jwt from 'jsonwebtoken'

// At /chat-token, for the signed-in user:
const token = jwt.sign(
  {
    sub: user.id,
    name: user.name,
    email: user.email,
    exp: Math.floor(Date.now() / 1000) + 3600,
  },
  process.env.CHAT_SIGNING_KEY,
  { algorithm: 'HS256', keyid: 'YOUR_KEY_ID' },
)
```

In Python:

```python
# pip install pyjwt
import os
import time

import jwt

# At /chat-token, for the signed-in user:
token = jwt.encode(
    {
        "sub": user.id,
        "name": user.name,
        "email": user.email,
        "exp": int(time.time()) + 3600,
    },
    os.environ["CHAT_SIGNING_KEY"],
    algorithm="HS256",
    headers={"kid": "YOUR_KEY_ID"},
)
```

In PHP:

```php
// composer require firebase/php-jwt
use Firebase\JWT\JWT;

// At /chat-token, for the signed-in user:
$token = JWT::encode(
    [
        'sub' => $user->id,
        'name' => $user->name,
        'email' => $user->email,
        'exp' => time() + 3600,
    ],
    getenv('CHAT_SIGNING_KEY'),
    'HS256',
    'YOUR_KEY_ID'
);
```

In Go:

```go
// go get github.com/golang-jwt/jwt/v5
// At /chat-token, for the signed-in user:
t := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
	"sub":   user.ID,
	"name":  user.Name,
	"email": user.Email,
	"exp":   time.Now().Unix() + 3600,
})
t.Header["kid"] = "YOUR_KEY_ID"
token, err := t.SignedString([]byte(os.Getenv("CHAT_SIGNING_KEY")))
```

In Java:

```java
// io.jsonwebtoken: jjwt-api, jjwt-impl and jjwt-jackson 0.12
// At /chat-token, for the signed-in user:
SecretKey key = Keys.hmacShaKeyFor(
    System.getenv("CHAT_SIGNING_KEY").getBytes(StandardCharsets.UTF_8));
String token = Jwts.builder()
    .header().keyId("YOUR_KEY_ID").and()
    .subject(user.getId())
    .claim("name", user.getName())
    .claim("email", user.getEmail())
    .expiration(new Date(System.currentTimeMillis() + 3600_000))
    .signWith(key, Jwts.SIG.HS256)
    .compact();
```

Then add `token-url` to your chat's element, naming that path, and keep its other attributes, such as `mode="bubble"`.
The chat reads it with your page's cookies:

```html
<agent-chat agent="YOUR_AGENT_ID" token-url="/chat-token"></agent-chat>
```

The chat reads it as it starts, before the session it made ends, and after a refusal, never cached. Answer the token
as plain text, or as `{"token": "…"}`. When no one is signed in, answer `200` with nothing: an error status, such as
`401`, counts as no one too, but the chat warns about it in the browser's console each time it asks. Only a path on
the page's own origin, its scheme, host and port, is read, and a page that also sets `getUserToken` is asked that
instead.

### What goes wrong

The element tells your page with `chat-error`:

| Code | What it means | What to do |
|---|---|---|
| `site_not_allowed` | The page's origin isn't one of the agent's sites | List it on the agent's embed |
| `embed_off` | The agent's embed is off, or it has no version in use | Turn the embed on, or publish a version |
| `user_token_invalid` | Your page's token was refused | Test it in Sign-in, with Test a token; each identity provider and signing key says why it last refused one |
| `sign_in_not_accepted` | The agent doesn't take people signed in the way your page's token was: through that identity provider, or your signing keys | Choose the sign-ins it takes on the agent's embed, under Who chats; the chat tells the person it isn't available to their account, never to sign in again |
| `rate_limited` | Visitors sent more than the chat takes for now | Wait: the chat says when |
| `tenant_suspended` | The chat isn't available | Ask whoever runs your console |
| `unavailable` | The chat can't be reached now | Nothing: it's tried again |

A page only hears that a token was refused, so Sign-in in your console keeps the last reason each identity provider
and signing key refused one, and tests any token you paste. Its reasons:

| Reason | What it means | What to do |
|---|---|---|
| `isn't a signed token` | Your page gave something else: an opaque access token, or a session's ID | Hand over the signed ID token or access token your identity provider issues |
| `no issuer or signing key it names` | Its `iss`, or its `kid`, is none of yours | Add its identity provider, or check the signing key's ID |
| `signed with an algorithm it doesn't allow` | An issuer's token signed with HS256, or not signed at all | An issuer's tokens are RS256, PS256, ES256, ES384, ES512 or EdDSA; HS256 is for a signing key's |
| `a key it doesn't publish` | Its `kid` isn't one of the issuer's keys | The issuer's keys are read again when a token names one they don't hold; a key retired from them can't be used |
| `its signature doesn't check` | It was signed with another key, or changed after | Sign it with the issuer's key, or the signing key's secret |
| `expired`, `no expiry` | Its `exp` has passed, or it has none | Hand over a fresh token: the embed asks for one before the session it made ends |
| `not valid yet`, `issued in the future` | Its `nbf` or `iat` is ahead of the time, past a minute's leeway | Check your server's clock |
| `lasts longer than a day` | Its `exp` is more than 24 hours on | Make it shorter: an hour is enough |
| `wrong issuer` | Its `iss` isn't the issuer's, a final slash included | Name the issuer exactly as its tokens do |
| `wrong audience` | Its `aud` doesn't hold the issuer's audience; with no `aud`, its `azp` isn't it; with neither, its `client_id` isn't | Give the issuer the audience your tokens carry |
| `no audience set` | The identity provider names no app its tokens are for, kept from before one was needed | Give it your app's audience in Sign-in |
| `no user ID`, `its user ID isn't a string`, `its user ID is longer than 200 characters or holds a control character` | The claim that names the user is missing or isn't an ID | Point the issuer's user ID claim at your user's ID |

## Let people connect their accounts

Your agents act for the people who chat with them: on your own servers, and on other services, each time with the
person's own account there. Each person connects an account once, the first time an agent needs it, and the connection
is kept and renewed. This guide explains what a person meets as they connect, how your agents know your people, what
your own MCP server does so your people can connect to it, and how to set it all up, in your console and at your
identity provider.

The words this guide uses, as your console uses them:

- **Your identity provider** is the OpenID Connect issuer your app's people sign in with, such as Auth0, Okta or
  Keycloak. An app with none makes a **signing key** instead (HS256, a shared secret), which its own server signs their
  tokens with. You add either in your console, under Access → Single sign-on, in Embed sign-in.
- **A person** is someone who chats with your agents: a user, who is signed in to your app, or a visitor, who isn't.
- **A connector** is a server that gives your agents tools (an MCP server): one of your own, or a third party's. You
  add it in your console, under Build → Connectors.
- **To connect** is a person signing in to a connector's server with their own account there. The connection is kept
  and renewed (OAuth), and the agents use it in every conversation after.
- **Your MCP server** is a server of yours that signs people in with your identity provider, as MCP's authorization
  describes, so its tools act for each person with their own account.
- **The embed code** is the lines on your page that put the chat there and hand it each signed-in person's token.

### What a person meets

A person connects an account on a connector that signs in with each user's own login (Add it as a connector, below):
every call runs as the person who sent the turn, with their own account at the server. When a turn needs an account
its person hasn't connected, the chat, on your site or in your chat app, pauses the turn and shows a card:

- **"Connect {connector}"**, the first time;
- **"Sign in to {connector} again"**, once a connection stopped working, such as when the person removed your agents'
  access at the service.

The card opens a window, which goes on to the server's sign-in, and says "Sign in in the window that opened. The agent
goes on once you're connected." The person signs in there with their own account, and allows your agents' access where
the server asks. The window then says their account is connected, and the agent goes on in the chat. "Not now" tells
the agent they chose not to.

**No password where they're signed in already.** The window is the server's sign-in, in the person's own browser. When
that browser is signed in there already, the sign-in asks for no password: at most it asks them to allow your agents'
access, and the window goes on. Your people are signed in at your identity provider once they've signed in to your app
through its page, so a connect to your own MCP server, which signs them in there, takes them straight through (Your own
MCP server, below). When your app has a login form of its own, the first connect asks for their password once, and
your identity provider's session covers the rest. At a third party's service, they sign in with their account there.

Only that window can finish the connect. The chat hands it a one-time binding as it opens it, and the sign-in finishes
only with that binding (as RFC 9700 binds a flow to the browser that started it). A copy of its address, opened
anywhere else, connects nothing: its page says "Open this from your chat", or that the link is no longer open. So
someone sent a person's link can't connect their own account to that person's chat.

The binding needs the browser's Web Crypto (`crypto.subtle`), which a page served over plain http doesn't have. Serve
the pages your chat is on over https. `http://localhost` works while you develop.

In your console's Playground, a connector on each user's own login connects your own account, as you test.

#### Through the API

When a turn of an API conversation needs an account, it pauses with a `chat:connect` interrupt. Its
`metadata.chat.url` is a link for the person. Open it for that person alone, in a window of its own.

The link's page says whose chat it's for, by the name your app gave the person: "You're connecting an account to
{person}'s chat with {agent}". It goes on when they choose Continue, and binds the sign-in to its own window, as the
chat does. That page is the guard against the link reaching someone else, who would connect their own account to the
person's chat. Keep the link as private as the conversation.

Once they've connected, the turn goes on by itself, and the conversation's stream shows it. There's nothing to resume.

#### A person's connections

The chat's menu lists a person's accounts under Connected accounts: the ones they connected, with the account each
signed in as where its sign-in named it, and the ones the agent connects for them that they haven't yet. They connect
one there with "Connect {connector}", or with "Reconnect {connector}" once it says "Sign in again next time", and can
disconnect any. Your chat app's Settings lists them too, across agents.

Your server lists and removes them with your API key: `GET /users/{id}/connections` and
`DELETE /users/{id}/connections/{connector}`, and the same under `/visitors/{id}`. `GET /users/{id}/connectors` lists
the accounts an agent connects for the person, and `POST /users/{id}/connections/{connector}/link` gives your app a link
for them to connect one from its own menu, through a page like the interrupt's. An agent that needs a connection
removed asks for it again.

### How your people are known

Every person who chats with your agents is a user or a visitor. Each has one record of their own, which holds their
conversations, their files and the accounts they connected. No call for one person reaches another's.

A user is someone signed in to your app. They're known by the ID your app gives them, however they arrive:

- **In the embed**, your page hands the chat their token. An identity provider that keeps a token in the page takes one
  line of script, `getUserToken`. A session behind a cookie takes one attribute, `token-url`. The chat checks the token
  against your identity provider, or your signing key, and reads the person's ID from its `sub` claim, or from the claim
  you choose in Embed sign-in, which fills in Okta's `uid` and Entra ID's `oid` itself, since their `sub` isn't the one
  ID a person keeps.
- **Through the API**, your server names them with `X-User-ID`.

One ID is one person. A token naming `4711` and `X-User-ID: 4711` are the same user, with the same conversations and the
same connected accounts. So every identity provider you add must name people by your app's IDs. Add token issuer says so
when you add a second one: "Its people's IDs must be your app's IDs. If they're different people, they'd share
conversations."

A token is checked before the person chats, and asked for again before the session it made ends. It's never stored.
It also tells the agent the person's name, email, language and time zone, from the claims Embed sign-in reads them from:
`name`, `email`, `locale` and `zoneinfo`, unless you choose others. Your server tells the agent the same through the
API, with `PUT /users/{id}`.

A visitor isn't signed in. The embed makes an ID for each visitor the first time they chat, and their browser keeps it
until 30 days after their last visit. Your server names a visitor through the API with `X-Visitor-ID`. A visitor
connects no accounts of their own (Visitors don't connect accounts, below).

In your console, under Access → Single sign-on, Embed sign-in lists what your page's tokens are checked against: your
identity provider, or a signing key. Add yours there, then your page's embed code. Each step is below; each identity
provider's own is under Each provider's setup.

#### Your identity provider

1. Under Embed sign-in, choose **Add token issuer**.
2. Give one of these: your identity provider's domain, such as `acme.us.auth0.com`; its address (its issuer); its
   discovery address, ending in `/.well-known/openid-configuration`; or a token your app got from it. For one that
   publishes no discovery document, choose **Enter endpoints manually** and give its issuer and its JWKS URI.
3. Its discovery document is read (OpenID Connect Discovery, else RFC 8414's authorization server metadata), and the
   line under the field says what was found. One that publishes no key to check your people's tokens with can't be
   added.
4. A token you paste is read and checked, never kept. Its audience and claims fill in the form, and the line says whom
   it names, such as "This token checks: it names Ana Ruiz, user 4711."
5. Give the audience: the app your page's tokens are for. A token is judged by its `aud`, which must hold it; a token
   with no `aud`, by its `azp`; one with neither, by its `client_id`. A token for another of your identity provider's
   apps opens no session, and an identity provider with no audience takes none.
6. Check which claims hold the person's ID (`sub` unless you choose another), and their name, email, language and time
   zone.
7. Choose **Add token issuer**.

Its document and keys are read again every day. Each token issuer in the list says the audience it takes, when it last
accepted a token, and why it last refused one.

#### Embed code

Your page hands the chat each signed-in person's token in one of two ways:

- **One line of script**, for an identity provider that keeps a token in the page: `getUserToken`, a function that
  answers the token. Your identity provider's line is under its name in Each provider's setup, and in your console on
  each agent's embed, under Deliver → Embed.
- **One attribute**, for a session behind a cookie: `token-url`, a path on your own origin that answers the token.

The lines are for a page where the person is signed in. Where someone may not be, answer `null` for them: an error
counts as no one too, but the chat warns about it in the browser's console each time it asks.

Add `token-url` to your chat's element, naming a path on your page's own origin, and keep the element's other
attributes, such as `mode="bubble"`:

```html
<agent-chat agent="YOUR_AGENT_ID" token-url="/chat-token"></agent-chat>
```

The chat reads that path with your page's cookies, never cached: as it starts, before the session it made ends, and
after a refusal.

- Answer the person's token as plain text, or as JSON: `{"token": "…"}`.
- When no one is signed in, answer `200` with nothing, or `{"token": null}`. An error status, such as `401`, counts as
  no one too, but the chat warns about it in the browser's console each time it asks, and JSON with no `token` in it
  counts as no one with a warning once.
- It reads only a path on your page's own origin, its scheme, host and port. An address anywhere else, another
  subdomain of your site included, is ignored, with a warning in the browser's console. An answer your server sends on
  to another origin counts as no one.
- When your page also sets `getUserToken`, the chat asks that instead.

Your server answers with a token your identity provider gave it, while it's fresh, or one it signs with a signing key (A
signing key, below).

The `token-url` line names the agent by its ID, `YOUR_AGENT_ID` here: the agent's Embed in your console gives it with
its own ID filled in. [Put an agent on your site](https://hados.io/api/docs/embed) shows each form of the chat.

#### A signing key

For an app with no identity provider, such as one with sessions behind a cookie: choose Make a signing key under Access
→ Single sign-on, in Embed sign-in. Your server signs a token for each signed-in person with it, and your page names
that server's path with `token-url` (Embed code, above). The server's lines, in five languages, are in [Put an agent on
your site](https://hados.io/api/docs/embed).

A signing key signs your people in to your chat alone. A connector's server signs them in with an identity provider of
its own, where each person connects once.

### Your own MCP server

An MCP server of yours can act for each person with their own account. It signs people in with your identity provider,
as MCP's authorization describes (its 2026-07-28 revision), and your agents connect each person to it the first time
they need it. A person whose browser is still signed in at your identity provider, as it is once they've signed in to
your app through its page, connects with no password (What a person meets, above). This section says what your server
and your identity provider serve for that, and what a connect sends them. A third party's server is connected the same
way, by what it serves.

#### Add it as a connector

Under Build → Connectors, choose Add a connector and give your server's MCP address. Your console asks the server what
it offers, then one question: "How does the agent sign in to this server?" It offers the choices the server takes, in
this order. Each user's own login comes first, chosen for you:

- **Each user's own login (Per-user OAuth)**: "Calls run as the person chatting." Every call runs as the person who
  sent the turn, with their own account at the server. The first call for someone who hasn't connected pauses the turn
  and asks them to connect. The turn goes on once they have. On their own account, each person decides which actions
  ask them first.
- **One shared account (Shared OAuth)**: "An owner or a manager signs in once; every chat uses it." Every person's
  calls go through that account alike.
- **API key**, or **No authentication**. These are shared too, and nobody connects.

On a shared one, your agent's builder decides which actions ask the person first.

Below the choices, Advanced: OAuth client says which OAuth client the connector signs in with (Its OAuth client,
below), and the scopes it asks for. Then turn the connector on in an agent's Connectors tab.

#### Its metadata

Your server names your identity provider as its authorization server in its protected-resource metadata (RFC 9728), as
MCP's authorization asks:

- `resource`: your server's address, the MCP address you add it by, or a path above it, such as its origin;
- `authorization_servers`: your identity provider's issuer. When it lists several, a connector keeps the one it already
  signs in at, else takes the first;
- `scopes_supported`: the scopes your tools need for everyday use.

Serve it at `/.well-known/oauth-protected-resource` followed by your MCP endpoint's path, such as
`https://mcp.acme.com/.well-known/oauth-protected-resource/mcp` for `https://mcp.acme.com/mcp`, or at the root,
`https://mcp.acme.com/.well-known/oauth-protected-resource`, and name it in your 401s (Its challenges, below). Your
console reads it as you add the connector: it calls your server with no token, and follows your 401 to it.

Your identity provider's own metadata is read again at every connect, at RFC 8414's address
(`/.well-known/oauth-authorization-server`) or OpenID Connect's (`/.well-known/openid-configuration`). Its `issuer` is
the one your server names. A connect reads these in it:

| It lists | So a connect |
| --- | --- |
| `S256` in `code_challenge_methods_supported` | Proves its code with PKCE. MCP requires it: a connect refuses an identity provider that doesn't list it |
| `client_id_metadata_document_supported`, and `none` in `token_endpoint_auth_methods_supported` | Can sign in with a client document (Its OAuth client, below) |
| `registration_endpoint` | Can register a client (Its OAuth client, below) |
| `openid` in `scopes_supported` | Asks for it, and for `profile` and `email` where each is listed, beside your server's scopes, so the connection shows the account's name. A connect that asks no scope of its own asks none of the three |
| `offline_access` in `scopes_supported` | Asks for it, so the connection renews |
| `authorization_response_iss_parameter_supported` | Refuses an answer that doesn't name its issuer (The sign-in, below) |

An identity provider without `S256` still checks your people's tokens for the embed, but a server that signs people in
there can't act for each person: add it with an API key.

#### Its OAuth client

Every connect needs an OAuth client at your identity provider: the app your people allow there. A connector signs in
with the first of these it has:

1. **Its own OAuth client**, one you make at your identity provider for your agents. Enter it under Advanced: OAuth
   client as you add the connector, where it's "Optional: registered with the provider for this connector alone, and
   used before any other.", or later in the connector's Settings. Advanced: OAuth client then names it: "Its own OAuth
   client, registered with the provider." One client can serve every connector at one identity provider: enter it on
   each.
2. **A client document** (OAuth Client ID Metadata Documents), where your identity provider lists
   `client_id_metadata_document_supported` and takes a client with no secret, `none` among its
   `token_endpoint_auth_methods_supported`: a document's client is public. It carries your name and icon, as your
   console holds them, and both redirect addresses (below). Its address is on your console's host: an identity provider
   that takes documents only from the domains it trusts must trust that one.
3. **A registration** (Dynamic Client Registration, RFC 7591), where your identity provider offers one: a client named
   for you, registered at the first connect and kept. MCP keeps registration for identity providers that take no client
   documents, and most identity providers refuse it until you turn it on there.
4. **None**: Advanced: OAuth client says "None: enter your OAuth client below.", and says the client is needed, "so
   enter your OAuth client here". The connector isn't added without one: "that server's login needs an OAuth client
   registered with its provider: enter its client ID and secret under Advanced: OAuth client".

A client you make allows the authorization code grant with PKCE, refresh tokens, both redirect addresses and the scopes
your servers ask for, with `offline_access`, and `openid`, `profile` and `email` where your identity provider lists
them. Usually it's a confidential client, with a secret; one with no secret is public. Each identity provider's steps
are under Each provider's setup. A new client means everyone signs in again: the connections made through the old one
go.

#### The redirect addresses

A connect comes back to one of two addresses, which a client you make allows as its redirect URIs. Advanced: OAuth
client shows both, to copy: "Register both redirect URIs with the provider: the console's, and the API's, where your
people connect from their chats."

- `https://hados.io/api/v1/connect/callback`, for your people, who connect from their chats: on your site, in your chat app,
  and through the API's links;
- your console's own, ending in `/connections/callback`, for your team, who connect in your console: on a connector's
  page and in the Playground.

A connector on one shared account comes back to your console's alone. A client document and a registration list both
by themselves.

#### The sign-in

Each connect is OAuth's authorization code flow, as MCP's authorization has it:

- **PKCE**, with the `S256` challenge, so only the connect that started a sign-in can use its code.
- **`resource`** (RFC 8707): your server's `resource`, as its metadata names it, in the sign-in and in the token
  request. Your identity provider issues the token for your server, and your server accepts only tokens issued for it,
  as MCP requires.
- **The scopes**: those your server's 401 names in its challenge, else its metadata's `scopes_supported`, as Advanced:
  OAuth client lists them; beside them, `openid` where your identity provider lists it, with `profile` and `email` where
  each is listed, so the connection shows the account's name from the ID token: its email, else its name, else its
  `preferred_username`; and `offline_access` last, where your identity provider lists it, so the connection renews. A
  connect that asks no scope of its own, as for a server that names none, asks none of the three: MCP's rule asks such
  a server for no scope, `offline_access` aside, and `openid` would replace your identity provider's default scopes.
  Leave `offline_access` out of your server's own scopes: a connect adds it where your identity provider lists it.
  Signing in again also asks what a connect asked for the person's connection before and your identity provider
  granted, so it keeps what it had; a name your identity provider added to its answer on its own isn't asked back. A
  connect for more access (Its challenges, below) asks the scopes your 403 names too.
- **`state`**, used once: a sign-in finishes within 10 minutes of its start, in the window that started it.
- **`iss`** (RFC 9207): when your identity provider names itself in its answer, the `iss` must be exactly the `issuer`
  its metadata names, a final slash and all. An answer naming another connects nothing. Where its metadata says it
  names itself (`authorization_response_iss_parameter_supported`), an answer without `iss` connects nothing either.

A connection keeps its tokens, which no one is shown and no agent reads. It's renewed with its refresh token before it
ends, and when your server refuses its token. When the person disconnects, its tokens are revoked where your identity
provider offers revocation.

#### Its challenges

Your server takes each person's token in `Authorization: Bearer …`, and says why it refuses one in `WWW-Authenticate`,
as MCP's authorization has it:

- **`401 Unauthorized`**, for a request with no token, or with one that's expired, revoked or not issued for your
  server: a challenge naming your metadata, and in `scope` the scopes the request needs, such as
  `WWW-Authenticate: Bearer resource_metadata="https://mcp.acme.com/.well-known/oauth-protected-resource/mcp", scope="orders:read"`.
  A connection whose token meets a 401 is renewed once; one still refused asks its person to sign in again, with "Sign
  in to {connector} again".
- **`403 Forbidden`**, for a good token that lacks a scope the request needs: `error="insufficient_scope"`, every scope
  the request needs in one `scope`, and your metadata, such as
  `WWW-Authenticate: Bearer error="insufficient_scope", scope="orders:read orders:write", resource_metadata="https://mcp.acme.com/.well-known/oauth-protected-resource/mcp"`.
  Keep 401 for a token that's no good: a missing scope is a 403. The person is asked to allow more access, with "Sign
  in to {connector} again", and that sign-in asks your connector's scopes, what was asked for their connection before
  and granted, and those your challenge names. The call goes on once they have; a call asks once, so one your server
  still refuses then ends.

### Each provider's setup

Each identity provider's own setup, in its own console's words: what Embed sign-in takes from it and your embed code,
for your people's tokens; then, for your MCP servers that sign people in there, how a connect gets its OAuth client.
Where a provider takes neither a client document nor a registration, make one client there for your agents, as below,
and enter it as each such connector's own, under Advanced: OAuth client. Both redirect URIs are the two addresses in The
redirect addresses, above.

#### Auth0

Give Embed sign-in your Auth0 domain, such as `acme.us.auth0.com`, or your custom domain. Its audience is your API's
Identifier, under Applications → APIs. Give your page's Auth0 client the same `audience`, so `getTokenSilently()`
answers a signed token rather than an opaque one.

Your embed code, which renews the token when it's due:

```js
const chat = document.querySelector('agent-chat')
chat.getUserToken = () => auth0.getTokenSilently()
```

Auth0 refuses an app that registers itself until you turn on Dynamic Client Registration, under Settings → Advanced,
which is off at first. Make a client for your agents instead, in the Auth0 Dashboard:

1. Go to Applications → Applications and choose Create Application.
2. Name it (Agents, say), choose Regular Web Applications, and create it.
3. On its Settings tab, paste both redirect URIs into Allowed Callback URLs, and save.
4. Under Advanced Settings → Grant Types, keep Authorization Code and Refresh Token on.
5. If your servers' tokens are for an Auth0 API, turn on Allow Offline Access in Applications → APIs → that API →
   Settings, so connections renew.
6. Copy the Client ID and Client Secret from its Settings tab into each connector's Advanced: OAuth client.

#### Okta

Give Embed sign-in your custom authorization server's address, such as `https://acme.okta.com/oauth2/default`. Custom
authorization servers come with Okta's API Access Management. Your org's own, `https://acme.okta.com`, won't do: its
access tokens are for Okta's own APIs, and others can't check them. Its audience is the authorization server's, under
Security → API → Authorization Servers: `api://default` for the default one.

Embed sign-in reads the person's ID from `uid` in your page's tokens, and from `sub` in ID tokens. Both are the Okta
user ID, which never changes; an Okta access token's `sub` is the person's login, which can. For an identity provider
you add now, there's nothing to set up for it. One added before Embed sign-in filled these in keeps `sub`, the login, as
the person's ID; adding it again fills them in, and names its people anew, by their user ID.

Your embed code, which renews the token when it's due:

```js
const chat = document.querySelector('agent-chat')
chat.getUserToken = () => oktaAuth.getOrRenewAccessToken()
```

Okta registers an app only for a caller with an API token, which your agents don't have. Make a client for your agents,
in the Okta Admin Console:

1. Go to Applications → Applications and choose Create App Integration.
2. Choose OIDC - OpenID Connect and Web Application, then Next.
3. Name it, tick Refresh Token beside Authorization Code, and paste both redirect URIs into Sign-in redirect URIs.
4. Under Assignments, choose who may use it, and save.
5. In Security → API → Authorization Servers, open the server your servers use, and check that an access policy rule
   lets this client in, with the scopes your servers ask for and `openid`, `profile` and `email`: a rule applies only
   when it allows every scope a connect asks.
6. Copy the Client ID and Client secret from its General tab into each connector's Advanced: OAuth client.

#### Entra ID

Give Embed sign-in your own tenant's address: `https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0`. The `common` and
`organizations` addresses name no one issuer, so Embed sign-in refuses them.

In your API's app registration, open Manifest and set `requestedAccessTokenVersion` to `2` (`accessTokenAcceptedVersion`
in the older manifest). Its access tokens then name the issuer Embed sign-in read, ending in `/v2.0`, and hold your
API's Application (client) ID as their audience. Give Embed sign-in that ID as the audience.

Embed sign-in reads the person's ID from `oid`, and fills that in itself: Entra ID's `sub` is different in each app,
while `oid` is the same person in every app of your tenant.

Your embed code, with your API's scope. MSAL renews the token when it's due. It needs the signed-in account set as its
active account (`msal.setActiveAccount`), to know whose token to get:

```js
// Your API's scope, as Expose an API shows it in its app registration
const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => {
  const result = await msal.acquireTokenSilent({
    scopes: ['YOUR_API_SCOPE'],
  })
  return result.accessToken
}
```

Entra ID can be your identity provider for the embed, but your MCP servers can't sign people in through it: its
discovery document doesn't list PKCE's S256, which MCP requires. A server that signs people in there can't act for each
person: add it with an API key.

#### Keycloak

Give Embed sign-in your realm's address, such as `https://sso.acme.com/realms/acme`. Its audience is the client an
Audience mapper puts in your tokens, set in your app client's dedicated client scope.

Your embed code, which renews the token first when it ends within 30 seconds:

```js
const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => {
  await keycloak.updateToken(30)
  return keycloak.token
}
```

Keycloak's Trusted Hosts policy refuses an app that registers itself, unless its request comes from a host you trust.
Make a client for your agents instead, in the Keycloak Admin Console:

1. Choose your realm, go to Clients and choose Create client.
2. Keep OpenID Connect, give it a Client ID (agents, say), and Next.
3. Turn on Client authentication, keep Standard flow on, and Next.
4. Paste both redirect URIs into Valid redirect URIs, and save.
5. On its Client scopes tab, choose Add client scope, and add the scopes your servers ask for as Optional. Create any
   that are missing under Client scopes in the menu. Keycloak refuses a scope its client wasn't given, so keep
   `profile` and `email`, which a new client has: a connect asks them.
6. Copy the Client ID, and the Client Secret from its Credentials tab, into each connector's Advanced: OAuth client.

#### Cognito

Give Embed sign-in your user pool's address, such as `https://cognito-idp.us-east-1.amazonaws.com/us-east-1_EXAMPLE`.
Its audience is your app client's ID, which Cognito's ID tokens hold. Its access tokens hold no audience, so your page
hands over the ID token.

Your embed code, here with Amplify, which renews the session's tokens when they're due:

```js
// With Amplify: import { fetchAuthSession } from 'aws-amplify/auth'
const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => {
  const { tokens } = await fetchAuthSession()
  return tokens?.idToken?.toString()
}
```

Cognito can be your identity provider for the embed, but your MCP servers can't sign people in through it: its
discovery document doesn't list PKCE's S256, which MCP requires. A server that signs people in there can't act for each
person: add it with an API key.

#### Clerk

Give Embed sign-in your Frontend API's address, such as `https://clerk.acme.com`, or `https://NAME.clerk.accounts.dev`
while you develop. Its audience is your site's address, its origin, such as `https://acme.com`: Clerk's session tokens
carry no `aud`, and name the site that asked for them in `azp`. With a JWT template that adds an `aud`, such as Convex's
`convex`, its audience is what that `aud` holds, since a token with an `aud` is judged by it alone. Its session tokens
last 60 seconds, and the chat asks for a new one before each ends.

Your embed code:

```js
const chat = document.querySelector('agent-chat')
chat.getUserToken = () => Clerk.session.getToken()
```

Clerk refuses an app that registers itself until you turn on Publish DCR support, under OAuth applications → Settings,
which is off at first. Make a client for your agents instead, in the Clerk Dashboard:

1. Go to OAuth applications and add an OAuth application.
2. Name it and choose the scopes your servers ask for, offline_access, and openid, profile and email.
3. Copy its Client Secret now: Clerk shows it once.
4. On its page, add both redirect URIs as Redirect URIs, and keep Public off.
5. Copy the Client ID from its Application credentials, and the secret, into each connector's Advanced: OAuth client.

#### Supabase

Give Embed sign-in `https://PROJECT_REF.supabase.co/auth/v1`, with your project's reference. Its tokens are checked
against the keys your project publishes, which it does once it signs with asymmetric JWT signing keys. A project still
on the legacy shared secret publishes none, so it can't be added. Its audience is `authenticated`, which every Supabase
session token holds.

Your embed code:

```js
const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => {
  const { data } = await supabase.auth.getSession()
  return data.session.access_token
}
```

Supabase refuses an app that registers itself until you turn on dynamic client registration, under Authentication →
OAuth Server, which is off at first. Make a client for your agents instead, in your Supabase project's dashboard:

1. Turn on the OAuth server in Authentication → OAuth Server.
2. Go to Authentication → OAuth Apps and choose Add a new client.
3. Name it, add both redirect URIs as Redirect URIs, choose Confidential as its Client type, and create it.
4. Copy the Client ID and Client Secret into each connector's Advanced: OAuth client: the secret is shown once.

#### Firebase

Give Embed sign-in `https://securetoken.google.com/PROJECT_ID`, with your project's ID. Its audience is that ID, which
every Firebase ID token holds.

Your embed code:

```js
const chat = document.querySelector('agent-chat')
chat.getUserToken = () => firebase.auth().currentUser.getIdToken()
```

Firebase signs no other apps in, so your MCP servers can't sign people in through it.

#### Logto

Give Embed sign-in your Logto tenant's address, such as `https://acme.logto.app/oidc`, or just `acme.logto.app`. A
custom domain is an issuer of its own: use one host everywhere, in Embed sign-in, in your page's Logto client and in
your MCP servers' metadata. Its audience is your API resource's indicator, the API identifier your page asks Logto for
a token for. Logto signs with ES384 by default, which Embed sign-in reads.

Logto's access tokens carry no name or email, so the agents don't know a person's name until they're told it: add
`name` and `email` to your access tokens as custom token claims in Logto, or have your server tell the agents through
`PUT /users/{id}`.

Your embed code:

```js
// Your API resource’s indicator, as Logto’s API resources show it
const chat = document.querySelector('agent-chat')
chat.getUserToken = () =>
  logtoClient.getAccessToken('https://api.acme.com')
```

Logto doesn't let apps register themselves. Make a client for your agents, in the Logto Console:

1. Go to Applications and choose Create application.
2. Choose Traditional web, name it (Agents, say), and create it.
3. On its page, paste both redirect URIs into Redirect URIs, and save changes.
4. For each MCP server your connectors reach, go to API resources and create one whose API identifier is the server's
   `resource` exactly, as its metadata names it, with the permissions your server asks for.
5. In Roles, give the people who use your agents a role holding those permissions: Logto puts a permission in a token
   only for someone whose role holds it.
6. Copy the App ID and App secret from its page into each connector's Advanced: OAuth client.

Logto gives a refresh token only when a sign-in asks for consent, so a connect at Logto asks for it (`prompt=consent`).
Logto shows its own apps, such as a Traditional web one, no consent screen, so your people still go straight through.

#### Google

Google signs people in to its own services, and to servers that sign people in with Google accounts. A connect at
Google asks for access offline, with the person's consent (`access_type=offline`, `prompt=consent`): Google gives a
refresh token only then. So each time a person connects, Google asks them to allow your agents' access, even when
they're signed in to Google already.

Google lets no app register itself. Make a client for your agents in the Google Cloud console: an OAuth client of the
Web application type, with both redirect URIs as its Authorized redirect URIs, and its consent screen set up as Google
asks. Copy its Client ID and Client secret into each connector's Advanced: OAuth client.

#### Any OpenID Connect identity provider

Give Embed sign-in its domain, or its issuer's address. Its audience is what your tokens' `aud` holds: often your API's
identifier, or your app's client ID.

Your embed code, here with oidc-client-ts:

```js
// Any OpenID Connect identity provider: its ID or access token,
// here with oidc-client-ts
const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => (await userManager.getUser())?.id_token
```

Many identity providers refuse an app that registers itself until you turn that on, and take no client documents.
Where yours takes neither, make a client for your agents in its admin console:

1. Register a new web application: a confidential client, with a client secret.
2. Add both redirect URIs as its redirect URIs, which some consoles call callback URLs.
3. Allow the authorization code grant with PKCE (S256), refresh tokens with `offline_access`, the scopes your servers
   ask for, and `openid`, `profile` and `email`.
4. Copy its client ID and secret into each connector's Advanced: OAuth client.

### Visitors don't connect accounts

Only a user connects their own accounts. A visitor isn't signed in to your app, so nothing vouches for who they are: an
account connected in their chat would belong to a browser, not to a person your app knows, and no one could find it
again or protect it. So a visitor's turns offer none of the tools on a connector on each user's own login, and their
chat's menu offers no account to connect. An agent anyone may use, which its Share calls "Anyone, including visitors",
gives visitors its other tools.

To let someone connect their own accounts, sign them in to your app: the chat then knows them as a user (How your
people are known, above).

The connections a visitor still has stay theirs until they end: 30 days after the visitor's last visit, or when your
server erases the visitor (`DELETE /visitors/{id}`). Their chat's menu lists them, says when they end, and lets the
visitor disconnect any. Your server lists and removes them with `GET /visitors/{id}/connections` and
`DELETE /visitors/{id}/connections/{connector}`.

### What goes wrong

#### In the chat

What a person may see while they connect, why, and what changes it. Each refusal is a problem the API answers too, and
its code links its page.

- **"Open this from your chat"** ([`connect_open_from_chat`](https://hados.io/problems/connect_open_from_chat))
  - Why: a connect goes on only in the window that started it, which holds its binding. This one was opened another
    way, such as a copied link or a new tab.
  - What to change: go back to the chat and choose its card's button. Through the API, where the window started at the
    link's page, it says "This sign-in goes on only in the window it started in. Open the link you were given again,
    and choose Continue there.": open the interrupt's link again, for its person.
- **"This sign-in expired or was already used. Close this window and start again."**
  ([`sign_in_expired`](https://hados.io/problems/sign_in_expired))
  - Why: a sign-in finishes once, within 10 minutes of its start.
  - What to change: start it again from the chat's card, or open the interrupt's link again.
- **"Your account wasn't connected. Close this window and try again."**
  ([`connect_failed`](https://hados.io/problems/connect_failed))
  - Why: the sign-in refused to finish, or couldn't be reached, or its answer named another issuer than the identity
    provider's metadata does.
  - What to change: try again from the chat. If it fails again, check the OAuth client at the provider: both redirect
    URIs, the scopes it allows, and refresh tokens on; and that the `iss` it answers is exactly the `issuer` its
    metadata names.
- **"This account can't be connected right now. Let the app's team know."**
  ([`cant_connect`](https://hados.io/problems/cant_connect))
  - Why: the connector can't sign anyone in until your team changes something, such as an OAuth client it needs, where
    its server's sign-in takes neither a client document nor a registration from it. A visitor who meets a card asking
    them to connect is told the same: only someone signed in connects their own accounts (Visitors don't connect
    accounts, above).
  - What to change: open the connector under Build → Connectors, and give it its own OAuth client in its Settings. For
    a visitor, nothing at the connector: sign them in to your app, and they connect as a user.
- **"This link is no longer open. Go back to the conversation to see where it stands."**
  - Why: the turn no longer waits for this account. It was connected or declined, the turn ended, or 24 hours passed.
  - What to change: go back to the conversation.
- **"This page can't connect accounts: it isn't served over https. Let the site's team know."**
  - Why: the chat's page is served over plain http, where the browser has no Web Crypto for the binding.
  - What to change: serve the page over https. `http://localhost` works while you develop.
- **"The sign-in couldn't start just now. Try again in a moment."**
  - Why: the connect couldn't be asked for: the chat couldn't reach your agents, or the server's identity provider's
    metadata couldn't be read.
  - What to change: try again. If it keeps failing, check your agents are reachable from the page, and that your
    identity provider's metadata answers.
- **"Your browser kept the window from opening. Allow pop-ups for this site, then try again."**
  - Why: the browser blocked the sign-in's window.
  - What to change: allow pop-ups for your site.

#### In your setup

- **A server at your identity provider can't act for each person.**
  - Why: its identity provider's document doesn't list the code check MCP requires (PKCE's S256), as Entra ID's and
    Cognito's don't, or it signs no other apps in, as Firebase.
  - What to change: it still checks your people's tokens for the embed. A server that signs people in there can't act
    for each person: when you add it, choose API key.
- **Add a connector says the OAuth client is needed, and doesn't add the connector.**
  - Why: the server's sign-in takes neither a client document nor a registration, as most identity providers don't
    until you turn registration on there.
  - What to change: make a client for your agents at its identity provider (Each provider's setup, above), and enter
    it under Advanced: OAuth client.
- **Signing in to a connector says to "give this connector its own OAuth client, registered with its provider".**
  - Why: the server's sign-in refused a registration, as most identity providers do until you turn that on there.
    Keycloak's Trusted Hosts policy refuses one, Okta wants an API token, and Auth0, Clerk and Supabase keep it behind a
    switch that's off at first.
  - What to change: give the connector its own OAuth client in its Settings, or turn registration on there.
- **Your identity provider's page says the redirect URI isn't allowed.**
  - Why: the OAuth client doesn't list the address the connect comes back to.
  - What to change: add both redirect URIs to the client.
- **People are asked to sign in again right after they connect.**
  - Why: your server refuses the tokens their connections bring, with a 401: most often their audience isn't your
    server, since your identity provider didn't issue them for the `resource` the connect named.
  - What to change: have your identity provider issue tokens for your server's `resource` (as an API's identifier, or
    an API resource's), and have your server read each token's `aud`.
- **A connection says "Signs in again when its access ends" in the chat's menu.**
  - Why: its sign-in brought no refresh token: the client's refresh tokens are off, or your identity provider doesn't
    offer or grant `offline_access`.
  - What to change: allow refresh tokens, and `offline_access`, for the client. The person's next sign-in brings one.
- **A connection says "Sign in again next time" in the chat's menu.**
  - Why: your server refused its token, and it couldn't be renewed: the person removed your agents' access at the
    service, or your identity provider ended its refresh token.
  - What to change: nothing at your end: an agent that needs it asks the person to sign in again.
- **Embed sign-in refuses Entra ID's `common` or `organizations` address.**
  - Why: those name no one issuer.
  - What to change: give your own tenant's, `https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0`.
- **Entra ID's tokens are refused as `wrong issuer`.**
  - Why: version 1 access tokens name `https://sts.windows.net/YOUR_TENANT_ID/` as their issuer.
  - What to change: set `requestedAccessTokenVersion` to `2` in your API's manifest.
- **Entra ID's tokens are refused as `wrong audience`.**
  - Why: version 2 access tokens hold your API's Application (client) ID, not its Application ID URI.
  - What to change: give that ID as the audience.
- **One person chats as two users, in the embed and through the API.**
  - Why: their token's ID isn't the one your servers name them by.
  - What to change: point the person's ID claim, in Embed sign-in, at the claim your servers name them by.
- **Okta's tokens are refused.**
  - Why: your org's own authorization server's access tokens are for Okta's own APIs, and can't be checked.
  - What to change: use a custom authorization server, such as `https://acme.okta.com/oauth2/default`. Custom
    authorization servers come with Okta's API Access Management.
- **A page's token is refused** (`user_token_invalid`).
  - Why: Embed sign-in says why, on the token issuer or signing key that refused it.
  - What to change: paste one into Test a token, in Embed sign-in, to see why. Each reason, and what to change, is in
    [Put an agent on your site](https://hados.io/api/docs/embed).
- **The browser's console says `agent-chat: token-url failed: the server answered 401`.**
  - Why: your path answered an error for someone who isn't signed in.
  - What to change: answer `200` with nothing for them.
- **The browser's console says `agent-chat: token-url must be a path on this site, so it isn't fetched.`**
  - Why: `token-url` names an address on another origin, which the chat never reads: another scheme, host or port.
  - What to change: name a path on your page's own origin, such as `/chat-token`.
- **Resuming a `chat:connect` interrupt answers `not_connected`.**
  - Why: the person hasn't connected yet. For more access (`metadata.chat.more_access`), their account works, but they
    haven't signed in again asking for that access.
  - What to change: open the interrupt's link for them. Once they've connected, the turn goes on by itself: there's
    nothing to resume.

## Your chat app

Your chat app is your people's own app for your agents: your name, your look and your sign-in, at an address of yours.
This guide explains how it works and how to set it up in your console, for the people who run it and for developers.

### Its address

- **Your address.** Your chat app is at your handle on the chat app's domain, such as `https://acme.example.com`.
  Deliver → Chat app in the console shows it, beside a copy button and "Open the app".
- **https.** It's served over https with a certificate of its own, and an `http://` address is sent there.
- **Your own domain.** An address of your own, such as `chat.yourcompany.com`, comes later.

### Opening it

Your chat app is closed until an owner or a manager opens it in Deliver → Chat app.
- **While it's closed**, its address shows "{name} isn't open yet." and signs no one in. Closing it again asks first.
- **Preview as you** opens it as you'd see it, even while it's closed. An owner, a manager or a builder can preview.
- **Its look.**
  - Its name, its welcome line, its support address (which its emails reply to), its logos for light and dark, and its
    icon are set on the same page.
  - Its colours, font and corners are your brand's (Deliver → Brand).
  - Installed on a phone or a computer, it keeps your name and icon.

### Who can join

Access → Sign-in says who can make an account:
- invited people only, the default;
- anyone;
- anyone with an address at your domains.

Access → People invites people by address.
- **An invitation.** It lasts 14 days, one an address. It can be sent again or revoked, and can put the person in
  groups as they join.
- **Where only invited people join**, the sign-in page offers no sign-up: it reads "New to {name}? Enter the address
  your invitation went to, or ask your admin for one." An address with no account that has an invitation is offered
  sign-up for it; one without reads "There's no {name} account for {email}. Ask your admin for an invitation." No code
  is sent to an address that may not join.
- **Where people at your domains join**, sign-up asks for a work email.
- **Where your identity provider makes accounts** (Access → Single sign-on, Who signs in), an address at its domains is
  sent to it to sign in, whoever may join otherwise.
- **Someone who may not join** is told before any code is sent:
  - where only invited people join: "{email} has no open invitation to {name}. Use the address your invitation went
    to, or ask your admin to send you one." An invitation that lapsed reads so too.
  - where people at your domains join: "That address isn't one {name} takes. Use your work email, or ask your admin
    for an invitation."
  - signing in through your identity provider: "Ask {name}'s admin for an invitation."

### How people sign in

The ways to sign in are an email code, a password and passkeys, each on unless you turn it off in Access → Sign-in.
- **A way that's off** reads "That way of signing in is turned off here."
- **Two-step verification** is off, required for admins (the default), or required for everyone. A person it's
  required of sets it up before their first session.
- **Single sign-on** adds your organization's own sign-in beside them (below).

People manage their own account in Settings › Security: their password, passkeys, two-step verification, their devices
and their recent activity.

### Single sign-on

Single sign-on signs your people in to the chat app with your organization's identity provider, over OpenID Connect.
Set it up in Access → Single sign-on, or in the chat app's own admin area:

1. **Add identity provider.** Give its issuer URL, such as `https://login.yourcompany.com`. Its discovery document is
   read, and must offer an authorization and a token endpoint. For a provider with no discovery document, enter its
   endpoints manually: its issuer, its authorization, token and UserInfo endpoints, and its JWKS URI.
2. **Its OAuth client.** At your identity provider, create a confidential OAuth client (an OpenID Connect application)
   for the authorization code flow, with the redirect URI and the scopes the form shows:
   - the redirect URI is your chat app's address and `/api/v1/passport/sso/callback`;
   - the scopes are `openid email profile`, and your groups claim's scope where your provider lists one;
   - its ID tokens are signed with an asymmetric key, such as RS256 or ES256, never with the client secret.

   Paste its client ID and secret, and save: they're checked at your provider's token endpoint, and the secret is never
   shown again. The provider's page opens.
3. **Who signs in**, on the provider's page.
   - **Your domains.** People whose address is at them sign in with your provider, and your provider's word on such an
     address is trusted: make sure people can't change their own email there.
   - **Required.** Such an address must use single sign-on: it reads "This address signs in with your organization's
     account." at every other way in.
   - **Accounts made.** With it on, people at your domains get an account the first time they sign in, even when only
     invited people may join.
   - **Groups.** Your provider's groups claim, picked from the claims it lists, puts each person in your groups, value
     by value, at every sign-in.
4. **Test, then turn it on.** Both are at the top of the provider's page. Test sign-in signs in through it in a window:
   you see what your provider said and what would happen, and nothing is made. Turn on is beside it once your provider
   accepts its OAuth client. A test and turning it on use what's saved, so save your changes first.

People then see "Continue with {provider}" on the sign-in page. Someone signed in this way confirms it's them through
your provider too, when "Confirm it's you" asks.

One identity provider can serve both: single sign-on to the chat app, and embed sign-in, your site's tokens for the
embed. A person known on your site and in the chat app is then one person, with one history.

### People, groups and the admin area

- **People.** Access → People lists your people and invitations. Each person is an admin or a user, can be suspended,
  restored or removed, and can belong to groups.
- **Groups.** Access → Groups holds up to 100. An agent can be narrowed to some of them, so only their people meet it.
- **The admin area.** The chat app has an admin area for your organization's IT admins, in your brand. It's Admin in
  an admin's own menu, with five sections:
  - People: your people and invitations;
  - Groups: your groups and the agents each sees;
  - Sign-in: who can join, the ways in, two-step and single sign-on;
  - Usage: the last 30 days, with no costs;
  - Activity: what changed, and who changed it.

  An admin needs two-step verification on to use the admin area, unless Access → Sign-in turns it off; one who signs in
  through single sign-on has their provider's sign-in instead. A change past the hour after their sign-in asks
  "Confirm it's you" first.

### Agents in it

- **Putting an agent in.** A published agent joins the chat app from its Share tab: "Put it in the chat app", then
  "Who sees it in the chat app", Everyone or These groups.
- **The order.** Deliver → Chat app sets the order people meet your agents in, and the agent new chats start with.
- **What people see** of an agent is what its version in use shows: its name, picture, title, description and
  starter prompts.

### What your people can do

- **Home.** It greets them, with the agent they last chose and the others. New chat (⌘⇧O on a Mac, Ctrl+Shift+O
  elsewhere) starts a chat, and Search (⌘K on a Mac, Ctrl+K elsewhere) finds one by its words.
- **History.** One history across every agent, by day. They rename, pin and delete chats, and pin the agents they use
  most. Pinned holds both.
- **Settings.** Its sections are Profile, Memory, Connected accounts, Files, Security, Appearance and Data.
  - Memory holds About you, what they tell every agent about themselves, and what each agent remembers of them, with
    Forget.
  - Data deletes every conversation, or their account.
- **The embed.** When your site and the chat app sign them in through the same identity provider (single sign-on,
  above), a conversation they had in the embed on your site is in their history too, marked "From the website".

### For developers: the routes it uses

On your chat app's address, the app calls the routes below under `/api/v1`, with the access token its sign-in issues.
They're the person routes the API host serves, each in the [API reference](https://hados.io/api/docs), taking your chat app's
tokens instead of your API keys. The sign-in itself is under `/api/v1/passport`, its discovery document at
`/api/v1/passport/.well-known/openid-configuration`.

| Route | What it is |
|---|---|
| `GET /me` | Who's signed in: their name, language, time zone, role, photo and pins |
| `GET`, `PUT /me/about` | About you |
| `PUT /me/photo` | Their photo |
| `PUT`, `DELETE /me/pins/{kind}/{id}` | A pin, of a chat or an agent |
| `GET /me/search` | Their chats by their words |
| `DELETE /me/conversations` | Every conversation of theirs, at once |
| `GET /me/memory` | What each agent remembers of them |
| `GET /me/connections` | Their connected accounts |
| `GET /me/files` | The files agents kept for them |
| `GET /agents` | The agents in the chat app they may use, in its order |
| `GET`, `POST /agents/{id}/conversations` | Their chats with an agent, and a new one |
| `GET /conversations` | Their chats with every agent |
| `/admin/…` | The admin area's routes, for admins alone |

### What goes wrong

| People read | Because |
|---|---|
| "{name} isn't open yet." | The chat app is closed: open it in Deliver → Chat app. |
| "There's no {name} account for {email}. Ask your admin for an invitation." | At the sign-in page: that address has no account and may not make one. Invite it, or widen who can join. |
| "{email} has no open invitation to {name}. …" | Only invited people join, and that address has no invitation, or its invitation lapsed after 14 days: send it again, or widen who can join. |
| "That address isn't one {name} takes. …" | Their address isn't at your domains: invite it, or add its domain in Access → Sign-in. |
| "Ask {name}'s admin for an invitation." | They may not join: invite them, or widen who can join. |
| "That way of signing in is turned off here." | The way they tried is off in Access → Sign-in. |
| "This address signs in with your organization's account." | Their address is at a domain where single sign-on is required. |
| "Confirm it's you" | An admin's sign-in is over an hour old for a change in the admin area, or a person is changing their own account. |

The admin area also says, in words, when an admin must turn two-step verification on before they can use it.

## Problems

Every refusal and failure is a problem detail (RFC 9457), `application/problem+json`, with one of these codes as its `code` and the code's page, `https://hados.io/problems/{code}`, as its `type`.

| Code | Status | Title | What to do |
| --- | --- | --- | --- |
| `invalid_request` | 400 | The request isn't valid | A parameter, a header or a member of the body is missing or wrong. `errors` names each, by `pointer`, `parameter` or `header`: fix them and send it again. |
| `person_required` | 400 | The call names no one | Name the person the call is for: someone signed in to your app with `X-User-ID`, or a visitor with `X-Visitor-ID`. |
| `person_conflict` | 400 | The call names two people | Send `X-User-ID` or `X-Visitor-ID`, never both. |
| `person_header_not_here` | 400 | The call's sign-in names its person itself | A call with an embed session, or from your chat app, is its sign-in's person's: leave out `X-User-ID` and `X-Visitor-ID`. |
| `idempotency_key_required` | 400 | An Idempotency-Key is required | Send this call with an `Idempotency-Key` header, a key of your own for this request, so a call sent again is taken once. |
| `idempotency_key_invalid` | 400 | The Idempotency-Key isn't valid | A key is 1 to 100 visible ASCII characters, sent as a Structured Fields string: `Idempotency-Key: "8e03978e-40d5-43e8-bc93-6894a57f9324"`. |
| `answer_invalid` | 400 | The answer doesn't fit its interrupt | A resume entry's `payload` keeps to its interrupt's `responseSchema`: `errors` names the member at fault. |
| `attachments_not_supported` | 400 | The message carries more than text | AG-UI's run endpoint sends a message's text: attach files through the conversation's files, and name them on `POST /conversations/{id}/messages`. |
| `method_not_allowed_for_apps` | 400 | An app can't ask for this | An app's request on the run endpoint is `tools/call`, `resources/read`, `notifications/message` or `ping`: anything else is refused before anything is read. |
| `app_arguments_invalid` | 400 | The app's call has the wrong arguments | A `tools/call`'s `arguments` are a JSON object of at most 50,000 characters. |
| `invalid_app` | 400 | The message's app isn't shown here | `app.activity` names an app this conversation shows, from a connector that still shows its apps: a message from any other is refused. |
| `invalid_action` | 400 | The action isn't one the conversation takes | An action is a button the person pressed in a surface the agent showed and still holds open, with words for their message: `errors` names the member at fault. |
| `sign_in_expired` | 400 | The sign-in expired | A sign-in finishes once, within 10 minutes of its start: start it again from the conversation. `detail` says so in the person's words. |
| `connect_failed` | 400 | The account wasn't connected | The provider refused to finish the sign-in, or couldn't be reached, so nothing was connected: start it again from the conversation. `detail` says so in the person's words. |
| `api_key_invalid` | 401 | A valid API key is required | Send one of your API keys as `Authorization: Bearer <key>`. A key that was revoked, or never was, is refused the same way. |
| `session_invalid` | 401 | A valid embed session is required | Send the embed session `POST /embed/sessions` answered, as `Authorization: Bearer <session>`. One that was never made, whose person was erased, or whose identity provider or signing key was removed is refused the same way: ask for a new one. On your chat app, a sign-in that ended is refused so too: sign in again. |
| `session_expired` | 401 | The embed session has ended | Ask for a new session with `POST /embed/sessions`: for a signed-in person, with a fresh token from your identity provider or signing key. |
| `preview_invalid` | 401 | The preview link has expired | A link to preview your chat app works once, within a minute of being made: open a new one from the console's Deliver → Chat app. |
| `user_token_invalid` | 401 | The user token wasn't accepted | The token didn't verify under your identity providers and signing keys. The console's Access → Sign-in page says why the last one was refused. |
| `tenant_suspended` | 403 | This account is suspended | Calls are refused until the account is active again. |
| `chat_app_closed` | 403 | This chat app isn't open | Your chat app takes no sign-in and no call until it's opened, in the console under Deliver, then Chat app. |
| `sign_in_required` | 403 | This is for people who are signed in | A visitor can't use it: an agent for signed-in people, or what's kept for a person across conversations, such as their files, memory and About you. Name someone signed in to your app, with `X-User-ID`, or ask for an embed session with their user token. |
| `sign_in_not_accepted` | 403 | This agent doesn't take this sign-in | The embed session's person signed in through an identity provider, or your signing keys, that the agent doesn't take. Choose the sign-ins it takes in the console, under Deliver, then Embed, then Who chats. |
| `attachments_off` | 403 | This chat takes no files | The agent's embed has Attachments off, so an upload, or a check of one, through an embed session is refused, the embed's preview included. Your chat app and your API keys aren't refused. Turn it on in the console, under Deliver, then Embed, then What it shows. `detail` says so in the person's words. |
| `site_not_allowed` | 403 | This site isn't one of the embed's sites | The page's origin isn't among the agent's embed sites, so its launcher isn't drawn there. Add the origin in the console, under Deliver, then Embed, then Your sites. |
| `admin_only` | 403 | This is for the chat app's admins | The admin area is open to the people your chat app made admins, signed in to it: an API key, an embed session, a preview or a person who isn't an admin can't use it. |
| `two_step_required` | 403 | Two-step verification comes first | Your chat app asks its admins for two-step verification: set up an authenticator in Settings, under Security, then come back. |
| `recent_sign_in_required` | 403 | Sign in again to make this change | Changes in the admin area need a sign-in from the last hour: confirm it's you, then send the change again. |
| `connect_open_from_chat` | 403 | Open this from the chat | A connect finishes only in the window it started in, which holds its binding: start it again from the chat's Connect card, or open its link again. |
| `app_other_connector` | 403 | The activity is another connector's app | A call's `activity` names an app of another connector than the one its request names. |
| `app_tool_not_offered` | 403 | The app can't call this tool | An app calls only its own connector's tools whose visibility includes `app`. |
| `app_tool_unavailable` | 403 | This tool is off for the agent | The agent's tool is turned off, so its app can't call it either: the call is refused before it starts. |
| `not_found` | 404 | There's nothing here | No call is at this address. The API's document lists every one. |
| `app_not_found` | 404 | No such app here | This conversation shows no app of that connector, or at that address, or under that activity, or its connector no longer shows its apps. |
| `person_not_found` | 404 | No such person | Your app hasn't named this person, or they were erased. |
| `pin_not_found` | 404 | That isn't pinned | The person hasn't pinned this agent or conversation, or has unpinned it. |
| `issuer_not_found` | 404 | No such identity provider | It was removed, or isn't your chat app's: read the providers again. |
| `sso_test_not_found` | 404 | No such test | A test is kept fifteen minutes: start another. |
| `photo_invalid` | 400 | Not a photo | A photo is a JPEG, PNG or WebP image, by its bytes. |
| `photo_too_large` | 413 | The photo is too large | A photo is at most 5 MB. |
| `photo_not_found` | 404 | No photo | The person hasn't given a photo, or has taken it away. |
| `agent_not_found` | 404 | No such agent | No agent with this ID is shared through the API. |
| `embed_off` | 404 | This chat isn't open | No agent with this ID has its embed open to this session. |
| `conversation_not_found` | 404 | No such conversation | This person has no conversation with this ID: it was never theirs, or it was deleted. |
| `run_not_found` | 404 | No such turn | This person has no turn with this ID, or the conversation has no turn to try again. |
| `file_not_found` | 404 | No such file | The conversation has no file with this ID, or a message names a file that isn't one the person attached there: it was never its, or it was deleted. |
| `download_link_expired` | 404 | The download link has expired | A download link opens for five minutes from when it was made, while its person can still read the file: ask for another with `POST …/download-link`. A download it started goes on. |
| `preview_unavailable` | 404 | No smaller copy to show | This file will never have a smaller copy: it isn't a picture, it's a picture too large to show small, or it couldn't be read. Download it to look at it. A picture still being read is `file_not_found` until it's read. |
| `home_not_found` | 404 | No such home | This person has no home kept in that agent's sandboxes. |
| `process_not_found` | 404 | No such background job | The conversation has no background job of this number. |
| `interrupt_not_found` | 404 | No such interrupt | The conversation's turns never waited on this person for an interrupt with this ID. |
| `connector_not_offered` | 404 | Not an account this agent connects | The agent doesn't use this connector on each person's own login, or the person is a visitor: only someone signed in connects their own accounts. |
| `task_not_found` | 404 | No such task | The conversation has no task with this ID. |
| `connection_not_found` | 404 | No such connection | This person hasn't connected an account on this connector, or removed it. |
| `memory_not_found` | 404 | No such memory | No agent remembers anything of this person with this ID: it was never theirs, or it was forgotten. |
| `memory_ask_not_found` | 404 | No such change to memory | The conversation has no change to memory with this ID waiting or answered: it was never there, or 7 days passed and it went. |
| `invitation_not_found` | 404 | No such invitation | Your chat app has no pending invitation with this ID: it was revoked, or its address joined. |
| `group_not_found` | 404 | No such group | Your chat app has no group with this ID: it was deleted. |
| `method_not_allowed` | 405 | The method isn't allowed here | This address takes other methods: `Allow` lists them. |
| `conversation_busy` | 409 | The conversation is busy | Another change to it is under way: send this again in a moment. |
| `too_many_waiting` | 409 | Too many messages are waiting | Twenty messages already wait, held ones among them: remove some, or send this one once the agent catches up. |
| `nothing_to_stop` | 409 | Nothing to stop | No turn is under way in this conversation. |
| `apps_not_shown` | 409 | The connector no longer shows its apps | Its team turned its apps off since the app was shown. |
| `message_taken` | 409 | The message isn't waiting | It already started its turn, the agent read it, or it was removed: the conversation's `waiting` lists what still waits. |
| `turn_ended` | 409 | The turn ended first | The message didn't steer it: it waits first instead, and starts the next turn. |
| `message_held` | 409 | The message is held | A stop held it, and the turn it was meant for ended: send it to start a turn, or remove it. |
| `message_not_held` | 409 | The message isn't held | Only a message a stop held is sent: this one waits for the turn under way, so steer it or remove it. |
| `run_not_retryable` | 409 | The turn can't be tried again | Only a conversation's last turn can be tried again, once it failed or was stopped and nothing is under way. |
| `process_not_running` | 409 | The background job has ended | Only a job still running can be stopped. |
| `task_not_running` | 409 | The task has ended | Only a task still running can be cancelled. |
| `interrupt_answered` | 409 | The interrupt was answered | It took its first answer: the conversation's `interrupts` are those still open. |
| `interrupt_expired` | 409 | The interrupt is no longer open | What asked it moved on without it: the person stopped the turn, wrote something else or left it 24 hours, or the task that asked it ended or asked again. Send a message to go on. |
| `nothing_to_pause` | 409 | Nothing to pause | No turn is under way in this conversation. |
| `not_paused` | 409 | The turn isn't paused | Only a turn the person paused goes on with continue. |
| `interrupts_pending` | 409 | The turn waits for answers | Answer its open interrupts with resume: the conversation's `interrupts` lists them. |
| `not_connected` | 409 | The account isn't ready yet | Its person hasn't connected it, or hasn't allowed the more access its card asks. Open the `chat:connect` interrupt's link for them to sign in. Once they have, the turn goes on by itself, with nothing to resume. |
| `cant_connect` | 409 | The account can't be connected | The connector can't sign people in until your team changes something, such as its app: the console's Connectors page says what. A visitor connects no account: only someone signed in does. |
| `memory_ask_answered` | 409 | The change to memory was answered | It took its first answer, here or in another window: the conversation's `memory_asks` are those still waiting. |
| `memory_gone` | 409 | The memory it changes is gone | The memory the change renames or forgets was forgotten since, so there's nothing to change: the change waits for an answer still, and Don't save drops it. |
| `memory_full` | 409 | The agent remembers too much of this person | An agent keeps at most 200 memories of one person: delete one, then save the change again. |
| `memory_taken` | 409 | Another memory has that name | The change renames a memory to the name of another one: Don't save drops it. |
| `memory_name` | 409 | The memory's name isn't one it can have | Don't save drops the change; the agent names memories again as it chats. |
| `memory_too_long` | 409 | The memory is too long | A memory holds at most 2,000 characters: Don't save drops the change. |
| `memory_never_kept` | 409 | The memory holds what's never kept | A card number, a private key or a secret is never kept in memory: Don't save drops the change. |
| `memory_unused` | 409 | The agent doesn't remember people | Its team turned its memory off, so there's no switch to move: what it kept is still listed, to delete. |
| `too_many_pins` | 409 | Too many pins | A person keeps at most 50 pins: unpin one before pinning another. |
| `too_many_files` | 409 | The conversation holds too many files | A conversation holds at most 100 files: delete one first. |
| `file_sent` | 409 | A file went with another message | Each file goes with one message: attach it again to send it with this one. |
| `file_name_taken` | 409 | The file's name is taken | Every number of this name is taken in the conversation: send the file under another name. |
| `invitation_just_sent` | 409 | The invitation was just sent | An invitation is sent again at most once a minute: wait a minute, then resend it. |
| `has_account` | 409 | The address has an account | Someone with this address joined already: find them among your people instead. |
| `sign_in_busy` | 409 | Someone else is changing how people sign in | Read the sign-in rules again and send your change once more. |
| `group_exists` | 409 | A group has this name | Each group's name is its own, whatever its case: choose another name. |
| `too_many_groups` | 409 | Too many groups | Your chat app keeps at most 100 groups: delete one before making another. |
| `last_group` | 409 | The agent is for this group alone | Taking this group off the agent would let everyone see it: give it another group first, or ask your agency to take it out of the chat app. |
| `issuer_taken` | 409 | That identity provider is added already | Your chat app has that issuer: set up single sign-on on it instead. |
| `too_many_issuers` | 409 | Your chat app has all the identity providers it may | A chat app has at most 5 identity providers: remove one first. |
| `sso_domain_taken` | 409 | Another identity provider signs that domain in | Each email domain signs in with one identity provider: take it off the other one first. |
| `sso_not_working` | 409 | Single sign-on's client doesn't work yet | Single sign-on turns on once your identity provider accepts its client: check the client ID and secret, then check it again. |
| `sso_unsupported` | 422 | That identity provider can't sign people in here | Its discovery document lacks what single sign-on needs: an authorization endpoint, a token endpoint, and the openid scope where it lists scopes. Use another identity provider, or fix its settings there. |
| `sso_busy` | 409 | Someone else is changing this single sign-on | Other changes to it kept coming first: read it again, then send yours once more. |
| `not_yourself` | 409 | That's your own account | An admin can't change their own role, suspend or remove themselves: ask another admin, so your chat app always has one. |
| `idempotency_key_in_use` | 409 | A request with this key is still being answered | Wait for its answer, or send this again in a moment: it answers what the first did. |
| `length_required` | 411 | The body's length is required | Send the body with its `Content-Length`. |
| `body_too_large` | 413 | The body is too large | Send a smaller body. |
| `context_too_large` | 413 | The context is too large | A page's `context` is a JSON object of 8 KB at most: send what the page shows of what the person is looking at, not all of it. |
| `app_context_too_large` | 413 | What the app tells the model is too large | An app's context is at most 4,000 characters as the model reads it, its angle brackets escaped: send what it shows now, not all of it. |
| `unsupported_media_type` | 415 | The body isn't JSON | Send the body as `application/json`. |
| `file_unsupported` | 415 | The file can't be kept | A conversation keeps pictures, documents such as PDF, Word, PowerPoint and Excel, text files and archives, each as its name says: `detail` says what to send instead. |
| `range_not_satisfiable` | 416 | The range starts past the file's end | Ask for a range inside the file: `Content-Range` names its length, as `bytes */length`, or ask for the whole file with no `Range`. |
| `issuer_unreachable` | 422 | The identity provider couldn't be read | Its discovery document or keys didn't answer as they must: `detail` says what it answered. Check its address. |
| `group_unknown` | 422 | A group isn't one of your chat app's | One of the groups named was deleted or never yours: read the groups again, then send the change once more. Nothing changed. |
| `idempotency_key_reused` | 422 | This Idempotency-Key was sent with another request | A key names one request: send a new request with a key of its own. |
| `too_many_invitations` | 429 | Too many invitations this hour | Your chat app sends at most 300 invitations an hour, resends among them: send the rest in the next hour. |
| `too_many_app_calls` | 429 | Too many of an app's calls | An app's calls are at most 30 a minute for one person in one conversation: wait a moment. |
| `too_many_app_requests` | 429 | Too many of an app's requests | An app's reads, pings, log lines and contexts are at most 120 a minute for one person in one conversation: wait a moment. |
| `rate_limited` | 429 | Too many requests | The embed's visitors and the pages asking for sessions are limited: send this again after `Retry-After` seconds. |
| `internal_error` | 500 | Something went wrong | The call failed on our side. Send it again: with an `Idempotency-Key`, it's taken once. |
| `agents_unavailable` | 503 | Agents can't run right now | Turns can't start at the moment: send this again after `Retry-After` seconds. |
| `service_unavailable` | 503 | The service is unavailable | Send this again after `Retry-After` seconds. |
| `app_calls_unavailable` | 503 | An app's calls can't start right now | Send this again after `Retry-After` seconds. |
| `app_requests_unavailable` | 503 | An app's requests can't be answered right now | Send this again after `Retry-After` seconds. |
| `files_unavailable` | 503 | Files can't be kept or read right now | Send this again after `Retry-After` seconds. |
| `search_unavailable` | 503 | Search is unavailable right now | Send this again after `Retry-After` seconds. |
