Skip to main content
POST
Create agent

Authorizations

Authorization
string
header
required

Your workspace secret key, sk_live_ followed by 32 hex characters. Create one in the console under Developers.

Headers

Idempotency-Key
string

Up to 255 characters. The same key within 24 hours replays the first answer and creates nothing new. Build it from your own record, such as order-8842-reminder-1.

Maximum string length: 255

Body

application/json
first_message
string
required
Maximum string length: 500
language
string
required
Minimum string length: 1
name
string
required
Minimum string length: 1
system_prompt
string
required
Maximum string length: 48000
analysis
null | object

Replace the whole analysis block. Omit output_schema to remove structured extraction. Requires enabled=true to run.

archived
boolean
default:false

Archive to block new calls; false restores availability subject to draft validation. Accepted call snapshots remain unchanged.

background_sound
Available options:
off,
office
behavior
null | object

How the agent takes turns with the caller, whether it knows the date, and what it does when the caller goes quiet. Unlike other nested blocks, PATCH merges it field by field: omitted fields keep their current value and {} changes nothing; a sent pass_through replaces the whole list. null resets it to the defaults (interruptions normal, adaptive_interruptions true, pass_through [], date_awareness true, silence_wait_secs 10, silence_check_ins 1, silence_mode check_in, silence_hang_up true, silence_timeout_secs 30).

booking
null | object

The agent's booking window: which days, and at what hours, a caller may book. With date awareness on, every day a caller names is marked as bookable or not before the agent replies (after the window, a closed weekday or date, already past, or today after closing time) with that day's opening hours, the agent is told the window in its prompt and offered the nearest bookable day, so it never confirms a day you cannot take. Absent when not set. A PATCH replaces the whole block (omitted fields take their defaults); null removes it.

calls_from
null | object

The phone number this agent's outbound calls ring from when the call, or its campaign, does not choose one. Resolution is fixed: the call's (or campaign's) phone_number_id or pool_id, else this, else the workspace's default pool, else the workspace's own number, else the Mirai shared line (only for a workspace with no number that can place calls). A number set here dials through its own provider connection (India destinations only) and is re-checked before every call: if it can no longer call, calls fail with 409 not_ready and campaigns pause, never falling back to the shared line. null unsets it. Kept across a rollback.

draft
boolean
default:false

Drafts may have empty prompt or greeting, but cannot run calls.

emit_processed_webhook
boolean
default:true

Send call.processed when this agent has post-call tools, analysis or a flow (a flow agent's event carries the call's flow outcome). Set false to turn the event off.

emit_queued_webhook
boolean
default:false
end_call
object
features
object

Per-agent switches for platform behaviour still being tuned, by name. Each reaches the worker as a call variable of the same name, under the call's own variables: a variable the call supplies wins for that call. A switch the agent does not name keeps the platform's setting. Optional; {} or null clears every switch, and a PATCH replaces the whole object.

flow
null | object

Optional node graph; makes this a flow agent. PATCH replaces the whole graph; null removes it.

handoff
null | object

Live human takeover settings: number is the phone a person dials in from to take one of this agent's calls over (used when a takeover request names no connect.to). A PATCH replaces the block; null removes it.

inbound_pre_call_timeout_ms
integer | null

How long an incoming phone call waits for this agent's pre-call tools before it is answered, in milliseconds (1000-10000). The caller hears ringing meanwhile; the call is answered as soon as the tools finish. When the wait runs out, the tool still running is a timeout and its on_failure decides: continue answers without its values, abort leaves the call unanswered (not charged). Each tool still stops at its own timeout_ms. Unset (or null) is the default of about 2000. Applies to calls to your phone numbers (Plivo, SIP trunk, managed numbers) only; outbound calls are unaffected and WhatsApp calls keep about 2 seconds.

Required range: 1000 <= x <= 10000
input_schema
object | null

Replace the entire input declaration. Null removes it and restores legacy string variables.

keyterms
string[]

Words speech recognition listens for on this agent's calls: brand, product, place and people names it might otherwise mishear. Optional, at most 100. Each term is trimmed, its inner spaces collapsed to one and Unicode NFC normalised; it must then be 1-50 characters and at most 5 words, in any script, with no comma, new line, tab or other control character (anything else is 400 invalid_request naming keyterms and the term). Repeats are dropped ignoring case, keeping the first spelling.

Maximum array length: 100
Required string length: 1 - 50
knowledge
object | null

Attach knowledge bases. null removes the block.

max_duration_secs
integer
default:300
Required range: 30 <= x <= 1800
secondary_languages
enum<string>[]

Other languages callers may speak. Speech recognition listens for them as well as the primary language. Optional; the primary language is never repeated here. Entries are reduced to their base code (gu-IN is saved as gu; or is accepted for od), duplicates and the primary language are dropped, and at most 4 remain.

Maximum array length: 4
Available options:
hi,
en,
gu,
mr,
bn,
ta,
te,
kn,
ml,
pa,
od
tools
object[]

At most 40 tools: 10 pre_call, 20 on_call, 10 post_call. A PATCH replaces the whole list; null empties it. To edit one tool, use PUT/DELETE /v2/agents/{id}/tools/{name}.

Maximum array length: 40
voice
object

When omitted on create, voice_id defaults to ankit. Supplied blocks must include voice_id: a built-in voice, or the id (cv_...) of one of your custom voices (GET /v2/custom-voices), which work on phone and web calls but not realtime sessions.

voicemail
object

Response

Created