# Attach phone number to agent (/docs/api-reference/phone-numbers/attachPhoneNumber)

> Attach an account-owned phone number to an existing agent.



**POST** `/phone_number/attach`

Attach an account-owned phone number to an existing agent.

```yaml
operationId: attachPhoneNumber
requestBody:
  required: true
  content:
    application/json:
      schema:
        type: object
        required:
          - phone_number_id
          - agent_id
        properties:
          phone_number_id:
            type: integer
            description: ID of the phone number to attach.
            example: 23
          agent_id:
            type: integer
            description: ID of the agent to attach the phone number to.
            example: 158910
responses:
  '200':
    description: Phone number attached.
    content:
      application/json:
        schema:
          type: object
          properties:
            phone_number_id:
              type: integer
            message:
              type: string
        example:
          phone_number_id: 23
          message: Phone Number +15551234567 Attach Successfully.
```

**Python SDK**

```python
import os
from omnidimension import Client

# Initialize the client
api_key = os.environ.get('OMNIDIM_API_KEY')
client = Client(api_key)

# Attach a phone number to an agent
phone_number_id = 123  # Replace with your phone number ID
agent_id = 456  # Replace with your agent ID
response = client.phone_number.attach(phone_number_id, agent_id)
print(response)
```

**curl**

```bash
curl -X POST "https://backend.omnidim.io/api/v1/phone_number/attach" \
  -H "Authorization: Bearer $OMNIDIM_API_KEY"
```
