> ## 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.

# Update Phone Number

## Update Phone Number

Update a phone number's association with an agent or its label.

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT "https://api.example.com/api/v1/phone_numbers/1" \
    -H "X-API-Key: your-api-key-here" \
    -H "Content-Type: application/json" \
    -d '{
      "agent_id": "456",
      "label": "Updated Label"
    }'
  ```

  ```javascript JavaScript theme={null}
  const phoneNumberId = 1;
  const response = await fetch(`https://api.example.com/api/v1/phone_numbers/${phoneNumberId}`, {
    method: 'PUT',
    headers: {
      'X-API-Key': 'your-api-key-here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      agent_id: '456',
      label: 'Updated Label'
    })
  });

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

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

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

  payload = {
      'agent_id': '456',
      'label': 'Updated Label'
  }

  response = requests.put(
      f'https://api.example.com/api/v1/phone_numbers/{phone_number_id}',
      headers=headers,
      json=payload
  )

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

<ResponseExample>
  ```json Success Response theme={null}
  {
    "status": {
      "code": 200,
      "message": "Phone number updated successfully"
    },
    "data": {
      "id": 1,
      "phone_number": "+1234567890",
      "label": "Updated Label",
      "provider": "twilio",
      "elevenlabs_phone_number_id": "phone_xyz",
      "agent_id": 456,
      "agent_name": "Sales Agent",
      "user_id": 1,
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T11:00:00Z"
    }
  }
  ```
</ResponseExample>

<OpenApiExplorer />
