# Conversational AI API — Preview > Only Preview documentation is included in this export. # Conversational AI Platform REST API overview (/en/api-reference/api-ref/conversational-ai/platform) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). The Conversational AI Platform REST API (Preview) lets you save agents, secrets, and phone numbers in your project, and use them to run agent sessions and outbound call campaigns from your server. > **Info** > > During the Preview, agent sessions run in North America (US). Geofencing isn't supported. ## API basics - **Base URL**: `https://preview.ai.agora.io/conversational-ai/v1/projects/`, where `` is the App ID of your Agora project. Every resource belongs to one project. - **Authentication**: Use [token authentication](authentication#token-authentication) or [Basic HTTP authentication](authentication#basic-http-authentication) for every request. - **Request**: Request and response bodies use JSON. Request URLs and request bodies are case-sensitive. - **IDs**: Each resource returns its ID in a `_id` field, such as `agent_id`, `number_id`, and `campaign_id`. Agent, number, and campaign IDs are UUIDs, such as `3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10`. Session IDs are 32 lowercase letters and digits. - **Timestamps**: Timestamps are Unix times in seconds, in fields that end in `_ts`. Durations have a unit suffix, such as `_ms` or `_seconds`. Campaign schedules are the exception: they use local times in the schedule's time zone. ## Conventions The following conventions apply to every endpoint: - **Pagination**: List endpoints return `data`, `has_more`, and `next_cursor`. To get the next page, pass `next_cursor` in the `cursor` query parameter. `next_cursor` is `null` on the last page. - **Errors**: Every error response contains `detail` and `reason`. For all reasons, see [Status codes and error reasons](status-codes). - **Request ID**: Every response includes an `Agora-Request-Id` header. Include it when you contact Agora support. ## REST APIs The Platform APIs are organized by resource. You save agents, secrets, and phone numbers in your project, then reference them when you start sessions and campaigns. ### Agents An agent is a saved configuration that defines how your agent behaves, including its instructions, variables, greeting, and the models in its pipeline. Use these endpoints to manage agents that you start sessions and campaigns from. - [Create an agent](create-agent): Save an agent configuration. - [List agents](list-agents): Retrieve the agents in your project. - [Retrieve an agent](retrieve-agent): Retrieve the configuration of an agent. - [Update an agent](update-agent): Change the configuration of an agent. - [Delete an agent](delete-agent): Delete an agent. ### Sessions A session runs one agent in an RTC channel or a phone call. Use these endpoints to start sessions from a saved or inline agent, control them while they run, and stop them. - [Start a session](start-session): Start a session with a saved agent. - [Start an ephemeral session](start-ephemeral-session): Start a session with an agent configuration you pass in the request. - [List sessions](list-sessions): Retrieve the sessions that match your filters. - [Retrieve a session](retrieve-session): Retrieve the status of a session. - [Update a session](update-session): Renew the RTC token, or replace the messages or LLM parameters of a running session. - [Stop a session](stop-session): Stop a running session. ### Secrets A secret set stores provider API keys and other credentials, so your agent configurations reference secrets instead of containing them. Secret values are write-only and are never returned. - [Create a secret set](create-secret-set): Store credentials in a named secret set. - [List secret sets](list-secret-sets): Retrieve the secret sets in your project. - [Retrieve a secret set](retrieve-secret-set): Retrieve the key names in a secret set. - [Update a secret set](update-secret-set): Add, change, or remove several keys in one change. - [Replace a secret set](replace-secret-set): Replace all the keys in a set. - [Delete a secret set](delete-secret-set): Delete a set and all its keys. - [Set a secret key](set-secret-key): Add a key or replace its value. - [Delete a secret key](delete-secret-key): Remove a key from a set. ### Phone numbers A phone number connects your agents to the phone network through your carrier's SIP trunk. Agents call from a registered number, and you can choose the agent that answers inbound calls to it. - [Create a phone number](create-number): Import a phone number with its SIP trunk and inbound routing. - [List phone numbers](list-numbers): Retrieve the phone numbers in your project. - [Retrieve a phone number](retrieve-number): Retrieve a number and its SIP and inbound settings. - [Update a phone number](update-number): Change the SIP trunk or inbound routing of a number. - [Delete a phone number](delete-number): Remove a number from your project. ### Campaigns A campaign calls a list of contacts with a saved agent, on a schedule or right away. Each call starts a telephony session. Use these endpoints to create campaigns and control them while they run. - [Create a campaign](create-campaign): Dial a list of contacts with a saved agent. - [List campaigns](list-campaigns): Retrieve the campaigns in your project. - [Retrieve a campaign](retrieve-campaign): Retrieve a campaign and its contact counts. - [Update a campaign](update-campaign): Change the pacing, schedule, or dialing limits. - [Pause a campaign](pause-campaign): Stop placing new calls. - [Resume a campaign](resume-campaign): Continue dialing a paused campaign. - [Cancel a campaign](cancel-campaign): End a campaign permanently. - [Delete a campaign](delete-campaign): Delete a finished campaign. # RESTful authentication (/en/api-reference/api-ref/conversational-ai/platform/authentication) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Conversational AI Platform REST API requests require authentication. Use one of the following methods: - **[Token authentication](#token-authentication)**: Generate a token with your App ID and App Certificate, and set `Authorization: agora token=""`. - **[Basic HTTP authentication](#basic-http-authentication)**: Generate a Base64-encoded credential from your customer ID and customer secret, and set `Authorization: Basic `. > **Info** > > Implement authentication on the server to mitigate the risk of data leakage. ## Choose an authentication method You can use either method for any Platform API request. Choose the one recommended for your use case: | Use case | Recommended method | Why | | ------------------------------------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | | **Telephony only**: inbound calls, outbound calls, and campaigns, with no RTC channel | [Basic HTTP authentication](#basic-http-authentication) | You authenticate with your customer ID and customer secret. You don't need to generate tokens. | | **RTC**, or **RTC and telephony** | [Token authentication](#token-authentication) | An RTC session needs a token for the agent to join the channel. You can use the same token to authenticate your requests. | ## Token authentication Token authentication uses a token generated on your server with your App ID and App Certificate. To authenticate with a token, include the `Authorization` header in each request: ```text Authorization: agora token="" ``` ### Prerequisites Before you begin, get the following values from [Agora Console](https://console.agora.io): - **App ID**: A unique string that identifies your project. - **App Certificate**: A string used to generate tokens. > **Warning** > > Never expose your App Certificate in client-side code or public repositories. Generate tokens on your server only, and don't write tokens to public logs. Tokens expire after a maximum of 86400 seconds. ### Choose the token services The services a token needs depend on the request: - **Requests that start an RTC session**: Use a token with the ConvoAI, RTC, and RTM services, such as one from [`ConvoAITokenBuilder.buildToken`](#build-a-convoai-token). Put the same token in the `Authorization` header and in `transport.token`, which lets the agent join the channel. This applies when you [start a session](start-session) or [start an ephemeral session](start-ephemeral-session) with an RTC transport, and when you renew the token with [Update a session](update-session). - **All other requests**: A token with only the ConvoAI service is enough. These include managing agents, secrets, phone numbers, and campaigns; listing, retrieving, and stopping sessions; and starting telephony sessions. See [Build a token with specific services](#build-a-token-with-specific-services). To start an RTC session, you can also generate a separate token for each place. Put the REST authentication token in the `Authorization` header and a token with the RTC service in `transport.token`. When the token includes the RTC service, the token parameters must match the session request: - `channelName` must match `transport.channel`. - The account or UID must match `transport.uid`. ### Use a temporary token for testing For testing, you can generate a temporary token in Agora Console. A temporary token is valid for 24 hours. For details, see [Credentials](/en/introduction/console-setup#credentials). When you start an RTC session, use the channel name you entered when you generated the token as `transport.channel` in your request. In production, generate tokens on your server using the token builder library. ### Using the token builder library The [AgoraDynamicKey repository](https://github.com/AgoraIO/Tools/tree/master/DynamicKey/AgoraDynamicKey) provides open-source token generation libraries for multiple languages, including `ConvoAITokenBuilder` and the ConvoAI service. Install the token builder library for your language: **Node.js** ```bash npm install agora-token ``` **Golang** ```bash # Pins the latest commit on the feature/access-token2-convoai-stt-services branch go get github.com/AgoraIO/Tools/DynamicKey/AgoraDynamicKey/go/src@v0.0.0-20261010073935-b75635c32d30 ``` **Python** ```bash git clone --branch feature/access-token2-convoai-stt-services https://github.com/AgoraIO/Tools.git cd Tools/DynamicKey/AgoraDynamicKey/python3 ``` #### Build a ConvoAI token `ConvoAITokenBuilder.buildToken` generates a token with the ConvoAI, RTC, and RTM services. Use it to start an RTC session, with the same token in the `Authorization` header and in `transport.token`: **Node.js** ```js const { ConvoAITokenBuilder } = require('agora-token'); const appId = ''; const appCertificate = ''; const channelName = ''; const agentUid = ''; const tokenExpire = 86400; // Token lifetime, 24 hours, in seconds const privilegeExpire = 3600; // RTC and RTM privilege lifetime, 1 hour, in seconds const token = ConvoAITokenBuilder.buildToken( appId, appCertificate, channelName, agentUid, tokenExpire, privilegeExpire, ); ``` **Golang** ```go package main import ( "fmt" "log" "github.com/AgoraIO/Tools/DynamicKey/AgoraDynamicKey/go/src/convoaitokenbuilder" ) func main() { appID := "" appCertificate := "" channelName := "" agentUID := "" tokenExpire := uint32(24 * 60 * 60) // Token lifetime, 24 hours, in seconds privilegeExpire := uint32(60 * 60) // RTC and RTM privilege lifetime, 1 hour, in seconds token, err := convoaitokenbuilder.BuildToken( appID, appCertificate, channelName, agentUID, tokenExpire, privilegeExpire, ) if err != nil { log.Fatal(err) } fmt.Println(token) } ``` To run the example, save it as `main.go` in an empty folder, and run the following commands: ```bash go mod init example.com/convoai-token-generator go get github.com/AgoraIO/Tools/DynamicKey/AgoraDynamicKey/go/src@v0.0.0-20261010073935-b75635c32d30 go run main.go ``` The program prints a token that starts with `007`. **Python** ```python from src.convoai_token_builder import ConvoAITokenBuilder token_expire = 86400 # Token lifetime, 24 hours, in seconds privilege_expire = 3600 # RTC and RTM privilege lifetime, 1 hour, in seconds token = ConvoAITokenBuilder.build_token( app_id, app_certificate, channel_name, agent_uid, token_expire, privilege_expire ) ``` The privilege lifetime must not exceed the token lifetime. To set the RTC role or each RTC and RTM privilege separately, use `buildTokenWithPrivilege` (`BuildTokenWithPrivilege` in Go, `build_token_with_privilege` in Python). It also adds the ConvoAI service automatically. #### Build a token with specific services To control exactly which services a token includes, build it with the `AccessToken2` API. The following examples build a token with the ConvoAI service only. Use this token in the `Authorization` header for requests that don't join an RTC channel: **Node.js** ```js const { AccessToken2, ServiceConvoAI } = require('agora-token/src/AccessToken2'); const tokenExpire = 86400; // Token lifetime, 24 hours, in seconds const accessToken = new AccessToken2(appId, appCertificate, null, tokenExpire); accessToken.add_service(new ServiceConvoAI()); const token = accessToken.build(); ``` **Golang** ```go import accesstoken "github.com/AgoraIO/Tools/DynamicKey/AgoraDynamicKey/go/src/accesstoken2" const tokenExpire = 24 * 60 * 60 // Token lifetime, 24 hours, in seconds accessToken := accesstoken.NewAccessToken(appID, appCertificate, tokenExpire) accessToken.AddService(accesstoken.NewServiceConvoAI()) token, err := accessToken.Build() ``` **Python** ```python from src.AccessToken2 import AccessToken, ServiceConvoAI token_expire = 86400 # Token lifetime, 24 hours, in seconds access_token = AccessToken(app_id, app_certificate, expire=token_expire) access_token.add_service(ServiceConvoAI()) token = access_token.build() ``` To set the RTC privileges yourself, add the RTC service. The following examples build a token with the ConvoAI and RTC services, which works in the `Authorization` header and in `transport.token`. Each RTC privilege lifetime must not exceed the token lifetime: **Node.js** ```js const { AccessToken2, ServiceConvoAI, ServiceRtc } = require('agora-token/src/AccessToken2'); const tokenExpire = 86400; // Token lifetime, 24 hours, in seconds const privilegeExpire = 3600; // RTC privilege lifetime, 1 hour, in seconds const accessToken = new AccessToken2(appId, appCertificate, null, tokenExpire); const rtc = new ServiceRtc(channelName, agentUid); rtc.add_privilege(ServiceRtc.kPrivilegeJoinChannel, privilegeExpire); rtc.add_privilege(ServiceRtc.kPrivilegePublishAudioStream, privilegeExpire); rtc.add_privilege(ServiceRtc.kPrivilegePublishVideoStream, privilegeExpire); rtc.add_privilege(ServiceRtc.kPrivilegePublishDataStream, privilegeExpire); accessToken.add_service(rtc); accessToken.add_service(new ServiceConvoAI()); const token = accessToken.build(); ``` **Golang** ```go import accesstoken "github.com/AgoraIO/Tools/DynamicKey/AgoraDynamicKey/go/src/accesstoken2" const tokenExpire = 24 * 60 * 60 // Token lifetime, 24 hours, in seconds const privilegeExpire = 60 * 60 // RTC privilege lifetime, 1 hour, in seconds accessToken := accesstoken.NewAccessToken(appID, appCertificate, tokenExpire) rtc := accesstoken.NewServiceRtc(channelName, agentUID) rtc.AddPrivilege(accesstoken.PrivilegeJoinChannel, privilegeExpire) rtc.AddPrivilege(accesstoken.PrivilegePublishAudioStream, privilegeExpire) rtc.AddPrivilege(accesstoken.PrivilegePublishVideoStream, privilegeExpire) rtc.AddPrivilege(accesstoken.PrivilegePublishDataStream, privilegeExpire) accessToken.AddService(rtc) accessToken.AddService(accesstoken.NewServiceConvoAI()) token, err := accessToken.Build() ``` **Python** ```python from src.AccessToken2 import AccessToken, ServiceConvoAI, ServiceRtc token_expire = 86400 # Token lifetime, 24 hours, in seconds privilege_expire = 3600 # RTC privilege lifetime, 1 hour, in seconds access_token = AccessToken(app_id, app_certificate, expire=token_expire) rtc = ServiceRtc(channel_name, agent_uid) rtc.add_privilege(ServiceRtc.kPrivilegeJoinChannel, privilege_expire) rtc.add_privilege(ServiceRtc.kPrivilegePublishAudioStream, privilege_expire) rtc.add_privilege(ServiceRtc.kPrivilegePublishVideoStream, privilege_expire) rtc.add_privilege(ServiceRtc.kPrivilegePublishDataStream, privilege_expire) access_token.add_service(rtc) access_token.add_service(ServiceConvoAI()) token = access_token.build() ``` ### Send a request with a token The following example lists the agents in your project. It works with a token that has only the ConvoAI service, because it doesn't join an RTC channel: ```bash curl --request GET \ --url 'https://preview.ai.agora.io/conversational-ai/v1/projects//agents?limit=20' \ --header 'Authorization: agora token=""' ``` The following example starts an RTC session with a saved agent, using a token with the ConvoAI, RTC, and RTM services, such as one from [`ConvoAITokenBuilder.buildToken`](#build-a-convoai-token). It uses the same token in the `Authorization` header and in `transport.token`: ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//sessions \ --header 'Authorization: agora token=""' \ --header 'Content-Type: application/json' \ --data '{ "agent_id": "", "transport": { "type": "rtc", "channel": "", "token": "", "uid": "1001", "subscribe_uids": ["1002"] }, "lifecycle": { "idle_timeout_ms": 120000 } }' ``` The token must be generated for `` and UID `1001`. To create an agent first, see [Create an agent](create-agent). ## Basic HTTP authentication Basic HTTP authentication uses your Agora customer ID and customer secret. Generate a Base64-encoded credential from the `customer_id:customer_secret` string, then include it in the `Authorization` header: ```text Authorization: Basic ``` ### Generate Customer ID and Customer Secret To generate a Customer ID and Customer Secret, do the following: 1. In [Agora Console](https://console.agora.io), click the username at the bottom of the navigation sidebar to open the account menu, then select **RESTful API Keys**. ![RESTful API keys](https://assets-docs.agora.io/images/console/restful-api-keys.png) 2. Select **Create API Key**. A Customer ID and Customer Secret are generated. 3. Select **Download** and save the file somewhere secure — you can download it only once. In the file, **Key** is your Customer ID and **Secret** is your Customer Secret. 4. Use the Customer ID (**Key**) and Customer Secret (**Secret**) to generate a Base64-encoded credential, and pass it to the `Authorization` parameter in the HTTP request header. ### Generate an authorization header using a third-party tool For testing and debugging, you can use a [third-party online tool](https://www.debugbear.com/basic-auth-header-generator) to quickly generate your Authorization header. Enter your Customer ID as the Username and your Customer Secret as the Password. Your generated header should look like this: ```text Authorization: Basic NDI1OTQ3N2I4MzYy...YwZjA= ``` ### Generate an authorization header using code The following examples read your customer ID and customer secret from the `AGORA_CUSTOMER_KEY` and `AGORA_CUSTOMER_SECRET` environment variables, and print the value to use in the `Authorization` header: **Java** ```java import java.nio.charset.StandardCharsets; import java.util.Base64; public class BasicAuthHeader { public static void main(String[] args) { // Read your customer ID and customer secret from environment variables String customerKey = System.getenv("AGORA_CUSTOMER_KEY"); String customerSecret = System.getenv("AGORA_CUSTOMER_SECRET"); // Join the customer ID and customer secret, then encode them with Base64 String plainCredentials = customerKey + ":" + customerSecret; String base64Credentials = Base64.getEncoder() .encodeToString(plainCredentials.getBytes(StandardCharsets.UTF_8)); // Create the Authorization header value String authorizationHeader = "Basic " + base64Credentials; System.out.println(authorizationHeader); } } ``` **Golang** ```go package main import ( "encoding/base64" "fmt" "os" ) func main() { // Read your customer ID and customer secret from environment variables customerKey := os.Getenv("AGORA_CUSTOMER_KEY") customerSecret := os.Getenv("AGORA_CUSTOMER_SECRET") // Join the customer ID and customer secret, then encode them with Base64 plainCredentials := customerKey + ":" + customerSecret base64Credentials := base64.StdEncoding.EncodeToString([]byte(plainCredentials)) // Create the Authorization header value authorizationHeader := "Basic " + base64Credentials fmt.Println(authorizationHeader) } ``` **PHP** ```php Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Ends a campaign permanently. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: cancel-campaign - Method: POST - Path: /v1/projects/{appid}/campaigns/{campaign_id}:cancel - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/campaigns/{campaign_id}:cancel ## Servers - https://preview.ai.agora.io/conversational-ai Canceling is permanent. Contacts that haven't been called change to `canceled` and are never dialed, and you can't resume the campaign. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `campaign_id` (path, required, string) - The ID of the campaign, returned in `campaign_id` when you create the campaign. - Format: `uuid` ## Request body No request body. ## Responses ### 200 The campaign was canceled. The response body contains the campaign. - `campaign_id` (string) - The ID of the campaign, a UUID. - Format: `uuid` - `name` (string) - The name of the campaign. - `status` (string) - The status of the campaign: - `scheduled`: The campaign is waiting for its start time. - `running`: The campaign is dialing, or can dial during its schedule. - `paused`: You paused the campaign. - `completed`: The campaign has finished. - `canceled`: You canceled the campaign. - `failed`: The campaign failed. The details are in `failure`. - Allowed: `scheduled` | `running` | `paused` | `completed` | `canceled` | `failed` - `agent_id` (string) - The ID of the agent that makes the calls. - Format: `uuid` - `transport` (object) - `transport.type` (string) - Always `telephony`. - `transport.from` (array) - The `number_id` values of the numbers the campaign calls from. - `transport.from.items` (string) - `transport.call_policy` (object) - Limits and behavior for each call the campaign places. Each limit you omit adds no limit. - `transport.call_policy.max_ring_duration_ms` (integer) - The maximum time in milliseconds from starting the dial until the call is answered. If the call isn't answered in time, the dial attempt ends. - Range: `[1, 259200000]` - `transport.call_policy.max_call_duration_seconds` (integer) - The maximum length of the call in seconds, measured from when it's answered. The session's `lifecycle` limits can end the call earlier. - Range: `[1, 259200]` - `transport.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. This is separate from `pipeline.silence_config`, which only prompts the user. - Range: `[30000, 259200000]` - `transport.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `transport.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `transport.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `transport.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `lifecycle` (object) - When each session the campaign starts ends on its own. - `lifecycle.idle_timeout_ms` (integer) - How long in milliseconds the session continues with no participant present: after the subscribed user leaves the RTC channel, or after the other side of a phone call hangs up. It isn't silence detection. Set to `0` to turn off the idle timer. Can't be greater than `max_duration_ms`. - Default: `30000` - Range: `[0, 3600000]` - `lifecycle.max_duration_ms` (integer) - The maximum length of each session in milliseconds, measured from `start_ts`. Defaults to 5 minutes. The maximum is 1 hour. - Default: `300000` - Range: `[1000, 3600000]` - `lifecycle.graceful_stop` (object) - How the agent finishes when you stop the session, or when the idle timer expires. It doesn't extend `max_duration_ms`, and it doesn't add a farewell message. - `lifecycle.graceful_stop.enabled` (boolean) - Whether the agent finishes what it's saying before it leaves. - Default: `false` - `lifecycle.graceful_stop.timeout_ms` (integer) - The longest time in milliseconds the agent can take to finish. - Default: `30000` - Range: `[0, 120000]` - `schedule` (object) - When the campaign dials. Pass the fields of one schedule mode only. - `schedule.mode` (string, required) - `immediate`: The campaign starts dialing as soon as it's created. - `schedule.timezone` (string, required) - The IANA time zone for `days`, for example `America/New_York`. Daylight saving time is handled automatically. Required when you pass `days`. - Min length: `1` - Max length: `255` - `schedule.start` (string, required) - When the campaign can start dialing, as a local date and time in `YYYY-MM-DDTHH:MM` format with no offset, for example `2026-11-02T09:00`. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.end` (string, required) - When the campaign stops placing new calls, as a local date and time in `YYYY-MM-DDTHH:MM` format, later than `start`. Calls in progress continue. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.days` (array) - The weekly hours when new calls can start. Outside these hours, no new calls start. A day you don't list has no dialing. Omit `days` to dial at any time. - Min items: `1` - Max items: `7` - `schedule.days.items` (object) - `schedule.days.items.weekday` (string, required) - The day of the week. Each day can appear only once. - Allowed: `mon` | `tue` | `wed` | `thu` | `fri` | `sat` | `sun` - `schedule.days.items.ranges` (array, required) - One to 10 windows on this day, which can't overlap. - Min items: `1` - Max items: `10` - `schedule.days.items.ranges.items` (object) - `schedule.days.items.ranges.items.start` (string, required) - The start of the window, as a local time in 24-hour `HH:MM` format. - `schedule.days.items.ranges.items.end` (string, required) - The end of the window, as a local time in `HH:MM` format, later than `start`. Use `24:00` for the end of the day. - `counts` (object) - The number of contacts in each state. Retrieve the campaign to get current counts. - `counts.contacts` (integer) - The total number of contacts. - `counts.pending` (integer) - Contacts not called yet, or waiting for a retry. - `counts.calling` (integer) - Contacts in a call now. - `counts.completed` (integer) - Contacts whose call has finished. - `counts.failed` (integer) - Contacts not reached after all attempts. - `counts.canceled` (integer) - Contacts that won't be called because the campaign was canceled. - `create_ts` (integer) - The time the campaign was created, as a Unix timestamp in seconds. - `start_ts` (integer | null | null) - The time the campaign started dialing, as a Unix timestamp in seconds. `null` before it starts. - `complete_ts` (integer | null | null) - The time the campaign finished, as a Unix timestamp in seconds. `null` until it finishes. - `failure` (object) - Details of the failure when `status` is `failed`. Otherwise `null`. - `failure.code` (string, required) - A stable runtime error code, for example `provider_error`. - `failure.provider` (string) - The model provider that caused the failure, for example `openai`. - `failure.message` (string, required) - A human-readable explanation. - `failure.ts` (integer, required) - The time the failure occurred, as a Unix timestamp in seconds. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `CampaignInvalidState`: The campaign has already finished or been canceled. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "campaign_id": "b4f0581e-f138-43a2-851c-a8f8d228bb37", "name": "q3-renewals", "status": "canceled", "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "transport": { "type": "telephony", "from": [ "92e68758-3d3a-4f27-8b93-3fd8d834467c" ] }, "schedule": { "mode": "scheduled", "timezone": "America/New_York", "start": "2026-11-02T09:00", "end": "2026-11-13T17:00" }, "counts": { "contacts": 1, "pending": 0, "calling": 0, "completed": 0, "failed": 0, "canceled": 1 }, "create_ts": 1787673602, "start_ts": null, "complete_ts": 1787680000, "failure": null } ``` # Create an agent (/en/api-reference/api-ref/conversational-ai/platform/create-agent) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Saves a reusable agent configuration in your project. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: create-agent - Method: POST - Path: /v1/projects/{appid}/agents - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/agents ## Servers - https://preview.ai.agora.io/conversational-ai Use this endpoint to save an agent that you can then use to start sessions and campaigns. Only `agent_name` is required. If you omit `greeting`, the agent doesn't greet participants automatically. Saving or updating an agent doesn't change sessions that are already running. :::info[Keep provider keys in secrets] Set `credential` on each pipeline stage. With `byok`, pass your provider keys in `credential.fields` as `$secrets..` references to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). Most providers take one field, `api_key`. Agora checks that each reference exists when you create the agent. Keep credentials out of `params`. ::: ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. ## Request body - `agent_name` (string, required) - A name for the agent, 1 to 255 characters. It doesn't need to be unique. - Min length: `1` - Max length: `255` - `instructions` (string) - The system instructions that define how the agent behaves. The model receives them as the first `system` message, before `messages`. - `messages` (array) - Messages that start the conversation history. They follow `instructions`. - `messages.items` (object) - `messages.items.role` (string, required) - The author of the message: - `system`: An instruction to the model. - `user`: A message from the user. - `assistant`: A message from the agent. - Allowed: `system` | `user` | `assistant` - `messages.items.content` (string, required) - The text of the message. - `variables` (object) - Every variable the agent uses, keyed by variable name. A name starts with a lowercase letter and contains up to 64 lowercase letters, digits, and underscores. Reference a variable as `{{variable_name}}` in `instructions`, `messages`, `greeting.text`, `pipeline.llm.failure_message`, `pipeline.silence_config.content`, and generated filler instructions. The agent doesn't store values: pass them in `values` when you start a session, or in each campaign contact. Expansion is single-pass, so a value that contains a placeholder isn't expanded again. - Example: `{"customer_name":{"type":"str","required":true},"resolution_status":{"type":"str","options":["resolved","follow_up","unresolved"],"extract":true,"description":"Outcome of the conversation."}}` - `greeting` (object) - The message the agent speaks when a participant joins. If you omit it, the agent doesn't greet participants automatically. - `greeting.mode` (string, required) - `text`: The agent speaks `text` using the TTS stage. - `greeting.on` (string) - Which participants the agent greets: - `each_join`: Every participant who joins. - `first_join`: Only the first participant to join. - Allowed: `each_join` | `first_join` - Default: `each_join` - `greeting.delay_ms` (integer) - The delay in milliseconds between a participant joining and the agent starting the greeting. - Default: `0` - Range: `[0, 5000]` - `greeting.text` (string, required) - The greeting text. - `pipeline` (object) - The models that power the agent: separate ASR, LLM, and TTS stages. When you pass a pipeline, `llm` and `tts` are required. - `pipeline.mode` (string, required) - `cascaded`: Separate ASR, LLM, and TTS stages. - `pipeline.asr` (object) - The automatic speech recognition (ASR) stage, which transcribes the user's speech. - `pipeline.asr.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.asr.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.asr.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.asr.vendor` (string) - The ASR provider, for example `deepgram`. - `pipeline.asr.model` (string) - The provider model, for example `nova-3`. - `pipeline.asr.language` (string) - The language of the user's speech, for example `en-US`. - `pipeline.asr.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. - `pipeline.asr.params` (object) - Provider-specific settings that aren't secret, such as `keywords`, passed to the provider as they are. Keep API keys in `credential`, not here. - `pipeline.llm` (object, required) - The large language model (LLM) stage, which generates the agent's replies. - `pipeline.llm.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.llm.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.llm.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.llm.vendor` (string) - The LLM provider, for example `openai`. - `pipeline.llm.style` (string) - The API style used to communicate with the model, for example `openai` for OpenAI and OpenAI-compatible APIs. - `pipeline.llm.model` (string) - The provider model. - `pipeline.llm.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. For Google Gemini in an ephemeral session, the URL can include your API key as `key=`, with `credential.fields` left out. A saved agent's `url` can't contain a key. - `pipeline.llm.headers` (object) - Custom HTTP headers sent to the provider endpoint, at most 32. They are write-only and are never returned. A value can be a whole `$secrets..` reference when the stage uses `byok` and an approved provider endpoint. Agora resolves it when each session starts. A header name that looks like a credential, such as `X-Api-Key`, must use a reference. Transport, identity, and provider authentication headers are reserved. Set provider authentication in `credential`. - `pipeline.llm.params` (object) - Provider-specific settings that aren't secret, such as `reasoning_effort`, passed to the provider as they are. Keep API keys in `credential`, not here. - `pipeline.llm.input_modalities` (array) - The input types sent to the model, for example `["text"]`. - `pipeline.llm.input_modalities.items` (string) - `pipeline.llm.output_modalities` (array) - The output types requested from the model, for example `["text"]`. - `pipeline.llm.output_modalities.items` (string) - `pipeline.llm.max_history` (integer) - The number of recent conversation messages the LLM keeps as context. It counts messages, not user and agent pairs. The agent's `instructions` don't count toward this limit. - Default: `32` - Range: `[1, 1024]` - `pipeline.llm.failure_message` (string) - The message the agent speaks with the TTS stage when the LLM fails to produce a response. - `pipeline.llm.tools` (array) - Function tools the model can call. An agent can have up to 32 tools in total, including tools discovered from `mcp_servers`. Tool names must be unique, ignoring case. - Max items: `32` - `pipeline.llm.tools.items` (object) - `pipeline.llm.tools.items.type` (string, required) - Always `function`. - `pipeline.llm.tools.items.name` (string, required) - The tool name shown to the model. It starts with a letter and contains only letters and digits, up to 64 characters. It can't start with `mcp`, can't be `ragsearch_tool`, and can't match an MCP, built-in, or model-native tool. - Max length: `64` - `pipeline.llm.tools.items.description` (string, required) - What the tool does, 1 to 1,024 characters. The model uses it to decide when to call the tool. - Min length: `1` - Max length: `1024` - `pipeline.llm.tools.items.parameters` (object, required) - A JSON Schema that describes the tool's arguments. - `pipeline.llm.tools.items.execution` (object, required) - How the agent runs the tool. - `pipeline.llm.tools.items.execution.mode` (string, required) - `sync`: The agent waits for the tool response before it continues. - `pipeline.llm.tools.items.server` (object, required) - The HTTP endpoint the agent calls to run the tool. - `pipeline.llm.tools.items.server.method` (string, required) - The HTTP method. - Allowed: `GET` | `POST` - `pipeline.llm.tools.items.server.url` (string, required) - The HTTPS URL of the endpoint, up to 2,048 characters. - Min length: `1` - Max length: `2048` - Pattern: `^https://` - `pipeline.llm.tools.items.server.headers` (object) - HTTP headers sent to the endpoint, up to 32. They are write-only and are never returned. - `pipeline.llm.tools.items.server.body` (object) - Additional fields to include in the request body. - `pipeline.llm.tools.items.server.timeout_ms` (integer) - The request timeout in milliseconds. - Default: `10000` - Range: `[1000, 100000]` - `pipeline.llm.mcp_servers` (array) - MCP servers whose tools the model can call. - `pipeline.llm.mcp_servers.items` (object) - `pipeline.llm.mcp_servers.items.name` (string, required) - A name for the MCP server, 1 to 48 letters and digits. - Min length: `1` - Max length: `48` - `pipeline.llm.mcp_servers.items.endpoint` (string, required) - The HTTPS URL of the MCP server, up to 2,048 characters. - Min length: `1` - Max length: `2048` - Pattern: `^https://` - `pipeline.llm.mcp_servers.items.transport` (string, required) - The MCP transport. `streamable_http`: Streamable HTTP. - `pipeline.llm.mcp_servers.items.headers` (object) - HTTP headers sent to the MCP server, up to 32. They are write-only and are never returned. - `pipeline.llm.mcp_servers.items.allowed_tools` (array) - The tools the model can call from this server: - Omit the field, or include `*` in the list, to allow every tool. - Pass an empty list to allow no tools. - Otherwise, only the listed tools are allowed. - `pipeline.llm.mcp_servers.items.allowed_tools.items` (string) - Min length: `1` - `pipeline.llm.mcp_servers.items.timeout_ms` (integer) - The request timeout in milliseconds. - Range: `[1000, 100000]` - `pipeline.tts` (object, required) - The text-to-speech (TTS) stage, which converts the agent's replies to speech. - `pipeline.tts.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.tts.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.tts.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.tts.vendor` (string) - The TTS provider, for example `microsoft`. - `pipeline.tts.model` (string) - The TTS model the agent uses. Returned in responses only. - `pipeline.tts.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. - `pipeline.tts.headers` (object) - Custom HTTP headers sent to the provider endpoint, at most 32. They are write-only and are never returned. A value can be a whole `$secrets..` reference when the stage uses `byok` and an approved provider endpoint. Agora resolves it when each session starts. A header name that looks like a credential, such as `X-Api-Key`, must use a reference. Transport, identity, and provider authentication headers are reserved. Set provider authentication in `credential`. - `pipeline.tts.params` (object) - Provider-specific settings that aren't secret, such as the voice and, where the provider requires it, the model, passed to the provider as they are. Keep API keys in `credential`, not here. - `pipeline.tts.skip_patterns` (array) - Bracketed text that the agent doesn't speak, such as tone or action notes in the LLM output: - `fullwidth_parentheses`: Text in `()`. - `lenticular_brackets`: Text in `【】`. - `parentheses`: Text in `( )`. - `square_brackets`: Text in `[ ]`. - `curly_braces`: Text in `{ }`. - `pipeline.tts.skip_patterns.items` (string) - Allowed: `fullwidth_parentheses` | `lenticular_brackets` | `parentheses` | `square_brackets` | `curly_braces` - `pipeline.turn_detection` (object) - How the agent detects when the user starts and stops speaking, and handles interruptions. - `pipeline.turn_detection.speech_threshold` (number) - The speech detection threshold. Lower values detect speech more easily. Higher values ignore weak speech. - Default: `0.5` - Range: `[0, 1]` - `pipeline.turn_detection.start_of_speech` (object) - How the agent detects that the user starts speaking. Pass the fields of one detection type only. If you omit it, the agent uses `semantic` detection with its defaults. - `pipeline.turn_detection.start_of_speech.type` (string, required) - `semantic`: Detects a meaningful start of speech. If you omit `type`, the agent uses `semantic`. - Default: `semantic` - `pipeline.turn_detection.start_of_speech.interrupt_duration_ms` (integer) - Speech shorter than this, in milliseconds, is ignored. - Default: `160` - Range: `[120, 1200]` - `pipeline.turn_detection.start_of_speech.speaking_interrupt_duration_ms` (integer) - How long in milliseconds the user must speak to interrupt the agent while it's speaking. - Default: `160` - `pipeline.turn_detection.start_of_speech.prefix_padding_ms` (integer) - How many milliseconds of audio before the detected start of speech to keep, so the beginning of the speech isn't clipped. - Default: `800` - Range: `[0, 5000]` - `pipeline.turn_detection.end_of_speech` (object) - How the agent detects that the user has finished speaking. Pass the fields of one detection type only. If you omit it, the agent uses `semantic` detection with its defaults. - `pipeline.turn_detection.end_of_speech.type` (string, required) - `semantic`: Considers whether the utterance sounds complete. If you omit `type`, the agent uses `semantic`. - Default: `semantic` - `pipeline.turn_detection.end_of_speech.silence_duration_ms` (integer) - The silence in milliseconds that ends the turn. - Default: `320` - Range: `[120, 2000]` - `pipeline.turn_detection.end_of_speech.max_wait_ms` (integer) - The maximum time in milliseconds to wait before ending the turn, from 500 to 10,000. Set to `-1` to wait without a timeout. - Default: `3000` - Range: `[500, 10000]` - `pipeline.turn_detection.end_of_speech.pause_state_enabled` (boolean) - Whether the agent detects a pause within an utterance, such as "hold on", and waits for more input. - Default: `true` - `pipeline.turn_detection.interruption` (object) - How the user can interrupt the agent while it speaks or thinks. Pass the fields of one interruption mode only. If you omit it, any user speech interrupts the agent. - Default: `{"mode":"start_of_speech"}` - `pipeline.turn_detection.interruption.mode` (string, required) - `start_of_speech`: Any user speech interrupts the agent. - `pipeline.turn_detection.interruption.when_off` (string) - What happens to user speech that arrives while the agent speaks or thinks: - `append`: The agent responds to the speech after the current reply. - `ignore`: The agent discards the speech. - Allowed: `append` | `ignore` - Default: `append` - `pipeline.turn_detection.interruption.keywords` (array, required) - The phrases that interrupt the agent, 1 to 128. - Min items: `1` - Max items: `128` - `pipeline.turn_detection.interruption.keywords.items` (string) - Min length: `1` - `pipeline.silence_config` (object) - What the agent does after a period of silence. This only prompts the user. To hang up a phone call after silence, use `call_policy.max_silence_duration_ms`. - `pipeline.silence_config.enabled` (boolean, required) - Whether to act on silence. - `pipeline.silence_config.timeout_ms` (integer, required) - How long the silence lasts, in milliseconds, before the agent acts, up to 60,000. Applies only when `enabled` is `true`. - Range: `[0, 60000]` - `pipeline.silence_config.action` (string, required) - What the agent does when the timeout is reached: - `speak`: Speaks `content` as written. - `think`: Gives `content` to the LLM as an instruction, and responds to it. - Allowed: `speak` | `think` - `pipeline.silence_config.content` (string, required) - The text to speak, or the instruction for the LLM, depending on `action`. - `pipeline.avatar` (object) - The avatar that represents the agent on video. - `pipeline.avatar.enabled` (boolean) - Whether to show the avatar. - Default: `false` - `pipeline.avatar.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.avatar.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.avatar.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.avatar.vendor` (string) - The avatar provider. `generic` passes provider-neutral parameters through. - Allowed: `akool` | `liveavatar` | `anam` | `sensetime` | `spatius` | `generic` - `pipeline.avatar.params` (object) - Provider-specific settings, passed to the provider as they are. - `filler_words` (object) - Short phrases the agent says while it waits for the LLM to respond, such as when it waits for a tool call. - `filler_words.enable` (boolean) - Whether to play filler words. - Default: `false` - `filler_words.trigger` (object) - When to play a filler word. - `filler_words.trigger.mode` (string, required) - `fixed_time`: Play a filler word when the LLM hasn't responded within `response_wait_ms`. - `filler_words.trigger.response_wait_ms` (integer, required) - How long in milliseconds to wait for the LLM response before playing a filler word, for example `1500`. - Range: `[100, 10000]` - `filler_words.content` (object) - Where the filler words come from. Pass the fields of one source only. - `filler_words.content.mode` (string, required) - `static`: Pick a phrase from `phrases`. - `filler_words.content.instructions` (string, required) - The instructions used to generate filler phrases. They can't be empty or only whitespace. - Min length: `1` - `filler_words.content.fallback_strategy` (string) - What to use when a generated phrase isn't available. - Default: `static` - `filler_words.content.phrases` (array, required) - The filler phrases, 1 to 100 non-empty strings. - Min items: `1` - Max items: `100` - `filler_words.content.phrases.items` (string) - Min length: `1` - `filler_words.content.selection_rule` (string) - How the agent picks the next phrase: - `shuffle`: In random order. - `round_robin`: In list order, starting over after the last phrase. - Allowed: `shuffle` | `round_robin` - Default: `shuffle` ### Request body example ```json { "agent_name": "Customer Support Agent", "instructions": "You are a support agent for Acme. Address the caller as {{customer_name}}. Be concise.", "variables": { "customer_name": { "type": "str", "required": true }, "resolution_status": { "type": "str", "options": [ "resolved", "follow_up", "unresolved" ], "extract": true, "description": "Outcome of the conversation." } }, "pipeline": { "mode": "cascaded", "asr": { "credential": { "mode": "managed" }, "vendor": "deepgram", "model": "nova-3", "language": "en-US" }, "llm": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.llm" } }, "vendor": "openai", "style": "openai", "model": "", "max_history": 12, "failure_message": "I'm sorry, I couldn't generate a response. Please try again." }, "tts": { "credential": { "mode": "managed" }, "vendor": "minimax", "params": { "model": "speech-2.6-turbo", "voice_setting": { "voice_id": "English_captivating_female1", "speed": 1 } } }, "silence_config": { "enabled": true, "timeout_ms": 3000, "action": "speak", "content": "Hello, how can I help you?" } }, "greeting": { "mode": "text", "on": "each_join", "delay_ms": 0, "text": "Hi, thanks for calling Acme." } } ``` ## Responses ### 201 The agent was created. The response body contains the saved agent. - `agent_id` (string, required) - The ID of the agent, a UUID. - Format: `uuid` - `agent_name` (string, required) - A name for the agent, 1 to 255 characters. It doesn't need to be unique. - Min length: `1` - Max length: `255` - `instructions` (string) - The system instructions that define how the agent behaves. The model receives them as the first `system` message, before `messages`. - `messages` (array) - Messages that start the conversation history. They follow `instructions`. - `messages.items` (object) - `messages.items.role` (string, required) - The author of the message: - `system`: An instruction to the model. - `user`: A message from the user. - `assistant`: A message from the agent. - Allowed: `system` | `user` | `assistant` - `messages.items.content` (string, required) - The text of the message. - `variables` (object) - Every variable the agent uses, keyed by variable name. A name starts with a lowercase letter and contains up to 64 lowercase letters, digits, and underscores. Reference a variable as `{{variable_name}}` in `instructions`, `messages`, `greeting.text`, `pipeline.llm.failure_message`, `pipeline.silence_config.content`, and generated filler instructions. The agent doesn't store values: pass them in `values` when you start a session, or in each campaign contact. Expansion is single-pass, so a value that contains a placeholder isn't expanded again. - Example: `{"customer_name":{"type":"str","required":true},"resolution_status":{"type":"str","options":["resolved","follow_up","unresolved"],"extract":true,"description":"Outcome of the conversation."}}` - `greeting` (object) - The message the agent speaks when a participant joins. If you omit it, the agent doesn't greet participants automatically. - `greeting.mode` (string, required) - `text`: The agent speaks `text` using the TTS stage. - `greeting.on` (string) - Which participants the agent greets: - `each_join`: Every participant who joins. - `first_join`: Only the first participant to join. - Allowed: `each_join` | `first_join` - Default: `each_join` - `greeting.delay_ms` (integer) - The delay in milliseconds between a participant joining and the agent starting the greeting. - Default: `0` - Range: `[0, 5000]` - `greeting.text` (string, required) - The greeting text. - `pipeline` (object) - The models that power the agent: separate ASR, LLM, and TTS stages. When you pass a pipeline, `llm` and `tts` are required. - `pipeline.mode` (string, required) - `cascaded`: Separate ASR, LLM, and TTS stages. - `pipeline.asr` (object) - The automatic speech recognition (ASR) stage, which transcribes the user's speech. - `pipeline.asr.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.asr.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.asr.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.asr.vendor` (string) - The ASR provider, for example `deepgram`. - `pipeline.asr.model` (string) - The provider model, for example `nova-3`. - `pipeline.asr.language` (string) - The language of the user's speech, for example `en-US`. - `pipeline.asr.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. - `pipeline.asr.params` (object) - Provider-specific settings that aren't secret, such as `keywords`, passed to the provider as they are. Keep API keys in `credential`, not here. - `pipeline.llm` (object, required) - The large language model (LLM) stage, which generates the agent's replies. - `pipeline.llm.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.llm.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.llm.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.llm.vendor` (string) - The LLM provider, for example `openai`. - `pipeline.llm.style` (string) - The API style used to communicate with the model, for example `openai` for OpenAI and OpenAI-compatible APIs. - `pipeline.llm.model` (string) - The provider model. - `pipeline.llm.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. For Google Gemini in an ephemeral session, the URL can include your API key as `key=`, with `credential.fields` left out. A saved agent's `url` can't contain a key. - `pipeline.llm.headers` (object) - Custom HTTP headers sent to the provider endpoint, at most 32. They are write-only and are never returned. A value can be a whole `$secrets..` reference when the stage uses `byok` and an approved provider endpoint. Agora resolves it when each session starts. A header name that looks like a credential, such as `X-Api-Key`, must use a reference. Transport, identity, and provider authentication headers are reserved. Set provider authentication in `credential`. - `pipeline.llm.params` (object) - Provider-specific settings that aren't secret, such as `reasoning_effort`, passed to the provider as they are. Keep API keys in `credential`, not here. - `pipeline.llm.input_modalities` (array) - The input types sent to the model, for example `["text"]`. - `pipeline.llm.input_modalities.items` (string) - `pipeline.llm.output_modalities` (array) - The output types requested from the model, for example `["text"]`. - `pipeline.llm.output_modalities.items` (string) - `pipeline.llm.max_history` (integer) - The number of recent conversation messages the LLM keeps as context. It counts messages, not user and agent pairs. The agent's `instructions` don't count toward this limit. - Default: `32` - Range: `[1, 1024]` - `pipeline.llm.failure_message` (string) - The message the agent speaks with the TTS stage when the LLM fails to produce a response. - `pipeline.llm.tools` (array) - Function tools the model can call. An agent can have up to 32 tools in total, including tools discovered from `mcp_servers`. Tool names must be unique, ignoring case. - Max items: `32` - `pipeline.llm.tools.items` (object) - `pipeline.llm.tools.items.type` (string, required) - Always `function`. - `pipeline.llm.tools.items.name` (string, required) - The tool name shown to the model. It starts with a letter and contains only letters and digits, up to 64 characters. It can't start with `mcp`, can't be `ragsearch_tool`, and can't match an MCP, built-in, or model-native tool. - Max length: `64` - `pipeline.llm.tools.items.description` (string, required) - What the tool does, 1 to 1,024 characters. The model uses it to decide when to call the tool. - Min length: `1` - Max length: `1024` - `pipeline.llm.tools.items.parameters` (object, required) - A JSON Schema that describes the tool's arguments. - `pipeline.llm.tools.items.execution` (object, required) - How the agent runs the tool. - `pipeline.llm.tools.items.execution.mode` (string, required) - `sync`: The agent waits for the tool response before it continues. - `pipeline.llm.tools.items.server` (object, required) - The HTTP endpoint the agent calls to run the tool. - `pipeline.llm.tools.items.server.method` (string, required) - The HTTP method. - Allowed: `GET` | `POST` - `pipeline.llm.tools.items.server.url` (string, required) - The HTTPS URL of the endpoint, up to 2,048 characters. - Min length: `1` - Max length: `2048` - Pattern: `^https://` - `pipeline.llm.tools.items.server.headers` (object) - HTTP headers sent to the endpoint, up to 32. They are write-only and are never returned. - `pipeline.llm.tools.items.server.body` (object) - Additional fields to include in the request body. - `pipeline.llm.tools.items.server.timeout_ms` (integer) - The request timeout in milliseconds. - Default: `10000` - Range: `[1000, 100000]` - `pipeline.llm.mcp_servers` (array) - MCP servers whose tools the model can call. - `pipeline.llm.mcp_servers.items` (object) - `pipeline.llm.mcp_servers.items.name` (string, required) - A name for the MCP server, 1 to 48 letters and digits. - Min length: `1` - Max length: `48` - `pipeline.llm.mcp_servers.items.endpoint` (string, required) - The HTTPS URL of the MCP server, up to 2,048 characters. - Min length: `1` - Max length: `2048` - Pattern: `^https://` - `pipeline.llm.mcp_servers.items.transport` (string, required) - The MCP transport. `streamable_http`: Streamable HTTP. - `pipeline.llm.mcp_servers.items.headers` (object) - HTTP headers sent to the MCP server, up to 32. They are write-only and are never returned. - `pipeline.llm.mcp_servers.items.allowed_tools` (array) - The tools the model can call from this server: - Omit the field, or include `*` in the list, to allow every tool. - Pass an empty list to allow no tools. - Otherwise, only the listed tools are allowed. - `pipeline.llm.mcp_servers.items.allowed_tools.items` (string) - Min length: `1` - `pipeline.llm.mcp_servers.items.timeout_ms` (integer) - The request timeout in milliseconds. - Range: `[1000, 100000]` - `pipeline.tts` (object, required) - The text-to-speech (TTS) stage, which converts the agent's replies to speech. - `pipeline.tts.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.tts.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.tts.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.tts.vendor` (string) - The TTS provider, for example `microsoft`. - `pipeline.tts.model` (string) - The TTS model the agent uses. Returned in responses only. - `pipeline.tts.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. - `pipeline.tts.headers` (object) - Custom HTTP headers sent to the provider endpoint, at most 32. They are write-only and are never returned. A value can be a whole `$secrets..` reference when the stage uses `byok` and an approved provider endpoint. Agora resolves it when each session starts. A header name that looks like a credential, such as `X-Api-Key`, must use a reference. Transport, identity, and provider authentication headers are reserved. Set provider authentication in `credential`. - `pipeline.tts.params` (object) - Provider-specific settings that aren't secret, such as the voice and, where the provider requires it, the model, passed to the provider as they are. Keep API keys in `credential`, not here. - `pipeline.tts.skip_patterns` (array) - Bracketed text that the agent doesn't speak, such as tone or action notes in the LLM output: - `fullwidth_parentheses`: Text in `()`. - `lenticular_brackets`: Text in `【】`. - `parentheses`: Text in `( )`. - `square_brackets`: Text in `[ ]`. - `curly_braces`: Text in `{ }`. - `pipeline.tts.skip_patterns.items` (string) - Allowed: `fullwidth_parentheses` | `lenticular_brackets` | `parentheses` | `square_brackets` | `curly_braces` - `pipeline.turn_detection` (object) - How the agent detects when the user starts and stops speaking, and handles interruptions. - `pipeline.turn_detection.speech_threshold` (number) - The speech detection threshold. Lower values detect speech more easily. Higher values ignore weak speech. - Default: `0.5` - Range: `[0, 1]` - `pipeline.turn_detection.start_of_speech` (object) - How the agent detects that the user starts speaking. Pass the fields of one detection type only. If you omit it, the agent uses `semantic` detection with its defaults. - `pipeline.turn_detection.start_of_speech.type` (string, required) - `semantic`: Detects a meaningful start of speech. If you omit `type`, the agent uses `semantic`. - Default: `semantic` - `pipeline.turn_detection.start_of_speech.interrupt_duration_ms` (integer) - Speech shorter than this, in milliseconds, is ignored. - Default: `160` - Range: `[120, 1200]` - `pipeline.turn_detection.start_of_speech.speaking_interrupt_duration_ms` (integer) - How long in milliseconds the user must speak to interrupt the agent while it's speaking. - Default: `160` - `pipeline.turn_detection.start_of_speech.prefix_padding_ms` (integer) - How many milliseconds of audio before the detected start of speech to keep, so the beginning of the speech isn't clipped. - Default: `800` - Range: `[0, 5000]` - `pipeline.turn_detection.end_of_speech` (object) - How the agent detects that the user has finished speaking. Pass the fields of one detection type only. If you omit it, the agent uses `semantic` detection with its defaults. - `pipeline.turn_detection.end_of_speech.type` (string, required) - `semantic`: Considers whether the utterance sounds complete. If you omit `type`, the agent uses `semantic`. - Default: `semantic` - `pipeline.turn_detection.end_of_speech.silence_duration_ms` (integer) - The silence in milliseconds that ends the turn. - Default: `320` - Range: `[120, 2000]` - `pipeline.turn_detection.end_of_speech.max_wait_ms` (integer) - The maximum time in milliseconds to wait before ending the turn, from 500 to 10,000. Set to `-1` to wait without a timeout. - Default: `3000` - Range: `[500, 10000]` - `pipeline.turn_detection.end_of_speech.pause_state_enabled` (boolean) - Whether the agent detects a pause within an utterance, such as "hold on", and waits for more input. - Default: `true` - `pipeline.turn_detection.interruption` (object) - How the user can interrupt the agent while it speaks or thinks. Pass the fields of one interruption mode only. If you omit it, any user speech interrupts the agent. - Default: `{"mode":"start_of_speech"}` - `pipeline.turn_detection.interruption.mode` (string, required) - `start_of_speech`: Any user speech interrupts the agent. - `pipeline.turn_detection.interruption.when_off` (string) - What happens to user speech that arrives while the agent speaks or thinks: - `append`: The agent responds to the speech after the current reply. - `ignore`: The agent discards the speech. - Allowed: `append` | `ignore` - Default: `append` - `pipeline.turn_detection.interruption.keywords` (array, required) - The phrases that interrupt the agent, 1 to 128. - Min items: `1` - Max items: `128` - `pipeline.turn_detection.interruption.keywords.items` (string) - Min length: `1` - `pipeline.silence_config` (object) - What the agent does after a period of silence. This only prompts the user. To hang up a phone call after silence, use `call_policy.max_silence_duration_ms`. - `pipeline.silence_config.enabled` (boolean, required) - Whether to act on silence. - `pipeline.silence_config.timeout_ms` (integer, required) - How long the silence lasts, in milliseconds, before the agent acts, up to 60,000. Applies only when `enabled` is `true`. - Range: `[0, 60000]` - `pipeline.silence_config.action` (string, required) - What the agent does when the timeout is reached: - `speak`: Speaks `content` as written. - `think`: Gives `content` to the LLM as an instruction, and responds to it. - Allowed: `speak` | `think` - `pipeline.silence_config.content` (string, required) - The text to speak, or the instruction for the LLM, depending on `action`. - `pipeline.avatar` (object) - The avatar that represents the agent on video. - `pipeline.avatar.enabled` (boolean) - Whether to show the avatar. - Default: `false` - `pipeline.avatar.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.avatar.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.avatar.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.avatar.vendor` (string) - The avatar provider. `generic` passes provider-neutral parameters through. - Allowed: `akool` | `liveavatar` | `anam` | `sensetime` | `spatius` | `generic` - `pipeline.avatar.params` (object) - Provider-specific settings, passed to the provider as they are. - `filler_words` (object) - Short phrases the agent says while it waits for the LLM to respond, such as when it waits for a tool call. - `filler_words.enable` (boolean) - Whether to play filler words. - Default: `false` - `filler_words.trigger` (object) - When to play a filler word. - `filler_words.trigger.mode` (string, required) - `fixed_time`: Play a filler word when the LLM hasn't responded within `response_wait_ms`. - `filler_words.trigger.response_wait_ms` (integer, required) - How long in milliseconds to wait for the LLM response before playing a filler word, for example `1500`. - Range: `[100, 10000]` - `filler_words.content` (object) - Where the filler words come from. Pass the fields of one source only. - `filler_words.content.mode` (string, required) - `static`: Pick a phrase from `phrases`. - `filler_words.content.instructions` (string, required) - The instructions used to generate filler phrases. They can't be empty or only whitespace. - Min length: `1` - `filler_words.content.fallback_strategy` (string) - What to use when a generated phrase isn't available. - Default: `static` - `filler_words.content.phrases` (array, required) - The filler phrases, 1 to 100 non-empty strings. - Min items: `1` - Max items: `100` - `filler_words.content.phrases.items` (string) - Min length: `1` - `filler_words.content.selection_rule` (string) - How the agent picks the next phrase: - `shuffle`: In random order. - `round_robin`: In list order, starting over after the last phrase. - Allowed: `shuffle` | `round_robin` - Default: `shuffle` - `create_ts` (integer, required) - The time the agent was created, as a Unix timestamp in seconds. - `update_ts` (integer, required) - The time the agent was last updated, as a Unix timestamp in seconds. ### 400 The request is invalid. For example, `InvalidFieldValue` when a pipeline stage has an unsupported vendor, model, or credential mode, `MissingRequiredField` when a stage is missing a provider parameter or its BYOK `fields`, `UnknownSecretReference` when a `$secrets` reference names a set or key that doesn't exist, `InvalidModuleParameter` when the resulting pipeline is invalid, or `NotImplemented` when a field isn't available yet. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 201 ```json { "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "agent_name": "Customer Support Agent", "instructions": "You are a support agent for Acme. Address the caller as {{customer_name}}. Be concise.", "variables": { "customer_name": { "type": "str", "required": true }, "resolution_status": { "type": "str", "options": [ "resolved", "follow_up", "unresolved" ], "extract": true, "description": "Outcome of the conversation." } }, "pipeline": { "mode": "cascaded", "asr": { "credential": { "mode": "managed" }, "vendor": "deepgram", "model": "nova-3", "language": "en-US" }, "llm": { "credential": { "mode": "byok" }, "vendor": "openai", "style": "openai", "model": "", "max_history": 12, "failure_message": "I'm sorry, I couldn't generate a response. Please try again." }, "tts": { "credential": { "mode": "managed" }, "vendor": "minimax", "params": { "model": "speech-2.6-turbo", "voice_setting": { "voice_id": "English_captivating_female1", "speed": 1 } } }, "silence_config": { "enabled": true, "timeout_ms": 3000, "action": "speak", "content": "Hello, how can I help you?" } }, "greeting": { "mode": "text", "on": "each_join", "delay_ms": 0, "text": "Hi, thanks for calling Acme." }, "create_ts": 1786543331, "update_ts": 1786543331 } ``` # Create a campaign (/en/api-reference/api-ref/conversational-ai/platform/create-campaign) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Creates an outbound campaign that dials a list of contacts with a saved agent. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: create-campaign - Method: POST - Path: /v1/projects/{appid}/campaigns - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/campaigns ## Servers - https://preview.ai.agora.io/conversational-ai Each contact is one dial task, and each dial starts a telephony session with the agent in `agent_id`. You supply the contacts when you create the campaign, and you can't change them afterward. Before you create a campaign, [create the agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent) and [register the phone number](/en/api-reference/api-ref/conversational-ai/platform/create-number) to call from. :::warning[Caution] A campaign places real phone calls. When `schedule.mode` is `immediate`, dialing starts as soon as the campaign is created. To test, create a `scheduled` campaign with a start time in the future, then [cancel it](/en/api-reference/api-ref/conversational-ai/platform/cancel-campaign). ::: ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. ## Request body - `name` (string, required) - A name for the campaign that helps you identify it, 1 to 255 characters. - Min length: `1` - Max length: `255` - `agent_id` (string, required) - The ID of the saved agent that makes the calls. - Format: `uuid` - `transport` (object, required) - How the campaign reaches its contacts. - `transport.type` (string, required) - `telephony`: The campaign places phone calls. - `transport.from` (string, required) - The `number_id` of the number to call from, or a list of up to 100 unique `number_id` values. With a list, the campaign rotates across the numbers. - Format: `uuid` - Min items: `1` - Max items: `100` - `transport.from.items` (string) - Format: `uuid` - `transport.call_policy` (object) - Limits and behavior for each call the campaign places. Each limit you omit adds no limit. - `transport.call_policy.max_ring_duration_ms` (integer) - The maximum time in milliseconds from starting the dial until the call is answered. If the call isn't answered in time, the dial attempt ends. - Range: `[1, 259200000]` - `transport.call_policy.max_call_duration_seconds` (integer) - The maximum length of the call in seconds, measured from when it's answered. The session's `lifecycle` limits can end the call earlier. - Range: `[1, 259200]` - `transport.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. This is separate from `pipeline.silence_config`, which only prompts the user. - Range: `[30000, 259200000]` - `transport.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `transport.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `transport.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `transport.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `contacts` (array, required) - The contacts to call, from 1 to 50,000. The whole request body can be at most 10 MiB. You can't change the list after you create the campaign. A phone number that appears more than once is called once for each entry. - Min items: `1` - Max items: `50000` - `contacts.items` (object) - One contact to call. Each contact is a separate dial task. - `contacts.items.phone` (string, required) - The phone number to call, in E.164 format, for example `+12025550123`. - `contacts.items.values` (object) - Values for the agent's variables for this contact, keyed by variable name, up to 100. Each key must be a variable the agent declares, and each value must match its `type` and `options`. Pass a value for every `required` variable. If any contact breaks these rules, the whole request fails with `400`, and no campaign is created. `null` values are rejected. - `schedule` (object, required) - When the campaign dials. Pass the fields of one schedule mode only. - `schedule.mode` (string, required) - `immediate`: The campaign starts dialing as soon as it's created. - `schedule.timezone` (string, required) - The IANA time zone for `days`, for example `America/New_York`. Daylight saving time is handled automatically. Required when you pass `days`. - Min length: `1` - Max length: `255` - `schedule.start` (string, required) - When the campaign can start dialing, as a local date and time in `YYYY-MM-DDTHH:MM` format with no offset, for example `2026-11-02T09:00`. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.end` (string, required) - When the campaign stops placing new calls, as a local date and time in `YYYY-MM-DDTHH:MM` format, later than `start`. Calls in progress continue. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.days` (array) - The weekly hours when new calls can start. Outside these hours, no new calls start. A day you don't list has no dialing. Omit `days` to dial at any time. - Min items: `1` - Max items: `7` - `schedule.days.items` (object) - `schedule.days.items.weekday` (string, required) - The day of the week. Each day can appear only once. - Allowed: `mon` | `tue` | `wed` | `thu` | `fri` | `sat` | `sun` - `schedule.days.items.ranges` (array, required) - One to 10 windows on this day, which can't overlap. - Min items: `1` - Max items: `10` - `schedule.days.items.ranges.items` (object) - `schedule.days.items.ranges.items.start` (string, required) - The start of the window, as a local time in 24-hour `HH:MM` format. - `schedule.days.items.ranges.items.end` (string, required) - The end of the window, as a local time in `HH:MM` format, later than `start`. Use `24:00` for the end of the day. - `lifecycle` (object) - The lifecycle settings for each session the campaign starts. Each session can last up to 1 hour, and lasts up to 5 minutes by default. - `lifecycle.idle_timeout_ms` (integer) - How long in milliseconds the session continues with no participant present: after the subscribed user leaves the RTC channel, or after the other side of a phone call hangs up. It isn't silence detection. Set to `0` to turn off the idle timer. Can't be greater than `max_duration_ms`. - Default: `30000` - Range: `[0, 3600000]` - `lifecycle.max_duration_ms` (integer) - The maximum length of each session in milliseconds, measured from `start_ts`. Defaults to 5 minutes. The maximum is 1 hour. - Default: `300000` - Range: `[1000, 3600000]` - `lifecycle.graceful_stop` (object) - How the agent finishes when you stop the session, or when the idle timer expires. It doesn't extend `max_duration_ms`, and it doesn't add a farewell message. - `lifecycle.graceful_stop.enabled` (boolean) - Whether the agent finishes what it's saying before it leaves. - Default: `false` - `lifecycle.graceful_stop.timeout_ms` (integer) - The longest time in milliseconds the agent can take to finish. - Default: `30000` - Range: `[0, 120000]` - `pacing` (object) - How fast the campaign dials. Each contact is called once. - `pacing.max_concurrent` (integer) - The maximum number of calls in progress at the same time. - Default: `10` - Range: `[1, 10000]` - `pacing.max_calls_per_second` (integer) - The maximum number of new dials in any one-second window. If you omit it, the campaign uses your project's default dial rate. A value above the project's limit is rejected with `InvalidFieldValue`. - Range: `[1, 1000]` - `data_policy` (object) - How Agora handles the session's data. You set it when the session starts and can't change it afterward. - `data_policy.retention` (string) - How long Agora keeps the conversation data: - `30_days`: Agora keeps the data for 30 days. - `none`: Agora doesn't keep the data, and variable extraction doesn't run. Use it, for example, when a caller declines recording. - Allowed: `30_days` | `none` - Default: `30_days` ### Request body example ```json { "name": "q3-renewals", "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "transport": { "type": "telephony", "from": "92e68758-3d3a-4f27-8b93-3fd8d834467c" }, "contacts": [ { "phone": "+12025550123", "values": { "name": "Ava", "renewal_year": 2027 } } ], "lifecycle": { "idle_timeout_ms": 30000 }, "pacing": { "max_concurrent": 10, "max_calls_per_second": 2 }, "schedule": { "mode": "scheduled", "timezone": "America/New_York", "start": "2026-11-02T09:00", "end": "2026-11-13T17:00", "days": [ { "weekday": "mon", "ranges": [ { "start": "09:00", "end": "12:00" }, { "start": "13:00", "end": "17:00" } ] }, { "weekday": "wed", "ranges": [ { "start": "09:00", "end": "17:00" } ] } ] } } ``` ## Responses ### 201 The campaign was created. The response body contains the campaign. - `campaign_id` (string) - The ID of the campaign, a UUID. - Format: `uuid` - `name` (string) - The name of the campaign. - `status` (string) - The status of the campaign: - `scheduled`: The campaign is waiting for its start time. - `running`: The campaign is dialing, or can dial during its schedule. - `paused`: You paused the campaign. - `completed`: The campaign has finished. - `canceled`: You canceled the campaign. - `failed`: The campaign failed. The details are in `failure`. - Allowed: `scheduled` | `running` | `paused` | `completed` | `canceled` | `failed` - `agent_id` (string) - The ID of the agent that makes the calls. - Format: `uuid` - `transport` (object) - `transport.type` (string) - Always `telephony`. - `transport.from` (array) - The `number_id` values of the numbers the campaign calls from. - `transport.from.items` (string) - `transport.call_policy` (object) - Limits and behavior for each call the campaign places. Each limit you omit adds no limit. - `transport.call_policy.max_ring_duration_ms` (integer) - The maximum time in milliseconds from starting the dial until the call is answered. If the call isn't answered in time, the dial attempt ends. - Range: `[1, 259200000]` - `transport.call_policy.max_call_duration_seconds` (integer) - The maximum length of the call in seconds, measured from when it's answered. The session's `lifecycle` limits can end the call earlier. - Range: `[1, 259200]` - `transport.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. This is separate from `pipeline.silence_config`, which only prompts the user. - Range: `[30000, 259200000]` - `transport.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `transport.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `transport.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `transport.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `lifecycle` (object) - When each session the campaign starts ends on its own. - `lifecycle.idle_timeout_ms` (integer) - How long in milliseconds the session continues with no participant present: after the subscribed user leaves the RTC channel, or after the other side of a phone call hangs up. It isn't silence detection. Set to `0` to turn off the idle timer. Can't be greater than `max_duration_ms`. - Default: `30000` - Range: `[0, 3600000]` - `lifecycle.max_duration_ms` (integer) - The maximum length of each session in milliseconds, measured from `start_ts`. Defaults to 5 minutes. The maximum is 1 hour. - Default: `300000` - Range: `[1000, 3600000]` - `lifecycle.graceful_stop` (object) - How the agent finishes when you stop the session, or when the idle timer expires. It doesn't extend `max_duration_ms`, and it doesn't add a farewell message. - `lifecycle.graceful_stop.enabled` (boolean) - Whether the agent finishes what it's saying before it leaves. - Default: `false` - `lifecycle.graceful_stop.timeout_ms` (integer) - The longest time in milliseconds the agent can take to finish. - Default: `30000` - Range: `[0, 120000]` - `schedule` (object) - When the campaign dials. Pass the fields of one schedule mode only. - `schedule.mode` (string, required) - `immediate`: The campaign starts dialing as soon as it's created. - `schedule.timezone` (string, required) - The IANA time zone for `days`, for example `America/New_York`. Daylight saving time is handled automatically. Required when you pass `days`. - Min length: `1` - Max length: `255` - `schedule.start` (string, required) - When the campaign can start dialing, as a local date and time in `YYYY-MM-DDTHH:MM` format with no offset, for example `2026-11-02T09:00`. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.end` (string, required) - When the campaign stops placing new calls, as a local date and time in `YYYY-MM-DDTHH:MM` format, later than `start`. Calls in progress continue. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.days` (array) - The weekly hours when new calls can start. Outside these hours, no new calls start. A day you don't list has no dialing. Omit `days` to dial at any time. - Min items: `1` - Max items: `7` - `schedule.days.items` (object) - `schedule.days.items.weekday` (string, required) - The day of the week. Each day can appear only once. - Allowed: `mon` | `tue` | `wed` | `thu` | `fri` | `sat` | `sun` - `schedule.days.items.ranges` (array, required) - One to 10 windows on this day, which can't overlap. - Min items: `1` - Max items: `10` - `schedule.days.items.ranges.items` (object) - `schedule.days.items.ranges.items.start` (string, required) - The start of the window, as a local time in 24-hour `HH:MM` format. - `schedule.days.items.ranges.items.end` (string, required) - The end of the window, as a local time in `HH:MM` format, later than `start`. Use `24:00` for the end of the day. - `counts` (object) - The number of contacts in each state. Retrieve the campaign to get current counts. - `counts.contacts` (integer) - The total number of contacts. - `counts.pending` (integer) - Contacts not called yet, or waiting for a retry. - `counts.calling` (integer) - Contacts in a call now. - `counts.completed` (integer) - Contacts whose call has finished. - `counts.failed` (integer) - Contacts not reached after all attempts. - `counts.canceled` (integer) - Contacts that won't be called because the campaign was canceled. - `create_ts` (integer) - The time the campaign was created, as a Unix timestamp in seconds. - `start_ts` (integer | null | null) - The time the campaign started dialing, as a Unix timestamp in seconds. `null` before it starts. - `complete_ts` (integer | null | null) - The time the campaign finished, as a Unix timestamp in seconds. `null` until it finishes. - `failure` (object) - Details of the failure when `status` is `failed`. Otherwise `null`. - `failure.code` (string, required) - A stable runtime error code, for example `provider_error`. - `failure.provider` (string) - The model provider that caused the failure, for example `openai`. - `failure.message` (string, required) - A human-readable explanation. - `failure.ts` (integer, required) - The time the failure occurred, as a Unix timestamp in seconds. ### 400 The request is invalid. Check `reason` and `detail` in the response body. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 201 ```json { "campaign_id": "b4f0581e-f138-43a2-851c-a8f8d228bb37", "name": "q3-renewals", "status": "scheduled", "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "transport": { "type": "telephony", "from": [ "92e68758-3d3a-4f27-8b93-3fd8d834467c" ] }, "lifecycle": { "idle_timeout_ms": 30000, "max_duration_ms": 300000, "graceful_stop": { "enabled": false, "timeout_ms": 30000 } }, "schedule": { "mode": "scheduled", "timezone": "America/New_York", "start": "2026-11-02T09:00", "end": "2026-11-13T17:00" }, "counts": { "contacts": 1, "pending": 1, "calling": 0, "completed": 0, "failed": 0, "canceled": 0 }, "create_ts": 1787673602, "start_ts": null, "complete_ts": null, "failure": null } ``` # Create a phone number (/en/api-reference/api-ref/conversational-ai/platform/create-number) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Registers a phone number, its SIP trunk, and its inbound routing in your project. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: create-number - Method: POST - Path: /v1/projects/{appid}/numbers - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/numbers ## Servers - https://preview.ai.agora.io/conversational-ai Use this endpoint to import a number that your carrier assigned to you. Importing a number doesn't purchase one. Outbound sessions and campaigns can use the number as their caller ID, and `inbound` chooses the agent that answers calls to it. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. ## Request body - `number` (string, required) - The phone number in E.164 format, for example `+14155550100`. - Min length: `1` - Max length: `128` - `description` (string) - A description of the number's purpose. It's separate from `sip_trunk.name`, which names the carrier connection. - `sip_trunk` (object, required) - The carrier connection for this number. - `sip_trunk.name` (string) - A name for the carrier connection that helps you identify it. - `sip_trunk.hostname` (string, required) - The carrier's SIP hostname, without a scheme or port. For example, `acme.pstn.example.com`. - Pattern: `^[^:/\s]+$` - `sip_trunk.port` (integer) - The SIP signaling port. Defaults to `5061` when `transport` is `tls`, and `5060` when it's `udp` or `tcp`. - Range: `[1, 65535]` - `sip_trunk.transport` (string) - The transport protocol for the carrier connection. - Allowed: `udp` | `tcp` | `tls` - Default: `tls` - `sip_trunk.auth` (object) - The credentials for your SIP trunk. They are write-only and are never returned. - `sip_trunk.auth.username` (string, required) - The SIP username. - `sip_trunk.auth.password` (string, required) - The SIP password. Referring to a secret set, such as `$secrets.support_prod.sip_password`, isn't supported in the Preview. - `sip_trunk.allowed_ips` (array) - The addresses allowed to send inbound SIP traffic to this number. Each entry is an IPv4 address, such as `54.172.60.1`, or an IPv4 CIDR range, such as `54.172.60.0/23`. IPv6 addresses and hostnames aren't accepted. If you omit it, inbound SIP traffic is accepted from any address, so set it to your carrier's signaling addresses. - `sip_trunk.allowed_ips.items` (string) - `inbound` (object) - What happens when someone calls this number. If you omit it, inbound calls are rejected. `call_policy` is required when `agent` isn't `null`. - `inbound.agent` (string | null | null, required) - The ID of the agent that answers inbound calls. Set to `null` to reject inbound calls. - `inbound.call_policy` (object) - Limits and behavior for inbound calls to this number. Each limit you omit adds no limit. - `inbound.call_policy.max_call_duration_seconds` (integer) - The maximum length of a call in seconds, measured from when it's answered. - Minimum: `1` - `inbound.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. - Minimum: `1` - `inbound.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `inbound.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `inbound.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `inbound.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` ### Request body example ```json { "number": "+14155550100", "description": "Primary customer support line for North America.", "sip_trunk": { "name": "support-line", "hostname": "acme.pstn.example.com", "transport": "tls", "auth": { "username": "acme", "password": "" } }, "inbound": { "agent": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "call_policy": { "max_call_duration_seconds": 1800, "max_silence_duration_ms": 60000, "end_call": { "on_user_request": true } } } } ``` ## Responses ### 201 The number was created. The response body contains the saved number. - `number_id` (string) - The ID of the phone number, a UUID. - Format: `uuid` - `number` (string) - The phone number in E.164 format. - `description` (string) - A description of the number's purpose. It's separate from `sip_trunk.name`, which names the carrier connection. - `sip_trunk` (object) - `sip_trunk.name` (string) - The name of the carrier connection. - `sip_trunk.hostname` (string) - The carrier's SIP hostname. - `sip_trunk.port` (integer) - The SIP signaling port. - `sip_trunk.transport` (string) - The transport protocol for the carrier connection. - Allowed: `udp` | `tcp` | `tls` - `sip_trunk.allowed_ips` (array) - The addresses allowed to send inbound SIP traffic. - `sip_trunk.allowed_ips.items` (string) - `inbound` (object) - What happens when someone calls this number. If you omit it, inbound calls are rejected. `call_policy` is required when `agent` isn't `null`. - `inbound.agent` (string | null | null, required) - The ID of the agent that answers inbound calls. Set to `null` to reject inbound calls. - `inbound.call_policy` (object) - Limits and behavior for inbound calls to this number. Each limit you omit adds no limit. - `inbound.call_policy.max_call_duration_seconds` (integer) - The maximum length of a call in seconds, measured from when it's answered. - Minimum: `1` - `inbound.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. - Minimum: `1` - `inbound.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `inbound.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `inbound.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `inbound.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `create_ts` (integer) - The time the number was added, as a Unix timestamp in seconds. ### 400 The request is invalid. Check `reason` and `detail` in the response body. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `NumberAlreadyExists`: The number is already registered in the project. `ResourceConflict`: The number is registered to another account, or another project in your account already routes its inbound calls to an agent. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 201 ```json { "number_id": "92e68758-3d3a-4f27-8b93-3fd8d834467c", "number": "+14155550100", "description": "Primary customer support line for North America.", "sip_trunk": { "name": "support-line", "hostname": "acme.pstn.example.com", "port": 5061, "transport": "tls" }, "inbound": { "agent": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "call_policy": { "max_call_duration_seconds": 1800, "max_silence_duration_ms": 60000, "end_call": { "on_user_request": true } } }, "create_ts": 1787223852 } ``` # Create a secret set (/en/api-reference/api-ref/conversational-ai/platform/create-secret-set) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Creates a named set of secrets in your project. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: create-secret-set - Method: POST - Path: /v1/projects/{appid}/secrets - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/secrets ## Servers - https://preview.ai.agora.io/conversational-ai Use secret sets to keep provider API keys out of your agent configurations. To use a secret, pass `$secrets..` in an agent's `credential.fields`, for example in `credential.fields.api_key`. Agora resolves references when each session starts. If a set with the same name exists, the request fails with `SecretSetAlreadyExists`. To change values, [update the set](/en/api-reference/api-ref/conversational-ai/platform/update-secret-set) or [set a key](/en/api-reference/api-ref/conversational-ai/platform/set-secret-key). ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. ## Request body - `name` (string, required) - A name for the secret set, unique in the project. Use 1 to 64 characters from `A-Z`, `a-z`, `0-9`, and `_`. Names are case-sensitive. - Min length: `1` - Max length: `64` - `secrets` (object, required) - The secrets, as key-value pairs. Each key is 1 to 64 characters from `A-Z`, `a-z`, `0-9`, and `_`, and must be unique within the set. Values are write-only and are never returned. A set can hold at most 64 KiB, measured as the UTF-8 size of its keys and values encoded as a JSON object. A larger set is rejected with `400`. ### Request body example ```json { "name": "support_prod", "secrets": { "asr": "", "llm": "", "tts": "" } } ``` ## Responses ### 201 The secret set was created. The response body lists its keys. - `name` (string, required) - The name of the secret set. - `keys` (array, required) - The names of the keys in the set. Values are never returned. - `keys.items` (string) - `create_ts` (integer, required) - The time the set was created, as a Unix timestamp in seconds. - `update_ts` (integer, required) - The time the set was last updated, as a Unix timestamp in seconds. ### 400 The request is invalid. Check `reason` and `detail` in the response body. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `SecretSetAlreadyExists`: A set with this name exists. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 422 The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 201 ```json { "name": "support_prod", "keys": [ "asr", "llm", "tts" ], "create_ts": 1789898400, "update_ts": 1789898400 } ``` # Delete an agent (/en/api-reference/api-ref/conversational-ai/platform/delete-agent) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Deletes a saved agent. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: delete-agent - Method: DELETE - Path: /v1/projects/{appid}/agents/{agent_id} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/agents/{agent_id} ## Servers - https://preview.ai.agora.io/conversational-ai You can't delete an agent that a phone number routes inbound calls to, or that a campaign that hasn't finished uses. Remove those references first. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `agent_id` (path, required, string) - The ID of the agent, returned in `agent_id` when you create the agent. - Format: `uuid` ## Request body No request body. ## Responses ### 200 The agent was deleted. - `deleted` (boolean, required) - Always `true`. The resource is deleted. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `AgentInUse`: A phone number's inbound routing or an unfinished campaign references the agent. `detail` names the reference. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). # Delete a campaign (/en/api-reference/api-ref/conversational-ai/platform/delete-campaign) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Deletes a finished campaign and its contacts. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: delete-campaign - Method: DELETE - Path: /v1/projects/{appid}/campaigns/{campaign_id} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/campaigns/{campaign_id} ## Servers - https://preview.ai.agora.io/conversational-ai You can't delete a campaign that is `scheduled`, `running`, or `paused`. [Cancel it](/en/api-reference/api-ref/conversational-ai/platform/cancel-campaign) first. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `campaign_id` (path, required, string) - The ID of the campaign, returned in `campaign_id` when you create the campaign. - Format: `uuid` ## Request body No request body. ## Responses ### 200 The campaign was deleted. - `deleted` (boolean, required) - Always `true`. The resource is deleted. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `CampaignActive`: The campaign is `scheduled`, `running`, or `paused`, or it still has calls in progress. Cancel it, and wait for its calls to end before you delete it. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). # Delete a phone number (/en/api-reference/api-ref/conversational-ai/platform/delete-number) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Removes a phone number and its SIP trunk settings from your project. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: delete-number - Method: DELETE - Path: /v1/projects/{appid}/numbers/{number_id} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/numbers/{number_id} ## Servers - https://preview.ai.agora.io/conversational-ai ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `number_id` (path, required, string) - The ID of the phone number, returned in `number_id` when you create the number. - Format: `uuid` ## Request body No request body. ## Responses ### 200 The number was deleted. - `deleted` (boolean, required) - Always `true`. The resource is deleted. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `ResourceConflict`: A campaign that hasn't finished still calls from this number. Wait for the campaign to finish, or cancel it, before you delete the number. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). # Delete a secret key (/en/api-reference/api-ref/conversational-ai/platform/delete-secret-key) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Removes a key from a secret set. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: delete-secret-key - Method: DELETE - Path: /v1/projects/{appid}/secrets/{name}/keys/{key} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/secrets/{name}/keys/{key} ## Servers - https://preview.ai.agora.io/conversational-ai You can't remove a key that an agent references. A secret set must also keep at least one key. To remove the last key, [delete the set](/en/api-reference/api-ref/conversational-ai/platform/delete-secret-set) instead. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `name` (path, required, string) - The name of the secret set. - `key` (path, required, string) - The name of the key in the secret set. When you add a key, use 1 to 64 characters from `A-Z`, `a-z`, `0-9`, and `_`. - `If-Match` (header, optional, string) - The key's `ETag` from your last write to it. The request fails with `412` if the key has changed since then. ## Request body No request body. ## Responses ### 200 The key was removed. - `deleted` (boolean, required) - Always `true`. The resource is deleted. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `SecretSetInUse`: An agent references the key. `SecretSetEmpty`: The key is the last key in the set. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 412 The `If-Match` value doesn't match the current version of the resource. The reason is `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). # Delete a secret set (/en/api-reference/api-ref/conversational-ai/platform/delete-secret-set) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Deletes a secret set and all its keys. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: delete-secret-set - Method: DELETE - Path: /v1/projects/{appid}/secrets/{name} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/secrets/{name} ## Servers - https://preview.ai.agora.io/conversational-ai You can't delete a set that an agent references. Remove the references first. Changing a key also changes the set's `ETag`, so retrieve the set to get its current `ETag` before you delete it. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `name` (path, required, string) - The name of the secret set. - `If-Match` (header, required, string) - The `ETag` value from the most recent response for this resource. If the resource has changed since then, the request fails with `412` and reason `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`. ## Request body No request body. ## Responses ### 200 The secret set was deleted. - `deleted` (boolean, required) - Always `true`. The resource is deleted. ### 400 The request is invalid. Check `reason` and `detail` in the response body. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `SecretSetInUse`: An agent references the set. `detail` names the agent. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 412 The `If-Match` value doesn't match the current version of the resource. The reason is `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). # List agents (/en/api-reference/api-ref/conversational-ai/platform/list-agents) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Retrieves the agents saved in your project. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: list-agents - Method: GET - Path: /v1/projects/{appid}/agents - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/agents ## Servers - https://preview.ai.agora.io/conversational-ai ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `limit` (query, optional, integer) - The maximum number of agents to return on each page. - Default: `50` - Range: `[1, 200]` - `cursor` (query, optional, string) - The `next_cursor` value from the previous page of results. Omit it to get the first page. The cursor is opaque, so pass it back unchanged. - `order` (query, optional, string) - The sort order of the results: - `create_ts.desc`: Newest first. - `create_ts.asc`: Oldest first. - Allowed: `create_ts.desc` | `create_ts.asc` - Default: `create_ts.desc` ## Request body No request body. ## Responses ### 200 The request was successful. The response body contains a page of agents. - `has_more` (boolean) - Whether more results are available after this page. - `next_cursor` (string | null | null) - The cursor for the next page. Pass it in the `cursor` query parameter of your next request. `null` on the last page. - `data` (object) - `data.count` (integer) - The number of agents on this page. - `data.list` (array) - The agents on this page. Retrieve an agent to get its configuration. - `data.list.items` (object) - `data.list.items.agent_id` (string, required) - The ID of the agent. - Format: `uuid` - `data.list.items.agent_name` (string, required) - The name of the agent. - `data.list.items.create_ts` (integer, required) - The time the agent was created, as a Unix timestamp in seconds. - `data.list.items.update_ts` (integer, required) - The time the agent was last updated, as a Unix timestamp in seconds. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "data": { "count": 1, "list": [ { "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "agent_name": "Customer Support Agent", "create_ts": 1786543331, "update_ts": 1787733713 } ] }, "has_more": false, "next_cursor": null } ``` # List campaigns (/en/api-reference/api-ref/conversational-ai/platform/list-campaigns) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Retrieves the campaigns in your project. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: list-campaigns - Method: GET - Path: /v1/projects/{appid}/campaigns - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/campaigns ## Servers - https://preview.ai.agora.io/conversational-ai ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `status` (query, optional, string) - Return only campaigns with this status. - Allowed: `scheduled` | `running` | `paused` | `completed` | `canceled` | `failed` - `limit` (query, optional, integer) - The maximum number of campaigns to return on each page. - Minimum: `1` - `cursor` (query, optional, string) - The `next_cursor` value from the previous page of results. Omit it to get the first page. The cursor is opaque, so pass it back unchanged. - `order` (query, optional, string) - The sort order of the results: - `create_ts.desc`: Newest first. - `create_ts.asc`: Oldest first. - Allowed: `create_ts.desc` | `create_ts.asc` - Default: `create_ts.desc` ## Request body No request body. ## Responses ### 200 The request was successful. The response body contains a page of campaigns. - `has_more` (boolean) - Whether more results are available after this page. - `next_cursor` (string | null | null) - The cursor for the next page. Pass it in the `cursor` query parameter of your next request. `null` on the last page. - `data` (object) - `data.count` (integer) - The number of campaigns on this page. - `data.list` (array) - The campaigns on this page. - `data.list.items` (object) - `data.list.items.campaign_id` (string) - The ID of the campaign, a UUID. - Format: `uuid` - `data.list.items.name` (string) - The name of the campaign. - `data.list.items.status` (string) - The status of the campaign: - `scheduled`: The campaign is waiting for its start time. - `running`: The campaign is dialing, or can dial during its schedule. - `paused`: You paused the campaign. - `completed`: The campaign has finished. - `canceled`: You canceled the campaign. - `failed`: The campaign failed. The details are in `failure`. - Allowed: `scheduled` | `running` | `paused` | `completed` | `canceled` | `failed` - `data.list.items.agent_id` (string) - The ID of the agent that makes the calls. - Format: `uuid` - `data.list.items.transport` (object) - `data.list.items.transport.type` (string) - Always `telephony`. - `data.list.items.transport.from` (array) - The `number_id` values of the numbers the campaign calls from. - `data.list.items.transport.from.items` (string) - `data.list.items.transport.call_policy` (object) - Limits and behavior for each call the campaign places. Each limit you omit adds no limit. - `data.list.items.transport.call_policy.max_ring_duration_ms` (integer) - The maximum time in milliseconds from starting the dial until the call is answered. If the call isn't answered in time, the dial attempt ends. - Range: `[1, 259200000]` - `data.list.items.transport.call_policy.max_call_duration_seconds` (integer) - The maximum length of the call in seconds, measured from when it's answered. The session's `lifecycle` limits can end the call earlier. - Range: `[1, 259200]` - `data.list.items.transport.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. This is separate from `pipeline.silence_config`, which only prompts the user. - Range: `[30000, 259200000]` - `data.list.items.transport.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `data.list.items.transport.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `data.list.items.transport.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `data.list.items.transport.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `data.list.items.lifecycle` (object) - When each session the campaign starts ends on its own. - `data.list.items.lifecycle.idle_timeout_ms` (integer) - How long in milliseconds the session continues with no participant present: after the subscribed user leaves the RTC channel, or after the other side of a phone call hangs up. It isn't silence detection. Set to `0` to turn off the idle timer. Can't be greater than `max_duration_ms`. - Default: `30000` - Range: `[0, 3600000]` - `data.list.items.lifecycle.max_duration_ms` (integer) - The maximum length of each session in milliseconds, measured from `start_ts`. Defaults to 5 minutes. The maximum is 1 hour. - Default: `300000` - Range: `[1000, 3600000]` - `data.list.items.lifecycle.graceful_stop` (object) - How the agent finishes when you stop the session, or when the idle timer expires. It doesn't extend `max_duration_ms`, and it doesn't add a farewell message. - `data.list.items.lifecycle.graceful_stop.enabled` (boolean) - Whether the agent finishes what it's saying before it leaves. - Default: `false` - `data.list.items.lifecycle.graceful_stop.timeout_ms` (integer) - The longest time in milliseconds the agent can take to finish. - Default: `30000` - Range: `[0, 120000]` - `data.list.items.schedule` (object) - When the campaign dials. Pass the fields of one schedule mode only. - `data.list.items.schedule.mode` (string, required) - `immediate`: The campaign starts dialing as soon as it's created. - `data.list.items.schedule.timezone` (string, required) - The IANA time zone for `days`, for example `America/New_York`. Daylight saving time is handled automatically. Required when you pass `days`. - Min length: `1` - Max length: `255` - `data.list.items.schedule.start` (string, required) - When the campaign can start dialing, as a local date and time in `YYYY-MM-DDTHH:MM` format with no offset, for example `2026-11-02T09:00`. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `data.list.items.schedule.end` (string, required) - When the campaign stops placing new calls, as a local date and time in `YYYY-MM-DDTHH:MM` format, later than `start`. Calls in progress continue. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `data.list.items.schedule.days` (array) - The weekly hours when new calls can start. Outside these hours, no new calls start. A day you don't list has no dialing. Omit `days` to dial at any time. - Min items: `1` - Max items: `7` - `data.list.items.schedule.days.items` (object) - `data.list.items.schedule.days.items.weekday` (string, required) - The day of the week. Each day can appear only once. - Allowed: `mon` | `tue` | `wed` | `thu` | `fri` | `sat` | `sun` - `data.list.items.schedule.days.items.ranges` (array, required) - One to 10 windows on this day, which can't overlap. - Min items: `1` - Max items: `10` - `data.list.items.schedule.days.items.ranges.items` (object) - `data.list.items.schedule.days.items.ranges.items.start` (string, required) - The start of the window, as a local time in 24-hour `HH:MM` format. - `data.list.items.schedule.days.items.ranges.items.end` (string, required) - The end of the window, as a local time in `HH:MM` format, later than `start`. Use `24:00` for the end of the day. - `data.list.items.counts` (object) - The number of contacts in each state. Retrieve the campaign to get current counts. - `data.list.items.counts.contacts` (integer) - The total number of contacts. - `data.list.items.counts.pending` (integer) - Contacts not called yet, or waiting for a retry. - `data.list.items.counts.calling` (integer) - Contacts in a call now. - `data.list.items.counts.completed` (integer) - Contacts whose call has finished. - `data.list.items.counts.failed` (integer) - Contacts not reached after all attempts. - `data.list.items.counts.canceled` (integer) - Contacts that won't be called because the campaign was canceled. - `data.list.items.create_ts` (integer) - The time the campaign was created, as a Unix timestamp in seconds. - `data.list.items.start_ts` (integer | null | null) - The time the campaign started dialing, as a Unix timestamp in seconds. `null` before it starts. - `data.list.items.complete_ts` (integer | null | null) - The time the campaign finished, as a Unix timestamp in seconds. `null` until it finishes. - `data.list.items.failure` (object) - Details of the failure when `status` is `failed`. Otherwise `null`. - `data.list.items.failure.code` (string, required) - A stable runtime error code, for example `provider_error`. - `data.list.items.failure.provider` (string) - The model provider that caused the failure, for example `openai`. - `data.list.items.failure.message` (string, required) - A human-readable explanation. - `data.list.items.failure.ts` (integer, required) - The time the failure occurred, as a Unix timestamp in seconds. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "data": { "count": 1, "list": [ { "campaign_id": "b4f0581e-f138-43a2-851c-a8f8d228bb37", "name": "q3-renewals", "status": "running", "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "transport": { "type": "telephony", "from": [ "92e68758-3d3a-4f27-8b93-3fd8d834467c" ] }, "schedule": { "mode": "immediate" }, "counts": { "contacts": 120, "pending": 84, "calling": 6, "completed": 27, "failed": 3, "canceled": 0 }, "create_ts": 1787673602, "start_ts": 1787673602, "complete_ts": null, "failure": null } ] }, "has_more": false, "next_cursor": null } ``` # List phone numbers (/en/api-reference/api-ref/conversational-ai/platform/list-numbers) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Retrieves the phone numbers in your project. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: list-numbers - Method: GET - Path: /v1/projects/{appid}/numbers - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/numbers ## Servers - https://preview.ai.agora.io/conversational-ai ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `limit` (query, optional, integer) - The maximum number of phone numbers to return on each page. - Default: `50` - Range: `[1, 100]` - `cursor` (query, optional, string) - The `next_cursor` value from the previous page of results. Omit it to get the first page. The cursor is opaque, so pass it back unchanged. - `order` (query, optional, string) - The sort order of the results: - `create_ts.desc`: Newest first. - `create_ts.asc`: Oldest first. - Allowed: `create_ts.desc` | `create_ts.asc` - Default: `create_ts.desc` ## Request body No request body. ## Responses ### 200 The request was successful. The response body contains a page of phone numbers. - `has_more` (boolean) - Whether more results are available after this page. - `next_cursor` (string | null | null) - The cursor for the next page. Pass it in the `cursor` query parameter of your next request. `null` on the last page. - `data` (object) - `data.count` (integer) - The number of phone numbers on this page. - `data.list` (array) - The phone numbers on this page. - `data.list.items` (object) - `data.list.items.number_id` (string) - The ID of the phone number, a UUID. - Format: `uuid` - `data.list.items.number` (string) - The phone number in E.164 format. - `data.list.items.description` (string) - A description of the number's purpose. It's separate from `sip_trunk.name`, which names the carrier connection. - `data.list.items.sip_trunk` (object) - `data.list.items.sip_trunk.name` (string) - The name of the carrier connection. - `data.list.items.sip_trunk.hostname` (string) - The carrier's SIP hostname. - `data.list.items.sip_trunk.port` (integer) - The SIP signaling port. - `data.list.items.sip_trunk.transport` (string) - The transport protocol for the carrier connection. - Allowed: `udp` | `tcp` | `tls` - `data.list.items.sip_trunk.allowed_ips` (array) - The addresses allowed to send inbound SIP traffic. - `data.list.items.sip_trunk.allowed_ips.items` (string) - `data.list.items.inbound` (object) - What happens when someone calls this number. If you omit it, inbound calls are rejected. `call_policy` is required when `agent` isn't `null`. - `data.list.items.inbound.agent` (string | null | null, required) - The ID of the agent that answers inbound calls. Set to `null` to reject inbound calls. - `data.list.items.inbound.call_policy` (object) - Limits and behavior for inbound calls to this number. Each limit you omit adds no limit. - `data.list.items.inbound.call_policy.max_call_duration_seconds` (integer) - The maximum length of a call in seconds, measured from when it's answered. - Minimum: `1` - `data.list.items.inbound.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. - Minimum: `1` - `data.list.items.inbound.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `data.list.items.inbound.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `data.list.items.inbound.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `data.list.items.inbound.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `data.list.items.create_ts` (integer) - The time the number was added, as a Unix timestamp in seconds. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "data": { "count": 1, "list": [ { "number_id": "92e68758-3d3a-4f27-8b93-3fd8d834467c", "number": "+14155550100", "description": "Primary customer support line for North America.", "sip_trunk": { "name": "support-line", "hostname": "acme.pstn.example.com", "port": 5061, "transport": "tls" }, "inbound": { "agent": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "call_policy": { "max_call_duration_seconds": 1800, "max_silence_duration_ms": 60000, "end_call": { "on_user_request": true } } }, "create_ts": 1787223852 } ] }, "has_more": false, "next_cursor": null } ``` # List secret sets (/en/api-reference/api-ref/conversational-ai/platform/list-secret-sets) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Retrieves the secret sets in your project and their key names. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: list-secret-sets - Method: GET - Path: /v1/projects/{appid}/secrets - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/secrets ## Servers - https://preview.ai.agora.io/conversational-ai ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `limit` (query, optional, integer) - The maximum number of secret sets to return on each page. - Default: `50` - Range: `[1, 200]` - `cursor` (query, optional, string) - The `next_cursor` value from the previous page of results. Omit it to get the first page. The cursor is opaque, so pass it back unchanged. - `order` (query, optional, string) - The sort order of the results: - `create_ts.desc`: Newest first. - `create_ts.asc`: Oldest first. - Allowed: `create_ts.desc` | `create_ts.asc` - Default: `create_ts.desc` ## Request body No request body. ## Responses ### 200 The request was successful. The response body contains a page of secret sets. Secret values are never returned. - `has_more` (boolean) - Whether more results are available after this page. - `next_cursor` (string | null | null) - The cursor for the next page. Pass it in the `cursor` query parameter of your next request. `null` on the last page. - `data` (object) - `data.count` (integer) - The number of secret sets on this page. - `data.list` (array) - The secret sets on this page. - `data.list.items` (object) - `data.list.items.name` (string, required) - The name of the secret set. - `data.list.items.keys` (array, required) - The names of the keys in the set. Values are never returned. - `data.list.items.keys.items` (string) - `data.list.items.create_ts` (integer, required) - The time the set was created, as a Unix timestamp in seconds. - `data.list.items.update_ts` (integer, required) - The time the set was last updated, as a Unix timestamp in seconds. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "data": { "count": 1, "list": [ { "name": "support_prod", "keys": [ "llm" ], "create_ts": 1789898400, "update_ts": 1790000000 } ] }, "has_more": false, "next_cursor": null } ``` # List sessions (/en/api-reference/api-ref/conversational-ai/platform/list-sessions) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Retrieves the sessions in your project that match the filters. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: list-sessions - Method: GET - Path: /v1/projects/{appid}/sessions - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/sessions ## Servers - https://preview.ai.agora.io/conversational-ai By default, the response contains running sessions that started in the last two hours. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `channel` (query, optional, string) - Return only sessions in this RTC channel. The match is exact and case-sensitive. Telephony sessions have no RTC channel and never match. - `status` (query, optional, string) - The statuses to include, separated by commas, for example `RUNNING,STOPPED`. Valid statuses are `IDLE`, `STARTING`, `RUNNING`, `STOPPING`, `STOPPED`, and `FAILED`. - Default: `RUNNING` - `started_after` (query, optional, integer) - Return only sessions that started after this time, as a Unix timestamp in seconds. Defaults to two hours before the request. - Minimum: `0` - `started_before` (query, optional, integer) - Return only sessions that started before this time, as a Unix timestamp in seconds. Defaults to the time of the request. - Minimum: `0` - `limit` (query, optional, integer) - The maximum number of sessions to return on each page. - Default: `20` - Minimum: `1` - `cursor` (query, optional, string) - The `next_cursor` value from the previous page of results. Omit it to get the first page. The cursor is opaque, so pass it back unchanged. ## Request body No request body. ## Responses ### 200 The request was successful. The response body contains a page of sessions. - `has_more` (boolean) - Whether more results are available after this page. - `next_cursor` (string | null | null) - The cursor for the next page. Pass it in the `cursor` query parameter of your next request. `null` on the last page. - `data` (object) - `data.count` (integer) - The number of sessions on this page. - `data.list` (array) - The sessions on this page. - `data.list.items` (object) - `data.list.items.agent_session_id` (string) - The ID of the session. - `data.list.items.status` (string) - The status of the session: - `IDLE`: The session is idle. - `STARTING`: The session is starting. - `RUNNING`: The session is running. - `STOPPING`: The session is stopping. - `STOPPED`: The session has ended. - `FAILED`: The session failed. - Allowed: `IDLE` | `STARTING` | `RUNNING` | `STOPPING` | `STOPPED` | `FAILED` - `data.list.items.start_ts` (integer) - The time the session was created, as a Unix timestamp in seconds. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "data": { "count": 1, "list": [ { "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h", "start_ts": 1735035893, "status": "RUNNING" } ] }, "has_more": true, "next_cursor": "a42aj97dh44ve73km82yr34rr67pk75e" } ``` # Pause a campaign (/en/api-reference/api-ref/conversational-ai/platform/pause-campaign) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Stops a running campaign from placing new calls. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: pause-campaign - Method: POST - Path: /v1/projects/{appid}/campaigns/{campaign_id}:pause - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/campaigns/{campaign_id}:pause ## Servers - https://preview.ai.agora.io/conversational-ai You can pause a campaign whose status is `running`. Calls already in progress continue. To continue dialing, [resume the campaign](/en/api-reference/api-ref/conversational-ai/platform/resume-campaign). ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `campaign_id` (path, required, string) - The ID of the campaign, returned in `campaign_id` when you create the campaign. - Format: `uuid` ## Request body No request body. ## Responses ### 200 The campaign was paused. The response body contains the campaign. - `campaign_id` (string) - The ID of the campaign, a UUID. - Format: `uuid` - `name` (string) - The name of the campaign. - `status` (string) - The status of the campaign: - `scheduled`: The campaign is waiting for its start time. - `running`: The campaign is dialing, or can dial during its schedule. - `paused`: You paused the campaign. - `completed`: The campaign has finished. - `canceled`: You canceled the campaign. - `failed`: The campaign failed. The details are in `failure`. - Allowed: `scheduled` | `running` | `paused` | `completed` | `canceled` | `failed` - `agent_id` (string) - The ID of the agent that makes the calls. - Format: `uuid` - `transport` (object) - `transport.type` (string) - Always `telephony`. - `transport.from` (array) - The `number_id` values of the numbers the campaign calls from. - `transport.from.items` (string) - `transport.call_policy` (object) - Limits and behavior for each call the campaign places. Each limit you omit adds no limit. - `transport.call_policy.max_ring_duration_ms` (integer) - The maximum time in milliseconds from starting the dial until the call is answered. If the call isn't answered in time, the dial attempt ends. - Range: `[1, 259200000]` - `transport.call_policy.max_call_duration_seconds` (integer) - The maximum length of the call in seconds, measured from when it's answered. The session's `lifecycle` limits can end the call earlier. - Range: `[1, 259200]` - `transport.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. This is separate from `pipeline.silence_config`, which only prompts the user. - Range: `[30000, 259200000]` - `transport.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `transport.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `transport.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `transport.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `lifecycle` (object) - When each session the campaign starts ends on its own. - `lifecycle.idle_timeout_ms` (integer) - How long in milliseconds the session continues with no participant present: after the subscribed user leaves the RTC channel, or after the other side of a phone call hangs up. It isn't silence detection. Set to `0` to turn off the idle timer. Can't be greater than `max_duration_ms`. - Default: `30000` - Range: `[0, 3600000]` - `lifecycle.max_duration_ms` (integer) - The maximum length of each session in milliseconds, measured from `start_ts`. Defaults to 5 minutes. The maximum is 1 hour. - Default: `300000` - Range: `[1000, 3600000]` - `lifecycle.graceful_stop` (object) - How the agent finishes when you stop the session, or when the idle timer expires. It doesn't extend `max_duration_ms`, and it doesn't add a farewell message. - `lifecycle.graceful_stop.enabled` (boolean) - Whether the agent finishes what it's saying before it leaves. - Default: `false` - `lifecycle.graceful_stop.timeout_ms` (integer) - The longest time in milliseconds the agent can take to finish. - Default: `30000` - Range: `[0, 120000]` - `schedule` (object) - When the campaign dials. Pass the fields of one schedule mode only. - `schedule.mode` (string, required) - `immediate`: The campaign starts dialing as soon as it's created. - `schedule.timezone` (string, required) - The IANA time zone for `days`, for example `America/New_York`. Daylight saving time is handled automatically. Required when you pass `days`. - Min length: `1` - Max length: `255` - `schedule.start` (string, required) - When the campaign can start dialing, as a local date and time in `YYYY-MM-DDTHH:MM` format with no offset, for example `2026-11-02T09:00`. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.end` (string, required) - When the campaign stops placing new calls, as a local date and time in `YYYY-MM-DDTHH:MM` format, later than `start`. Calls in progress continue. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.days` (array) - The weekly hours when new calls can start. Outside these hours, no new calls start. A day you don't list has no dialing. Omit `days` to dial at any time. - Min items: `1` - Max items: `7` - `schedule.days.items` (object) - `schedule.days.items.weekday` (string, required) - The day of the week. Each day can appear only once. - Allowed: `mon` | `tue` | `wed` | `thu` | `fri` | `sat` | `sun` - `schedule.days.items.ranges` (array, required) - One to 10 windows on this day, which can't overlap. - Min items: `1` - Max items: `10` - `schedule.days.items.ranges.items` (object) - `schedule.days.items.ranges.items.start` (string, required) - The start of the window, as a local time in 24-hour `HH:MM` format. - `schedule.days.items.ranges.items.end` (string, required) - The end of the window, as a local time in `HH:MM` format, later than `start`. Use `24:00` for the end of the day. - `counts` (object) - The number of contacts in each state. Retrieve the campaign to get current counts. - `counts.contacts` (integer) - The total number of contacts. - `counts.pending` (integer) - Contacts not called yet, or waiting for a retry. - `counts.calling` (integer) - Contacts in a call now. - `counts.completed` (integer) - Contacts whose call has finished. - `counts.failed` (integer) - Contacts not reached after all attempts. - `counts.canceled` (integer) - Contacts that won't be called because the campaign was canceled. - `create_ts` (integer) - The time the campaign was created, as a Unix timestamp in seconds. - `start_ts` (integer | null | null) - The time the campaign started dialing, as a Unix timestamp in seconds. `null` before it starts. - `complete_ts` (integer | null | null) - The time the campaign finished, as a Unix timestamp in seconds. `null` until it finishes. - `failure` (object) - Details of the failure when `status` is `failed`. Otherwise `null`. - `failure.code` (string, required) - A stable runtime error code, for example `provider_error`. - `failure.provider` (string) - The model provider that caused the failure, for example `openai`. - `failure.message` (string, required) - A human-readable explanation. - `failure.ts` (integer, required) - The time the failure occurred, as a Unix timestamp in seconds. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `CampaignInvalidState`: The campaign isn't `running`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). # Replace a secret set (/en/api-reference/api-ref/conversational-ai/platform/replace-secret-set) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Replaces all the keys in a secret set in one change. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: replace-secret-set - Method: PUT - Path: /v1/projects/{appid}/secrets/{name} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/secrets/{name} ## Servers - https://preview.ai.agora.io/conversational-ai After the request, the set contains only the keys you pass. Keys you omit are removed. Agents keep referencing the set by name, so you don't need to change them. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `name` (path, required, string) - The name of the secret set. - `If-Match` (header, required, string) - The `ETag` value from the most recent response for this resource. If the resource has changed since then, the request fails with `412` and reason `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`. ## Request body - `secrets` (object, required) - The secrets, as key-value pairs. Each key is 1 to 64 characters from `A-Z`, `a-z`, `0-9`, and `_`, and must be unique within the set. Values are write-only and are never returned. A set can hold at most 64 KiB, measured as the UTF-8 size of its keys and values encoded as a JSON object. A larger set is rejected with `400`. ### Request body example ```json { "secrets": { "asr": "", "llm": "" } } ``` ## Responses ### 200 The secret set was replaced. The response body lists its keys. - `name` (string, required) - The name of the secret set. - `keys` (array, required) - The names of the keys in the set. Values are never returned. - `keys.items` (string) - `create_ts` (integer, required) - The time the set was created, as a Unix timestamp in seconds. - `update_ts` (integer, required) - The time the set was last updated, as a Unix timestamp in seconds. ### 400 The request is invalid. Check `reason` and `detail` in the response body. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `SecretSetInUse`: An agent references a key that the replacement removes. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 412 The `If-Match` value doesn't match the current version of the resource. The reason is `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). # Resume a campaign (/en/api-reference/api-ref/conversational-ai/platform/resume-campaign) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Continues dialing a paused campaign. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: resume-campaign - Method: POST - Path: /v1/projects/{appid}/campaigns/{campaign_id}:resume - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/campaigns/{campaign_id}:resume ## Servers - https://preview.ai.agora.io/conversational-ai You can resume a campaign whose status is `paused`. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `campaign_id` (path, required, string) - The ID of the campaign, returned in `campaign_id` when you create the campaign. - Format: `uuid` ## Request body No request body. ## Responses ### 200 The campaign was resumed. The response body contains the campaign. - `campaign_id` (string) - The ID of the campaign, a UUID. - Format: `uuid` - `name` (string) - The name of the campaign. - `status` (string) - The status of the campaign: - `scheduled`: The campaign is waiting for its start time. - `running`: The campaign is dialing, or can dial during its schedule. - `paused`: You paused the campaign. - `completed`: The campaign has finished. - `canceled`: You canceled the campaign. - `failed`: The campaign failed. The details are in `failure`. - Allowed: `scheduled` | `running` | `paused` | `completed` | `canceled` | `failed` - `agent_id` (string) - The ID of the agent that makes the calls. - Format: `uuid` - `transport` (object) - `transport.type` (string) - Always `telephony`. - `transport.from` (array) - The `number_id` values of the numbers the campaign calls from. - `transport.from.items` (string) - `transport.call_policy` (object) - Limits and behavior for each call the campaign places. Each limit you omit adds no limit. - `transport.call_policy.max_ring_duration_ms` (integer) - The maximum time in milliseconds from starting the dial until the call is answered. If the call isn't answered in time, the dial attempt ends. - Range: `[1, 259200000]` - `transport.call_policy.max_call_duration_seconds` (integer) - The maximum length of the call in seconds, measured from when it's answered. The session's `lifecycle` limits can end the call earlier. - Range: `[1, 259200]` - `transport.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. This is separate from `pipeline.silence_config`, which only prompts the user. - Range: `[30000, 259200000]` - `transport.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `transport.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `transport.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `transport.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `lifecycle` (object) - When each session the campaign starts ends on its own. - `lifecycle.idle_timeout_ms` (integer) - How long in milliseconds the session continues with no participant present: after the subscribed user leaves the RTC channel, or after the other side of a phone call hangs up. It isn't silence detection. Set to `0` to turn off the idle timer. Can't be greater than `max_duration_ms`. - Default: `30000` - Range: `[0, 3600000]` - `lifecycle.max_duration_ms` (integer) - The maximum length of each session in milliseconds, measured from `start_ts`. Defaults to 5 minutes. The maximum is 1 hour. - Default: `300000` - Range: `[1000, 3600000]` - `lifecycle.graceful_stop` (object) - How the agent finishes when you stop the session, or when the idle timer expires. It doesn't extend `max_duration_ms`, and it doesn't add a farewell message. - `lifecycle.graceful_stop.enabled` (boolean) - Whether the agent finishes what it's saying before it leaves. - Default: `false` - `lifecycle.graceful_stop.timeout_ms` (integer) - The longest time in milliseconds the agent can take to finish. - Default: `30000` - Range: `[0, 120000]` - `schedule` (object) - When the campaign dials. Pass the fields of one schedule mode only. - `schedule.mode` (string, required) - `immediate`: The campaign starts dialing as soon as it's created. - `schedule.timezone` (string, required) - The IANA time zone for `days`, for example `America/New_York`. Daylight saving time is handled automatically. Required when you pass `days`. - Min length: `1` - Max length: `255` - `schedule.start` (string, required) - When the campaign can start dialing, as a local date and time in `YYYY-MM-DDTHH:MM` format with no offset, for example `2026-11-02T09:00`. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.end` (string, required) - When the campaign stops placing new calls, as a local date and time in `YYYY-MM-DDTHH:MM` format, later than `start`. Calls in progress continue. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.days` (array) - The weekly hours when new calls can start. Outside these hours, no new calls start. A day you don't list has no dialing. Omit `days` to dial at any time. - Min items: `1` - Max items: `7` - `schedule.days.items` (object) - `schedule.days.items.weekday` (string, required) - The day of the week. Each day can appear only once. - Allowed: `mon` | `tue` | `wed` | `thu` | `fri` | `sat` | `sun` - `schedule.days.items.ranges` (array, required) - One to 10 windows on this day, which can't overlap. - Min items: `1` - Max items: `10` - `schedule.days.items.ranges.items` (object) - `schedule.days.items.ranges.items.start` (string, required) - The start of the window, as a local time in 24-hour `HH:MM` format. - `schedule.days.items.ranges.items.end` (string, required) - The end of the window, as a local time in `HH:MM` format, later than `start`. Use `24:00` for the end of the day. - `counts` (object) - The number of contacts in each state. Retrieve the campaign to get current counts. - `counts.contacts` (integer) - The total number of contacts. - `counts.pending` (integer) - Contacts not called yet, or waiting for a retry. - `counts.calling` (integer) - Contacts in a call now. - `counts.completed` (integer) - Contacts whose call has finished. - `counts.failed` (integer) - Contacts not reached after all attempts. - `counts.canceled` (integer) - Contacts that won't be called because the campaign was canceled. - `create_ts` (integer) - The time the campaign was created, as a Unix timestamp in seconds. - `start_ts` (integer | null | null) - The time the campaign started dialing, as a Unix timestamp in seconds. `null` before it starts. - `complete_ts` (integer | null | null) - The time the campaign finished, as a Unix timestamp in seconds. `null` until it finishes. - `failure` (object) - Details of the failure when `status` is `failed`. Otherwise `null`. - `failure.code` (string, required) - A stable runtime error code, for example `provider_error`. - `failure.provider` (string) - The model provider that caused the failure, for example `openai`. - `failure.message` (string, required) - A human-readable explanation. - `failure.ts` (integer, required) - The time the failure occurred, as a Unix timestamp in seconds. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `CampaignInvalidState`: The campaign isn't `paused`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). # Retrieve an agent (/en/api-reference/api-ref/conversational-ai/platform/retrieve-agent) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Retrieves the configuration of a saved agent. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: retrieve-agent - Method: GET - Path: /v1/projects/{appid}/agents/{agent_id} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/agents/{agent_id} ## Servers - https://preview.ai.agora.io/conversational-ai The response includes the agent's current `ETag`. Pass it in the `If-Match` header when you [update the agent](/en/api-reference/api-ref/conversational-ai/platform/update-agent). Pipeline stages report only `credential.mode`. API keys and secret references are never returned. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `agent_id` (path, required, string) - The ID of the agent, returned in `agent_id` when you create the agent. - Format: `uuid` ## Request body No request body. ## Responses ### 200 The request was successful. The response body contains the agent. - `agent_id` (string, required) - The ID of the agent, a UUID. - Format: `uuid` - `agent_name` (string, required) - A name for the agent, 1 to 255 characters. It doesn't need to be unique. - Min length: `1` - Max length: `255` - `instructions` (string) - The system instructions that define how the agent behaves. The model receives them as the first `system` message, before `messages`. - `messages` (array) - Messages that start the conversation history. They follow `instructions`. - `messages.items` (object) - `messages.items.role` (string, required) - The author of the message: - `system`: An instruction to the model. - `user`: A message from the user. - `assistant`: A message from the agent. - Allowed: `system` | `user` | `assistant` - `messages.items.content` (string, required) - The text of the message. - `variables` (object) - Every variable the agent uses, keyed by variable name. A name starts with a lowercase letter and contains up to 64 lowercase letters, digits, and underscores. Reference a variable as `{{variable_name}}` in `instructions`, `messages`, `greeting.text`, `pipeline.llm.failure_message`, `pipeline.silence_config.content`, and generated filler instructions. The agent doesn't store values: pass them in `values` when you start a session, or in each campaign contact. Expansion is single-pass, so a value that contains a placeholder isn't expanded again. - Example: `{"customer_name":{"type":"str","required":true},"resolution_status":{"type":"str","options":["resolved","follow_up","unresolved"],"extract":true,"description":"Outcome of the conversation."}}` - `greeting` (object) - The message the agent speaks when a participant joins. If you omit it, the agent doesn't greet participants automatically. - `greeting.mode` (string, required) - `text`: The agent speaks `text` using the TTS stage. - `greeting.on` (string) - Which participants the agent greets: - `each_join`: Every participant who joins. - `first_join`: Only the first participant to join. - Allowed: `each_join` | `first_join` - Default: `each_join` - `greeting.delay_ms` (integer) - The delay in milliseconds between a participant joining and the agent starting the greeting. - Default: `0` - Range: `[0, 5000]` - `greeting.text` (string, required) - The greeting text. - `pipeline` (object) - The models that power the agent: separate ASR, LLM, and TTS stages. When you pass a pipeline, `llm` and `tts` are required. - `pipeline.mode` (string, required) - `cascaded`: Separate ASR, LLM, and TTS stages. - `pipeline.asr` (object) - The automatic speech recognition (ASR) stage, which transcribes the user's speech. - `pipeline.asr.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.asr.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.asr.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.asr.vendor` (string) - The ASR provider, for example `deepgram`. - `pipeline.asr.model` (string) - The provider model, for example `nova-3`. - `pipeline.asr.language` (string) - The language of the user's speech, for example `en-US`. - `pipeline.asr.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. - `pipeline.asr.params` (object) - Provider-specific settings that aren't secret, such as `keywords`, passed to the provider as they are. Keep API keys in `credential`, not here. - `pipeline.llm` (object, required) - The large language model (LLM) stage, which generates the agent's replies. - `pipeline.llm.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.llm.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.llm.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.llm.vendor` (string) - The LLM provider, for example `openai`. - `pipeline.llm.style` (string) - The API style used to communicate with the model, for example `openai` for OpenAI and OpenAI-compatible APIs. - `pipeline.llm.model` (string) - The provider model. - `pipeline.llm.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. For Google Gemini in an ephemeral session, the URL can include your API key as `key=`, with `credential.fields` left out. A saved agent's `url` can't contain a key. - `pipeline.llm.headers` (object) - Custom HTTP headers sent to the provider endpoint, at most 32. They are write-only and are never returned. A value can be a whole `$secrets..` reference when the stage uses `byok` and an approved provider endpoint. Agora resolves it when each session starts. A header name that looks like a credential, such as `X-Api-Key`, must use a reference. Transport, identity, and provider authentication headers are reserved. Set provider authentication in `credential`. - `pipeline.llm.params` (object) - Provider-specific settings that aren't secret, such as `reasoning_effort`, passed to the provider as they are. Keep API keys in `credential`, not here. - `pipeline.llm.input_modalities` (array) - The input types sent to the model, for example `["text"]`. - `pipeline.llm.input_modalities.items` (string) - `pipeline.llm.output_modalities` (array) - The output types requested from the model, for example `["text"]`. - `pipeline.llm.output_modalities.items` (string) - `pipeline.llm.max_history` (integer) - The number of recent conversation messages the LLM keeps as context. It counts messages, not user and agent pairs. The agent's `instructions` don't count toward this limit. - Default: `32` - Range: `[1, 1024]` - `pipeline.llm.failure_message` (string) - The message the agent speaks with the TTS stage when the LLM fails to produce a response. - `pipeline.llm.tools` (array) - Function tools the model can call. An agent can have up to 32 tools in total, including tools discovered from `mcp_servers`. Tool names must be unique, ignoring case. - Max items: `32` - `pipeline.llm.tools.items` (object) - `pipeline.llm.tools.items.type` (string, required) - Always `function`. - `pipeline.llm.tools.items.name` (string, required) - The tool name shown to the model. It starts with a letter and contains only letters and digits, up to 64 characters. It can't start with `mcp`, can't be `ragsearch_tool`, and can't match an MCP, built-in, or model-native tool. - Max length: `64` - `pipeline.llm.tools.items.description` (string, required) - What the tool does, 1 to 1,024 characters. The model uses it to decide when to call the tool. - Min length: `1` - Max length: `1024` - `pipeline.llm.tools.items.parameters` (object, required) - A JSON Schema that describes the tool's arguments. - `pipeline.llm.tools.items.execution` (object, required) - How the agent runs the tool. - `pipeline.llm.tools.items.execution.mode` (string, required) - `sync`: The agent waits for the tool response before it continues. - `pipeline.llm.tools.items.server` (object, required) - The HTTP endpoint the agent calls to run the tool. - `pipeline.llm.tools.items.server.method` (string, required) - The HTTP method. - Allowed: `GET` | `POST` - `pipeline.llm.tools.items.server.url` (string, required) - The HTTPS URL of the endpoint, up to 2,048 characters. - Min length: `1` - Max length: `2048` - Pattern: `^https://` - `pipeline.llm.tools.items.server.headers` (object) - HTTP headers sent to the endpoint, up to 32. They are write-only and are never returned. - `pipeline.llm.tools.items.server.body` (object) - Additional fields to include in the request body. - `pipeline.llm.tools.items.server.timeout_ms` (integer) - The request timeout in milliseconds. - Default: `10000` - Range: `[1000, 100000]` - `pipeline.llm.mcp_servers` (array) - MCP servers whose tools the model can call. - `pipeline.llm.mcp_servers.items` (object) - `pipeline.llm.mcp_servers.items.name` (string, required) - A name for the MCP server, 1 to 48 letters and digits. - Min length: `1` - Max length: `48` - `pipeline.llm.mcp_servers.items.endpoint` (string, required) - The HTTPS URL of the MCP server, up to 2,048 characters. - Min length: `1` - Max length: `2048` - Pattern: `^https://` - `pipeline.llm.mcp_servers.items.transport` (string, required) - The MCP transport. `streamable_http`: Streamable HTTP. - `pipeline.llm.mcp_servers.items.headers` (object) - HTTP headers sent to the MCP server, up to 32. They are write-only and are never returned. - `pipeline.llm.mcp_servers.items.allowed_tools` (array) - The tools the model can call from this server: - Omit the field, or include `*` in the list, to allow every tool. - Pass an empty list to allow no tools. - Otherwise, only the listed tools are allowed. - `pipeline.llm.mcp_servers.items.allowed_tools.items` (string) - Min length: `1` - `pipeline.llm.mcp_servers.items.timeout_ms` (integer) - The request timeout in milliseconds. - Range: `[1000, 100000]` - `pipeline.tts` (object, required) - The text-to-speech (TTS) stage, which converts the agent's replies to speech. - `pipeline.tts.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.tts.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.tts.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.tts.vendor` (string) - The TTS provider, for example `microsoft`. - `pipeline.tts.model` (string) - The TTS model the agent uses. Returned in responses only. - `pipeline.tts.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. - `pipeline.tts.headers` (object) - Custom HTTP headers sent to the provider endpoint, at most 32. They are write-only and are never returned. A value can be a whole `$secrets..` reference when the stage uses `byok` and an approved provider endpoint. Agora resolves it when each session starts. A header name that looks like a credential, such as `X-Api-Key`, must use a reference. Transport, identity, and provider authentication headers are reserved. Set provider authentication in `credential`. - `pipeline.tts.params` (object) - Provider-specific settings that aren't secret, such as the voice and, where the provider requires it, the model, passed to the provider as they are. Keep API keys in `credential`, not here. - `pipeline.tts.skip_patterns` (array) - Bracketed text that the agent doesn't speak, such as tone or action notes in the LLM output: - `fullwidth_parentheses`: Text in `()`. - `lenticular_brackets`: Text in `【】`. - `parentheses`: Text in `( )`. - `square_brackets`: Text in `[ ]`. - `curly_braces`: Text in `{ }`. - `pipeline.tts.skip_patterns.items` (string) - Allowed: `fullwidth_parentheses` | `lenticular_brackets` | `parentheses` | `square_brackets` | `curly_braces` - `pipeline.turn_detection` (object) - How the agent detects when the user starts and stops speaking, and handles interruptions. - `pipeline.turn_detection.speech_threshold` (number) - The speech detection threshold. Lower values detect speech more easily. Higher values ignore weak speech. - Default: `0.5` - Range: `[0, 1]` - `pipeline.turn_detection.start_of_speech` (object) - How the agent detects that the user starts speaking. Pass the fields of one detection type only. If you omit it, the agent uses `semantic` detection with its defaults. - `pipeline.turn_detection.start_of_speech.type` (string, required) - `semantic`: Detects a meaningful start of speech. If you omit `type`, the agent uses `semantic`. - Default: `semantic` - `pipeline.turn_detection.start_of_speech.interrupt_duration_ms` (integer) - Speech shorter than this, in milliseconds, is ignored. - Default: `160` - Range: `[120, 1200]` - `pipeline.turn_detection.start_of_speech.speaking_interrupt_duration_ms` (integer) - How long in milliseconds the user must speak to interrupt the agent while it's speaking. - Default: `160` - `pipeline.turn_detection.start_of_speech.prefix_padding_ms` (integer) - How many milliseconds of audio before the detected start of speech to keep, so the beginning of the speech isn't clipped. - Default: `800` - Range: `[0, 5000]` - `pipeline.turn_detection.end_of_speech` (object) - How the agent detects that the user has finished speaking. Pass the fields of one detection type only. If you omit it, the agent uses `semantic` detection with its defaults. - `pipeline.turn_detection.end_of_speech.type` (string, required) - `semantic`: Considers whether the utterance sounds complete. If you omit `type`, the agent uses `semantic`. - Default: `semantic` - `pipeline.turn_detection.end_of_speech.silence_duration_ms` (integer) - The silence in milliseconds that ends the turn. - Default: `320` - Range: `[120, 2000]` - `pipeline.turn_detection.end_of_speech.max_wait_ms` (integer) - The maximum time in milliseconds to wait before ending the turn, from 500 to 10,000. Set to `-1` to wait without a timeout. - Default: `3000` - Range: `[500, 10000]` - `pipeline.turn_detection.end_of_speech.pause_state_enabled` (boolean) - Whether the agent detects a pause within an utterance, such as "hold on", and waits for more input. - Default: `true` - `pipeline.turn_detection.interruption` (object) - How the user can interrupt the agent while it speaks or thinks. Pass the fields of one interruption mode only. If you omit it, any user speech interrupts the agent. - Default: `{"mode":"start_of_speech"}` - `pipeline.turn_detection.interruption.mode` (string, required) - `start_of_speech`: Any user speech interrupts the agent. - `pipeline.turn_detection.interruption.when_off` (string) - What happens to user speech that arrives while the agent speaks or thinks: - `append`: The agent responds to the speech after the current reply. - `ignore`: The agent discards the speech. - Allowed: `append` | `ignore` - Default: `append` - `pipeline.turn_detection.interruption.keywords` (array, required) - The phrases that interrupt the agent, 1 to 128. - Min items: `1` - Max items: `128` - `pipeline.turn_detection.interruption.keywords.items` (string) - Min length: `1` - `pipeline.silence_config` (object) - What the agent does after a period of silence. This only prompts the user. To hang up a phone call after silence, use `call_policy.max_silence_duration_ms`. - `pipeline.silence_config.enabled` (boolean, required) - Whether to act on silence. - `pipeline.silence_config.timeout_ms` (integer, required) - How long the silence lasts, in milliseconds, before the agent acts, up to 60,000. Applies only when `enabled` is `true`. - Range: `[0, 60000]` - `pipeline.silence_config.action` (string, required) - What the agent does when the timeout is reached: - `speak`: Speaks `content` as written. - `think`: Gives `content` to the LLM as an instruction, and responds to it. - Allowed: `speak` | `think` - `pipeline.silence_config.content` (string, required) - The text to speak, or the instruction for the LLM, depending on `action`. - `pipeline.avatar` (object) - The avatar that represents the agent on video. - `pipeline.avatar.enabled` (boolean) - Whether to show the avatar. - Default: `false` - `pipeline.avatar.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.avatar.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.avatar.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.avatar.vendor` (string) - The avatar provider. `generic` passes provider-neutral parameters through. - Allowed: `akool` | `liveavatar` | `anam` | `sensetime` | `spatius` | `generic` - `pipeline.avatar.params` (object) - Provider-specific settings, passed to the provider as they are. - `filler_words` (object) - Short phrases the agent says while it waits for the LLM to respond, such as when it waits for a tool call. - `filler_words.enable` (boolean) - Whether to play filler words. - Default: `false` - `filler_words.trigger` (object) - When to play a filler word. - `filler_words.trigger.mode` (string, required) - `fixed_time`: Play a filler word when the LLM hasn't responded within `response_wait_ms`. - `filler_words.trigger.response_wait_ms` (integer, required) - How long in milliseconds to wait for the LLM response before playing a filler word, for example `1500`. - Range: `[100, 10000]` - `filler_words.content` (object) - Where the filler words come from. Pass the fields of one source only. - `filler_words.content.mode` (string, required) - `static`: Pick a phrase from `phrases`. - `filler_words.content.instructions` (string, required) - The instructions used to generate filler phrases. They can't be empty or only whitespace. - Min length: `1` - `filler_words.content.fallback_strategy` (string) - What to use when a generated phrase isn't available. - Default: `static` - `filler_words.content.phrases` (array, required) - The filler phrases, 1 to 100 non-empty strings. - Min items: `1` - Max items: `100` - `filler_words.content.phrases.items` (string) - Min length: `1` - `filler_words.content.selection_rule` (string) - How the agent picks the next phrase: - `shuffle`: In random order. - `round_robin`: In list order, starting over after the last phrase. - Allowed: `shuffle` | `round_robin` - Default: `shuffle` - `create_ts` (integer, required) - The time the agent was created, as a Unix timestamp in seconds. - `update_ts` (integer, required) - The time the agent was last updated, as a Unix timestamp in seconds. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "agent_name": "Customer Support Agent", "instructions": "You are a support agent for Acme. Be concise.", "pipeline": { "mode": "cascaded", "llm": { "credential": { "mode": "byok" }, "vendor": "openai", "style": "openai", "model": "" } }, "create_ts": 1786543331, "update_ts": 1787733713 } ``` # Retrieve a campaign (/en/api-reference/api-ref/conversational-ai/platform/retrieve-campaign) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Retrieves a campaign and the current number of contacts in each state. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: retrieve-campaign - Method: GET - Path: /v1/projects/{appid}/campaigns/{campaign_id} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/campaigns/{campaign_id} ## Servers - https://preview.ai.agora.io/conversational-ai ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `campaign_id` (path, required, string) - The ID of the campaign, returned in `campaign_id` when you create the campaign. - Format: `uuid` ## Request body No request body. ## Responses ### 200 The request was successful. The response body contains the campaign. - `campaign_id` (string) - The ID of the campaign, a UUID. - Format: `uuid` - `name` (string) - The name of the campaign. - `status` (string) - The status of the campaign: - `scheduled`: The campaign is waiting for its start time. - `running`: The campaign is dialing, or can dial during its schedule. - `paused`: You paused the campaign. - `completed`: The campaign has finished. - `canceled`: You canceled the campaign. - `failed`: The campaign failed. The details are in `failure`. - Allowed: `scheduled` | `running` | `paused` | `completed` | `canceled` | `failed` - `agent_id` (string) - The ID of the agent that makes the calls. - Format: `uuid` - `transport` (object) - `transport.type` (string) - Always `telephony`. - `transport.from` (array) - The `number_id` values of the numbers the campaign calls from. - `transport.from.items` (string) - `transport.call_policy` (object) - Limits and behavior for each call the campaign places. Each limit you omit adds no limit. - `transport.call_policy.max_ring_duration_ms` (integer) - The maximum time in milliseconds from starting the dial until the call is answered. If the call isn't answered in time, the dial attempt ends. - Range: `[1, 259200000]` - `transport.call_policy.max_call_duration_seconds` (integer) - The maximum length of the call in seconds, measured from when it's answered. The session's `lifecycle` limits can end the call earlier. - Range: `[1, 259200]` - `transport.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. This is separate from `pipeline.silence_config`, which only prompts the user. - Range: `[30000, 259200000]` - `transport.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `transport.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `transport.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `transport.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `lifecycle` (object) - When each session the campaign starts ends on its own. - `lifecycle.idle_timeout_ms` (integer) - How long in milliseconds the session continues with no participant present: after the subscribed user leaves the RTC channel, or after the other side of a phone call hangs up. It isn't silence detection. Set to `0` to turn off the idle timer. Can't be greater than `max_duration_ms`. - Default: `30000` - Range: `[0, 3600000]` - `lifecycle.max_duration_ms` (integer) - The maximum length of each session in milliseconds, measured from `start_ts`. Defaults to 5 minutes. The maximum is 1 hour. - Default: `300000` - Range: `[1000, 3600000]` - `lifecycle.graceful_stop` (object) - How the agent finishes when you stop the session, or when the idle timer expires. It doesn't extend `max_duration_ms`, and it doesn't add a farewell message. - `lifecycle.graceful_stop.enabled` (boolean) - Whether the agent finishes what it's saying before it leaves. - Default: `false` - `lifecycle.graceful_stop.timeout_ms` (integer) - The longest time in milliseconds the agent can take to finish. - Default: `30000` - Range: `[0, 120000]` - `schedule` (object) - When the campaign dials. Pass the fields of one schedule mode only. - `schedule.mode` (string, required) - `immediate`: The campaign starts dialing as soon as it's created. - `schedule.timezone` (string, required) - The IANA time zone for `days`, for example `America/New_York`. Daylight saving time is handled automatically. Required when you pass `days`. - Min length: `1` - Max length: `255` - `schedule.start` (string, required) - When the campaign can start dialing, as a local date and time in `YYYY-MM-DDTHH:MM` format with no offset, for example `2026-11-02T09:00`. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.end` (string, required) - When the campaign stops placing new calls, as a local date and time in `YYYY-MM-DDTHH:MM` format, later than `start`. Calls in progress continue. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.days` (array) - The weekly hours when new calls can start. Outside these hours, no new calls start. A day you don't list has no dialing. Omit `days` to dial at any time. - Min items: `1` - Max items: `7` - `schedule.days.items` (object) - `schedule.days.items.weekday` (string, required) - The day of the week. Each day can appear only once. - Allowed: `mon` | `tue` | `wed` | `thu` | `fri` | `sat` | `sun` - `schedule.days.items.ranges` (array, required) - One to 10 windows on this day, which can't overlap. - Min items: `1` - Max items: `10` - `schedule.days.items.ranges.items` (object) - `schedule.days.items.ranges.items.start` (string, required) - The start of the window, as a local time in 24-hour `HH:MM` format. - `schedule.days.items.ranges.items.end` (string, required) - The end of the window, as a local time in `HH:MM` format, later than `start`. Use `24:00` for the end of the day. - `counts` (object) - The number of contacts in each state. Retrieve the campaign to get current counts. - `counts.contacts` (integer) - The total number of contacts. - `counts.pending` (integer) - Contacts not called yet, or waiting for a retry. - `counts.calling` (integer) - Contacts in a call now. - `counts.completed` (integer) - Contacts whose call has finished. - `counts.failed` (integer) - Contacts not reached after all attempts. - `counts.canceled` (integer) - Contacts that won't be called because the campaign was canceled. - `create_ts` (integer) - The time the campaign was created, as a Unix timestamp in seconds. - `start_ts` (integer | null | null) - The time the campaign started dialing, as a Unix timestamp in seconds. `null` before it starts. - `complete_ts` (integer | null | null) - The time the campaign finished, as a Unix timestamp in seconds. `null` until it finishes. - `failure` (object) - Details of the failure when `status` is `failed`. Otherwise `null`. - `failure.code` (string, required) - A stable runtime error code, for example `provider_error`. - `failure.provider` (string) - The model provider that caused the failure, for example `openai`. - `failure.message` (string, required) - A human-readable explanation. - `failure.ts` (integer, required) - The time the failure occurred, as a Unix timestamp in seconds. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "campaign_id": "b4f0581e-f138-43a2-851c-a8f8d228bb37", "name": "q3-renewals", "status": "running", "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "transport": { "type": "telephony", "from": [ "92e68758-3d3a-4f27-8b93-3fd8d834467c" ] }, "lifecycle": { "idle_timeout_ms": 30000, "max_duration_ms": 300000, "graceful_stop": { "enabled": false, "timeout_ms": 30000 } }, "schedule": { "mode": "immediate" }, "counts": { "contacts": 120, "pending": 84, "calling": 6, "completed": 27, "failed": 3, "canceled": 0 }, "create_ts": 1787673602, "start_ts": 1787673602, "complete_ts": null, "failure": null } ``` # Retrieve a phone number (/en/api-reference/api-ref/conversational-ai/platform/retrieve-number) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Retrieves a phone number and its SIP and inbound settings. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: retrieve-number - Method: GET - Path: /v1/projects/{appid}/numbers/{number_id} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/numbers/{number_id} ## Servers - https://preview.ai.agora.io/conversational-ai ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `number_id` (path, required, string) - The ID of the phone number, returned in `number_id` when you create the number. - Format: `uuid` ## Request body No request body. ## Responses ### 200 The request was successful. The response body contains the number. SIP credentials are never returned. - `number_id` (string) - The ID of the phone number, a UUID. - Format: `uuid` - `number` (string) - The phone number in E.164 format. - `description` (string) - A description of the number's purpose. It's separate from `sip_trunk.name`, which names the carrier connection. - `sip_trunk` (object) - `sip_trunk.name` (string) - The name of the carrier connection. - `sip_trunk.hostname` (string) - The carrier's SIP hostname. - `sip_trunk.port` (integer) - The SIP signaling port. - `sip_trunk.transport` (string) - The transport protocol for the carrier connection. - Allowed: `udp` | `tcp` | `tls` - `sip_trunk.allowed_ips` (array) - The addresses allowed to send inbound SIP traffic. - `sip_trunk.allowed_ips.items` (string) - `inbound` (object) - What happens when someone calls this number. If you omit it, inbound calls are rejected. `call_policy` is required when `agent` isn't `null`. - `inbound.agent` (string | null | null, required) - The ID of the agent that answers inbound calls. Set to `null` to reject inbound calls. - `inbound.call_policy` (object) - Limits and behavior for inbound calls to this number. Each limit you omit adds no limit. - `inbound.call_policy.max_call_duration_seconds` (integer) - The maximum length of a call in seconds, measured from when it's answered. - Minimum: `1` - `inbound.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. - Minimum: `1` - `inbound.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `inbound.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `inbound.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `inbound.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `create_ts` (integer) - The time the number was added, as a Unix timestamp in seconds. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "number_id": "92e68758-3d3a-4f27-8b93-3fd8d834467c", "number": "+14155550100", "description": "Primary customer support line for North America.", "sip_trunk": { "name": "support-line", "hostname": "acme.pstn.example.com", "port": 5061, "transport": "tls" }, "inbound": { "agent": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "call_policy": { "max_call_duration_seconds": 1800, "max_silence_duration_ms": 60000, "end_call": { "on_user_request": true } } }, "create_ts": 1787223852 } ``` # Retrieve a secret set (/en/api-reference/api-ref/conversational-ai/platform/retrieve-secret-set) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Retrieves the key names in a secret set. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: retrieve-secret-set - Method: GET - Path: /v1/projects/{appid}/secrets/{name} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/secrets/{name} ## Servers - https://preview.ai.agora.io/conversational-ai ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `name` (path, required, string) - The name of the secret set. ## Request body No request body. ## Responses ### 200 The request was successful. The response body lists the keys in the set. Secret values are never returned. - `name` (string, required) - The name of the secret set. - `keys` (array, required) - The names of the keys in the set. Values are never returned. - `keys.items` (string) - `create_ts` (integer, required) - The time the set was created, as a Unix timestamp in seconds. - `update_ts` (integer, required) - The time the set was last updated, as a Unix timestamp in seconds. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "name": "support_prod", "keys": [ "llm" ], "create_ts": 1789898400, "update_ts": 1790000000 } ``` # Retrieve a session (/en/api-reference/api-ref/conversational-ai/platform/retrieve-session) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Retrieves the status of a session. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: retrieve-session - Method: GET - Path: /v1/projects/{appid}/sessions/{agent_session_id} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/sessions/{agent_session_id} ## Servers - https://preview.ai.agora.io/conversational-ai Starting and stopping a session happen asynchronously. Retrieve the session to follow its `status`. After the session ends, the response includes `stop_ts`. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `agent_session_id` (path, required, string) - The ID of the session, returned in `agent_session_id` when you start the session. ## Request body No request body. ## Responses ### 200 The request was successful. The response body contains the session. - `agent_session_id` (string) - The ID of the session. - `agent_name` (string) - The name of the agent that the session runs. - `status` (string) - The status of the session: - `IDLE`: The session is idle. - `STARTING`: The session is starting. - `RUNNING`: The session is running. - `STOPPING`: The session is stopping. - `STOPPED`: The session has ended. - `FAILED`: The session failed. - Allowed: `IDLE` | `STARTING` | `RUNNING` | `STOPPING` | `STOPPED` | `FAILED` - `start_ts` (integer) - The time the session was created, as a Unix timestamp in seconds. - `stop_ts` (integer | null | null) - The time the session ended, as a Unix timestamp in seconds. `null` while the session is active. - `message` (string | null | null) - Additional details about the status, such as a failure diagnosis. `null` when there are none. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h", "agent_name": "Customer Support Agent", "status": "RUNNING", "start_ts": 1735035893, "stop_ts": null, "message": null } ``` # Set a secret key (/en/api-reference/api-ref/conversational-ai/platform/set-secret-key) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Adds a key to a secret set, or replaces the value of an existing key. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: set-secret-key - Method: PUT - Path: /v1/projects/{appid}/secrets/{name}/keys/{key} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/secrets/{name}/keys/{key} ## Servers - https://preview.ai.agora.io/conversational-ai Use this endpoint to add or rotate one key without sending the set's other values. Repeating the request is safe. Agents keep referencing `$secrets..` without changes, and new sessions use the new value. The response returns `201` when the key is new and `200` when it replaces an existing value. Both headers are optional. Without them, the last write to the key wins. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `name` (path, required, string) - The name of the secret set. - `key` (path, required, string) - The name of the key in the secret set. When you add a key, use 1 to 64 characters from `A-Z`, `a-z`, `0-9`, and `_`. - `If-Match` (header, optional, string) - The key's `ETag` from your last write to it. The request fails with `412` if the key has changed since then. - `If-None-Match` (header, optional, string) - Set to `*` to create the key only if it doesn't exist. If the key exists, the request fails with `412`, so a live value is never overwritten by accident. ## Request body - `value` (string, required) - The secret value. It is write-only and is never returned. The whole set, including this value, can hold at most 64 KiB. - Format: `password` - Min length: `1` ### Request body example ```json { "value": "" } ``` ## Responses ### 200 The key's value was replaced. - `key` (string, required) - The name of the key. ### 201 The key was added to the set. - `key` (string, required) - The name of the key. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 412 The `If-Match` value doesn't match the current version of the resource. The reason is `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "key": "llm" } ``` ### 201 ```json { "key": "tts" } ``` # Start an ephemeral session (/en/api-reference/api-ref/conversational-ai/platform/start-ephemeral-session) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Starts a session with an agent configuration that you pass in the request. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: start-ephemeral-session - Method: POST - Path: /v1/projects/{appid}/sessions/ephemeral - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/sessions/ephemeral ## Servers - https://preview.ai.agora.io/conversational-ai Use this endpoint to start a session without saving an agent first, for example to test a configuration. The request body is the same as [Start a session](/en/api-reference/api-ref/conversational-ai/platform/start-session), but with the agent configuration in `agent` instead of `agent_id`. The configuration isn't saved. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `Idempotency-Key` (header, optional, string) - A unique key, so that retrying the request can't start a second session. If a session was already started with this key, the request fails with `409` and reason `IdempotencyKeyConflict`, and no new session starts. The API doesn't return the original response. To find the session, [list sessions](/en/api-reference/api-ref/conversational-ai/platform/list-sessions). Keep the same key when you retry; never switch keys. - Min length: `1` - Max length: `256` - Pattern: `^[\x21-\x7E]+$` ## Request body - `agent` (object, required) - The agent configuration for this session. It has the same fields as [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent), except `agent_name`. The configuration isn't saved. - `agent.instructions` (string) - The system instructions that define how the agent behaves. The model receives them as the first `system` message, before `messages`. - `agent.messages` (array) - Messages that start the conversation history. They follow `instructions`. - `agent.messages.items` (object) - `agent.messages.items.role` (string, required) - The author of the message: - `system`: An instruction to the model. - `user`: A message from the user. - `assistant`: A message from the agent. - Allowed: `system` | `user` | `assistant` - `agent.messages.items.content` (string, required) - The text of the message. - `agent.variables` (object) - Every variable the agent uses, keyed by variable name. A name starts with a lowercase letter and contains up to 64 lowercase letters, digits, and underscores. Reference a variable as `{{variable_name}}` in `instructions`, `messages`, `greeting.text`, `pipeline.llm.failure_message`, `pipeline.silence_config.content`, and generated filler instructions. The agent doesn't store values: pass them in `values` when you start a session, or in each campaign contact. Expansion is single-pass, so a value that contains a placeholder isn't expanded again. - Example: `{"customer_name":{"type":"str","required":true},"resolution_status":{"type":"str","options":["resolved","follow_up","unresolved"],"extract":true,"description":"Outcome of the conversation."}}` - `agent.greeting` (object) - The message the agent speaks when a participant joins. If you omit it, the agent doesn't greet participants automatically. - `agent.greeting.mode` (string, required) - `text`: The agent speaks `text` using the TTS stage. - `agent.greeting.on` (string) - Which participants the agent greets: - `each_join`: Every participant who joins. - `first_join`: Only the first participant to join. - Allowed: `each_join` | `first_join` - Default: `each_join` - `agent.greeting.delay_ms` (integer) - The delay in milliseconds between a participant joining and the agent starting the greeting. - Default: `0` - Range: `[0, 5000]` - `agent.greeting.text` (string, required) - The greeting text. - `agent.pipeline` (object) - The models that power the agent: separate ASR, LLM, and TTS stages. When you pass a pipeline, `llm` and `tts` are required. - `agent.pipeline.mode` (string, required) - `cascaded`: Separate ASR, LLM, and TTS stages. - `agent.pipeline.asr` (object) - The automatic speech recognition (ASR) stage, which transcribes the user's speech. - `agent.pipeline.asr.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `agent.pipeline.asr.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `agent.pipeline.asr.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `agent.pipeline.asr.vendor` (string) - The ASR provider, for example `deepgram`. - `agent.pipeline.asr.model` (string) - The provider model, for example `nova-3`. - `agent.pipeline.asr.language` (string) - The language of the user's speech, for example `en-US`. - `agent.pipeline.asr.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. - `agent.pipeline.asr.params` (object) - Provider-specific settings that aren't secret, such as `keywords`, passed to the provider as they are. Keep API keys in `credential`, not here. - `agent.pipeline.llm` (object, required) - The large language model (LLM) stage, which generates the agent's replies. - `agent.pipeline.llm.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `agent.pipeline.llm.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `agent.pipeline.llm.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `agent.pipeline.llm.vendor` (string) - The LLM provider, for example `openai`. - `agent.pipeline.llm.style` (string) - The API style used to communicate with the model, for example `openai` for OpenAI and OpenAI-compatible APIs. - `agent.pipeline.llm.model` (string) - The provider model. - `agent.pipeline.llm.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. For Google Gemini in an ephemeral session, the URL can include your API key as `key=`, with `credential.fields` left out. A saved agent's `url` can't contain a key. - `agent.pipeline.llm.headers` (object) - Custom HTTP headers sent to the provider endpoint, at most 32. They are write-only and are never returned. A value can be a whole `$secrets..` reference when the stage uses `byok` and an approved provider endpoint. Agora resolves it when each session starts. A header name that looks like a credential, such as `X-Api-Key`, must use a reference. Transport, identity, and provider authentication headers are reserved. Set provider authentication in `credential`. - `agent.pipeline.llm.params` (object) - Provider-specific settings that aren't secret, such as `reasoning_effort`, passed to the provider as they are. Keep API keys in `credential`, not here. - `agent.pipeline.llm.input_modalities` (array) - The input types sent to the model, for example `["text"]`. - `agent.pipeline.llm.input_modalities.items` (string) - `agent.pipeline.llm.output_modalities` (array) - The output types requested from the model, for example `["text"]`. - `agent.pipeline.llm.output_modalities.items` (string) - `agent.pipeline.llm.max_history` (integer) - The number of recent conversation messages the LLM keeps as context. It counts messages, not user and agent pairs. The agent's `instructions` don't count toward this limit. - Default: `32` - Range: `[1, 1024]` - `agent.pipeline.llm.failure_message` (string) - The message the agent speaks with the TTS stage when the LLM fails to produce a response. - `agent.pipeline.llm.tools` (array) - Function tools the model can call. An agent can have up to 32 tools in total, including tools discovered from `mcp_servers`. Tool names must be unique, ignoring case. - Max items: `32` - `agent.pipeline.llm.tools.items` (object) - `agent.pipeline.llm.tools.items.type` (string, required) - Always `function`. - `agent.pipeline.llm.tools.items.name` (string, required) - The tool name shown to the model. It starts with a letter and contains only letters and digits, up to 64 characters. It can't start with `mcp`, can't be `ragsearch_tool`, and can't match an MCP, built-in, or model-native tool. - Max length: `64` - `agent.pipeline.llm.tools.items.description` (string, required) - What the tool does, 1 to 1,024 characters. The model uses it to decide when to call the tool. - Min length: `1` - Max length: `1024` - `agent.pipeline.llm.tools.items.parameters` (object, required) - A JSON Schema that describes the tool's arguments. - `agent.pipeline.llm.tools.items.execution` (object, required) - How the agent runs the tool. - `agent.pipeline.llm.tools.items.execution.mode` (string, required) - `sync`: The agent waits for the tool response before it continues. - `agent.pipeline.llm.tools.items.server` (object, required) - The HTTP endpoint the agent calls to run the tool. - `agent.pipeline.llm.tools.items.server.method` (string, required) - The HTTP method. - Allowed: `GET` | `POST` - `agent.pipeline.llm.tools.items.server.url` (string, required) - The HTTPS URL of the endpoint, up to 2,048 characters. - Min length: `1` - Max length: `2048` - Pattern: `^https://` - `agent.pipeline.llm.tools.items.server.headers` (object) - HTTP headers sent to the endpoint, up to 32. They are write-only and are never returned. - `agent.pipeline.llm.tools.items.server.body` (object) - Additional fields to include in the request body. - `agent.pipeline.llm.tools.items.server.timeout_ms` (integer) - The request timeout in milliseconds. - Default: `10000` - Range: `[1000, 100000]` - `agent.pipeline.llm.mcp_servers` (array) - MCP servers whose tools the model can call. - `agent.pipeline.llm.mcp_servers.items` (object) - `agent.pipeline.llm.mcp_servers.items.name` (string, required) - A name for the MCP server, 1 to 48 letters and digits. - Min length: `1` - Max length: `48` - `agent.pipeline.llm.mcp_servers.items.endpoint` (string, required) - The HTTPS URL of the MCP server, up to 2,048 characters. - Min length: `1` - Max length: `2048` - Pattern: `^https://` - `agent.pipeline.llm.mcp_servers.items.transport` (string, required) - The MCP transport. `streamable_http`: Streamable HTTP. - `agent.pipeline.llm.mcp_servers.items.headers` (object) - HTTP headers sent to the MCP server, up to 32. They are write-only and are never returned. - `agent.pipeline.llm.mcp_servers.items.allowed_tools` (array) - The tools the model can call from this server: - Omit the field, or include `*` in the list, to allow every tool. - Pass an empty list to allow no tools. - Otherwise, only the listed tools are allowed. - `agent.pipeline.llm.mcp_servers.items.allowed_tools.items` (string) - Min length: `1` - `agent.pipeline.llm.mcp_servers.items.timeout_ms` (integer) - The request timeout in milliseconds. - Range: `[1000, 100000]` - `agent.pipeline.tts` (object, required) - The text-to-speech (TTS) stage, which converts the agent's replies to speech. - `agent.pipeline.tts.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `agent.pipeline.tts.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `agent.pipeline.tts.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `agent.pipeline.tts.vendor` (string) - The TTS provider, for example `microsoft`. - `agent.pipeline.tts.model` (string) - The TTS model the agent uses. Returned in responses only. - `agent.pipeline.tts.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. - `agent.pipeline.tts.headers` (object) - Custom HTTP headers sent to the provider endpoint, at most 32. They are write-only and are never returned. A value can be a whole `$secrets..` reference when the stage uses `byok` and an approved provider endpoint. Agora resolves it when each session starts. A header name that looks like a credential, such as `X-Api-Key`, must use a reference. Transport, identity, and provider authentication headers are reserved. Set provider authentication in `credential`. - `agent.pipeline.tts.params` (object) - Provider-specific settings that aren't secret, such as the voice and, where the provider requires it, the model, passed to the provider as they are. Keep API keys in `credential`, not here. - `agent.pipeline.tts.skip_patterns` (array) - Bracketed text that the agent doesn't speak, such as tone or action notes in the LLM output: - `fullwidth_parentheses`: Text in `()`. - `lenticular_brackets`: Text in `【】`. - `parentheses`: Text in `( )`. - `square_brackets`: Text in `[ ]`. - `curly_braces`: Text in `{ }`. - `agent.pipeline.tts.skip_patterns.items` (string) - Allowed: `fullwidth_parentheses` | `lenticular_brackets` | `parentheses` | `square_brackets` | `curly_braces` - `agent.pipeline.turn_detection` (object) - How the agent detects when the user starts and stops speaking, and handles interruptions. - `agent.pipeline.turn_detection.speech_threshold` (number) - The speech detection threshold. Lower values detect speech more easily. Higher values ignore weak speech. - Default: `0.5` - Range: `[0, 1]` - `agent.pipeline.turn_detection.start_of_speech` (object) - How the agent detects that the user starts speaking. Pass the fields of one detection type only. If you omit it, the agent uses `semantic` detection with its defaults. - `agent.pipeline.turn_detection.start_of_speech.type` (string, required) - `semantic`: Detects a meaningful start of speech. If you omit `type`, the agent uses `semantic`. - Default: `semantic` - `agent.pipeline.turn_detection.start_of_speech.interrupt_duration_ms` (integer) - Speech shorter than this, in milliseconds, is ignored. - Default: `160` - Range: `[120, 1200]` - `agent.pipeline.turn_detection.start_of_speech.speaking_interrupt_duration_ms` (integer) - How long in milliseconds the user must speak to interrupt the agent while it's speaking. - Default: `160` - `agent.pipeline.turn_detection.start_of_speech.prefix_padding_ms` (integer) - How many milliseconds of audio before the detected start of speech to keep, so the beginning of the speech isn't clipped. - Default: `800` - Range: `[0, 5000]` - `agent.pipeline.turn_detection.end_of_speech` (object) - How the agent detects that the user has finished speaking. Pass the fields of one detection type only. If you omit it, the agent uses `semantic` detection with its defaults. - `agent.pipeline.turn_detection.end_of_speech.type` (string, required) - `semantic`: Considers whether the utterance sounds complete. If you omit `type`, the agent uses `semantic`. - Default: `semantic` - `agent.pipeline.turn_detection.end_of_speech.silence_duration_ms` (integer) - The silence in milliseconds that ends the turn. - Default: `320` - Range: `[120, 2000]` - `agent.pipeline.turn_detection.end_of_speech.max_wait_ms` (integer) - The maximum time in milliseconds to wait before ending the turn, from 500 to 10,000. Set to `-1` to wait without a timeout. - Default: `3000` - Range: `[500, 10000]` - `agent.pipeline.turn_detection.end_of_speech.pause_state_enabled` (boolean) - Whether the agent detects a pause within an utterance, such as "hold on", and waits for more input. - Default: `true` - `agent.pipeline.turn_detection.interruption` (object) - How the user can interrupt the agent while it speaks or thinks. Pass the fields of one interruption mode only. If you omit it, any user speech interrupts the agent. - Default: `{"mode":"start_of_speech"}` - `agent.pipeline.turn_detection.interruption.mode` (string, required) - `start_of_speech`: Any user speech interrupts the agent. - `agent.pipeline.turn_detection.interruption.when_off` (string) - What happens to user speech that arrives while the agent speaks or thinks: - `append`: The agent responds to the speech after the current reply. - `ignore`: The agent discards the speech. - Allowed: `append` | `ignore` - Default: `append` - `agent.pipeline.turn_detection.interruption.keywords` (array, required) - The phrases that interrupt the agent, 1 to 128. - Min items: `1` - Max items: `128` - `agent.pipeline.turn_detection.interruption.keywords.items` (string) - Min length: `1` - `agent.pipeline.silence_config` (object) - What the agent does after a period of silence. This only prompts the user. To hang up a phone call after silence, use `call_policy.max_silence_duration_ms`. - `agent.pipeline.silence_config.enabled` (boolean, required) - Whether to act on silence. - `agent.pipeline.silence_config.timeout_ms` (integer, required) - How long the silence lasts, in milliseconds, before the agent acts, up to 60,000. Applies only when `enabled` is `true`. - Range: `[0, 60000]` - `agent.pipeline.silence_config.action` (string, required) - What the agent does when the timeout is reached: - `speak`: Speaks `content` as written. - `think`: Gives `content` to the LLM as an instruction, and responds to it. - Allowed: `speak` | `think` - `agent.pipeline.silence_config.content` (string, required) - The text to speak, or the instruction for the LLM, depending on `action`. - `agent.pipeline.avatar` (object) - The avatar that represents the agent on video. - `agent.pipeline.avatar.enabled` (boolean) - Whether to show the avatar. - Default: `false` - `agent.pipeline.avatar.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `agent.pipeline.avatar.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `agent.pipeline.avatar.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `agent.pipeline.avatar.vendor` (string) - The avatar provider. `generic` passes provider-neutral parameters through. - Allowed: `akool` | `liveavatar` | `anam` | `sensetime` | `spatius` | `generic` - `agent.pipeline.avatar.params` (object) - Provider-specific settings, passed to the provider as they are. - `agent.filler_words` (object) - Short phrases the agent says while it waits for the LLM to respond, such as when it waits for a tool call. - `agent.filler_words.enable` (boolean) - Whether to play filler words. - Default: `false` - `agent.filler_words.trigger` (object) - When to play a filler word. - `agent.filler_words.trigger.mode` (string, required) - `fixed_time`: Play a filler word when the LLM hasn't responded within `response_wait_ms`. - `agent.filler_words.trigger.response_wait_ms` (integer, required) - How long in milliseconds to wait for the LLM response before playing a filler word, for example `1500`. - Range: `[100, 10000]` - `agent.filler_words.content` (object) - Where the filler words come from. Pass the fields of one source only. - `agent.filler_words.content.mode` (string, required) - `static`: Pick a phrase from `phrases`. - `agent.filler_words.content.instructions` (string, required) - The instructions used to generate filler phrases. They can't be empty or only whitespace. - Min length: `1` - `agent.filler_words.content.fallback_strategy` (string) - What to use when a generated phrase isn't available. - Default: `static` - `agent.filler_words.content.phrases` (array, required) - The filler phrases, 1 to 100 non-empty strings. - Min items: `1` - Max items: `100` - `agent.filler_words.content.phrases.items` (string) - Min length: `1` - `agent.filler_words.content.selection_rule` (string) - How the agent picks the next phrase: - `shuffle`: In random order. - `round_robin`: In list order, starting over after the last phrase. - Allowed: `shuffle` | `round_robin` - Default: `shuffle` - `transport` (object, required) - How the agent connects to the participant. Pass the fields of one transport type only. - `transport.type` (string, required) - `rtc`: The agent joins an RTC channel. - `transport.from` (string, required) - The `number_id` of the number in the project to call from. Phone numbers aren't accepted. [Import the number](/en/api-reference/api-ref/conversational-ai/platform/create-number) first. - Format: `uuid` - `transport.to` (string, required) - The phone number to call, in E.164 format, for example `+14155550100`. - Pattern: `^\+[1-9][0-9]{1,14}$` - `transport.call_policy` (object) - Limits and behavior for outbound phone calls. Each limit you omit adds no limit. - `transport.call_policy.max_ring_duration_ms` (integer) - The maximum time in milliseconds from starting the dial until the call is answered. If the call isn't answered in time, the dial attempt ends. - Minimum: `1` - `transport.call_policy.max_call_duration_seconds` (integer) - The maximum length of the call in seconds, measured from when it's answered. The session's `lifecycle` limits can end the call earlier. - Minimum: `1` - `transport.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. This is separate from `pipeline.silence_config`, which only prompts the user. - Minimum: `1` - `transport.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `transport.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `transport.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `transport.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `transport.channel` (string, required) - The name of the RTC channel to join, 1 to 256 characters. - Min length: `1` - Max length: `256` - `transport.token` (string) - The RTC token the agent uses to join the channel. Required when the project has an App Certificate enabled. To renew it, [update the session](/en/api-reference/api-ref/conversational-ai/platform/update-session). - `transport.uid` (string) - The user ID the agent uses in the channel. Pass a string of up to 255 characters, such as `"1002"` or `"agent-bot"`, or an integer from 0 to 4294967295, such as `1002`. Omit it, or pass `0`, to let Agora assign a user ID that differs from `subscribe_uids`. - Default: `0` - Range: `[0, 4294967295]` - Min length: `1` - Max length: `255` - `transport.subscribe_uids` (array, required) - The user ID of the participant the agent talks to, as a string or an integer. Pass exactly one user ID. - Min items: `1` - Max items: `1` - `transport.subscribe_uids.items` (string) - Range: `[1, 4294967295]` - Min length: `1` - Max length: `255` - `transport.audio_scenario` (string) - The audio scenario of the agent in the channel: - `aiserver`: Optimized for latency and network resilience in conversations with an agent. - `chorus`: For participants with good network conditions who need ultra-low latency. - Allowed: `aiserver` | `chorus` - Default: `aiserver` - `transport.encryption` (object) - Media encryption for the RTC channel. These values are never returned. - `transport.encryption.mode` (string, required) - The encryption mode. Agora recommends `aes_128_gcm2` or `aes_256_gcm2`, which use a salt. - Allowed: `aes_128_xts` | `aes_128_ecb` | `aes_256_xts` | `sm4_128_ecb` | `aes_128_gcm` | `aes_256_gcm` | `aes_128_gcm2` | `aes_256_gcm2` - `transport.encryption.key` (string, required) - The encryption key. - Min length: `1` - `transport.encryption.salt` (string) - A Base64-encoded salt that is 32 bytes long after decoding. Required when `mode` is `aes_128_gcm2` or `aes_256_gcm2`. - Pattern: `^[A-Za-z0-9+/]{43}=$` - `values` (object) - Values for the agent's variables, keyed by variable name, for this session only. Each key must be a variable the agent declares, and each value must match its `type` and `options`. Pass a value for every `required` variable. `null` values are rejected. - Example: `{"customer_name":"Ada"}` - `lifecycle` (object) - When the session ends on its own. - `lifecycle.idle_timeout_ms` (integer) - How long in milliseconds the session continues with no participant present: after the subscribed user leaves the RTC channel, or after the other side of a phone call hangs up. It isn't silence detection. Set to `0` to turn off the idle timer. Can't be greater than `max_duration_ms`. - Default: `30000` - Range: `[0, 3600000]` - `lifecycle.max_duration_ms` (integer) - The maximum length of the session in milliseconds, measured from `start_ts`. Defaults to 5 minutes. The maximum is 1 hour. - Default: `300000` - Range: `[1000, 3600000]` - `lifecycle.graceful_stop` (object) - How the agent finishes when you stop the session, or when the idle timer expires. It doesn't extend `max_duration_ms`, and it doesn't add a farewell message. - `lifecycle.graceful_stop.enabled` (boolean) - Whether the agent finishes what it's saying before it leaves. - Default: `false` - `lifecycle.graceful_stop.timeout_ms` (integer) - The longest time in milliseconds the agent can take to finish. - Default: `30000` - Range: `[0, 120000]` - `data_policy` (object) - How Agora handles the session's data. You set it when the session starts and can't change it afterward. - `data_policy.retention` (string) - How long Agora keeps the conversation data: - `30_days`: Agora keeps the data for 30 days. - `none`: Agora doesn't keep the data, and variable extraction doesn't run. Use it, for example, when a caller declines recording. - Allowed: `30_days` | `none` - Default: `30_days` - `labels` (object) - Key-value labels for this session, such as a team or customer ID. They're included in the `payload` of [notification events](/en/ai/reference/event-types). ### Request body example ```json { "agent": { "instructions": "Answer account questions concisely.", "pipeline": { "mode": "cascaded", "asr": { "credential": { "mode": "managed" }, "vendor": "deepgram", "model": "nova-3", "language": "en-US" }, "llm": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.llm" } }, "vendor": "openai", "style": "openai", "model": "" }, "tts": { "credential": { "mode": "managed" }, "vendor": "minimax", "params": { "model": "speech-2.6-turbo", "voice_setting": { "voice_id": "English_captivating_female1", "speed": 1 } } } } }, "transport": { "type": "rtc", "channel": "support-4821", "token": "", "uid": "1002", "subscribe_uids": [ "1001" ] } } ``` ## Responses ### 200 The session was created. - `agent_session_id` (string, required) - The ID of the session. - Pattern: `^[a-z0-9]{32}$` - `create_ts` (integer, required) - The time the session was created, as a Unix timestamp in seconds. - `status` (string, required) - The status of the session when it starts. For a phone call, `RUNNING` doesn't mean the call was answered. - Allowed: `STARTING` | `RUNNING` ### 400 The request was rejected and no session was created. For example, `InvalidModuleParameter` when the pipeline is invalid, or `UnknownSecretReference` when a `$secrets` reference doesn't exist. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `TaskConflict`: An agent is already running with the same RTC channel and UID. `IdempotencyKeyConflict`: A session was already started with this `Idempotency-Key`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 422 The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 429 `ConcurrencyLimitExceeded`: The project has reached its concurrent session limit. Stop a session, or retry later with exponential backoff. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 503 The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 504 The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "agent_session_id": "a42al97tw77hv93ja98dm74fk56lw97x", "create_ts": 1737111452, "status": "RUNNING" } ``` # Start a session (/en/api-reference/api-ref/conversational-ai/platform/start-session) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Starts a session that runs a saved agent in an RTC channel or over the phone. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: start-session - Method: POST - Path: /v1/projects/{appid}/sessions - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/sessions ## Servers - https://preview.ai.agora.io/conversational-ai The session uses the agent's configuration as saved when the session starts. To run a configuration without saving an agent first, use [Start an ephemeral session](/en/api-reference/api-ref/conversational-ai/platform/start-ephemeral-session). A `200` response confirms that the session exists. It doesn't confirm that the agent has joined the RTC channel or that an outbound call was answered. To follow the session, [retrieve it](/en/api-reference/api-ref/conversational-ai/platform/retrieve-session). The session ends when you [stop it](/en/api-reference/api-ref/conversational-ai/platform/stop-session), or when it reaches a limit in `lifecycle`. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `Idempotency-Key` (header, optional, string) - A unique key, so that retrying the request can't start a second session. If a session was already started with this key, the request fails with `409` and reason `IdempotencyKeyConflict`, and no new session starts. The API doesn't return the original response. To find the session, [list sessions](/en/api-reference/api-ref/conversational-ai/platform/list-sessions). Keep the same key when you retry; never switch keys. - Min length: `1` - Max length: `256` - Pattern: `^[\x21-\x7E]+$` ## Request body - `agent_id` (string, required) - The ID of the saved agent to run. - Format: `uuid` - `transport` (object, required) - How the agent connects to the participant. Pass the fields of one transport type only. - `transport.type` (string, required) - `rtc`: The agent joins an RTC channel. - `transport.from` (string, required) - The `number_id` of the number in the project to call from. Phone numbers aren't accepted. [Import the number](/en/api-reference/api-ref/conversational-ai/platform/create-number) first. - Format: `uuid` - `transport.to` (string, required) - The phone number to call, in E.164 format, for example `+14155550100`. - Pattern: `^\+[1-9][0-9]{1,14}$` - `transport.call_policy` (object) - Limits and behavior for outbound phone calls. Each limit you omit adds no limit. - `transport.call_policy.max_ring_duration_ms` (integer) - The maximum time in milliseconds from starting the dial until the call is answered. If the call isn't answered in time, the dial attempt ends. - Minimum: `1` - `transport.call_policy.max_call_duration_seconds` (integer) - The maximum length of the call in seconds, measured from when it's answered. The session's `lifecycle` limits can end the call earlier. - Minimum: `1` - `transport.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. This is separate from `pipeline.silence_config`, which only prompts the user. - Minimum: `1` - `transport.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `transport.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `transport.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `transport.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `transport.channel` (string, required) - The name of the RTC channel to join, 1 to 256 characters. - Min length: `1` - Max length: `256` - `transport.token` (string) - The RTC token the agent uses to join the channel. Required when the project has an App Certificate enabled. To renew it, [update the session](/en/api-reference/api-ref/conversational-ai/platform/update-session). - `transport.uid` (string) - The user ID the agent uses in the channel. Pass a string of up to 255 characters, such as `"1002"` or `"agent-bot"`, or an integer from 0 to 4294967295, such as `1002`. Omit it, or pass `0`, to let Agora assign a user ID that differs from `subscribe_uids`. - Default: `0` - Range: `[0, 4294967295]` - Min length: `1` - Max length: `255` - `transport.subscribe_uids` (array, required) - The user ID of the participant the agent talks to, as a string or an integer. Pass exactly one user ID. - Min items: `1` - Max items: `1` - `transport.subscribe_uids.items` (string) - Range: `[1, 4294967295]` - Min length: `1` - Max length: `255` - `transport.audio_scenario` (string) - The audio scenario of the agent in the channel: - `aiserver`: Optimized for latency and network resilience in conversations with an agent. - `chorus`: For participants with good network conditions who need ultra-low latency. - Allowed: `aiserver` | `chorus` - Default: `aiserver` - `transport.encryption` (object) - Media encryption for the RTC channel. These values are never returned. - `transport.encryption.mode` (string, required) - The encryption mode. Agora recommends `aes_128_gcm2` or `aes_256_gcm2`, which use a salt. - Allowed: `aes_128_xts` | `aes_128_ecb` | `aes_256_xts` | `sm4_128_ecb` | `aes_128_gcm` | `aes_256_gcm` | `aes_128_gcm2` | `aes_256_gcm2` - `transport.encryption.key` (string, required) - The encryption key. - Min length: `1` - `transport.encryption.salt` (string) - A Base64-encoded salt that is 32 bytes long after decoding. Required when `mode` is `aes_128_gcm2` or `aes_256_gcm2`. - Pattern: `^[A-Za-z0-9+/]{43}=$` - `values` (object) - Values for the agent's variables, keyed by variable name, for this session only. Each key must be a variable the agent declares, and each value must match its `type` and `options`. Pass a value for every `required` variable. `null` values are rejected. - Example: `{"customer_name":"Ada"}` - `lifecycle` (object) - When the session ends on its own. - `lifecycle.idle_timeout_ms` (integer) - How long in milliseconds the session continues with no participant present: after the subscribed user leaves the RTC channel, or after the other side of a phone call hangs up. It isn't silence detection. Set to `0` to turn off the idle timer. Can't be greater than `max_duration_ms`. - Default: `30000` - Range: `[0, 3600000]` - `lifecycle.max_duration_ms` (integer) - The maximum length of the session in milliseconds, measured from `start_ts`. Defaults to 5 minutes. The maximum is 1 hour. - Default: `300000` - Range: `[1000, 3600000]` - `lifecycle.graceful_stop` (object) - How the agent finishes when you stop the session, or when the idle timer expires. It doesn't extend `max_duration_ms`, and it doesn't add a farewell message. - `lifecycle.graceful_stop.enabled` (boolean) - Whether the agent finishes what it's saying before it leaves. - Default: `false` - `lifecycle.graceful_stop.timeout_ms` (integer) - The longest time in milliseconds the agent can take to finish. - Default: `30000` - Range: `[0, 120000]` - `data_policy` (object) - How Agora handles the session's data. You set it when the session starts and can't change it afterward. - `data_policy.retention` (string) - How long Agora keeps the conversation data: - `30_days`: Agora keeps the data for 30 days. - `none`: Agora doesn't keep the data, and variable extraction doesn't run. Use it, for example, when a caller declines recording. - Allowed: `30_days` | `none` - Default: `30_days` - `labels` (object) - Key-value labels for this session, such as a team or customer ID. They're included in the `payload` of [notification events](/en/ai/reference/event-types). ### Request body example ```json { "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "values": { "customer_name": "Ada" }, "labels": { "team": "support" }, "transport": { "type": "rtc", "channel": "support-4821", "token": "", "uid": "1002", "subscribe_uids": [ "1001" ] }, "lifecycle": { "idle_timeout_ms": 30000, "max_duration_ms": 3600000 } } ``` ## Responses ### 200 The session was created. - `agent_session_id` (string, required) - The ID of the session. - Pattern: `^[a-z0-9]{32}$` - `create_ts` (integer, required) - The time the session was created, as a Unix timestamp in seconds. - `status` (string, required) - The status of the session when it starts. For a phone call, `RUNNING` doesn't mean the call was answered. - Allowed: `STARTING` | `RUNNING` ### 400 The request was rejected and no session was created. For example, `InvalidModuleParameter` when the agent's pipeline is invalid, `MissingRequiredField` when a required variable has no value, or `InvalidFieldValue` when a telephony session uses an agent that is deployed for inbound calls. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `TaskConflict`: An agent is already running with the same RTC channel and UID. `IdempotencyKeyConflict`: A session was already started with this `Idempotency-Key`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 422 The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 429 `ConcurrencyLimitExceeded`: The project has reached its concurrent session limit. Stop a session, or retry later with exponential backoff. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 503 The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 504 The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h", "create_ts": 1737111452, "status": "RUNNING" } ``` # Status codes and error reasons (/en/api-reference/api-ref/conversational-ai/platform/status-codes) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Use the HTTP status code together with the `reason` and `detail` fields in the response body to troubleshoot failed Conversational AI Platform REST API requests. ## Error response format When a request fails, the response body contains a machine-readable `reason` and a human-readable `detail`: ```json { "detail": "Secret set support_prod is referenced by agent 3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10. Remove the reference before deleting the set.", "reason": "SecretSetInUse" } ``` - `reason` is stable. Branch your error handling on it, not on `detail`. New reasons may be added, so handle an unknown `reason` by its HTTP status. - `detail` names the field or resource involved, when there is one. Validation stops at the first problem, so fix it and retry to find any others. - Every response includes an `Agora-Request-Id` header. Include its value when you contact Agora support. A model provider that times out or rejects a key doesn't fail the request that starts a session. The session starts, and the failure surfaces at runtime. ## HTTP status codes | Status code | Description | Suggested action | | ----------- | ---------------------- | ------------------------------------------------------------------------------------------------------------ | | `200` | OK | The request was successful. | | `201` | Created | The resource was created. The response body contains it. Starting a session returns `200` instead. | | `400` | Invalid request | Fix the request based on `reason` and `detail`, then send it again. | | `401` | Authentication failed | Check your credentials. | | `403` | Access denied | Check that the service is enabled for the project and that your credentials have permission for the request. | | `404` | Not found | Check the App ID, and the ID or name in the request. | | `409` | Conflict | Check the state of the resource. For example, cancel a campaign before you delete it. | | `405` | Method not allowed | Check the HTTP method for the endpoint. | | `412` | Precondition failed | Retrieve the resource, apply your change again, and retry with the new `ETag`. | | `413` | Payload too large | Send a smaller request body. | | `415` | Unsupported media type | Send the body as JSON with `Content-Type: application/json`. | | `422` | Quota exceeded | Delete resources you no longer need, such as secret sets, or contact Agora support to raise your quota. | | `429` | Too many requests | Retry with exponential backoff. | | `500` | Internal error | Retry with exponential backoff. If the problem persists, contact Agora support. | | `502` | Upstream error | Retry with exponential backoff. | | `503` | Service unavailable | Retry with exponential backoff. | | `504` | Operation timeout | Retrieve or list sessions before you retry, because the operation may still complete. | ## Error reasons ### Request errors | Reason | Status | Description | | ------------------------ | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `InvalidRequestBody` | `400` | The body isn't valid JSON, doesn't match the request format, or contains an unknown field. | | `MissingRequiredField` | `400` | A required field, query parameter, or header, such as `If-Match`, is missing. Also returned when a session or campaign contact has no value for a required variable. | | `InvalidFieldValue` | `400` | A value has the wrong type, is out of range, has the wrong format, or isn't allowed. | | `InvalidModuleParameter` | `400` | The agent's pipeline is invalid as a whole, for example a parameter value the model service rejects. An unsupported provider, model, or credential mode returns `InvalidFieldValue` instead. | | `UnknownSecretReference` | `400` | A `$secrets..` reference names a secret set or key that doesn't exist in the project. | | `NotImplemented` | `400` | The field, value, or operation isn't available yet, or the provider doesn't support the action. Don't retry. | | `MethodNotAllowed` | `405` | The HTTP method isn't supported for this path. Returned by phone number endpoints. Other endpoints return `405` with `NotImplemented`. | | `PayloadTooLarge` | `413` | The request body is too large. Returned by phone number endpoints. Other endpoints return `413` with `InvalidRequestBody`. | | `UnsupportedMediaType` | `415` | The request body isn't sent as `application/json`. Returned by phone number endpoints. Other endpoints return `415` with `InvalidRequestBody`. | | `UpstreamRejected` | `4xx` | The telephony service rejected the phone number's configuration. Returned only by phone number endpoints, with the status code that the telephony service returned. Fix the request based on `detail`, then send it again. | ### Access errors | Reason | Status | Description | | ------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- | | `InvalidPermission` | `401` | Authentication is missing or invalid. | | `InvalidPermission` | `403` | The credentials don't have permission for the request. A project that doesn't belong to your account returns `404 ResourceNotFound` instead. | | `ServiceNotEnabled` | `403` | Conversational AI isn't enabled for the project. | | `AccountSuspended` | `403` | The account is suspended. | ### Resource errors | Reason | Status | Description | | ---------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | | `ResourceNotFound` | `404` | The project, agent, secret set, secret key, phone number, or campaign in the path doesn't exist, or the project doesn't belong to your account. | | `TaskNotFound` | `404` | The session in the path doesn't exist. | | `AgentNotFound` | `404` | An agent in the request body, in `agent_id` or `inbound.agent`, doesn't exist. | | `NumberNotFound` | `404` | A number in `transport.from` doesn't exist in the project. | | `ResourceQuotaLimitExceeded` | `422` | A quota was reached. For example, the account has reached its number of secret sets. | ### Conflict and precondition errors | Reason | Status | Description | | ------------------------ | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `TaskConflict` | `409` | Another operation on the session is in progress. For example, an agent is already running with the same RTC channel and UID, or the session is already stopping. Retry after the other operation finishes. | | `TaskNotRunning` | `409` | The session has ended or isn't running yet, so you can't update it. | | `IdempotencyKeyConflict` | `409` | A session was already started with this `Idempotency-Key`. Don't retry. [List sessions](list-sessions) to find it. | | `SecretSetAlreadyExists` | `409` | A secret set with this name already exists. To change its values, [update the set](update-secret-set). | | `SecretSetInUse` | `409` | An agent references the secret set, or a key you're removing from it. `detail` names the agent. Remove the reference first. | | `SecretSetEmpty` | `409` | The change would remove every key from the secret set. To remove every key, [delete the set](delete-secret-set). | | `NumberAlreadyExists` | `409` | The phone number is already registered in the project. | | `AgentInUse` | `409` | A phone number's inbound routing or an unfinished campaign references the agent you're deleting. `detail` names the reference. Remove it first. | | `ResourceConflict` | `409` | The phone number conflicts with another resource: it's registered to another account, another project in your account routes its inbound calls to an agent, or an unfinished campaign calls from the number you're deleting. | | `CampaignNotEditable` | `409` | The campaign has started dialing, so only `pacing` can change. A `completed`, `canceled`, or `failed` campaign can't change at all. | | `CampaignActive` | `409` | The campaign is `scheduled`, `running`, or `paused`, or it still has calls in progress. [Cancel it](cancel-campaign), and wait for its calls to end before you delete it. | | `CampaignInvalidState` | `409` | The action isn't allowed in the campaign's current status. For example, you can only pause a `running` campaign. | | `PreconditionFailed` | `412` | The `If-Match` value doesn't match the current `ETag`, or you sent `If-None-Match: *` for a key that exists. | ### Limit and server errors | Reason | Status | Description | | -------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------ | | `RateLimitExceeded` | `429` | Too many requests. Retry with exponential backoff. | | `ConcurrencyLimitExceeded` | `429` | The project has reached its concurrent session limit. Stop a session, or retry later with exponential backoff. | | `InternalError` | `500` | Something failed on Agora's side. Retry with exponential backoff, and report the `Agora-Request-Id` if it persists. | | `ServiceUnavailable` | `502` | An upstream Agora service returned an invalid response. Retry with exponential backoff. | | `ServiceUnavailable` | `503` | A required service is temporarily unavailable. Retry with exponential backoff. | | `ResourceAllocationFailed` | `503` | No capacity is available to start the session. Retry with exponential backoff. | | `TaskOperationTimeout` | `504` | Starting or stopping the session didn't finish in time, and it may still complete. Retrieve or list sessions before you retry. | ## Retry safely - For `4xx` errors, don't retry the same request. Fix it, or change the state it conflicts with. The exceptions are `409 TaskConflict` and `429`. - For `500`, `502`, and `503` errors, retry with exponential backoff. When you retry a session start, keep the same `Idempotency-Key`, so the session can't start twice. If the retry fails with `409 IdempotencyKeyConflict`, the first request started the session. - For `504 TaskOperationTimeout`, retrieve or list sessions before you retry, so that you don't start a duplicate session. # Stop a session (/en/api-reference/api-ref/conversational-ai/platform/stop-session) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Stops a running session. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: stop-session - Method: POST - Path: /v1/projects/{appid}/sessions/{agent_session_id}/stop - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/sessions/{agent_session_id}/stop ## Servers - https://preview.ai.agora.io/conversational-ai Use this endpoint to end a session as soon as its task is complete. Send the request without a body. The stop happens asynchronously. [Retrieve the session](/en/api-reference/api-ref/conversational-ai/platform/retrieve-session) to confirm that its status is `STOPPED`. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `agent_session_id` (path, required, string) - The ID of the session, returned in `agent_session_id` when you start the session. ## Request body No request body. ## Responses ### 200 The stop request was accepted. The response body is an empty object. No schema. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `TaskConflict`: The session is already stopping. `TaskNotRunning`: The session has already ended. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 504 The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json {} ``` # Update an agent (/en/api-reference/api-ref/conversational-ai/platform/update-agent) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Changes the configuration of a saved agent. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: update-agent - Method: PATCH - Path: /v1/projects/{appid}/agents/{agent_id} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/agents/{agent_id} ## Servers - https://preview.ai.agora.io/conversational-ai The request body is a JSON merge patch. Send only the fields you want to change. Nested objects merge field by field, arrays replace the saved value, and `null` removes a field. Variable definitions merge field by field too: to drop a saved `options`, `extract`, or `description`, set it to `null`. The update applies to sessions that start afterward. Running sessions keep the configuration they started with. To change a running session, use [Update a session](/en/api-reference/api-ref/conversational-ai/platform/update-session). ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `agent_id` (path, required, string) - The ID of the agent, returned in `agent_id` when you create the agent. - Format: `uuid` - `If-Match` (header, required, string) - The `ETag` value from the most recent response for this resource. If the resource has changed since then, the request fails with `412` and reason `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`. ## Request body - `agent_name` (string) - A name for the agent, 1 to 255 characters. It doesn't need to be unique. - Min length: `1` - Max length: `255` - `instructions` (string) - The system instructions that define how the agent behaves. The model receives them as the first `system` message, before `messages`. - `messages` (array) - Messages that start the conversation history. They follow `instructions`. - `messages.items` (object) - `messages.items.role` (string, required) - The author of the message: - `system`: An instruction to the model. - `user`: A message from the user. - `assistant`: A message from the agent. - Allowed: `system` | `user` | `assistant` - `messages.items.content` (string, required) - The text of the message. - `variables` (object) - Changes to the variables, keyed by variable name. Each definition you pass merges into the saved definition field by field, so set a field such as `options` to `null` to remove it. Set a variable to `null` to remove the variable. - `greeting` (object) - Changes to the greeting. Pass any of the `greeting` fields of [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). Set it to `null` to remove the greeting. - `pipeline` (object) - Changes to the pipeline. Pass any of the `pipeline` fields of [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). Nested objects merge field by field. - `filler_words` (object) - Changes to the filler words. Pass any of the `filler_words` fields of [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). ### Request body example ```json { "instructions": "You are a support agent for Acme. Address the caller as {{customer_name}}. Be concise and polite.", "variables": { "follow_up_date": null } } ``` ## Responses ### 200 The agent was updated. The response body contains the full agent. - `agent_id` (string, required) - The ID of the agent, a UUID. - Format: `uuid` - `agent_name` (string, required) - A name for the agent, 1 to 255 characters. It doesn't need to be unique. - Min length: `1` - Max length: `255` - `instructions` (string) - The system instructions that define how the agent behaves. The model receives them as the first `system` message, before `messages`. - `messages` (array) - Messages that start the conversation history. They follow `instructions`. - `messages.items` (object) - `messages.items.role` (string, required) - The author of the message: - `system`: An instruction to the model. - `user`: A message from the user. - `assistant`: A message from the agent. - Allowed: `system` | `user` | `assistant` - `messages.items.content` (string, required) - The text of the message. - `variables` (object) - Every variable the agent uses, keyed by variable name. A name starts with a lowercase letter and contains up to 64 lowercase letters, digits, and underscores. Reference a variable as `{{variable_name}}` in `instructions`, `messages`, `greeting.text`, `pipeline.llm.failure_message`, `pipeline.silence_config.content`, and generated filler instructions. The agent doesn't store values: pass them in `values` when you start a session, or in each campaign contact. Expansion is single-pass, so a value that contains a placeholder isn't expanded again. - Example: `{"customer_name":{"type":"str","required":true},"resolution_status":{"type":"str","options":["resolved","follow_up","unresolved"],"extract":true,"description":"Outcome of the conversation."}}` - `greeting` (object) - The message the agent speaks when a participant joins. If you omit it, the agent doesn't greet participants automatically. - `greeting.mode` (string, required) - `text`: The agent speaks `text` using the TTS stage. - `greeting.on` (string) - Which participants the agent greets: - `each_join`: Every participant who joins. - `first_join`: Only the first participant to join. - Allowed: `each_join` | `first_join` - Default: `each_join` - `greeting.delay_ms` (integer) - The delay in milliseconds between a participant joining and the agent starting the greeting. - Default: `0` - Range: `[0, 5000]` - `greeting.text` (string, required) - The greeting text. - `pipeline` (object) - The models that power the agent: separate ASR, LLM, and TTS stages. When you pass a pipeline, `llm` and `tts` are required. - `pipeline.mode` (string, required) - `cascaded`: Separate ASR, LLM, and TTS stages. - `pipeline.asr` (object) - The automatic speech recognition (ASR) stage, which transcribes the user's speech. - `pipeline.asr.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.asr.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.asr.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.asr.vendor` (string) - The ASR provider, for example `deepgram`. - `pipeline.asr.model` (string) - The provider model, for example `nova-3`. - `pipeline.asr.language` (string) - The language of the user's speech, for example `en-US`. - `pipeline.asr.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. - `pipeline.asr.params` (object) - Provider-specific settings that aren't secret, such as `keywords`, passed to the provider as they are. Keep API keys in `credential`, not here. - `pipeline.llm` (object, required) - The large language model (LLM) stage, which generates the agent's replies. - `pipeline.llm.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.llm.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.llm.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.llm.vendor` (string) - The LLM provider, for example `openai`. - `pipeline.llm.style` (string) - The API style used to communicate with the model, for example `openai` for OpenAI and OpenAI-compatible APIs. - `pipeline.llm.model` (string) - The provider model. - `pipeline.llm.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. For Google Gemini in an ephemeral session, the URL can include your API key as `key=`, with `credential.fields` left out. A saved agent's `url` can't contain a key. - `pipeline.llm.headers` (object) - Custom HTTP headers sent to the provider endpoint, at most 32. They are write-only and are never returned. A value can be a whole `$secrets..` reference when the stage uses `byok` and an approved provider endpoint. Agora resolves it when each session starts. A header name that looks like a credential, such as `X-Api-Key`, must use a reference. Transport, identity, and provider authentication headers are reserved. Set provider authentication in `credential`. - `pipeline.llm.params` (object) - Provider-specific settings that aren't secret, such as `reasoning_effort`, passed to the provider as they are. Keep API keys in `credential`, not here. - `pipeline.llm.input_modalities` (array) - The input types sent to the model, for example `["text"]`. - `pipeline.llm.input_modalities.items` (string) - `pipeline.llm.output_modalities` (array) - The output types requested from the model, for example `["text"]`. - `pipeline.llm.output_modalities.items` (string) - `pipeline.llm.max_history` (integer) - The number of recent conversation messages the LLM keeps as context. It counts messages, not user and agent pairs. The agent's `instructions` don't count toward this limit. - Default: `32` - Range: `[1, 1024]` - `pipeline.llm.failure_message` (string) - The message the agent speaks with the TTS stage when the LLM fails to produce a response. - `pipeline.llm.tools` (array) - Function tools the model can call. An agent can have up to 32 tools in total, including tools discovered from `mcp_servers`. Tool names must be unique, ignoring case. - Max items: `32` - `pipeline.llm.tools.items` (object) - `pipeline.llm.tools.items.type` (string, required) - Always `function`. - `pipeline.llm.tools.items.name` (string, required) - The tool name shown to the model. It starts with a letter and contains only letters and digits, up to 64 characters. It can't start with `mcp`, can't be `ragsearch_tool`, and can't match an MCP, built-in, or model-native tool. - Max length: `64` - `pipeline.llm.tools.items.description` (string, required) - What the tool does, 1 to 1,024 characters. The model uses it to decide when to call the tool. - Min length: `1` - Max length: `1024` - `pipeline.llm.tools.items.parameters` (object, required) - A JSON Schema that describes the tool's arguments. - `pipeline.llm.tools.items.execution` (object, required) - How the agent runs the tool. - `pipeline.llm.tools.items.execution.mode` (string, required) - `sync`: The agent waits for the tool response before it continues. - `pipeline.llm.tools.items.server` (object, required) - The HTTP endpoint the agent calls to run the tool. - `pipeline.llm.tools.items.server.method` (string, required) - The HTTP method. - Allowed: `GET` | `POST` - `pipeline.llm.tools.items.server.url` (string, required) - The HTTPS URL of the endpoint, up to 2,048 characters. - Min length: `1` - Max length: `2048` - Pattern: `^https://` - `pipeline.llm.tools.items.server.headers` (object) - HTTP headers sent to the endpoint, up to 32. They are write-only and are never returned. - `pipeline.llm.tools.items.server.body` (object) - Additional fields to include in the request body. - `pipeline.llm.tools.items.server.timeout_ms` (integer) - The request timeout in milliseconds. - Default: `10000` - Range: `[1000, 100000]` - `pipeline.llm.mcp_servers` (array) - MCP servers whose tools the model can call. - `pipeline.llm.mcp_servers.items` (object) - `pipeline.llm.mcp_servers.items.name` (string, required) - A name for the MCP server, 1 to 48 letters and digits. - Min length: `1` - Max length: `48` - `pipeline.llm.mcp_servers.items.endpoint` (string, required) - The HTTPS URL of the MCP server, up to 2,048 characters. - Min length: `1` - Max length: `2048` - Pattern: `^https://` - `pipeline.llm.mcp_servers.items.transport` (string, required) - The MCP transport. `streamable_http`: Streamable HTTP. - `pipeline.llm.mcp_servers.items.headers` (object) - HTTP headers sent to the MCP server, up to 32. They are write-only and are never returned. - `pipeline.llm.mcp_servers.items.allowed_tools` (array) - The tools the model can call from this server: - Omit the field, or include `*` in the list, to allow every tool. - Pass an empty list to allow no tools. - Otherwise, only the listed tools are allowed. - `pipeline.llm.mcp_servers.items.allowed_tools.items` (string) - Min length: `1` - `pipeline.llm.mcp_servers.items.timeout_ms` (integer) - The request timeout in milliseconds. - Range: `[1000, 100000]` - `pipeline.tts` (object, required) - The text-to-speech (TTS) stage, which converts the agent's replies to speech. - `pipeline.tts.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.tts.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.tts.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.tts.vendor` (string) - The TTS provider, for example `microsoft`. - `pipeline.tts.model` (string) - The TTS model the agent uses. Returned in responses only. - `pipeline.tts.url` (string) - A custom provider endpoint. Don't also put the endpoint in `params`. - `pipeline.tts.headers` (object) - Custom HTTP headers sent to the provider endpoint, at most 32. They are write-only and are never returned. A value can be a whole `$secrets..` reference when the stage uses `byok` and an approved provider endpoint. Agora resolves it when each session starts. A header name that looks like a credential, such as `X-Api-Key`, must use a reference. Transport, identity, and provider authentication headers are reserved. Set provider authentication in `credential`. - `pipeline.tts.params` (object) - Provider-specific settings that aren't secret, such as the voice and, where the provider requires it, the model, passed to the provider as they are. Keep API keys in `credential`, not here. - `pipeline.tts.skip_patterns` (array) - Bracketed text that the agent doesn't speak, such as tone or action notes in the LLM output: - `fullwidth_parentheses`: Text in `()`. - `lenticular_brackets`: Text in `【】`. - `parentheses`: Text in `( )`. - `square_brackets`: Text in `[ ]`. - `curly_braces`: Text in `{ }`. - `pipeline.tts.skip_patterns.items` (string) - Allowed: `fullwidth_parentheses` | `lenticular_brackets` | `parentheses` | `square_brackets` | `curly_braces` - `pipeline.turn_detection` (object) - How the agent detects when the user starts and stops speaking, and handles interruptions. - `pipeline.turn_detection.speech_threshold` (number) - The speech detection threshold. Lower values detect speech more easily. Higher values ignore weak speech. - Default: `0.5` - Range: `[0, 1]` - `pipeline.turn_detection.start_of_speech` (object) - How the agent detects that the user starts speaking. Pass the fields of one detection type only. If you omit it, the agent uses `semantic` detection with its defaults. - `pipeline.turn_detection.start_of_speech.type` (string, required) - `semantic`: Detects a meaningful start of speech. If you omit `type`, the agent uses `semantic`. - Default: `semantic` - `pipeline.turn_detection.start_of_speech.interrupt_duration_ms` (integer) - Speech shorter than this, in milliseconds, is ignored. - Default: `160` - Range: `[120, 1200]` - `pipeline.turn_detection.start_of_speech.speaking_interrupt_duration_ms` (integer) - How long in milliseconds the user must speak to interrupt the agent while it's speaking. - Default: `160` - `pipeline.turn_detection.start_of_speech.prefix_padding_ms` (integer) - How many milliseconds of audio before the detected start of speech to keep, so the beginning of the speech isn't clipped. - Default: `800` - Range: `[0, 5000]` - `pipeline.turn_detection.end_of_speech` (object) - How the agent detects that the user has finished speaking. Pass the fields of one detection type only. If you omit it, the agent uses `semantic` detection with its defaults. - `pipeline.turn_detection.end_of_speech.type` (string, required) - `semantic`: Considers whether the utterance sounds complete. If you omit `type`, the agent uses `semantic`. - Default: `semantic` - `pipeline.turn_detection.end_of_speech.silence_duration_ms` (integer) - The silence in milliseconds that ends the turn. - Default: `320` - Range: `[120, 2000]` - `pipeline.turn_detection.end_of_speech.max_wait_ms` (integer) - The maximum time in milliseconds to wait before ending the turn, from 500 to 10,000. Set to `-1` to wait without a timeout. - Default: `3000` - Range: `[500, 10000]` - `pipeline.turn_detection.end_of_speech.pause_state_enabled` (boolean) - Whether the agent detects a pause within an utterance, such as "hold on", and waits for more input. - Default: `true` - `pipeline.turn_detection.interruption` (object) - How the user can interrupt the agent while it speaks or thinks. Pass the fields of one interruption mode only. If you omit it, any user speech interrupts the agent. - Default: `{"mode":"start_of_speech"}` - `pipeline.turn_detection.interruption.mode` (string, required) - `start_of_speech`: Any user speech interrupts the agent. - `pipeline.turn_detection.interruption.when_off` (string) - What happens to user speech that arrives while the agent speaks or thinks: - `append`: The agent responds to the speech after the current reply. - `ignore`: The agent discards the speech. - Allowed: `append` | `ignore` - Default: `append` - `pipeline.turn_detection.interruption.keywords` (array, required) - The phrases that interrupt the agent, 1 to 128. - Min items: `1` - Max items: `128` - `pipeline.turn_detection.interruption.keywords.items` (string) - Min length: `1` - `pipeline.silence_config` (object) - What the agent does after a period of silence. This only prompts the user. To hang up a phone call after silence, use `call_policy.max_silence_duration_ms`. - `pipeline.silence_config.enabled` (boolean, required) - Whether to act on silence. - `pipeline.silence_config.timeout_ms` (integer, required) - How long the silence lasts, in milliseconds, before the agent acts, up to 60,000. Applies only when `enabled` is `true`. - Range: `[0, 60000]` - `pipeline.silence_config.action` (string, required) - What the agent does when the timeout is reached: - `speak`: Speaks `content` as written. - `think`: Gives `content` to the LLM as an instruction, and responds to it. - Allowed: `speak` | `think` - `pipeline.silence_config.content` (string, required) - The text to speak, or the instruction for the LLM, depending on `action`. - `pipeline.avatar` (object) - The avatar that represents the agent on video. - `pipeline.avatar.enabled` (boolean) - Whether to show the avatar. - Default: `false` - `pipeline.avatar.credential` (object) - How this stage authenticates with the provider. Set it explicitly on each stage. Pass the fields of one credential mode only. Responses return only `mode`. - `pipeline.avatar.credential.mode` (string, required) - `managed`: Agora provides the provider authentication. - `pipeline.avatar.credential.fields` (object) - Your provider credentials, keyed by the provider's field name. Most providers take one field, `api_key`. Some use other names, such as `key` or `credentials`, or take more than one field, such as an AWS access key ID and secret access key. Each model page lists its provider's fields. In an agent, each value must be a `$secrets..` reference to a [secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set). An ephemeral session also accepts the values themselves. Agora resolves references when each session starts. The values are never returned. - `pipeline.avatar.vendor` (string) - The avatar provider. `generic` passes provider-neutral parameters through. - Allowed: `akool` | `liveavatar` | `anam` | `sensetime` | `spatius` | `generic` - `pipeline.avatar.params` (object) - Provider-specific settings, passed to the provider as they are. - `filler_words` (object) - Short phrases the agent says while it waits for the LLM to respond, such as when it waits for a tool call. - `filler_words.enable` (boolean) - Whether to play filler words. - Default: `false` - `filler_words.trigger` (object) - When to play a filler word. - `filler_words.trigger.mode` (string, required) - `fixed_time`: Play a filler word when the LLM hasn't responded within `response_wait_ms`. - `filler_words.trigger.response_wait_ms` (integer, required) - How long in milliseconds to wait for the LLM response before playing a filler word, for example `1500`. - Range: `[100, 10000]` - `filler_words.content` (object) - Where the filler words come from. Pass the fields of one source only. - `filler_words.content.mode` (string, required) - `static`: Pick a phrase from `phrases`. - `filler_words.content.instructions` (string, required) - The instructions used to generate filler phrases. They can't be empty or only whitespace. - Min length: `1` - `filler_words.content.fallback_strategy` (string) - What to use when a generated phrase isn't available. - Default: `static` - `filler_words.content.phrases` (array, required) - The filler phrases, 1 to 100 non-empty strings. - Min items: `1` - Max items: `100` - `filler_words.content.phrases.items` (string) - Min length: `1` - `filler_words.content.selection_rule` (string) - How the agent picks the next phrase: - `shuffle`: In random order. - `round_robin`: In list order, starting over after the last phrase. - Allowed: `shuffle` | `round_robin` - Default: `shuffle` - `create_ts` (integer, required) - The time the agent was created, as a Unix timestamp in seconds. - `update_ts` (integer, required) - The time the agent was last updated, as a Unix timestamp in seconds. ### 400 The request is invalid. For example, `MissingRequiredField` when the `If-Match` header is missing, `InvalidModuleParameter` when a pipeline stage is invalid, or `UnknownSecretReference` when a `$secrets` reference doesn't exist. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 412 The `If-Match` value doesn't match the current version of the resource. The reason is `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). # Update a campaign (/en/api-reference/api-ref/conversational-ai/platform/update-campaign) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Changes the pacing, schedule, or dialing limits of a campaign. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: update-campaign - Method: PATCH - Path: /v1/projects/{appid}/campaigns/{campaign_id} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/campaigns/{campaign_id} ## Servers - https://preview.ai.agora.io/conversational-ai Before the campaign starts dialing, you can change `pacing`, `schedule`, `lifecycle`, and `transport.call_policy`. After it starts, you can change only `pacing`, and other fields fail with `CampaignNotEditable`. After the campaign is `completed`, `canceled`, or `failed`, you can't change it. You can never change `agent_id`, `transport.type`, `transport.from`, or `contacts`. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `campaign_id` (path, required, string) - The ID of the campaign, returned in `campaign_id` when you create the campaign. - Format: `uuid` - `If-Match` (header, required, string) - The `ETag` value from the most recent response for this resource. If the resource has changed since then, the request fails with `412` and reason `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`. ## Request body - `pacing` (object) - Changes to the pacing. Pass any of the `pacing` fields of [Create a campaign](/en/api-reference/api-ref/conversational-ai/platform/create-campaign). Fields you omit keep their saved values. - `pacing.max_concurrent` (integer) - The maximum number of calls in progress at the same time. - Range: `[1, 10000]` - `pacing.max_calls_per_second` (integer) - The maximum number of new dials in any one-second window. - Range: `[1, 1000]` - `schedule` (object) - When the campaign dials. Pass the fields of one schedule mode only. - `schedule.mode` (string, required) - `immediate`: The campaign starts dialing as soon as it's created. - `schedule.timezone` (string, required) - The IANA time zone for `days`, for example `America/New_York`. Daylight saving time is handled automatically. Required when you pass `days`. - Min length: `1` - Max length: `255` - `schedule.start` (string, required) - When the campaign can start dialing, as a local date and time in `YYYY-MM-DDTHH:MM` format with no offset, for example `2026-11-02T09:00`. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.end` (string, required) - When the campaign stops placing new calls, as a local date and time in `YYYY-MM-DDTHH:MM` format, later than `start`. Calls in progress continue. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.days` (array) - The weekly hours when new calls can start. Outside these hours, no new calls start. A day you don't list has no dialing. Omit `days` to dial at any time. - Min items: `1` - Max items: `7` - `schedule.days.items` (object) - `schedule.days.items.weekday` (string, required) - The day of the week. Each day can appear only once. - Allowed: `mon` | `tue` | `wed` | `thu` | `fri` | `sat` | `sun` - `schedule.days.items.ranges` (array, required) - One to 10 windows on this day, which can't overlap. - Min items: `1` - Max items: `10` - `schedule.days.items.ranges.items` (object) - `schedule.days.items.ranges.items.start` (string, required) - The start of the window, as a local time in 24-hour `HH:MM` format. - `schedule.days.items.ranges.items.end` (string, required) - The end of the window, as a local time in `HH:MM` format, later than `start`. Use `24:00` for the end of the day. - `lifecycle` (object) - When each session the campaign starts ends on its own. - `lifecycle.idle_timeout_ms` (integer) - How long in milliseconds the session continues with no participant present: after the subscribed user leaves the RTC channel, or after the other side of a phone call hangs up. It isn't silence detection. Set to `0` to turn off the idle timer. Can't be greater than `max_duration_ms`. - Default: `30000` - Range: `[0, 3600000]` - `lifecycle.max_duration_ms` (integer) - The maximum length of each session in milliseconds, measured from `start_ts`. Defaults to 5 minutes. The maximum is 1 hour. - Default: `300000` - Range: `[1000, 3600000]` - `lifecycle.graceful_stop` (object) - How the agent finishes when you stop the session, or when the idle timer expires. It doesn't extend `max_duration_ms`, and it doesn't add a farewell message. - `lifecycle.graceful_stop.enabled` (boolean) - Whether the agent finishes what it's saying before it leaves. - Default: `false` - `lifecycle.graceful_stop.timeout_ms` (integer) - The longest time in milliseconds the agent can take to finish. - Default: `30000` - Range: `[0, 120000]` - `transport` (object) - The transport settings that can change. You can't change `type` or `from`. - `transport.call_policy` (object) - Limits and behavior for each call the campaign places. Each limit you omit adds no limit. - `transport.call_policy.max_ring_duration_ms` (integer) - The maximum time in milliseconds from starting the dial until the call is answered. If the call isn't answered in time, the dial attempt ends. - Range: `[1, 259200000]` - `transport.call_policy.max_call_duration_seconds` (integer) - The maximum length of the call in seconds, measured from when it's answered. The session's `lifecycle` limits can end the call earlier. - Range: `[1, 259200]` - `transport.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. This is separate from `pipeline.silence_config`, which only prompts the user. - Range: `[30000, 259200000]` - `transport.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `transport.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `transport.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `transport.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` ### Request body example ```json { "pacing": { "max_concurrent": 20 } } ``` ## Responses ### 200 The campaign was updated. The response body contains the full campaign. - `campaign_id` (string) - The ID of the campaign, a UUID. - Format: `uuid` - `name` (string) - The name of the campaign. - `status` (string) - The status of the campaign: - `scheduled`: The campaign is waiting for its start time. - `running`: The campaign is dialing, or can dial during its schedule. - `paused`: You paused the campaign. - `completed`: The campaign has finished. - `canceled`: You canceled the campaign. - `failed`: The campaign failed. The details are in `failure`. - Allowed: `scheduled` | `running` | `paused` | `completed` | `canceled` | `failed` - `agent_id` (string) - The ID of the agent that makes the calls. - Format: `uuid` - `transport` (object) - `transport.type` (string) - Always `telephony`. - `transport.from` (array) - The `number_id` values of the numbers the campaign calls from. - `transport.from.items` (string) - `transport.call_policy` (object) - Limits and behavior for each call the campaign places. Each limit you omit adds no limit. - `transport.call_policy.max_ring_duration_ms` (integer) - The maximum time in milliseconds from starting the dial until the call is answered. If the call isn't answered in time, the dial attempt ends. - Range: `[1, 259200000]` - `transport.call_policy.max_call_duration_seconds` (integer) - The maximum length of the call in seconds, measured from when it's answered. The session's `lifecycle` limits can end the call earlier. - Range: `[1, 259200]` - `transport.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. This is separate from `pipeline.silence_config`, which only prompts the user. - Range: `[30000, 259200000]` - `transport.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `transport.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `transport.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `transport.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `lifecycle` (object) - When each session the campaign starts ends on its own. - `lifecycle.idle_timeout_ms` (integer) - How long in milliseconds the session continues with no participant present: after the subscribed user leaves the RTC channel, or after the other side of a phone call hangs up. It isn't silence detection. Set to `0` to turn off the idle timer. Can't be greater than `max_duration_ms`. - Default: `30000` - Range: `[0, 3600000]` - `lifecycle.max_duration_ms` (integer) - The maximum length of each session in milliseconds, measured from `start_ts`. Defaults to 5 minutes. The maximum is 1 hour. - Default: `300000` - Range: `[1000, 3600000]` - `lifecycle.graceful_stop` (object) - How the agent finishes when you stop the session, or when the idle timer expires. It doesn't extend `max_duration_ms`, and it doesn't add a farewell message. - `lifecycle.graceful_stop.enabled` (boolean) - Whether the agent finishes what it's saying before it leaves. - Default: `false` - `lifecycle.graceful_stop.timeout_ms` (integer) - The longest time in milliseconds the agent can take to finish. - Default: `30000` - Range: `[0, 120000]` - `schedule` (object) - When the campaign dials. Pass the fields of one schedule mode only. - `schedule.mode` (string, required) - `immediate`: The campaign starts dialing as soon as it's created. - `schedule.timezone` (string, required) - The IANA time zone for `days`, for example `America/New_York`. Daylight saving time is handled automatically. Required when you pass `days`. - Min length: `1` - Max length: `255` - `schedule.start` (string, required) - When the campaign can start dialing, as a local date and time in `YYYY-MM-DDTHH:MM` format with no offset, for example `2026-11-02T09:00`. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.end` (string, required) - When the campaign stops placing new calls, as a local date and time in `YYYY-MM-DDTHH:MM` format, later than `start`. Calls in progress continue. A local time that doesn't exist or occurs twice because of a daylight saving change is rejected. - `schedule.days` (array) - The weekly hours when new calls can start. Outside these hours, no new calls start. A day you don't list has no dialing. Omit `days` to dial at any time. - Min items: `1` - Max items: `7` - `schedule.days.items` (object) - `schedule.days.items.weekday` (string, required) - The day of the week. Each day can appear only once. - Allowed: `mon` | `tue` | `wed` | `thu` | `fri` | `sat` | `sun` - `schedule.days.items.ranges` (array, required) - One to 10 windows on this day, which can't overlap. - Min items: `1` - Max items: `10` - `schedule.days.items.ranges.items` (object) - `schedule.days.items.ranges.items.start` (string, required) - The start of the window, as a local time in 24-hour `HH:MM` format. - `schedule.days.items.ranges.items.end` (string, required) - The end of the window, as a local time in `HH:MM` format, later than `start`. Use `24:00` for the end of the day. - `counts` (object) - The number of contacts in each state. Retrieve the campaign to get current counts. - `counts.contacts` (integer) - The total number of contacts. - `counts.pending` (integer) - Contacts not called yet, or waiting for a retry. - `counts.calling` (integer) - Contacts in a call now. - `counts.completed` (integer) - Contacts whose call has finished. - `counts.failed` (integer) - Contacts not reached after all attempts. - `counts.canceled` (integer) - Contacts that won't be called because the campaign was canceled. - `create_ts` (integer) - The time the campaign was created, as a Unix timestamp in seconds. - `start_ts` (integer | null | null) - The time the campaign started dialing, as a Unix timestamp in seconds. `null` before it starts. - `complete_ts` (integer | null | null) - The time the campaign finished, as a Unix timestamp in seconds. `null` until it finishes. - `failure` (object) - Details of the failure when `status` is `failed`. Otherwise `null`. - `failure.code` (string, required) - A stable runtime error code, for example `provider_error`. - `failure.provider` (string) - The model provider that caused the failure, for example `openai`. - `failure.message` (string, required) - A human-readable explanation. - `failure.ts` (integer, required) - The time the failure occurred, as a Unix timestamp in seconds. ### 400 The request is invalid. Check `reason` and `detail` in the response body. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `CampaignNotEditable`: The campaign has started dialing, so only `pacing` can change, or the campaign is `completed`, `canceled`, or `failed`, so nothing can change. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 412 The `If-Match` value doesn't match the current version of the resource. The reason is `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). # Update a phone number (/en/api-reference/api-ref/conversational-ai/platform/update-number) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Changes the SIP trunk or inbound routing of a phone number. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: update-number - Method: PATCH - Path: /v1/projects/{appid}/numbers/{number_id} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/numbers/{number_id} ## Servers - https://preview.ai.agora.io/conversational-ai Send only the fields you want to change. `sip_trunk` and `inbound` are each replaced as a whole, so pass the complete object, including `sip_trunk.auth` if the trunk uses authentication. If you leave out `auth` or `allowed_ips`, the saved values are removed. To stop routing inbound calls to an agent, set `inbound` to `null`. You can't change the phone number itself. To use a different number, create a new one. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `number_id` (path, required, string) - The ID of the phone number, returned in `number_id` when you create the number. - Format: `uuid` - `If-Match` (header, required, string) - The `ETag` value from the most recent response for this resource. If the resource has changed since then, the request fails with `412` and reason `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`. ## Request body - `number` (string) - The phone number in a different format. You can reformat the number, but you can't change it to a different number. - Min length: `1` - Max length: `128` - `description` (string) - A description of the number's purpose. It's separate from `sip_trunk.name`, which names the carrier connection. - `sip_trunk` (object) - The carrier connection for this number. - `sip_trunk.name` (string) - A name for the carrier connection that helps you identify it. - `sip_trunk.hostname` (string, required) - The carrier's SIP hostname, without a scheme or port. For example, `acme.pstn.example.com`. - Pattern: `^[^:/\s]+$` - `sip_trunk.port` (integer) - The SIP signaling port. Defaults to `5061` when `transport` is `tls`, and `5060` when it's `udp` or `tcp`. - Range: `[1, 65535]` - `sip_trunk.transport` (string) - The transport protocol for the carrier connection. - Allowed: `udp` | `tcp` | `tls` - Default: `tls` - `sip_trunk.auth` (object) - The credentials for your SIP trunk. They are write-only and are never returned. - `sip_trunk.auth.username` (string, required) - The SIP username. - `sip_trunk.auth.password` (string, required) - The SIP password. Referring to a secret set, such as `$secrets.support_prod.sip_password`, isn't supported in the Preview. - `sip_trunk.allowed_ips` (array) - The addresses allowed to send inbound SIP traffic to this number. Each entry is an IPv4 address, such as `54.172.60.1`, or an IPv4 CIDR range, such as `54.172.60.0/23`. IPv6 addresses and hostnames aren't accepted. If you omit it, inbound SIP traffic is accepted from any address, so set it to your carrier's signaling addresses. - `sip_trunk.allowed_ips.items` (string) - `inbound` (object) - What happens when someone calls this number. If you omit it, inbound calls are rejected. `call_policy` is required when `agent` isn't `null`. - `inbound.agent` (string | null | null, required) - The ID of the agent that answers inbound calls. Set to `null` to reject inbound calls. - `inbound.call_policy` (object) - Limits and behavior for inbound calls to this number. Each limit you omit adds no limit. - `inbound.call_policy.max_call_duration_seconds` (integer) - The maximum length of a call in seconds, measured from when it's answered. - Minimum: `1` - `inbound.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. - Minimum: `1` - `inbound.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `inbound.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `inbound.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `inbound.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` ### Request body example ```json { "inbound": { "agent": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "call_policy": { "max_call_duration_seconds": 1800 } } } ``` ## Responses ### 200 The number was updated. The response body contains the full number. - `number_id` (string) - The ID of the phone number, a UUID. - Format: `uuid` - `number` (string) - The phone number in E.164 format. - `description` (string) - A description of the number's purpose. It's separate from `sip_trunk.name`, which names the carrier connection. - `sip_trunk` (object) - `sip_trunk.name` (string) - The name of the carrier connection. - `sip_trunk.hostname` (string) - The carrier's SIP hostname. - `sip_trunk.port` (integer) - The SIP signaling port. - `sip_trunk.transport` (string) - The transport protocol for the carrier connection. - Allowed: `udp` | `tcp` | `tls` - `sip_trunk.allowed_ips` (array) - The addresses allowed to send inbound SIP traffic. - `sip_trunk.allowed_ips.items` (string) - `inbound` (object) - What happens when someone calls this number. If you omit it, inbound calls are rejected. `call_policy` is required when `agent` isn't `null`. - `inbound.agent` (string | null | null, required) - The ID of the agent that answers inbound calls. Set to `null` to reject inbound calls. - `inbound.call_policy` (object) - Limits and behavior for inbound calls to this number. Each limit you omit adds no limit. - `inbound.call_policy.max_call_duration_seconds` (integer) - The maximum length of a call in seconds, measured from when it's answered. - Minimum: `1` - `inbound.call_policy.max_silence_duration_ms` (integer) - Hang up when nobody on the call has spoken for this many milliseconds. - Minimum: `1` - `inbound.call_policy.end_call` (object) - Conditions under which the agent can end the call itself. Every condition is off unless you set it to `true`. - `inbound.call_policy.end_call.on_user_request` (boolean) - End the call when the caller clearly says goodbye or asks to hang up. - Default: `false` - `inbound.call_policy.end_call.on_voicemail` (boolean) - End the call when the agent reaches voicemail, such as a "please leave a message after the tone" announcement. - Default: `false` - `inbound.call_policy.end_call.on_ai_assistant` (boolean) - End the call when the call is answered by an AI assistant, a voice secretary, or another automated answering system. - Default: `false` - `create_ts` (integer) - The time the number was added, as a Unix timestamp in seconds. ### 400 The request is invalid. Check `reason` and `detail` in the response body. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `ResourceConflict`: Another project in your account already routes this number's inbound calls to an agent. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 412 The `If-Match` value doesn't match the current version of the resource. The reason is `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). # Update a secret set (/en/api-reference/api-ref/conversational-ai/platform/update-secret-set) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Adds, changes, or removes several keys in a secret set in one change. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: update-secret-set - Method: PATCH - Path: /v1/projects/{appid}/secrets/{name} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/secrets/{name} ## Servers - https://preview.ai.agora.io/conversational-ai Use this endpoint to rotate keys that must change together. Pass a string to add or replace a key, or `null` to remove it. Keys you omit don't change. To change one key, [set the key](/en/api-reference/api-ref/conversational-ai/platform/set-secret-key) instead. To replace the whole set, use [Replace a secret set](/en/api-reference/api-ref/conversational-ai/platform/replace-secret-set). Running sessions keep the values they resolved when they started. New sessions use the new values. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `name` (path, required, string) - The name of the secret set. - `If-Match` (header, optional, string) - The `ETag` value from the most recent response for this resource. When you include it, the request fails with `412` and reason `PreconditionFailed` if the resource has changed since then. Use it to avoid overwriting a concurrent change. ## Request body - `secrets` (object, required) - The keys to change. A string value adds the key, or replaces its value if the key exists. A `null` value removes the key. Keys you omit don't change. ### Request body example ```json { "secrets": { "llm": "", "tts": "", "asr": null } } ``` ## Responses ### 200 The secret set was updated. The response body lists its keys. - `name` (string, required) - The name of the secret set. - `keys` (array, required) - The names of the keys in the set. Values are never returned. - `keys.items` (string) - `create_ts` (integer, required) - The time the set was created, as a Unix timestamp in seconds. - `update_ts` (integer, required) - The time the set was last updated, as a Unix timestamp in seconds. ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `SecretSetInUse`: An agent references a key you're removing. `SecretSetEmpty`: The change would remove every key from the set. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 412 The `If-Match` value doesn't match the current version of the resource. The reason is `PreconditionFailed`. Retrieve the resource, apply your change again, and retry with the new `ETag`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). # Update a session (/en/api-reference/api-ref/conversational-ai/platform/update-session) > Documentation: Conversational AI API. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v2.txt). Changes the RTC token or the model context of a running session. - OpenAPI: /openapi/conversational-ai/rest-api-platform.en.yaml - Operation ID: update-session - Method: PATCH - Path: /v1/projects/{appid}/sessions/{agent_session_id} - Endpoint: https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/sessions/{agent_session_id} ## Servers - https://preview.ai.agora.io/conversational-ai Use this endpoint to renew the agent's RTC token, or to replace the conversation messages or LLM parameters of a running session. Each field you pass replaces its current value as a whole, so include every LLM parameter that must stay. `messages` also replaces the agent's `instructions`, so pass the instructions as the first `system` message to keep them. You can't change other session or transport fields after the session starts. Support for runtime changes depends on the provider. If the provider can't apply a change, the request fails with `NotImplemented` and the session doesn't change. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of your project. - `agent_session_id` (path, required, string) - The ID of the session, returned in `agent_session_id` when you start the session. ## Request body - `transport` (object) - Changes to the transport. Only the RTC token can change. - `transport.token` (string, required) - A new RTC token for the agent. Applies only to sessions that started with a token. - Min length: `1` - `agent` (object) - Changes to the running agent. - `agent.overrides` (object) - Values that replace the running agent's current values. - `agent.overrides.messages` (array) - Messages that start the conversation history. They follow `instructions`. - `agent.overrides.messages.items` (object) - `agent.overrides.messages.items.role` (string, required) - The author of the message: - `system`: An instruction to the model. - `user`: A message from the user. - `assistant`: A message from the agent. - Allowed: `system` | `user` | `assistant` - `agent.overrides.messages.items.content` (string, required) - The text of the message. - `agent.overrides.pipeline` (object) - Runtime model parameters. - `agent.overrides.pipeline.llm` (object) - `agent.overrides.pipeline.llm.params` (object) - Provider-specific LLM parameters. They replace the current `params` object as a whole, so include every parameter that must stay. ### Request body example ```json { "transport": { "token": "" }, "agent": { "overrides": { "messages": [ { "role": "system", "content": "You are helping the customer with a billing question." } ], "pipeline": { "llm": { "params": { "temperature": 0.2 } } } } } } ``` ## Responses ### 200 The session was updated. - `agent_session_id` (string, required) - The ID of the session. - `create_ts` (integer, required) - The time the session was created, as a Unix timestamp in seconds. - `status` (string, required) - The status of the session: - `IDLE`: The session is idle. - `STARTING`: The session is starting. - `RUNNING`: The session is running. - `STOPPING`: The session is stopping. - `STOPPED`: The session has ended. - `FAILED`: The session failed. - Allowed: `IDLE` | `STARTING` | `RUNNING` | `STOPPING` | `STOPPED` | `FAILED` ### 400 The update was rejected and the session didn't change. For example, `InvalidModuleParameter` when a parameter is invalid for the provider, or `NotImplemented` when the provider doesn't support this runtime change. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 401 Authentication is missing or invalid. The reason is `InvalidPermission`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 404 The resource in the path doesn't exist. The reason is `ResourceNotFound`. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### 409 `TaskNotRunning`: The session has ended or isn't running yet. `TaskConflict`: Another operation on the session is in progress. - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ### default The request failed. The response body contains the `reason` and `detail` of the failure. For possible reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). - `detail` (string, required) - A human-readable description of the error. It names the field or resource involved, when there is one. Don't parse it; branch on `reason` instead. - `reason` (string, required) - A machine-readable error reason, such as `InvalidFieldValue` or `ResourceNotFound`. For all reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Response examples ### 200 ```json { "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h", "create_ts": 1737111452, "status": "RUNNING" } ```