Skip to main content

Overview

The Agents API allows you to create, configure, and manage AI voice agents programmatically.

List Agents

Get all agents in your account.
curl -X GET "https://api.getsmartalex.com/v1/agents" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "data": [
    {
      "id": "agent_abc123",
      "name": "Alex",
      "voice": "nova",
      "language": "en-US",
      "status": "ready",
      "created_at": "2024-01-15T10:30:00Z"
    },
    {
      "id": "agent_def456",
      "name": "Sarah",
      "voice": "alloy",
      "language": "en-US",
      "status": "ready",
      "created_at": "2024-01-14T08:15:00Z"
    }
  ],
  "meta": {
    "total": 2,
    "page": 1,
    "per_page": 20
  }
}

Get Agent

Retrieve a single agent by ID.
curl -X GET "https://api.getsmartalex.com/v1/agents/agent_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "data": {
    "id": "agent_abc123",
    "name": "Alex",
    "voice": "nova",
    "language": "en-US",
    "status": "ready",
    "prompt": "You are Alex, a friendly receptionist...",
    "knowledge_base": "Our business hours are...",
    "phone_numbers": ["+15551234567"],
    "settings": {
      "recording_enabled": true,
      "voicemail_enabled": true,
      "transfer_number": "+15559876543"
    },
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T14:22:00Z"
  }
}

Create Agent

Create a new AI voice agent.
curl -X POST "https://api.getsmartalex.com/v1/agents" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Alex",
    "voice": "nova",
    "language": "en-US",
    "prompt": "You are Alex, a friendly receptionist for ABC Company. Answer questions about our services, collect caller information, and schedule appointments.",
    "settings": {
      "recording_enabled": true
    }
  }'

Parameters

ParameterTypeRequiredDescription
namestringYesAgent display name
voicestringYesVoice ID (see available voices below)
languagestringNoLanguage code (default: en-US)
promptstringYesSystem prompt defining agent behavior
knowledge_basestringNoAdditional context for the agent
settingsobjectNoAgent configuration settings

Settings Object

FieldTypeDefaultDescription
recording_enabledbooleantrueRecord calls
voicemail_enabledbooleantrueEnable voicemail
transfer_numberstringnullNumber for call transfers
max_call_durationinteger1800Max call length in seconds

Response

{
  "data": {
    "id": "agent_new789",
    "name": "Alex",
    "voice": "nova",
    "language": "en-US",
    "status": "creating",
    "created_at": "2024-01-16T09:00:00Z"
  }
}
New agents have status creating while being provisioned. This typically takes a few seconds.

Update Agent

Update an existing agent’s configuration.
curl -X PUT "https://api.getsmartalex.com/v1/agents/agent_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Updated prompt instructions...",
    "settings": {
      "transfer_number": "+15559876543"
    }
  }'

Parameters

All parameters are optional. Only included fields will be updated.
ParameterTypeDescription
namestringAgent display name
voicestringVoice ID
languagestringLanguage code
promptstringSystem prompt
knowledge_basestringAdditional context
settingsobjectAgent settings

Delete Agent

Delete an agent. This action cannot be undone.
curl -X DELETE "https://api.getsmartalex.com/v1/agents/agent_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "data": {
    "id": "agent_abc123",
    "deleted": true
  }
}
Deleting an agent will unassign it from all phone numbers and cancel any active campaigns using that agent.

Available Voices

Voice IDDescriptionLanguages
novaWarm and friendly femaleen-US, en-GB
alloyProfessional neutralen-US, en-GB, es
echoConfident maleen-US
fableExpressive femaleen-US, en-GB
onyxDeep authoritative maleen-US
shimmerSoft and gentle femaleen-US, en-GB

Agent Status

StatusDescription
draftNot yet ready for calls
creatingBeing provisioned
readyActive and can take calls
errorConfiguration issue

Error Codes

CodeDescription
agent_not_foundAgent ID doesn’t exist
agent_limit_reachedPlan limit for agents reached
invalid_voiceVoice ID not recognized
invalid_languageLanguage code not supported