curl --location 'https://api.weya.live/backend/api/agents' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"agent_name": "Sales Agent",
"gender": "Female",
"conversationType": "single_prompt",
"systemMessage": "You are a friendly sales assistant calling {customer_name} about their order.",
"startMessage": "Hello {customer_name}, this is Asha from Example Store.",
"selectedLanguage": ["en-IN"]
}'
{
"status": true,
"code": 201,
"message": "Agent created successfully",
"errorMessage": null,
"data": []
}
Agents
Create Agent
Create a single-prompt or voice blaster AI agent.
POST
/
api
/
agents
curl --location 'https://api.weya.live/backend/api/agents' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"agent_name": "Sales Agent",
"gender": "Female",
"conversationType": "single_prompt",
"systemMessage": "You are a friendly sales assistant calling {customer_name} about their order.",
"startMessage": "Hello {customer_name}, this is Asha from Example Store.",
"selectedLanguage": ["en-IN"]
}'
{
"status": true,
"code": 201,
"message": "Agent created successfully",
"errorMessage": null,
"data": []
}
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 createssingle_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
single_prompt– a conversational agent driven bysystemMessagestatic_voice_blaster– a voice blaster whosestartMessageis the same for every contact; it can’t contain variablesdynamic_voice_blaster– a voice blaster whosestartMessagecan contain variables
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.First thing the agent says when the call connects. Can contain
{variable_name} variables, except for static_voice_blaster.IDs of knowledge bases the agent can answer from. See Get Knowledge Bases.
curl --location 'https://api.weya.live/backend/api/agents' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"agent_name": "Sales Agent",
"gender": "Female",
"conversationType": "single_prompt",
"systemMessage": "You are a friendly sales assistant calling {customer_name} about their order.",
"startMessage": "Hello {customer_name}, this is Asha from Example Store.",
"selectedLanguage": ["en-IN"]
}'
Response
{
"status": true,
"code": 201,
"message": "Agent created successfully",
"errorMessage": null,
"data": []
}
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 returnstatus: false, with the reason in errorMessage.
- 400 Bad Request
- A required field is missing, or
genderorconversationTypeisn’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 insystemMessageis malformed.Start message cannot contain variables for static_voice_blaster conversation type.A chat agent must be a single prompt or multi-stage agent.
- A required field is missing, or
- 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.Was this page helpful?

