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

# Daily (API)

> Set up the Unpod side of a Daily integration over the REST API - create a SIP trunk to your Daily SIP dial-in room and attach your number.

The **programmatic** path for the **Unpod side**: create a SIP trunk pointed at your
**Daily SIP dial-in** address and attach your number. The trunk's **origin endpoint** is
what Daily uses to reach Unpod - see the [Dashboard guide](/telephony/integrations/daily/dashboard)
for the Daily-side setup.

<Note>
  **Base URL:** `https://unpod.ai/api/v2/platform/`
  Every request needs `Authorization: Token <your-api-key>` and an `Org-Handle` header.
  See [Authentication](/api/get-started/authentication).
</Note>

## Prerequisites

* An Unpod **API Token** and **Org-Handle**.
* A number in your org (we'll fetch its `id` below).
* A Daily room with **SIP dial-in enabled** - note its `sip_uri`
  (`sip:<endpoint>@<your-subdomain>.sip.daily.co`).

## 1. Find your number

```bash cURL theme={null}
curl https://unpod.ai/api/v2/platform/telephony/numbers/ \
  -H "Authorization: Token $UNPOD_TOKEN" \
  -H "Org-Handle: $ORG_HANDLE"
```

```json Response (200) theme={null}
{
  "status_code": 200,
  "message": "Telephony numbers fetched successfully.",
  "data": [
    { "id": 501, "number": "+15551234567", "state": "NOT_ASSIGNED", "active": true }
  ]
}
```

<Card title="List Numbers reference" icon="hash" href="/telephony/numbers/list-numbers">
  Full request/response schema.
</Card>

## 2. Create the SIP trunk to Daily

Point the trunk's `sip_url` at your Daily room's `sip_uri`. One trunk carries both inbound and outbound.

```bash cURL theme={null}
curl -X POST https://unpod.ai/api/v2/platform/telephony/trunks/ \
  -H "Authorization: Token $UNPOD_TOKEN" \
  -H "Org-Handle: $ORG_HANDLE" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Daily trunk",
    "sip_url": "sip:endpoint@your-subdomain.sip.daily.co",
    "transport": "udp",
    "port": "5060"
  }'
```

```json Response (201) theme={null}
{
  "status_code": 201,
  "message": "Trunk created successfully.",
  "data": { "id": 21, "name": "Daily trunk", "sip_url": "sip:endpoint@your-subdomain.sip.daily.co", "transport": "udp", "port": "5060", "active": true }
}
```

<Card title="Create Trunk reference" icon="plus-circle" href="/telephony/trunks/create-trunk">
  All request fields (`sip_url`, `auth_username`, `auth_password`, `transport`, `port`, `source_ips`).
</Card>

## 3. Attach your number to the trunk

Map the number from step 1 (its `id`) to the trunk from step 2 (its `id`). The response
returns the **origin endpoint** - the address + creds Daily uses to reach Unpod.

```bash cURL theme={null}
curl -X POST https://unpod.ai/api/v2/platform/telephony/trunks/21/attach-numbers/ \
  -H "Authorization: Token $UNPOD_TOKEN" \
  -H "Org-Handle: $ORG_HANDLE" \
  -H "Content-Type: application/json" \
  -d '{ "number_ids": [501] }'
```

```json Response (201) theme={null}
{
  "status_code": 201,
  "message": "Numbers mapped to trunk.",
  "data": {
    "trunk_id": 21,
    "origin_endpoint": {
      "ingress": "sip:sip-lb1.unpod.tel",
      "dids": ["+15551234567"],
      "accepted_source_ips": [],
      "region": "ap-south"
    }
  }
}
```

<Card title="Attach Numbers reference" icon="link" href="/telephony/trunks/attach-numbers">
  Path params, request body, and the full origin-endpoint response.
</Card>

## Configure the Daily side

Enable **SIP dial-in** on your Daily room. This is **Daily's own API** (`api.daily.co`,
`Authorization: Bearer` with your Daily key). Run this **first** - the `sip_uri` it returns
is exactly what you put in the trunk's `sip_url` in step 2.

### 4. Enable SIP dial-in on the room

```bash cURL theme={null}
curl -X POST https://api.daily.co/v1/rooms/your-room-name \
  -H "Authorization: Bearer $DAILY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "properties": {
      "sip": {
        "sip_mode": "dial-in",
        "display_name": "SIP Participant",
        "num_endpoints": 1,
        "codecs": { "audio": ["OPUS"] }
      }
    }
  }'
```

```json Response theme={null}
{
  "config": {
    "sip_uri": { "endpoint": "sip:123456780@example.sip.daily.co" },
    "sip": { "sip_mode": "dial-in", "display_name": "SIP Participant" }
  }
}
```

`config.sip_uri.endpoint` is the address you point the Unpod trunk at (the `sip_url` in
step 2). Route that room to your agent so calls from Unpod connect to it.

<Card title="Daily SIP dial-in docs" icon="arrow-up-right-from-square" href="https://docs.daily.co/guides/products/dial-in-dial-out/sip">
  Full room `sip` properties + `sip_uri` response (this is Daily's API).
</Card>

## Troubleshooting

| Status              | Meaning           | Fix                                     |
| ------------------- | ----------------- | --------------------------------------- |
| `400` on `/trunks/` | Missing `sip_url` | Send your Daily room `sip_uri`          |
| `400` on attach     | Number not in org | Use a valid `id` from **GET /numbers/** |
| `401`               | Bad Unpod token   | Verify `Authorization: Token …`         |
| `403`               | Wrong org         | Verify the `Org-Handle` header          |

<CardGroup cols={2}>
  <Card title="No-code version" icon="layout-dashboard" href="/telephony/integrations/daily/dashboard">
    The same flow in the Studio UI.
  </Card>

  <Card title="All platforms" icon="blocks" href="/telephony/integrations/overview">
    Back to the integrations overview.
  </Card>
</CardGroup>
