For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
HomeGet API key
DocumentationIntegrationsAPI Reference
DocumentationIntegrationsAPI Reference
  • Get Started
    • Welcome
  • Guides
    • Agents
    • Phone Numbers
    • Conversations
    • Calls
    • Webhooks
    • Agent Webhooks
    • Usage & Billing
  • Reference
    • Pagination
    • Error Handling
    • Messaging Rate Limits
    • Testing
    • Best Practices
    • Code Examples
    • FAQ
  • SDKs
    • TypeScript / JavaScript
    • Python
LogoLogo
HomeGet API key
On this page
  • Voice modes
  • Create agent
  • Request body
  • Example
  • List agents
  • Query parameters
  • Example
  • Get agent
  • Example
  • Update agent
  • Example
  • Delete agent
  • Example
  • Attach number to agent
  • Request body
  • Example
  • List agent conversations
  • Example
  • List agent calls
  • Example
  • List available voices
  • Example
Guides

Agents

Was this page helpful?
Previous

Phone numbers

Next
Built with

Agents represent AI personas (e.g., Support Bot, Sales Agent) that can have phone numbers attached to them. Each agent can be configured with a voice mode, system prompt, greeting message, and voice selection.

Voice modes

Agents support two voice modes for handling calls:

  • webhook (default) — Forwards call transcripts to your configured webhook URL. You process the transcript with your own AI backend and return a response.
  • hosted — Uses a built-in LLM with the agent’s systemPrompt. No webhook is needed for voice conversations; the platform handles the AI interaction directly.

Create agent

Create a new agent.

POST /v1/agents

Request body

FieldTypeRequiredDescription
namestringYesName of the agent
descriptionstring or nullNoDescription of what the agent does
voiceModestring or nullNoVoice handling mode: "webhook" (default) or "hosted"
systemPromptstring or nullNoSystem prompt for the built-in LLM (used when voiceMode is "hosted")
beginMessagestring or nullNoInitial greeting message spoken when a call connects
voicestring or nullNoVoice identifier for text-to-speech (e.g., "Polly.Amy")
modelTierstring or nullNoQuality/latency tradeoff for hosted-mode agents: "turbo" (lowest latency, best for simple tasks), "balanced" (default, good mix of speed and quality), or "max" (highest quality, best for complex reasoning)
sttModestring or nullNoSpeech-to-text mode: "fast" (default) optimizes for latency, "accurate" optimizes for transcription accuracy (~200ms additional latency)
ambientSoundstring or nullNoBackground ambience to mask synthetic silence between turns: "none" (default), "office", "coffee-shop", or "outdoor"
denoisingModestring or nullNoAudio denoising level: "noise-cancellation" (default) or "noise-and-background-speech-cancellation" (more aggressive, for callers in cars, cafes, or near TVs). $0.005/min surcharge.
transferNumberstring or nullNoPhone number to transfer calls to when the agent triggers a transfer action
voicemailMessagestring or nullNoMessage to play when a call goes to voicemail

Example

$curl -X POST "https://api.agentphone.ai/v1/agents" \
> -H "Authorization: Bearer YOUR_API_KEY" \
> -H "Content-Type: application/json" \
> -d '{
> "name": "Support Bot",
> "description": "Handles customer support inquiries",
> "voiceMode": "hosted",
> "systemPrompt": "You are a helpful customer support agent for Acme Corp.",
> "beginMessage": "Hello! Thanks for calling Acme Corp. How can I help you today?",
> "voice": "Polly.Amy"
> }'
1{
2 "id": "agt_abc123",
3 "name": "Support Bot",
4 "description": "Handles customer support inquiries",
5 "voiceMode": "hosted",
6 "systemPrompt": "You are a helpful customer support agent for Acme Corp.",
7 "beginMessage": "Hello! Thanks for calling Acme Corp. How can I help you today?",
8 "voice": "Polly.Amy",
9 "createdAt": "2025-01-15T10:30:00Z",
10 "numbers": []
11}

List agents

List all agents for this project.

GET /v1/agents

Query parameters

ParameterTypeRequiredDefaultDescription
limitintegerNo20Number of results to return (max 100)
offsetintegerNo0Number of results to skip (min 0)

Example

$curl -X GET "https://api.agentphone.ai/v1/agents?limit=10&offset=0" \
> -H "Authorization: Bearer YOUR_API_KEY"

Get agent

Get a single agent with its attached numbers.

GET /v1/agents/{agent_id}

Example

$curl -X GET "https://api.agentphone.ai/v1/agents/agt_abc123" \
> -H "Authorization: Bearer YOUR_API_KEY"

Update agent

Update an agent’s configuration. Use this to change voice mode, system prompt, greeting, or voice.

PATCH /v1/agents/{agent_id}

All fields are optional. Only include the fields you want to update.

Example

$curl -X PATCH "https://api.agentphone.ai/v1/agents/agt_abc123" \
> -H "Authorization: Bearer YOUR_API_KEY" \
> -H "Content-Type: application/json" \
> -d '{
> "systemPrompt": "You are a friendly sales assistant for Acme Corp.",
> "voiceMode": "hosted"
> }'

Delete agent

Delete an agent. Phone numbers, conversations, and calls associated with the agent will have their agent reference cleared but will not be deleted.

DELETE /v1/agents/{agent_id}

Example

$curl -X DELETE "https://api.agentphone.ai/v1/agents/agt_abc123" \
> -H "Authorization: Bearer YOUR_API_KEY"

Attach number to agent

Attach an existing phone number to an agent. The number must belong to the same project and must not be released.

POST /v1/agents/{agent_id}/numbers

Request body

FieldTypeRequiredDescription
numberIdstringYesThe ID of the phone number to attach

Example

$curl -X POST "https://api.agentphone.ai/v1/agents/agt_abc123/numbers" \
> -H "Authorization: Bearer YOUR_API_KEY" \
> -H "Content-Type: application/json" \
> -d '{"numberId": "num_xyz789"}'

List agent conversations

List all conversations for a specific agent.

GET /v1/agents/{agent_id}/conversations

Example

$curl -X GET "https://api.agentphone.ai/v1/agents/agt_abc123/conversations?limit=10" \
> -H "Authorization: Bearer YOUR_API_KEY"

List agent calls

List all calls for a specific agent.

GET /v1/agents/{agent_id}/calls

Example

$curl -X GET "https://api.agentphone.ai/v1/agents/agt_abc123/calls?limit=5" \
> -H "Authorization: Bearer YOUR_API_KEY"

List available voices

List all available TTS voices that can be used with the voice field when creating or updating agents.

GET /v1/agents/voices

Example

$curl -X GET "https://api.agentphone.ai/v1/agents/voices" \
> -H "Authorization: Bearer YOUR_API_KEY"

Use the returned voice identifiers (e.g., "Polly.Amy", "Polly.Joanna") in the voice field when creating agents, updating agents, or making outbound calls.