AI agents API
AI assistants: what they say, which voice and language, what they know.
The same operations are in the interactive API reference, and the whole contract is in the OpenAPI document.
GET/v1/agents
List agents
Returns every AI assistant in the organization. Needs agents:read.
Paged, newest first: limit is 1 to 100 (default 50, out of range values are clamped) and cursor is the next_cursor of the previous page. The cursor is opaque and never built by the client; a cursor this API did not return is a 400. has_more is true while another page exists. There is no total. Free.
The instructions field is returned in full on every item, so a list can be large for organizations with long prompts.
Scope agents:read. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
limit | query | integer | No | How many items to return. Default 50, at most 100. |
cursor | query | string | No | The `next_cursor` of the previous page. Opaque; never built by the client. |
POST/v1/agents
Create an agent
Creates an assistant. Needs agents:write and an admin role; a non-admin gets 403 "Only admins can change this."
All four fields are required. instructions is the assistant's prompt: what the business is, how it speaks, what it must and must not do. languages are language tags such as ne and en. voice is a voice name.
Creating an agent does not route any number to it: set a number's routing to make it answer calls.
No credit is spent creating or editing an agent. Credit is spent only when it takes a live call or message. In test mode the agent is created in the sandbox and exists only there.
Send Idempotency-Key. Without it a retry after a timeout creates a second agent with the same name; names are not unique.
Scope agents:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
GET/v1/agents/{id}
Get an agent
Returns one assistant with its full instructions. Needs agents:read. Free.
Returns 404 for an id that does not exist in this organization or in this mode (test versus live).
Scope agents:read. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
PATCH/v1/agents/{id}
Update an agent
Changes an assistant. Needs agents:write and an admin role. Only the fields you send change; languages replaces the whole list when sent.
The change applies to calls and chats that start after it. A call already in progress keeps the instructions it started with.
Repeating the same PATCH leaves the same result, so no Idempotency-Key is needed.
Because instructions is replaced as a whole, read the agent first when you only want to add a sentence. Two writers editing at once overwrite each other: the last write wins and there is no version check.
Scope agents:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |