Skip to main content
POST
/
api
/
v1
/
agents
Create agent
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    name: '<string>',
    config: {
      primaryLanguage: '<string>',
      ttsConfig: {
        voiceId: '<string>',
        vendor: '<string>',
        model: null,
        speed: 1,
        speedAdjustment: {version: 'v1', strategy: 'OnRequest'},
        vendorSpecificOptions: {},
        responsiveness: null,
        pronunciationDictionary: {id: '<string>', hash: '<string>'}
      },
      llmConfig: {
        model: '<string>',
        vendor: '<string>',
        prompt: '<string>',
        apiKey: null,
        endpoint: null,
        options: {
          temperature: null,
          maxTokens: null,
          topP: null,
          frequencyPenalty: null,
          presencePenalty: null,
          stop: null,
          trailingPrompt: null,
          reasoningMode: null,
          maxRetries: null,
          reasoningEffort: null
        },
        vendorSpecificOptions: {},
        toolScopes: null
      },
      sttConfig: {version: 'v1', vendor: 'Auto', vendorSpecificOptions: {}},
      outboundSipConfig: {
        server: '<string>',
        authUser: '<string>',
        domain: null,
        password: null,
        fromUser: null,
        transport: 'udp',
        cpsLimit: null,
        cpsKey: null,
        displayName: null
      },
      resultWebhook: {
        url: '<string>',
        headers: {},
        customSettings: {httpMethod: 'GET', queryParams: {}, bodyFormat: {template: '<string>'}}
      },
      features: {
        version: 'v1',
        postCallAnalysis: [],
        talkFirst: {version: 'v1', delay: 1, isEnabled: false, interruptible: true},
        maxDuration: {
          version: 'v1',
          maxDurationSeconds: 3600,
          maxDurationInTransferSeconds: 7200,
          isEnabled: true
        },
        ivrDetection: {
          version: 'v1',
          isEnabled: true,
          enabledForChat: false,
          enabledForInbound: false,
          enabledForOutbound: true,
          enabledForWebCall: false,
          ivrNavigation: false
        },
        ambientNoise: {version: 'v1', isEnabled: false, ambientNoiseLevel: 0.1},
        languageSwitching: {version: 'v1', isEnabled: true},
        fillers: {version: 'v1', isEnabled: true, strategy: {type: 'static', texts: ['um']}},
        backchannel: {version: 'v1', isEnabled: false},
        silenceManagement: {
          version: 'v1',
          isEnabled: true,
          maxReminderAttempts: 2,
          reminderSilenceThresholdSeconds: 5,
          endWhenReminderLimitExceeded: true
        }
      },
      mcpConnections: [
        {
          name: '<string>',
          serverUrl: '<string>',
          authentication: {apiKey: '<string>', headerName: '<string>'},
          customHeaders: {},
          isEnabled: true,
          description: null,
          transport: 'SSE',
          blackListTools: null,
          whiteListTools: null
        }
      ],
      startWebhook: {
        webhook: {
          url: '<string>',
          headers: {},
          customSettings: {httpMethod: 'GET', queryParams: {}, bodyFormat: {template: '<string>'}}
        },
        fallbackResponse: {accept: false, reasonMessage: 'Webhook for started webhook failed'},
        isEnabledForInbound: false,
        isEnabledForOutbound: false,
        isEnabledForWidget: false,
        timeout: 10
      },
      tools: [
        {
          name: '<string>',
          schema: {},
          webhook: {
            url: '<string>',
            headers: {},
            customSettings: {httpMethod: 'GET', queryParams: {}, bodyFormat: {template: '<string>'}}
          },
          description: '<string>',
          fallBackResult: null,
          timeoutSeconds: null,
          retryCount: null
        }
      ],
      builtInTools: [{name: '<string>', additionalInstructions: null}]
    },
    isEnabled: true,
    description: null,
    additionalData: {},
    schedule: {
      timezone: 'UTC',
      mon: [{start: {hour: 0, minute: 0}, end: {hour: 23, minute: 59}}],
      tue: [{start: {hour: 0, minute: 0}, end: {hour: 23, minute: 59}}],
      wed: [{start: {hour: 0, minute: 0}, end: {hour: 23, minute: 59}}],
      thu: [{start: {hour: 0, minute: 0}, end: {hour: 23, minute: 59}}],
      fri: [{start: {hour: 0, minute: 0}, end: {hour: 23, minute: 59}}],
      sat: [{start: {hour: 0, minute: 0}, end: {hour: 23, minute: 59}}],
      sun: [{start: {hour: 0, minute: 0}, end: {hour: 23, minute: 59}}]
    },
    inboundSipConfig: {phoneNumber: null}
  })
};

fetch('https://blackbox.dasha.ai/api/v1/agents', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "name": "<string>",
  "config": {
    "primaryLanguage": "<string>",
    "ttsConfig": {
      "voiceId": "<string>",
      "vendor": "<string>",
      "version": "v1",
      "model": null,
      "speed": 1,
      "speedAdjustment": {
        "version": "v1",
        "strategy": "OnRequest"
      },
      "vendorSpecificOptions": {},
      "responsiveness": null,
      "pronunciationDictionary": {
        "id": "<string>",
        "hash": "<string>"
      }
    },
    "llmConfig": {
      "model": "<string>",
      "vendor": "<string>",
      "prompt": "<string>",
      "version": "v1",
      "apiKey": null,
      "endpoint": null,
      "options": {
        "temperature": null,
        "maxTokens": null,
        "topP": null,
        "frequencyPenalty": null,
        "presencePenalty": null,
        "stop": null,
        "trailingPrompt": null,
        "reasoningMode": null,
        "maxRetries": null,
        "reasoningEffort": null
      },
      "vendorSpecificOptions": {},
      "toolScopes": null
    },
    "version": "v1",
    "sttConfig": {
      "version": "v1",
      "vendor": "Auto",
      "vendorSpecificOptions": {}
    },
    "outboundSipConfig": {
      "server": "<string>",
      "authUser": "<string>",
      "type": "v1",
      "domain": null,
      "password": null,
      "fromUser": null,
      "transport": "udp",
      "cpsLimit": null,
      "cpsKey": null,
      "displayName": null
    },
    "resultWebhook": {
      "url": "<string>",
      "headers": {},
      "customSettings": {
        "httpMethod": "GET",
        "queryParams": {},
        "bodyFormat": {
          "type": "Text",
          "template": "<string>"
        }
      }
    },
    "features": {
      "version": "v1",
      "postCallAnalysis": [],
      "talkFirst": {
        "version": "v1",
        "delay": 1,
        "isEnabled": false,
        "interruptible": true
      },
      "maxDuration": {
        "version": "v1",
        "maxDurationSeconds": 3600,
        "maxDurationInTransferSeconds": 7200,
        "isEnabled": true
      },
      "ivrDetection": {
        "version": "v1",
        "isEnabled": true,
        "enabledForChat": false,
        "enabledForInbound": false,
        "enabledForOutbound": true,
        "enabledForWebCall": false,
        "ivrNavigation": false
      },
      "ambientNoise": {
        "version": "v1",
        "isEnabled": false,
        "ambientNoiseLevel": 0.1
      },
      "languageSwitching": {
        "version": "v1",
        "isEnabled": true
      },
      "fillers": {
        "version": "v1",
        "isEnabled": true,
        "strategy": {
          "type": "static",
          "texts": [
            "um"
          ]
        }
      },
      "backchannel": {
        "version": "v1",
        "isEnabled": false
      },
      "silenceManagement": {
        "version": "v1",
        "isEnabled": true,
        "maxReminderAttempts": 2,
        "reminderSilenceThresholdSeconds": 5,
        "endWhenReminderLimitExceeded": true
      }
    },
    "mcpConnections": [
      {
        "name": "<string>",
        "serverUrl": "<string>",
        "authentication": {
          "type": "apiKey",
          "apiKey": "<string>",
          "headerName": "<string>"
        },
        "customHeaders": {},
        "isEnabled": true,
        "description": null,
        "transport": "SSE",
        "blackListTools": null,
        "whiteListTools": null
      }
    ],
    "startWebhook": {
      "webhook": {
        "url": "<string>",
        "headers": {},
        "customSettings": {
          "httpMethod": "GET",
          "queryParams": {},
          "bodyFormat": {
            "type": "Text",
            "template": "<string>"
          }
        }
      },
      "version": "v1",
      "fallbackResponse": {
        "accept": false,
        "reasonMessage": "Webhook for started webhook failed"
      },
      "isEnabledForInbound": false,
      "isEnabledForOutbound": false,
      "isEnabledForWidget": false,
      "timeout": 10
    },
    "tools": [
      {
        "name": "<string>",
        "schema": {},
        "webhook": {
          "url": "<string>",
          "headers": {},
          "customSettings": {
            "httpMethod": "GET",
            "queryParams": {},
            "bodyFormat": {
              "type": "Text",
              "template": "<string>"
            }
          }
        },
        "description": "<string>",
        "fallBackResult": null,
        "timeoutSeconds": null,
        "retryCount": null
      }
    ],
    "builtInTools": [
      {
        "name": "<string>",
        "additionalInstructions": null
      }
    ]
  },
  "agentId": "<string>",
  "orgId": "<string>",
  "createdTime": "2023-11-07T05:31:56Z",
  "lastUpdateTime": "2023-11-07T05:31:56Z",
  "inboundSipConfig": {
    "id": "<string>",
    "phoneNumber": null,
    "sipUri": null,
    "sipTrunkUri": null
  },
  "schedule": {
    "timezone": "<string>",
    "mon": [
      {
        "start": {
          "hour": 0,
          "minute": 0
        },
        "end": {
          "hour": 23,
          "minute": 59
        }
      }
    ],
    "tue": [
      {
        "start": {
          "hour": 0,
          "minute": 0
        },
        "end": {
          "hour": 23,
          "minute": 59
        }
      }
    ],
    "wed": [
      {
        "start": {
          "hour": 0,
          "minute": 0
        },
        "end": {
          "hour": 23,
          "minute": 59
        }
      }
    ],
    "thu": [
      {
        "start": {
          "hour": 0,
          "minute": 0
        },
        "end": {
          "hour": 23,
          "minute": 59
        }
      }
    ],
    "fri": [
      {
        "start": {
          "hour": 0,
          "minute": 0
        },
        "end": {
          "hour": 23,
          "minute": 59
        }
      }
    ],
    "sat": [
      {
        "start": {
          "hour": 0,
          "minute": 0
        },
        "end": {
          "hour": 23,
          "minute": 59
        }
      }
    ],
    "sun": [
      {
        "start": {
          "hour": 0,
          "minute": 0
        },
        "end": {
          "hour": 23,
          "minute": 59
        }
      }
    ]
  },
  "isEnabled": true,
  "description": null,
  "additionalData": {}
}

Before You Begin

Ensure all referenced resources exist before creating an agent:
  • Media files for hold music or background sounds must be uploaded first
  • Pronunciation dictionaries must be created if referenced
  • SIP configuration must be set up if using warm transfer

Required Configuration

At minimum, you must provide:
  • Agent name (unique within your organization)
  • Voice configuration (voice ID and language)
  • TTS (Text-to-Speech) configuration

Body

Agent configuration

Request to create or update an agent with full configuration including name, description, behavior settings, call schedule, and inbound routing. Contains all agent properties such as enabled status, display name, optional description, complete agent configuration (TTS, LLM, STT, outbound SIP for making calls, webhooks, features, MCP connections, tools), default prompt variables in AdditionalData, time-based schedule for when outbound calls can be made, and inbound call routing configuration.

name
string
required

Display name for the agent. Used to identify the agent in the UI, logs, and API responses.

Required string length: 1 - 100
config
object
required

Complete configuration for the agent's behavior including voice settings (TTS), language model (LLM), speech recognition (STT), outbound SIP configuration for making calls, webhooks for event notifications, features like RAG and transfers, MCP connections for external services, and custom tools. This defines how the agent will interact during conversations and what capabilities it has.

isEnabled
boolean | null
default:true

Whether the agent is enabled and can handle calls. When disabled, the agent cannot make outbound calls or handle inbound routing.

description
string | null

Optional description explaining the agent's purpose, behavior, or use case. Useful for documentation and team collaboration to understand what this agent is designed to do.

additionalData
object

Default data for variable interpolation in agent prompts. Values can be referenced in prompts using {{variableName}} syntax. These serve as default values for the agent and can be overridden on a per-call basis when enqueueing calls.

schedule
object

Time-based schedule defining when the agent can make outbound calls. Specifies available time slots for each day of the week and the timezone for schedule interpretation. Scheduled calls will only be placed during these time windows.

inboundSipConfig
object

Configuration for routing inbound calls to this agent. To configure phone number routing for incoming calls, use the SIP phone numbers API to assign a phone number to this agent instead of using this field directly.

Response

Agent created successfully

Complete agent details including all configuration, identifiers, timestamps, schedule, and inbound routing. Contains the full agent state including enabled status, display name, optional description, complete agent configuration (TTS, LLM, STT, outbound SIP for making calls, webhooks, features, MCP connections, tools), default prompt variables in AdditionalData, unique identifiers, creation and update timestamps, call schedule for outbound calls, and inbound call routing configuration.

name
string
required

Display name for the agent. Used to identify the agent in the UI, logs, and API responses.

Required string length: 1 - 100
config
object
required

Complete configuration for the agent's behavior including voice settings (TTS), language model (LLM), speech recognition (STT), outbound SIP configuration for making calls, webhooks for event notifications, features like RAG and transfers, MCP connections for external services, and custom tools. This defines how the agent will interact during conversations and what capabilities it has.

agentId
string
required

Unique identifier for the agent. Use this ID to reference the agent in API calls, call enqueueing, and WebSocket connections.

Minimum string length: 1
orgId
string
required

Organization identifier that owns this agent. All resources and calls for this agent are scoped to this organization.

Minimum string length: 1
createdTime
string<date-time>
required

Timestamp when the agent was created. Recorded in UTC.

lastUpdateTime
string<date-time>
required

Timestamp when the agent was last updated. Recorded in UTC and updated whenever any agent configuration changes.

inboundSipConfig
object
required

Inbound call routing configuration showing which phone number routes incoming calls to this agent. Includes the unique configuration ID, assigned phone number, SIP URI for routing, and trunk URI. To modify phone number routing, use the SIP phone numbers API.

schedule
object
required

Time-based schedule defining when the agent can make outbound calls. Specifies available time slots for each day of the week and the timezone for schedule interpretation. Scheduled calls will only be placed during these time windows.

isEnabled
boolean | null
default:true

Whether the agent is enabled and can handle calls. When disabled, the agent cannot make outbound calls or handle inbound routing.

description
string | null

Optional description explaining the agent's purpose, behavior, or use case. Useful for documentation and team collaboration to understand what this agent is designed to do.

additionalData
object

Default data for variable interpolation in agent prompts. Values can be referenced in prompts using {{variableName}} syntax. These serve as default values for the agent and can be overridden on a per-call basis when enqueueing calls.