Agents

Agents are the core resource in Voicebip. Each agent is an AI persona that owns phone numbers and handles voice calls, SMS, and WhatsApp conversations.

Create an Agent

$curl -X POST "https://api.voicebip.com/v1/agents" \
> -H "Authorization: Bearer pk_live_your_key" \
> -H "Content-Type: application/json" \
> -d '{
> "display_name": "Loan Recovery Agent",
> "language": "en",
> "ai_provider": "openai",
> "system_prompt": "You are a friendly loan recovery agent for a Nigerian fintech. Help callers understand their outstanding balance and payment options. Be professional and empathetic."
> }'

Parameters

FieldTypeRequiredDescription
display_namestringYesHuman-readable name
template_idstringNoTemplate ID to pre-fill agent configuration (see Templates)
languagestringNoen, ha, yo, ig, pcm, fr, ar, pt, auto (default: en)
ai_providerstringNobyom, openai, gemini (default: byom)
ai_modelstringNoModel name for the selected provider (e.g. gpt-4o, gemini-2.0-flash). Defaults to provider’s recommended model
system_promptstringNoInstructions for the AI model
webhook_urlstringNoURL that receives BYOM turn requests and lifecycle events (call.initiated, call.transcription, call.completed). Required when ai_provider is byom; also used for lifecycle events on hosted providers.
greeting_textstringNoCustom greeting played via TTS when a call connects
pre_call_announcementstringNoShort announcement played before the greeting. Required for CBN-regulated financial agents
shareablebooleanNoEnable “try my agent” public link (default: false)
tool_definitionsstringNoJSON array of OpenAI-compatible tool definitions. Built-in tools: hang_up, transfer_call, hold_call, resume_call. Custom tools dispatch to your webhook URL. Defaults to "[]".
call_window_startstringNoEarliest time the agent accepts inbound calls in HH:MM 24h format (e.g. 08:00). CBN compliance field
call_window_endstringNoLatest time the agent accepts inbound calls in HH:MM 24h format (e.g. 18:00). CBN compliance field
call_window_timezonestringNoIANA timezone for call window enforcement (e.g. Africa/Lagos). Defaults to Africa/Lagos
recording_enabledbooleanNoEnable call recording for this agent (default: false). Workspace-level recording must also be enabled via POST /v1/workspace/recording.
consent_requiredbooleanNoWhen true (default), the caller hears a consent prompt before recording starts. When false, recording begins immediately without a prompt — only disable this if you have an independent legal basis under NDPR.

List Agents

$curl "https://api.voicebip.com/v1/agents" \
> -H "Authorization: Bearer pk_live_your_key"

Update an Agent

$curl -X PATCH "https://api.voicebip.com/v1/agents/{agent_id}" \
> -H "Authorization: Bearer pk_live_your_key" \
> -H "Content-Type: application/json" \
> -d '{"system_prompt": "Updated prompt."}'

Delete an Agent

$curl -X DELETE "https://api.voicebip.com/v1/agents/{agent_id}" \
> -H "Authorization: Bearer pk_live_your_key"

Agent ID Format

agt_{WORKSPACE_PREFIX}_{nanoid(12)} — Example: agt_PAEZ_njcfm2kycpjs

Agent Playground

Test your agent’s prompt with text chat before making live calls:

$curl -X POST https://api.voicebip.com/v1/agents/agt_xxx/playground \
> -H "Authorization: Bearer pk_live_xxx" \
> -H "Content-Type: application/json" \
> -d '{"message": "Hello, what can you help me with?", "history": []}'

The playground uses the agent’s configured system prompt, AI provider, and model. Pass previous turns in history to maintain conversation context.

Tool Calling (Function Calling)

Agents can invoke tools during voice calls. When the AI decides to call a tool, the voice pipeline executes it and feeds the result back to the AI before generating the spoken response.

Built-in Tools

ToolDescriptionParameters
hang_upEnd the call gracefully after farewellNone
transfer_callTransfer to another phone numberdestination (string, required)
hold_callPlace the caller on holdNone
resume_callResume a held callNone

Custom Tools

Custom tools are dispatched to your agent’s webhook URL as a POST request:

1{
2 "event_type": "tool.invocation",
3 "call_id": "call_xxx",
4 "agent_id": "agt_xxx",
5 "tool": {
6 "tool_call_id": "call_abc",
7 "name": "check_balance",
8 "arguments": {"account_id": "ACC-4421"}
9 }
10}

Return a JSON response with the tool result. The AI receives this and generates its spoken response.

Configuring Tools

Set tool_definitions when creating or updating an agent:

$curl -X PATCH https://api.voicebip.com/v1/agents/agt_xxx \
> -H "Authorization: Bearer pk_live_xxx" \
> -H "Content-Type: application/json" \
> -d '{
> "tool_definitions": "[{\"type\":\"function\",\"function\":{\"name\":\"hang_up\",\"description\":\"End the call gracefully\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"required\":[]}}}]"
> }'

The format follows the OpenAI function calling schema. The hang_up tool is enabled by default in the dashboard.

Recording

Call recording requires two gates to be open: recording must be enabled at the workspace level, and then separately enabled on each agent.

Step 1 — Enable recording for your workspace

Recording availability and pricing depends on your billing tier:

TierRecordingMonthly cost (NGN)
StarterNot available
BuilderAdd-on₦10,000/month
ScaleIncludedFree
PAYGAdd-on₦15,000/month

Enable it workspace-wide:

$curl -X POST "https://api.voicebip.com/v1/workspace/recording" \
> -H "Authorization: Bearer pk_live_your_key" \
> -H "Content-Type: application/json" \
> -d '{"enabled": true}'

Returns 400 RESOURCE_NOT_AVAILABLE_ON_TIER on Starter. Disabling is unconditional on all tiers.

Step 2 — Enable recording on the agent

Once workspace recording is on, flip the flag per agent:

$curl -X PATCH "https://api.voicebip.com/v1/agents/agt_xxx" \
> -H "Authorization: Bearer pk_live_your_key" \
> -H "Content-Type: application/json" \
> -d '{"recording_enabled": true}'

Both flags must be true for a call to be recorded. Either flag being false suppresses recording.

By default (consent_required: true) Voicebip plays a consent prompt at the start of every recorded call:

“This call may be recorded for quality purposes. Press 1 to continue, or press 2 to opt out of recording.”

  • DTMF 1 — consent granted, recording starts
  • DTMF 2 — caller opts out, call continues without recording
  • No input within 12 seconds — defaults to no recording

To disable the prompt and record immediately without asking:

$curl -X PATCH "https://api.voicebip.com/v1/agents/agt_xxx" \
> -H "Authorization: Bearer pk_live_your_key" \
> -H "Content-Type: application/json" \
> -d '{"consent_required": false}'

Setting consent_required to false means you are recording callers without an in-call prompt. You must have an independent legal basis (e.g. prior written consent, a pre-call disclosure, or a regulatory exemption) under the Nigeria Data Protection Regulation (NDPR) before doing this. Every toggle is recorded in the audit log.

Accessing Recordings

When a call is recorded the call.completed webhook payload includes a recording_url field. Use it to download the WAV file:

$curl "https://api.voicebip.com/v1/calls/{call_id}/recording" \
> -H "Authorization: Bearer pk_live_your_key" \
> --output recording.wav

Recordings are retained for 30 days and then automatically deleted. See Recording Playback for range-request and browser-playback details.

Tier Limits

TierMax Agents
Starter2
Builder10
ScaleUnlimited