Skip to main content
POST

Overview

Create an AI agent for the user who owns the API key. Once it has an agent, a phone number can use it for campaigns and inbound calls. This endpoint creates single_prompt, static_voice_blaster and dynamic_voice_blaster agents. Multi-stage agents can’t be created here. Advanced settings such as tools, call analysis metrics and call settings are easiest to configure in the dashboard after the agent is created.

Prerequisites

  • An API key for your workspace

Request

string
required
Your workspace API key. Create one from the profile menu in the dashboard → API Keys.
string
required
Name of the agent.
string
required
Male or Female. Used for the agent’s voice and, in some languages, its verb forms.
string
required
  • single_prompt – a conversational agent driven by systemMessage
  • static_voice_blaster – a voice blaster whose startMessage is the same for every contact; it can’t contain variables
  • dynamic_voice_blaster – a voice blaster whose startMessage can contain variables
string
required
The agent’s instructions (prompt). Write variables as {variable_name}; they are filled from each contact’s fields. [condition] and [variations] blocks are checked for valid syntax.
string
First thing the agent says when the call connects. Can contain {variable_name} variables, except for static_voice_blaster.
string
ID of the voice the agent speaks with, from GET /api/voices.
array[string]
default:"[\"en-IN\"]"
Language codes the agent speaks, for example ["en-IN", "hi-IN"].
array[string]
IDs of knowledge bases the agent can answer from. See Get Knowledge Bases.
string
Short description of the agent.
array[string]
Tags for organizing agents.
string
default:"voice"
voice or chat. A chat agent has no voice and must be single_prompt.

Response

string
required
Agent created successfully.
array
required
Always empty: the response doesn’t include the new agent or its ID. Find the agent with Get Agents (newest first, or search by name).

Error Handling

Errors return status: false, with the reason in errorMessage.
  • 400 Bad Request
    • A required field is missing, or gender or conversationType isn’t one of the allowed values.
    • Multi-stage agents must be created via /api/msp-agents.
    • Invalid system message syntax — … – a [condition] or [variations] block in systemMessage is malformed.
    • Start message cannot contain variables for static_voice_blaster conversation type.
    • A chat agent must be a single prompt or multi-stage agent.
  • 401 Unauthorized – Missing or invalid API key.
  • 500 Internal Server Error – Unexpected server error.
The variables used in systemMessage and startMessage become the agent’s variables. When you add contacts to a campaign, include a field with the same name for each one.