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

# Create Phone Number

## Create Phone Number

Purchase and create a new phone number, optionally associating it with an agent.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.example.com/api/v1/phone_numbers" \
    -H "X-API-Key: your-api-key-here" \
    -H "Content-Type: application/json" \
    -d '{
      "phone_number": "+1234567890",
      "label": "Main Number",
      "provider": "twilio",
      "agent_id": "123"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.example.com/api/v1/phone_numbers', {
    method: 'POST',
    headers: {
      'X-API-Key': 'your-api-key-here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      phone_number: '+1234567890',
      label: 'Main Number',
      provider: 'twilio',
      agent_id: '123'
    })
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  headers = {
      'X-API-Key': 'your-api-key-here',
      'Content-Type': 'application/json'
  }

  payload = {
      'phone_number': '+1234567890',
      'label': 'Main Number',
      'provider': 'twilio',
      'agent_id': '123'
  }

  response = requests.post(
      'https://api.example.com/api/v1/phone_numbers',
      headers=headers,
      json=payload
  )

  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "status": {
      "code": 201,
      "message": "Phone number created successfully"
    },
    "data": {
      "id": 1,
      "phone_number": "+1234567890",
      "label": "Main Number",
      "provider": "twilio",
      "elevenlabs_phone_number_id": "phone_xyz",
      "agent_id": 123,
      "agent_name": "Customer Support Agent",
      "user_id": 1,
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:30:00Z"
    }
  }
  ```
</ResponseExample>

<OpenApiExplorer />
