Skip to Content
CallMitraDocs
API referenceAgents

Create an agent

Creates an agent from a `config` (see the AgentConfig schema). It starts as a `draft`; publish it with publishAgent, or send `status: published`. Values outside the documented range or list, and a language, voice or model that is not available, are refused with `parameter_invalid` naming the field (for example `config.voice`).

POST
/api/v1/agents/

Creates an agent from a config (see the AgentConfig schema). It starts as a draft; publish it with publishAgent, or send status: published. Values outside the documented range or list, and a language, voice or model that is not available, are refused with parameter_invalid naming the field (for example config.voice).

Authorization

headerX-API-Key<token>

Create in the console: Settings → API & webhooks.

Header Parameters

Idempotency-Key?string

Any unique string up to 255 characters. Retrying with the same key and body within 24 hours returns the first result instead of acting twice.

Lengthlength <= 255

Request Body

application/json
  1. body

A new agent. It starts as a draft unless status is published.

config?

Agent configuration.

name?Name

Display name; also the name the agent introduces itself with.

Lengthlength <= 255
Default""
sourceTemplateId?|

Template id this agent is based on.

sourceTemplateSlug?|

Template slug this agent is based on.

sourceTemplateVersion?|

Template version this agent is based on.

status?|

draft (default) or published.

Value in"draft""published"

Response Body

OK

application/json
  1. response

One agent.

agent*

An AI agent: its live configuration, draft, status and numbers.

success?Success

Always true on success.

Defaulttrue
[key: string]?any
Example Request
curl -X POST 'https://api.callmitra.ai/api/v1/agents/' \  -H 'Content-Type: application/json' \  -d '{  "config": {    "language": "hi-IN",    "llm_model": "gpt-4o-mini",    "stt": "sarvam",    "template_payload": {      "greeting_message": "Namaste, main Acme Realty se Priya bol rahi hoon.",      "system_prompt": "You are Priya from Acme Realty. Qualify the lead'\''s budget and preferred area."    },    "tts": "sarvam",    "voice": "priya"  },  "name": "Priya"}'
Example Response
{  "agent": {    "config": {      "language": "hi-IN",      "llm_model": "gpt-4o-mini",      "tts": "sarvam",      "voice": "priya"    },    "id": "3f0c2a9e-6a51-4c6e-9a3e-2d1b7c4e8f10",    "language": "hi-IN",    "name": "Priya",    "rosterState": "in_training",    "status": "draft",    "takingCalls": false,    "unpublishedChanges": false  },  "success": true}