Skip to navigation

Create agent

View as Markdown

Creates a new agent. Required: name only. Optional: instructions, output_fields, output_instructions, language, voice, tools, interruption, call messages, DIDs, webhook, and call transfer. Returns full agent details.

Authentication

X-API-Keystring

API key for authentication. Example: raya_ABCD1234567890abcdef

Request

This endpoint expects an object.
namestringRequired

Agent name (required)

instructionsstringOptional
Instructions that define agent behavior
output_fieldslist of objectsOptional

Array of key-description pairs. Each item has key and description only (no extra properties).

output_instructionsstringOptional

Instructions for how to populate output_fields after a call.

webhook_urlstring or nullOptionalformat: "uri"
Webhook URL. Must be HTTPS or null.
required_silence_after_speechdouble or nullOptional>=0.2Defaults to 0.4

Required silence after speech in seconds. Optional; defaults to 0.4 if omitted.

allowed_silence_before_nudgeinteger or nullOptional>=0Defaults to 20

Allowed silence before nudge in seconds. Optional; defaults to 20 if omitted.

allowed_speech_before_nudgeinteger or nullOptional>=0Defaults to 30

Allowed speech before nudge in seconds. Optional; defaults to 30 if omitted.

out_diddouble or nullOptional
Outbound DID. If omitted, first DID from customer is used.
allow_call_transferbooleanOptional

When true, transfer_destination_phone is required (10-digit India mobile). Defaults to false unless a transfer phone is provided.

transfer_destination_phonestring or nullOptionalformat: "^[0-9]{10}$"
India mobile, 10 digits, no country code. Null or omit if not using transfer.
language_idstringOptionalformat: "uuid"

Call language UUID. Use Auto detect (88296485-1c49-4931-919e-7333986e16da) for an agent that speaks several languages. See Language options.

voice_idstringOptionalformat: "uuid"

Voice UUID. See /documentation/agent-voice-options.

languageslist of stringsOptional

Languages the agent speaks, as ISO 639-1 codes (hi, en, mr, te, kn, bn, as, gu, ml, ne, ta, pa). The first is the starting language. Two or more need language_id set to Auto detect (88296485-1c49-4931-919e-7333986e16da) and a multilingual voice_id that speaks all of them; otherwise the request gets a 400. More than 4 is allowed, but the response then has a note in messages: detection gets less reliable as the list grows (we recommend 3 or fewer). See Language options.

stt_language_modeenumOptional

How the caller’s language is detected. auto: detect every turn. lock: lock to the first detected language, code-mix on (the caller can still mix in other languages). handoff: lock to the detected language, code-mix off. On the portal: Detect every turn / Lock to detected language (code-mix on or off).

Allowed values:
default_voice_idstring or nullOptionalformat: "uuid"

Starting voice when voice_id is a composite voice (a mix of one voice per language that our team prepares on request): one of that composite’s member voices. null clears it. Any other voice gets a 400.

toolsobjectOptional

Function tools: { llm_tools: […] }. Each tool needs type function, function (name, description, parameters), and api_details (method, url). See documentation/agents-llm-tools.

allow_interruptionbooleanOptional
Whether the user may interrupt the agent while speaking.
min_user_speech_to_interruptdoubleOptional>=0

Minimum user speech (seconds) before interruption is allowed.

max_call_duration_minsdoubleOptional>=0
Maximum call duration in minutes.
say_hellobooleanOptional
Whether the agent says hello at call start.
voicemail_msgstringOptional
Voicemail message. Send empty string to clear.
call_duration_exceed_messagestringOptional
Message when max call duration is reached. Send empty string to clear.
in_diddoubleOptional
Inbound DID. Must be assigned to your account.

Response

Agent created successfully
uuidstringOptionalformat: "uuid"
Unique identifier of the agent
namestringOptional
Name of the agent
instructionsstringOptional
Agent instructions
output_instructionsstringOptional

Instructions for how to populate output_fields after a call.

output_fieldslist of objectsOptional

Array of key-description pairs. Each item has key and description only (no extra properties).

agent_argsmap from strings to anyOptional

Agent arguments as a JSON object (e.g. {“contact_name”: “John”, “order_id”: “123”}). Not an array.

required_silence_after_speechdouble or nullOptional
Required silence after speech in seconds
allowed_silence_before_nudgedouble or nullOptional
Allowed silence before nudge in seconds
allowed_speech_before_nudgedouble or nullOptional
Allowed speech before nudge in seconds
out_diddouble or nullOptional
Outbound DID number
in_diddouble or nullOptional

Inbound DID number (read-only; for reference)

webhook_urlstring or nullOptional

Webhook URL for callbacks (sent on call completed or call failure). See Webhooks for payload format.

allow_call_transferbooleanOptional

When true, the voice agent may use live call transfer to a human (India only). Default true.

transfer_destination_phonestring or nullOptionalformat: "^[0-9]{10}$"
India mobile, 10 digits, no country code. Null or omit if not using transfer.
language_idstring or nullOptionalformat: "uuid"

Call language UUID. See /documentation/agent-language-options.

voice_idstring or nullOptionalformat: "uuid"

Voice UUID. See /documentation/agent-voice-options.

languageslist of stringsOptional

Languages the agent speaks (ISO 639-1); the first is the starting language. Empty for a single-language agent.

stt_language_modeenumOptional

How the caller’s language is detected: auto (every turn), lock (first detected language, code-mix on) or handoff (lock, code-mix off).

Allowed values:
default_voice_idstring or nullOptionalformat: "uuid"

Starting voice of a composite voice_id, or null.

toolsobjectOptional

Function tools ({ "llm_tools": [...] }). Empty array when none configured.

allow_interruptionbooleanOptional
Whether the user may interrupt the agent while speaking.
min_user_speech_to_interruptdouble or nullOptional>=0

Minimum user speech duration (seconds) before interruption is allowed.

max_call_duration_minsdouble or nullOptional>=0
Maximum call duration in minutes.
say_hellobooleanOptional
Whether the agent says hello at call start.
voicemail_msgstring or nullOptional
Message played when voicemail is detected.
call_duration_exceed_messagestring or nullOptional
Message played when the maximum call duration is reached.
messageslist of stringsOptional

Notes about the request, present only when there are any: an inbound number moved from another agent, or more than 4 languages. The change itself was applied.

Errors

400
Bad Request Error
401
Unauthorized Error
500
Internal Server Error