# Attach a number to a SIP trunk

Attaches a number to a SIP trunk.

```http
POST https://api.pozy.ai/v1/phone-numbers/{id}/sip-trunk
```

- Area: Phone & voice / Voice
- Auth: Authorization: Bearer pz_live_...

## Path parameters

- `id` (string, required)

## Request body

Content type: `application/json`

- `trunkId`, string, required

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/phone-numbers/6bfebd43ddc270f6d2c56fc5/sip-trunk" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "trunkId": "63c129d65b39ac7f72332672"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/phone-numbers/6bfebd43ddc270f6d2c56fc5/sip-trunk", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    trunkId: "63c129d65b39ac7f72332672"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.post(
    "https://api.pozy.ai/v1/phone-numbers/6bfebd43ddc270f6d2c56fc5/sip-trunk",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "trunkId": "63c129d65b39ac7f72332672",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `attached`, boolean
- `phoneNumber`, string
- `trunkId`, string

```json
{
  "attached": true,
  "phoneNumber": "+14155550123",
  "trunkId": "63c129d65b39ac7f72332672"
}
```
