> ## Documentation Index
> Fetch the complete documentation index at: https://wakoai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Phone Numbers

> Phone numbers are used to have our agents make or received phone calls.

## Buying a Number

Phone numbers can be bought directly through VoiceOS, either through the [dashboard](https://app.voiceos.io/phone-numbers) or using the [endpoint](https://wakoai.mintlify.site/api-reference/endpoint/phone_numbers/buy).

**1. Using the Dashboard**

Login to the dashboard and navigate to the phone numbers section. Click on the buy button and select the number you want to buy.

![](https://mintlify.s3-us-west-1.amazonaws.com/wakoai/images/buy-number-dashboard-light-mode.png)

Select the phone number you want to buy

**2. Using the Endpoint**

Buying the number through the API requires you to list the [available numbers](https://wakoai.mintlify.site/api-reference/endpoint/phone_numbers/available) and then [buy the number](https://wakoai.mintlify.site/api-reference/endpoint/phone_numbers/buy) you want using.
\[!WARNING] The id of the phone number is the phone number including the extension. For example: '+14152722440'

## Inbound Calls

You can setup an agent to receive inbound calls from your phone number by using the [dashboard](https://app.voiceos.io/phone-numbers) or using the [endpoint](https://wakoai.mintlify.site/api-reference/endpoint/phone_numbers/update).

**1. Using the Dashboard**

Login to the dashboard and navigate to the phone numbers section. Click on the phone number and select the inbound agent you want to use.

![](https://mintlify.s3-us-west-1.amazonaws.com/wakoai/images/inbound-agent-dashboard-light-mode.png)

**2. Using the Endpoint**

Update the phone number with the agent you want to use to receive the inbound calls using the [update number](https://wakoai.mintlify.site/api-reference/endpoint/phone_numbers/update) endpoint.

```typescript web
// Install: npm i voiceos
import VoiceOS from 'voiceos';

const voiceos = new VoiceOS('your-api-key');

voiceos.phoneNumbers.updatePhoneNumber('your-voiceos-number',
    {
        inbound_agent_id: 'your-agent-id'
    }
);
```

```python python
# Install: pip install voiceos
from voiceos.client import VoiceOS

voiceos = VoiceOS("your-api-key")

voiceos.phone_numbers.update_phone_number("your-voiceos-number",
    {
        "inbound_agent_id": "your-agent-id"
    }
)
```

```python http
import requests
import json

api_key = "your-api-key"

url = "https://api.voiceos.io/phone_numbers/{YOUR_PHONE_NUMBER}"

payload = {
    "inbound_agent_id": "your-agent-id"
}

headers = {
    'Authorization': 'Bearer ' + api_key,
    'Content-Type': 'application/json'
}

response = requests.request(
    "PATCH",
    url,
    headers=headers,
    data=json.dumps(payload)
)
```


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