Create Agent
Create a new AI voice agent on the v1 API.
When to use this
Use this endpoint to create agents programmatically as part of an onboarding flow, template system, or multi-tenant setup. The request is scoped to the authenticated organization automatically.Before you begin
Fetch alanguage_id from List Languages and a voice_id from List Voices. Creating an agent does not publish its first version.
Minimal request
Start with the four required fields. Add advanced speech, model, fallback, analysis, routing, and function settings only when the basic agent works:Fallback STT, Boosted Keywords, And Post-Call Analysis
Usefallback_stt_enabled and stt_fallback_transcriber_id to configure fallback transcription on the first draft version. Pick the fallback transcriber ID from List Fallback Transcribers. The fallback transcriber ID must differ from transcriber_id.
Use boosted_keywords when a cascaded agent uses Deepgram or Soniox and important names or product terms are being misheard. Send a comma-separated string. Each term can contain letters, numbers, and spaces only, with up to 100 normalized terms, 50 characters per term, and 2,000 total characters.
If you need post-call fields at creation time, pass post_call_analysis. To change the LLM used for extracting those fields after creation, use Update Agent with post_call_analysis_llm_id.
Phone Numbers, Predictive Preprocessing, And Prompt Caching
You can includeinbound_phone_number_id and outbound_phone_number_id when creating the first draft version. The IDs must belong to the authenticated workspace. Creating the agent stores those IDs on the draft, but live dispatch routing is claimed only when the version is published through Update Agent with is_published: true.
Use predictive_preprocessing_enabled to turn on predictive preprocessing for the first draft version when your agent should pre-generate likely next replies between turns. This setting is most useful for cascaded agents with repeated, predictable scripts.
Use prompt_caching_enabled only when DialNexa has enabled Prompt Caching for your workspace. If the feature is not enabled, the API returns 403 Forbidden.
Validation Rules
The create request validates several fields before the draft is created.Verify the result
Store the returnedid, confirm current_version.version_number is 1, then publish the draft with version_number: 1 and is_published: true before placing a call.
If the create request times out, list agents and search for the title before retrying. The contract does not currently publish an idempotency key.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Title of the agent (max 70 characters)
70"Customer Support Agent"
ID of the language the agent speaks
"1"
ID of the voice used by the agent
"VOICE123456789"
Main instructions for the agent. Supports Handlebars template syntax such as {{variable}} for dynamic content. Must be valid Handlebars template text.
"Hello, how can I assist you today?"
Indicates whether voicemail detection is enabled
true
Hang up immediately when voicemail is detected instead of leaving a message
false
Message spoken when voicemail is detected and hangup_on_voicemail is false. Supports Handlebars template syntax such as {{variable}} and must be valid Handlebars template text.
"Hi, please call us back at your convenience."
Whether the agent listens for keypad (DTMF) input from the caller
true
Seconds to wait for keypad input before timing out (0-15)
0 <= x <= 155
Single character key that ends the call (digits, * or #)
"#"
Maximum number of DTMF digits to collect from the caller (1-50)
1 <= x <= 501
Seconds of silence after which the call is automatically ended. Accepted range: 15 to 30 seconds. Must be more than 5 seconds above reminder_message_interval when reminders are configured.
15 <= x <= 3020
Maximum call duration in seconds before the call is forcibly ended. Accepted range: 60 to 5400 seconds for cascaded agents. Speech to Speech agents are capped at 3600 seconds.
60 <= x <= 5400600
Seconds of silence inserted before the agent starts speaking
x >= 00
How long to let the phone ring before treating the call as unanswered (seconds)
x >= 130
Background sound file or identifier
Volume of background sound (0 to 2)
0 <= x <= 2Enable or disable ambient noise playback on the call
Responsiveness level from 0 to 1.
0 <= x <= 1Interruption sensitivity level (0 to 1)
0 <= x <= 1How eagerly the agent responds (0 to 1). Only applied when transcriber is Soniox.
0 <= x <= 1Enable or disable backchanneling
Backchannel frequency from (0 to 1)
0 <= x <= 1Mode for transcription
optimize_for_speed, optimize_for_accuracy Mode for denoising audio input
remove_noise, remove_noise_and_speech Enable or disable speech normalization
Enable or disable transcript formatting
Comma-separated list of backchannel keywords
Comma-separated recognition hints for supported Deepgram and Soniox transcribers. Terms can contain letters, numbers, and spaces only. The normalized list supports up to 100 terms, 50 characters per term, and 2000 total characters.
2000"DialNexa, Nexa Prime, customer success"
Interval between reminder messages (in seconds)
Frequency of reminder messages
ID of the transcriber catalog entry
Enable parallel fallback STT for this agent
Fallback STT transcriber catalog entry. Required when fallback_stt_enabled is true and must differ from transcriber_id.
Milliseconds to wait for primary STT after fallback finalizes first
x >= 0Enable TTS audio caching for this agent
ID of the folder this agent belongs to
"fld_abc123xyz789"
Type of the agent
Single_Prompt_Agent, Conversational_Flow_Agent "Single_Prompt_Agent"
Pipeline subtype for Single_Prompt_Agent. Cascaded = ASR→LLM→TTS pipeline. Speech_To_Speech = direct speech model. Null for Conversational_Flow_Agent.
Cascaded, Speech_To_Speech "Cascaded"
Version title (optional, will be auto-generated if not provided, max 35 characters)
35null
Description of the agent
"This agent handles customer support inquiries"
Timezone for the agent
"Asia/Kolkata"
ID of the outbound phone number to use for this agent. Must be an existing phone number ID in your organization. Stored on the draft at creation; live outbound routing is claimed when the version is published.
ID of the inbound phone number to use for this agent. Must be an existing phone number ID in your organization. Stored on the draft at creation; live inbound routing is claimed when the version is published.
ID of the LLM associated with the agent
"A1B2C3D4E5F6G7"
ID of the webhook associated with the agent
"wh_12345678901234"
Static system instructions for the agent. Use prompt_text for dynamic content via {{variable}} syntax.
"You are a helpful customer support agent named Sarah."
Node positions for Conversational_Flow_Agent type (stored as JSON string)
"{\"node1\": {\"x\": 100, \"y\": 200}}"
Who starts the conversation
user, agent_dynamic, agent_defined "user"
Opening message spoken by the agent at the start of the call. Supports Handlebars template syntax such as {{variable}} and must be valid Handlebars template text.
"Welcome to our service!"
Whether the agent allows interruptions
true
Instructions for JSON output
IDs of the knowledge bases attached to this agent version
Maximum number of RAG chunks to fetch (1-10)
1 <= x <= 105
Minimum similarity score threshold for RAG results (0-1)
0 <= x <= 10.5
Default values for dynamic variables used in Handlebars templates. For call-transfer flows, agent_transfer_destinations accepts up to 7 pipe-separated phone numbers. Each number must use US +1 or India +91 and exactly 10 digits after the country code.
Speech synthesis model for the selected voice. The model must belong to the same provider as voice_id. Omit this field when you want DialNexa to apply the recommended model. For ElevenLabs voices, use eleven_flash_v2_5 where supported. To find supported models for one voice, call GET /v1/voices/{voice_id}/voice-models.
"voice_model_abc123"
Voice speed (0.25 to 4.0)
0.25 <= x <= 41
Voice temperature (0.0 to 2.0)
0 <= x <= 21
Voice volume (0 to 10)
0 <= x <= 101
Pitch adjustment of the voice (-1 to 1)
-1 <= x <= 10
LLM temperature (0.0 to 2.0)
0 <= x <= 20.1
Opt out of sensitive data storage
false
Opt in to secure URLs
false
Enable fallback LLM for this agent
false
Enable predictive preprocessing for this agent version
false
Milliseconds to wait before triggering the fallback LLM
500
ID (llms.id) of the LLM to use as fallback
"abc123xyz789ab"
Fallback voices for TTS. Used when the primary voice is unavailable.
Functions the agent can invoke during a call (e.g. end call, transfer, booking). Passed at create time; use PATCH to replace later.
Fields to extract from the call transcript after the call ends.
Alias for post_call_analysis (backward compatibility).
Agent identity (required for Conversational_Flow_Agent type on update)
"You are a helpful customer support agent named Sarah."
Agent background (required for Conversational_Flow_Agent type on update)
"You have 5 years of experience in customer support and specialize in helping customers with technical issues."
Enable OpenAI Prompt Caching for this agent version. DialNexa must enable this feature for your workspace.
false
Response
Agent created successfully.
Signed agent ID
"agent_2g7Xy3tY53gRlp"
Single_Prompt_Agent, Conversational_Flow_Agent Cascaded, Speech_To_Speech