POST /create-chat-agent

Changed on

Create a new chat agent

Request

  • Base URL
    https://api.retellai.com
  • Auth
    HTTP bearer

Request body

agent_namestring nullable

The name of the chat agent. Only used for your own reference.

version_titlestring nullable

Optional title of the chat agent version. Used for your own reference.

auto_close_messagestring nullable

Message to display when the chat is automatically closed.

end_chat_after_silence_msinteger nullable

If users stay silent for a period after agent speech, end the chat. The minimum value allowed is 120,000 ms (2 minutes). The maximum value allowed is 259,200,000 ms (72 hours). By default, this is set to 3,600,000 (1 hour).

webhook_urlstring nullable

The webhook for agent to listen to chat events. See what events it would get at webhook doc. If set, will binds webhook events for this agent to the specified url, and will ignore the account level webhook for this agent. Set to null to remove webhook url from this agent.

webhook_eventsstring[] nullable

Which webhook events this agent should receive. If not set, defaults to chat_started, chat_ended, chat_analyzed.

webhook_timeout_msinteger

The timeout for the webhook in milliseconds. If not set, default value of 10000 will apply.

data_storage_setting'everything' | 'everything_except_pii' | 'basic_attributes_only' nullable

Controls what data is stored for this agent. "everything" stores all data including transcripts and recordings. "everything_except_pii" stores data but excludes PII when possible based on PII configuration. "basic_attributes_only" stores only basic metadata. If not set, defaults to "everything".

data_storage_retention_daysinteger nullable

Number of days to retain call/chat data before automatic deletion. Must be between 1 and 730 days. If not set, data is retained forever (no automatic deletion).

opt_in_signed_urlboolean

Whether this agent opts in to signed url for public log. If not set, default value of false will apply.

signed_url_expiration_msinteger nullable

The expiration time for the signed url in milliseconds. Only applicable when opt_in_signed_url is true. If not set, default value of 86400000 (24 hours) will apply.

post_chat_analysis_model'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-5' | 'gpt-5-mini' | 'gpt-5-nano' | 'gpt-5.1' | 'gpt-5.2' | 'gpt-5.4' | 'gpt-5.4-mini' | 'gpt-5.4-nano' | 'gpt-5.5' | 'gpt-5.6-terra' | 'gpt-5.6-luna' | 'gpt-6-astra' | 'gpt-6-sol' | 'gpt-6.1-sol' | 'gpt-6.1-terra' | 'gpt-6-luna' | 'claude-4.6-sonnet' | 'claude-5-opus' | 'claude-5.5-opus' | 'claude-5-sonnet' | 'claude-5.5-sonnet' | 'claude-5.5-haiku' | 'claude-4.5-haiku' | 'gemini-3.0-flash' | 'gemini-3.1-flash-lite' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-3.8-flash' | 'gemini-4-argon' | 'null' nullable

Available LLM models for agents.

timezonestring nullable

IANA timezone for the agent (e.g. America/New_York). Defaults to America/Los_Angeles if not set.

Example request

{
  "agent_name": "Jarvis",
  "version_title": "Production hotfix",
  "auto_close_message": "Thank you for chatting. The conversation has ended.",
  "end_chat_after_silence_ms": 3600000,
  "language": "en-US",
  "webhook_url": "https://webhook-url-here",
  "webhook_timeout_ms": 10000,
  "data_storage_setting": "everything",
  "data_storage_retention_days": 30,
  "opt_in_signed_url": true,
  "signed_url_expiration_ms": 86400000,
  "post_chat_analysis_data": [
    {
      "type": "string",
      "name": "customer_name",
      "description": "The name of the customer.",
      "examples": [
        "John Doe",
        "Jane Smith"
      ]
    }
  ],
  "timezone": "America/New_York",
  "pre_session_tools": [
    {
      "response_variables": {
        "contact_first_name": "data.first_name"
      },
      "output_selection": {
        "fields": [
          "id",
          "properties.email"
        ]
      }
    }
  ],
  "post_session_tools": [
    {
      "response_variables": {
        "contact_first_name": "data.first_name"
      },
      "output_selection": {
        "fields": [
          "id",
          "properties.email"
        ]
      }
    }
  ]
}

Response

Successfully created a new chat agent.

agent_idstring required

Unique id of chat agent.

versioninteger

The version of the chat agent.

base_versioninteger nullable

Version that this draft was based on. Null for initial versions.

assigned_tagsstring[]

Tags assigned to this chat agent version. Preferred tag is listed first.

is_publishedboolean

Whether the chat agent is published.

agent_namestring nullable

The name of the chat agent. Only used for your own reference.

version_titlestring nullable

Optional title of the chat agent version. Used for your own reference.

auto_close_messagestring nullable

Message to display when the chat is automatically closed.

end_chat_after_silence_msinteger nullable

If users stay silent for a period after agent speech, end the chat. The minimum value allowed is 120,000 ms (2 minutes). The maximum value allowed is 259,200,000 ms (72 hours). By default, this is set to 3,600,000 (1 hour).

webhook_urlstring nullable

The webhook for agent to listen to chat events. See what events it would get at webhook doc. If set, will binds webhook events for this agent to the specified url, and will ignore the account level webhook for this agent. Set to null to remove webhook url from this agent.

webhook_eventsstring[] nullable

Which webhook events this agent should receive. If not set, defaults to chat_started, chat_ended, chat_analyzed.

webhook_timeout_msinteger

The timeout for the webhook in milliseconds. If not set, default value of 10000 will apply.

data_storage_setting'everything' | 'everything_except_pii' | 'basic_attributes_only' nullable

Controls what data is stored for this agent. "everything" stores all data including transcripts and recordings. "everything_except_pii" stores data but excludes PII when possible based on PII configuration. "basic_attributes_only" stores only basic metadata. If not set, defaults to "everything".

data_storage_retention_daysinteger nullable

Number of days to retain call/chat data before automatic deletion. Must be between 1 and 730 days. If not set, data is retained forever (no automatic deletion).

opt_in_signed_urlboolean

Whether this agent opts in to signed url for public log. If not set, default value of false will apply.

signed_url_expiration_msinteger nullable

The expiration time for the signed url in milliseconds. Only applicable when opt_in_signed_url is true. If not set, default value of 86400000 (24 hours) will apply.

post_chat_analysis_model'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-5' | 'gpt-5-mini' | 'gpt-5-nano' | 'gpt-5.1' | 'gpt-5.2' | 'gpt-5.4' | 'gpt-5.4-mini' | 'gpt-5.4-nano' | 'gpt-5.5' | 'gpt-5.6-terra' | 'gpt-5.6-luna' | 'gpt-6-astra' | 'gpt-6-sol' | 'gpt-6.1-sol' | 'gpt-6.1-terra' | 'gpt-6-luna' | 'claude-4.6-sonnet' | 'claude-5-opus' | 'claude-5.5-opus' | 'claude-5-sonnet' | 'claude-5.5-sonnet' | 'claude-5.5-haiku' | 'claude-4.5-haiku' | 'gemini-3.0-flash' | 'gemini-3.1-flash-lite' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-3.8-flash' | 'gemini-4-argon' | 'null' nullable

Available LLM models for agents.

timezonestring nullable

IANA timezone for the agent (e.g. America/New_York). Defaults to America/Los_Angeles if not set.

last_modification_timestampinteger required

Last modification timestamp (milliseconds since epoch). Either the time of last update or creation if no updates available.

Example response

{
  "agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
  "base_version": 12,
  "agent_name": "Jarvis",
  "version_title": "Production hotfix",
  "auto_close_message": "Thank you for chatting. The conversation has ended.",
  "end_chat_after_silence_ms": 3600000,
  "language": "en-US",
  "webhook_url": "https://webhook-url-here",
  "webhook_timeout_ms": 10000,
  "data_storage_setting": "everything",
  "data_storage_retention_days": 30,
  "opt_in_signed_url": true,
  "signed_url_expiration_ms": 86400000,
  "post_chat_analysis_data": [
    {
      "type": "string",
      "name": "customer_name",
      "description": "The name of the customer.",
      "examples": [
        "John Doe",
        "Jane Smith"
      ]
    }
  ],
  "timezone": "America/New_York",
  "pre_session_tools": [
    {
      "response_variables": {
        "contact_first_name": "data.first_name"
      },
      "output_selection": {
        "fields": [
          "id",
          "properties.email"
        ]
      }
    }
  ],
  "post_session_tools": [
    {
      "response_variables": {
        "contact_first_name": "data.first_name"
      },
      "output_selection": {
        "fields": [
          "id",
          "properties.email"
        ]
      }
    }
  ],
  "last_modification_timestamp": 1703413636133
}

Changes

    • warning

      added the new gpt-6.1-terra enum value to the //// response property for the response status

    • info

      added the new gpt-6.1-terra enum value to the request property ////

    • info

      added the new optional request property ///////////

    • info

      added the new optional request property ///////////

    • info

      added the new optional request property ///////////

    • info

      added the new optional request property ///////////

    • info

      added the new optional request property ///////////

    • info

      added the new optional request property ///////////

    • info

      added the optional property /////////// to the response with the status

    • info

      added the optional property /////////// to the response with the status

    • info

      added the optional property /////////// to the response with the status

    • info

      added the optional property /////////// to the response with the status

    • info

      added the optional property /////////// to the response with the status

    • info

      added the optional property /////////// to the response with the status