> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.voicebip.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.voicebip.com/_mcp/server.

# Create an agent

POST https://api.voicebip.com/v1/agents
Content-Type: application/json

Reference: https://docs.voicebip.com/api/agents/create-agent

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://api.voicebip.com` (Production, default)
- `https://sandbox.voicebip.com` (Sandbox)

## Request

### Body (application/json)

This endpoint expects an object.

- `display_name` (string, required)
- `description` (string, optional)
- `knowledge_base_id` (string, optional) — Attach a knowledge base at creation (kb_… id, must belong to the workspace).
- `template_id` (string, optional) — Optional template ID. When provided, the agent is pre-configured with the template's settings (system_prompt, language, ai_provider, etc.). You can override individual fields.
- `language` (string, optional, default: en)
- `ai_provider` (string, optional) — AI backend for this agent. Use `GET /admin/ai/providers` to see all available providers (typically `gemini` or `openai` for hosted AI). Set to `byom` to relay every caller turn to your own webhook URL — `webhook_url` is then **required**.
- `ai_model` (string, optional) — Model ID for the chosen provider. Must be an active model in the platform catalogue (AI model IDs validated against `voicebip_v1.ai_models`). Omit the field to use the provider's platform default. Ignored when `ai_provider` is `byom`.
- `tts_voice` (string, optional) — The voice the agent speaks with. Pass a `voice_id` from `GET /v1/voice/models` (e.g. `aura-asteria-en`). Validated at save time — an unknown id is rejected with 400. Omit to use the platform-default voice.
- `system_prompt` (string, optional)
- `webhook_url` (string, optional) — HTTPS endpoint that receives **all** agent traffic: BYOM voice turn requests, messaging BYOM turns, and lifecycle events (`call.initiated`, `call.transcription`, `call.completed`). Required when `ai_provider` is `byom`. Ignored for hosted AI providers (`gemini`, `openai`). Distinguish turn requests from lifecycle events by the presence of an `event_type` field in the body. See the [BYOM guide](/guides/byom) for the full request/response schema.
- `greeting_text` (string, optional) — Custom greeting played via TTS when a call connects
- `tool_definitions` (string, optional) — JSON array of OpenAI-compatible tool definitions. Defaults to '[]'.
- `shareable` (boolean, optional) — Enable the public 'try my agent' shareable link
- `call_window_start` (string, optional, default: 08:00) — Earliest outbound call time (HH:MM). Default: 08:00
- `call_window_end` (string, optional, default: 20:00) — Latest outbound call time (HH:MM). Default: 20:00
- `call_window_timezone` (string, optional, default: Africa/Lagos) — IANA timezone. Default: Africa/Lagos
- `pre_call_announcement` (string, optional)
- `recording_enabled` (boolean, optional) — Enable call recording for this agent. Workspace recording must also be enabled via POST /v1/workspace/recording (available on Builder and Scale tiers; not available on Starter).
- `consent_required` (boolean, optional) — When true (default), plays a DTMF consent prompt before recording. Set to false only if you have prior consent or an NDPR exemption.
- `screening_enabled` (boolean, optional) — BYOM only. Enable the synchronous pre-greeting `call.screening` webhook for inbound calls (allow/reject + optional dynamic greeting). Requires `ai_provider=byom` and a `webhook_url`.
- `screening_fail_closed` (boolean, optional) — Screening failure policy: false (default) = fail-open (allow on webhook error), true = fail-closed (reject).

## Response

### 200

Agent created

- `agent_id` (string, optional)
- `workspace_id` (string, optional)
- `display_name` (string, optional)
- `description` (string, optional)
- `language` (string, optional)
- `ai_provider` (string, optional)
- `ai_model` (string, optional)
- `tts_voice` (string, optional) — The voice the agent speaks with. This is a `voice_id` from `GET /v1/voice/models` (e.g. `aura-asteria-en`). Null/absent means the platform-default voice.
- `system_prompt` (string, optional)
- `webhook_url` (string, optional)
- `greeting_text` (string, optional) — Custom greeting played via TTS when a call connects. If null, a default greeting is used.
- `greeting_audio_url` (string, optional) — The source URL of a hosted WAV played as the greeting instead of greeting_text. Set via UpdateAgent; validated and stored at save time. The system-managed storage key is never returned.
- `tool_definitions` (string, optional, default: []) — JSON array of OpenAI-compatible function/tool definitions. The AI can invoke these tools during voice calls. Built-in tools: hang_up, transfer_call, hold_call, resume_call. Custom tools are dispatched to the agent's webhook_url. Defaults to "[]".
- `shareable` (boolean, optional) — When true, enables a public 'try my agent' link for browser-based test calls.
- `knowledge_base_id` (string, optional) — Attached knowledge base (RAG). When set, hosted-AI turns answer from this KB's documents. Empty/absent = none.
- `call_window_start` (string, optional, default: 08:00) — Earliest permitted outbound call time (HH:MM, 24hr). CBN compliance.
- `call_window_end` (string, optional, default: 20:00) — Latest permitted outbound call time (HH:MM, 24hr). CBN compliance.
- `call_window_timezone` (string, optional, default: Africa/Lagos) — IANA timezone for call window evaluation.
- `pre_call_announcement` (string, optional) — CBN requirement: spoken announcement at start of call identifying the sponsoring institution.
- `recording_enabled` (boolean, optional) — Whether call recording is enabled for this agent. Workspace-level recording must also be enabled via POST /v1/workspace/recording for calls to be recorded.
- `consent_required` (boolean, optional) — When true (default), the caller hears a consent prompt before recording starts. When false, recording begins immediately. Only disable if you have an independent legal basis under NDPR.
- `screening_enabled` (boolean, optional) — BYOM only. When true, inbound calls trigger a synchronous `call.screening` webhook (to the agent's `webhook_url`) BEFORE the greeting so you can allow/reject the caller and optionally override the greeting. See the [BYOM guide](/guides/byom).
- `screening_fail_closed` (boolean, optional) — Screening failure policy. false (default) = fail-open (allow the call if the screening webhook errors/times out); true = fail-closed (reject).
- `status` (enum, optional)
  - Allowed values: `active`, `suspended`
- `created_at` (datetime, optional)
- `updated_at` (datetime, optional)

## Errors

### 400 Create Agent Request Bad Request Error

Bad request

- `error_code` (enum, required)
  - Allowed values: `NOT_FOUND`, `ALREADY_EXISTS`, `INVALID_ARGUMENT`, `PERMISSION_DENIED`, `UNAUTHENTICATED`, `RATE_LIMITED`, `INTERNAL`, `UNAVAILABLE`, `QUOTA_EXCEEDED`, `NUMBER_UNAVAILABLE`, `CALL_FAILED`, `MESSAGE_FAILED`, `WEBHOOK_FAILED`, `AI_PROVIDER_ERROR`, `CALL_WINDOW_RESTRICTED`, `INVALID_REQUEST`, `INVALID_PLAN`, `NO_OP`, `NO_ACTIVE_SUBSCRIPTION`, `WORKSPACE_NOT_FOUND`, `TIER_SWITCH_UNSUPPORTED`, `INSUFFICIENT_BALANCE`, `WORKSPACE_BLOCKED`, `TIER_SWITCH_TOO_FREQUENT`, `CHANNEL_MISMATCH`, `OPT_OUT_ENFORCED`, `UPSTREAM_ERROR`, `REQUEST_BODY_TOO_LARGE`, `INVALID_BODY`, `AI_ERROR`, `ADMIN_DISABLED`, `STORE_UNAVAILABLE`, `ADMIN_DB_UNAVAILABLE`, `MISSING_ACTOR`, `ACTOR_TOO_LONG`, `MISSING_FIELD`, `INVALID_JSON`, `INVALID_AMOUNT`, `INVALID_INCLUDED_QTY`, `INVALID_CURRENCY`, `INVALID_PROFILE`, `INVALID_RESOURCE`, `INVALID_UNIT`, `INVALID_TIER`, `INVALID_EFFECTIVE_FROM`, `NOTES_TOO_LONG`, `INVALID_LIMIT`, `LIST_FAILED`, `UPSERT_FAILED`, `WORKSPACE_OVERRIDE_DISABLED`, `WORKSPACE_OVERRIDE_UNCONFIRMED`, `MISSING_WORKSPACE_HEADER`, `INVALID_PASSWORD`, `INVALID_EMAIL`, `INVALID_CREDENTIALS`, `EMAIL_EXISTS`, `EMAIL_NOT_VERIFIED`, `WEAK_PASSWORD`, `MISSING_COMPANY`, `MISSING_TOKEN`, `INVALID_TOKEN`, `TOO_MANY_ATTEMPTS`
- `message` (string, required)
- `request_id` (string, required)
- `documentation_url` (string, optional)

### 401 Create Agent Request Unauthorized Error

Unauthorized

- `error_code` (enum, required)
  - Allowed values: `NOT_FOUND`, `ALREADY_EXISTS`, `INVALID_ARGUMENT`, `PERMISSION_DENIED`, `UNAUTHENTICATED`, `RATE_LIMITED`, `INTERNAL`, `UNAVAILABLE`, `QUOTA_EXCEEDED`, `NUMBER_UNAVAILABLE`, `CALL_FAILED`, `MESSAGE_FAILED`, `WEBHOOK_FAILED`, `AI_PROVIDER_ERROR`, `CALL_WINDOW_RESTRICTED`, `INVALID_REQUEST`, `INVALID_PLAN`, `NO_OP`, `NO_ACTIVE_SUBSCRIPTION`, `WORKSPACE_NOT_FOUND`, `TIER_SWITCH_UNSUPPORTED`, `INSUFFICIENT_BALANCE`, `WORKSPACE_BLOCKED`, `TIER_SWITCH_TOO_FREQUENT`, `CHANNEL_MISMATCH`, `OPT_OUT_ENFORCED`, `UPSTREAM_ERROR`, `REQUEST_BODY_TOO_LARGE`, `INVALID_BODY`, `AI_ERROR`, `ADMIN_DISABLED`, `STORE_UNAVAILABLE`, `ADMIN_DB_UNAVAILABLE`, `MISSING_ACTOR`, `ACTOR_TOO_LONG`, `MISSING_FIELD`, `INVALID_JSON`, `INVALID_AMOUNT`, `INVALID_INCLUDED_QTY`, `INVALID_CURRENCY`, `INVALID_PROFILE`, `INVALID_RESOURCE`, `INVALID_UNIT`, `INVALID_TIER`, `INVALID_EFFECTIVE_FROM`, `NOTES_TOO_LONG`, `INVALID_LIMIT`, `LIST_FAILED`, `UPSERT_FAILED`, `WORKSPACE_OVERRIDE_DISABLED`, `WORKSPACE_OVERRIDE_UNCONFIRMED`, `MISSING_WORKSPACE_HEADER`, `INVALID_PASSWORD`, `INVALID_EMAIL`, `INVALID_CREDENTIALS`, `EMAIL_EXISTS`, `EMAIL_NOT_VERIFIED`, `WEAK_PASSWORD`, `MISSING_COMPANY`, `MISSING_TOKEN`, `INVALID_TOKEN`, `TOO_MANY_ATTEMPTS`
- `message` (string, required)
- `request_id` (string, required)
- `documentation_url` (string, optional)

### 429 Create Agent Request Too Many Requests Error

Rate limited

- `error_code` (enum, required)
  - Allowed values: `NOT_FOUND`, `ALREADY_EXISTS`, `INVALID_ARGUMENT`, `PERMISSION_DENIED`, `UNAUTHENTICATED`, `RATE_LIMITED`, `INTERNAL`, `UNAVAILABLE`, `QUOTA_EXCEEDED`, `NUMBER_UNAVAILABLE`, `CALL_FAILED`, `MESSAGE_FAILED`, `WEBHOOK_FAILED`, `AI_PROVIDER_ERROR`, `CALL_WINDOW_RESTRICTED`, `INVALID_REQUEST`, `INVALID_PLAN`, `NO_OP`, `NO_ACTIVE_SUBSCRIPTION`, `WORKSPACE_NOT_FOUND`, `TIER_SWITCH_UNSUPPORTED`, `INSUFFICIENT_BALANCE`, `WORKSPACE_BLOCKED`, `TIER_SWITCH_TOO_FREQUENT`, `CHANNEL_MISMATCH`, `OPT_OUT_ENFORCED`, `UPSTREAM_ERROR`, `REQUEST_BODY_TOO_LARGE`, `INVALID_BODY`, `AI_ERROR`, `ADMIN_DISABLED`, `STORE_UNAVAILABLE`, `ADMIN_DB_UNAVAILABLE`, `MISSING_ACTOR`, `ACTOR_TOO_LONG`, `MISSING_FIELD`, `INVALID_JSON`, `INVALID_AMOUNT`, `INVALID_INCLUDED_QTY`, `INVALID_CURRENCY`, `INVALID_PROFILE`, `INVALID_RESOURCE`, `INVALID_UNIT`, `INVALID_TIER`, `INVALID_EFFECTIVE_FROM`, `NOTES_TOO_LONG`, `INVALID_LIMIT`, `LIST_FAILED`, `UPSERT_FAILED`, `WORKSPACE_OVERRIDE_DISABLED`, `WORKSPACE_OVERRIDE_UNCONFIRMED`, `MISSING_WORKSPACE_HEADER`, `INVALID_PASSWORD`, `INVALID_EMAIL`, `INVALID_CREDENTIALS`, `EMAIL_EXISTS`, `EMAIL_NOT_VERIFIED`, `WEAK_PASSWORD`, `MISSING_COMPANY`, `MISSING_TOKEN`, `INVALID_TOKEN`, `TOO_MANY_ATTEMPTS`
- `message` (string, required)
- `request_id` (string, required)
- `documentation_url` (string, optional)

## Examples

**Request**

```json
{
  "display_name": "display_name"
}
```

**Response**

```json
{
  "agent_id": "agent_id",
  "workspace_id": "workspace_id",
  "display_name": "display_name",
  "description": "description",
  "language": "language",
  "ai_provider": "ai_provider",
  "ai_model": "ai_model",
  "tts_voice": "tts_voice",
  "system_prompt": "system_prompt",
  "webhook_url": "webhook_url",
  "greeting_text": "greeting_text",
  "greeting_audio_url": "greeting_audio_url",
  "tool_definitions": "[{\"type\":\"function\",\"function\":{\"name\":\"hang_up\",\"description\":\"End the call gracefully\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"required\":[]}}}]",
  "shareable": true,
  "knowledge_base_id": "knowledge_base_id",
  "call_window_start": "08:00",
  "call_window_end": "20:00",
  "call_window_timezone": "Africa/Lagos",
  "pre_call_announcement": "pre_call_announcement",
  "recording_enabled": true,
  "consent_required": true,
  "screening_enabled": true,
  "screening_fail_closed": true,
  "status": "active",
  "created_at": "2024-01-15T09:30:00Z",
  "updated_at": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.voicebip.com/v1/agents"

payload = { "display_name": "display_name" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.voicebip.com/v1/agents';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"display_name":"display_name"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.voicebip.com/v1/agents"

	payload := strings.NewReader("{\n  \"display_name\": \"display_name\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.voicebip.com/v1/agents")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"display_name\": \"display_name\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.voicebip.com/v1/agents")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"display_name\": \"display_name\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.voicebip.com/v1/agents', [
  'body' => '{
  "display_name": "display_name"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.voicebip.com/v1/agents");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"display_name\": \"display_name\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["display_name": "display_name"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.voicebip.com/v1/agents")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```