> ## Documentation Index
> Fetch the complete documentation index at: https://www.vobiz.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Vapi integration (API)

> Connect Vapi to Vobiz SIP trunking via API - route inbound calls to any Vapi AI assistant and place outbound calls to 130+ countries programmatically.

![Vapi API integration with Vobiz SIP trunking](https://mintcdn.com/vobizai/OZ7y9Kg025aXyvCH/images/integration-bg/VAPI.png?fit=max\&auto=format\&n=OZ7y9Kg025aXyvCH\&q=85\&s=79082396532611658b6e57e00c7dfeae)

This guide shows how to integrate Vapi with Vobiz programmatically to enable **outbound calling** and **inbound calling**. Your AI assistants can call any phone number, and inbound calls to your Vobiz number can be routed to a Vapi assistant.

> [!TIP]
>
> **Prefer the dashboard?** Check out the [dashboard setup guide](https://www.vobiz.ai/docs/integrations/vapi-dashboard.md) for a visual step-by-step walkthrough.

## Prerequisites

* A [Vobiz account](https://console.vobiz.ai/auth/signup) with a SIP trunk
* A [Vapi account](https://dashboard.vapi.ai/signup) with a private key
* A Vapi assistant - [create one in the dashboard](https://dashboard.vapi.ai)
* A phone number from Vobiz (for caller ID)

## Part 1: Vobiz setup

Create a SIP trunk

Create a SIP trunk in Vobiz to handle voice traffic. See the [SIP trunks documentation](https://www.vobiz.ai/docs/trunks.md).

Save these values from the response:

* `sip_domain` (for example, `5f3a607b.sip.vobiz.ai`)
* `username`
* `password`

You'll need them for Vapi configuration.

Get a phone number

Purchase a phone number for outbound caller ID or inbound calls. See the [phone numbers documentation](https://www.vobiz.ai/docs/account-phone-number/list-inventory-numbers.md).

## Part 2: Vapi setup

Get your Vapi private key

1. Log in to the [Vapi Dashboard](https://dashboard.vapi.ai).
2. Click your profile icon (top right) and go to **Settings → API Keys**.
3. Click **Create new key** and copy the key.

```text theme={null}
c07947df-6ba2-4e58-92f5-35e92849f6c2
```

> [!WARNING]
>
> Save this key securely - you'll use it in all API requests.

Get your assistant ID

1. In the [Vapi Dashboard](https://dashboard.vapi.ai), go to **Assistants**.
2. Select your assistant (or create one) and copy the **Assistant ID**.

```text theme={null}
9fb6d4c5-9403-49ea-afeb-9b493d63b474
```

Or list assistants via the API:

```bash theme={null}
curl "https://api.vapi.ai/assistant" \
  -H "Authorization: Bearer YOUR_VAPI_PRIVATE_KEY"
```

## Part 3: Connect Vobiz to Vapi (outbound)

Step 1: Create the SIP credential in Vapi

Register your Vobiz SIP trunk with Vapi for outbound calling.

```bash theme={null}
curl -X POST "https://api.vapi.ai/credential" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_VAPI_PRIVATE_KEY" \
  -d '{
    "provider": "byo-sip-trunk",
    "name": "Vobiz Trunk",
    "gateways": [{
      "ip": "bfab10fb.sip.vobiz.ai",
      "inboundEnabled": false
    }],
    "outboundLeadingPlusEnabled": true,
    "outboundAuthenticationPlan": {
      "authUsername": "Vapi_user",
      "authPassword": "Password@123"
    }
  }'
```

Replace:

* `bfab10fb.sip.vobiz.ai` → your Vobiz SIP domain
* `Vapi_user` → your Vobiz username
* `Password@123` → your Vobiz password

```json theme={null}
{
  "id": "65a79bd2-c1b9-4c83-8e55-97c22c092b48",
  "provider": "byo-sip-trunk",
  "gateways": [{
    "ip": "bfab10fb.sip.vobiz.ai",
    "inboundEnabled": false
  }]
}
```

Save the `id` - this is your **credential ID**.

Step 2: Register the phone number

Associate your phone number with the SIP credential for caller ID.

```bash theme={null}
curl -X POST "https://api.vapi.ai/phone-number" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_VAPI_PRIVATE_KEY" \
  -d '{
    "provider": "byo-phone-number",
    "name": "Vobiz Line",
    "number": "08071387149",
    "numberE164CheckEnabled": false,
    "credentialId": "65a79bd2-c1b9-4c83-8e55-97c22c092b48"
  }'
```

```json theme={null}
{
  "id": "91122039-9644-47fd-a545-d865075a6941",
  "number": "08071387149",
  "status": "active",
  "credentialId": "65a79bd2-c1b9-4c83-8e55-97c22c092b48"
}
```

Save the `id` - this is your **phone number ID**.

Step 3: Make an outbound call

```bash theme={null}
curl -X POST "https://api.vapi.ai/call/phone" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_VAPI_PRIVATE_KEY" \
  -d '{
    "assistantId": "9fb6d4c5-9403-49ea-afeb-9b493d63b474",
    "customer": {
      "number": "+919148223344",
      "numberE164CheckEnabled": false
    },
    "phoneNumberId": "91122039-9644-47fd-a545-d865075a6941"
  }'
```

```json theme={null}
{
  "id": "019a0bce-0cf3-7337-a253-f65f4e9c68f4",
  "status": "queued",
  "type": "outboundPhoneCall",
  "assistantId": "9fb6d4c5-9403-49ea-afeb-9b493d63b474",
  "customer": { "number": "+919148223344" },
  "phoneNumberId": "91122039-9644-47fd-a545-d865075a6941"
}
```

> [!TIP]
>
> Call initiated. The phone will ring, and when answered, your AI assistant will speak.

## Verification

Check call status

View call logs in [Vapi Dashboard](https://dashboard.vapi.ai) → **Calls**, or via API:

```bash theme={null}
curl "https://api.vapi.ai/call/019a0bce-0cf3-7337-a253-f65f4e9c68f4" \
  -H "Authorization: Bearer YOUR_VAPI_PRIVATE_KEY"
```

Test call flow

1. Run Step 3 to initiate a call.
2. Wait for the destination phone to ring.
3. Answer the call.
4. The AI assistant will greet and speak.
5. Check the call transcript in the Vapi Dashboard.

## Inbound calls

Route calls placed to your Vobiz number directly to your Vapi AI assistant using the API.

```text theme={null}
Caller dials Vobiz number → Vobiz SIP → Vapi SIP trunk → Vapi AI assistant
```

Step 1: Create an inbound SIP credential in Vapi

Create a SIP trunk credential configured for **inbound only** - using the Vobiz gateway IPs instead of a SIP domain. Vobiz sends inbound SIP from **any** of its signaling IPs, so add a gateway for **every** Vobiz SIP signaling IP; get the current list from [IP whitelisting → SIP signaling](https://www.vobiz.ai/docs/concepts/ip-whitelisting.md#sip-signaling).

> [!NOTE]
>
> **RTP media firewall update:** If your network filters RTP traffic for Vapi calls, allow inbound and outbound UDP traffic on ports `5000–65535` from the complete [RTP media IP list](https://www.vobiz.ai/docs/concepts/ip-whitelisting.md#rtp-media), including these new ranges:
>
> * `18.96.230.96/28`
> * `18.96.230.112/28`
>
> These ranges carry audio. Do not include them in the Vapi `gateways` array; that array uses SIP signaling IPs only.

```bash theme={null}
curl -X POST "https://api.vapi.ai/credential" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_VAPI_PRIVATE_KEY" \
  -d '{
    "provider": "byo-sip-trunk",
    "name": "Vobiz Inbound Trunk",
    "gateways": [
      { "ip": "13.203.7.132",  "port": 5060, "netmask": 32, "inboundEnabled": true, "outboundEnabled": false },
      { "ip": "65.2.100.211",  "port": 5060, "netmask": 32, "inboundEnabled": true, "outboundEnabled": false },
      { "ip": "13.126.98.234", "port": 5060, "netmask": 32, "inboundEnabled": true, "outboundEnabled": false },
      { "ip": "13.235.11.131", "port": 5060, "netmask": 32, "inboundEnabled": true, "outboundEnabled": false },
      { "ip": "13.233.44.61",  "port": 5060, "netmask": 32, "inboundEnabled": true, "outboundEnabled": false },
      { "ip": "3.111.255.163", "port": 5060, "netmask": 32, "inboundEnabled": true, "outboundEnabled": false },
      { "ip": "3.111.128.110", "port": 5060, "netmask": 32, "inboundEnabled": true, "outboundEnabled": false },
      { "ip": "43.204.64.203", "port": 5060, "netmask": 32, "inboundEnabled": true, "outboundEnabled": false },
      { "ip": "15.207.232.91", "port": 5060, "netmask": 32, "inboundEnabled": true, "outboundEnabled": false },
      { "ip": "35.154.133.28", "port": 5060, "netmask": 32, "inboundEnabled": true, "outboundEnabled": false }
    ]
  }'
```

```json theme={null}
{
  "id": "46deea29-645d-44a3-bf42-7c6ec2d4b65c",
  "provider": "byo-sip-trunk",
  "gateways": [{
    "ip": "13.233.44.61",
    "outboundEnabled": false
  }],
  "name": "Vobiz Inbound Trunk"
}
```

Save the `id` - this is your **inbound credential ID** (also called Trunk ID).

> [!TIP]
>
> Want both inbound and outbound on the same trunk? Add a second gateway entry for outbound with your Vobiz SIP domain and credentials:
>
> ```json theme={null}
> "gateways": [
>   {
>     "ip": "13.233.44.61",
>     "inboundEnabled": true,
>     "outboundEnabled": false
>   },
>   {
>     "ip": "bfab10fb.sip.vobiz.ai",
>     "inboundEnabled": false,
>     "outboundEnabled": true
>   }
> ]
> ```

Step 2: Get the trunk ID

If you didn't save the ID from Step 1, retrieve it by listing all credentials:

```bash theme={null}
curl -X GET "https://api.vapi.ai/credential" \
  -H "Authorization: Bearer YOUR_VAPI_PRIVATE_KEY"
```

Find the entry with gateway IP `13.233.44.61` and `outboundEnabled: false`. The `id` field is your trunk ID.

Step 3: Configure the inbound trunk in Vobiz

Create an inbound trunk in the Vobiz Console that routes calls to Vapi:

1. Go to [Vobiz Console](https://console.vobiz.ai) → **SIP Trunks → Inbound Trunk**.
2. Click **Create New Trunk**.
3. Set **Name** and **Transport** to `UDP`.
4. Set **Primary URI** to `<VAPI_TRUNK_ID>.sip.vapi.ai` - for example, `46deea29-645d-44a3-bf42-7c6ec2d4b65c.sip.vapi.ai`.
5. Link your Vobiz phone number to this trunk.
6. Click **Save**.

Or use the Vobiz API to create the inbound trunk programmatically - see the [SIP trunks documentation](https://www.vobiz.ai/docs/trunks.md).

Step 4: Register the inbound phone number in Vapi

Register your Vobiz number with the inbound credential and assign your assistant:

```bash theme={null}
curl -X POST "https://api.vapi.ai/phone-number" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_VAPI_PRIVATE_KEY" \
  -d '{
    "provider": "byo-phone-number",
    "name": "Vobiz Inbound Line",
    "number": "+918071387376",
    "numberE164CheckEnabled": true,
    "credentialId": "46deea29-645d-44a3-bf42-7c6ec2d4b65c",
    "assistantId": "YOUR_ASSISTANT_ID"
  }'
```

Replace:

* `+918071387376` → your Vobiz phone number
* `46deea29-...` → your inbound credential ID from Step 1
* `YOUR_ASSISTANT_ID` → your Vapi assistant ID

> [!TIP]
>
> **Inbound setup complete!** Dial your Vobiz number - the call will route to your Vapi AI assistant automatically.

## Troubleshooting

"Unauthorized" / "Invalid API key"

Vapi private key is incorrect.

* Verify you copied the entire key.
* Generate a new key at [Vapi Dashboard](https://dashboard.vapi.ai) → **Settings → API Keys**.

"Couldn't get assistant"

Wrong assistant ID or it doesn't exist.

* Run `curl "https://api.vapi.ai/assistant" -H "Authorization: Bearer YOUR_KEY"` and use the correct `id`.
* Don't confuse credential ID with assistant ID.

"SIP authentication failed"

Vobiz credentials are incorrect.

* Verify SIP domain, username, password in [Vobiz Console](https://console.vobiz.ai).
* Use the exact `sip_domain` (for example, `bfab10fb.sip.vobiz.ai`), not a generic `sip.vobiz.ai`.

Call connects but silent

Assistant configuration issue.

* Verify the assistant has a "First Message" configured.
* Check the assistant has a voice provider set up.
* View call logs in [Vapi Dashboard](https://dashboard.vapi.ai) → **Calls**.

Call doesn't connect

* Use E.164 format: `+919148223344`.
* Verify your Vobiz trunk is active in [Vobiz Console](https://console.vobiz.ai).

## Quick reference

Required credentials

| Credential | Where to get | Used in |
| - | - | - |
| Vapi private key | Vapi Dashboard → Settings → API Keys | All API requests |
| Vobiz SIP domain | Vobiz Console → Trunks → `sip_domain` | Step 1: `gateways[0].ip` |
| Vobiz username | Vobiz Console → Trunks | Step 1: `authUsername` |
| Vobiz password | Vobiz Console → Trunks | Step 1: `authPassword` |
| Phone number | Vobiz Console → Numbers | Step 2: `number` |
| Credential ID | Step 1 response `id` | Step 2: `credentialId` |
| Phone number ID | Step 2 response `id` | Step 3: `phoneNumberId` |
| Assistant ID | Vapi Dashboard → Assistants | Step 3: `assistantId` |

API endpoints

All requests require `Authorization: Bearer YOUR_VAPI_PRIVATE_KEY`.

| Action | Method | Endpoint |
| - | - | - |
| Create SIP credential | POST | `https://api.vapi.ai/credential` |
| Register phone number | POST | `https://api.vapi.ai/phone-number` |
| Make outbound call | POST | `https://api.vapi.ai/call/phone` |
| List assistants | GET | `https://api.vapi.ai/assistant` |
| Get call details | GET | `https://api.vapi.ai/call/{callId}` |

Common errors

| Error | Cause | Fix |
| - | - | - |
| 401 Unauthorized | Wrong Vapi private key | Verify the key in the dashboard |
| Assistant does not exist | Wrong assistant ID | List assistants via API |
| SIP auth failed | Wrong Vobiz credentials | Check Vobiz Console → Trunks |
| Insufficient balance | Low Vobiz credits | Add funds in the Vobiz Console |
| Phone format error | Missing `+` or country code | Use `+919148223344` or `09148223344` |

## Resources

**Vobiz**

* [SIP trunks](https://www.vobiz.ai/docs/trunks.md)
* [Phone numbers](https://www.vobiz.ai/docs/account-phone-number/list-inventory-numbers.md)
* [Vobiz Console](https://console.vobiz.ai)
* Support: [support@vobiz.ai](mailto:support@vobiz.ai)

**Vapi**

* [API reference](https://docs.vapi.ai/api-reference)
* [Assistants guide](https://docs.vapi.ai/assistants)
* [Phone calling](https://docs.vapi.ai/phone-calling)
* [Vapi Dashboard](https://dashboard.vapi.ai)
* Support: [Vapi Discord](https://discord.gg/vapi) or [support@vapi.ai](mailto:support@vapi.ai)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.