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

# Create Trunk

> Create a SIP trunk (carrier credential) for your organization

Create a SIP trunk - your carrier credential. Once created, [map numbers to it](/telephony/trunks/attach-numbers)
to receive inbound calls. The response masks `auth_password`.

<Note>
  **Prerequisites:** API Token + Org-Handle. See [Authentication](/api/get-started/authentication).
</Note>

### Headers

| Name          | Type   | Required | Description                |
| ------------- | ------ | -------- | -------------------------- |
| Authorization | string | Yes      | `Token <your-api-key>`     |
| Org-Handle    | string | Yes      | Organization domain handle |
| Content-Type  | string | Yes      | `application/json`         |

### Request body

| Field          | Type      | Required | Description                                 |
| -------------- | --------- | -------- | ------------------------------------------- |
| name           | string    | Yes      | Display name for the trunk                  |
| sip\_url       | string    | Yes      | Carrier SIP URL / host                      |
| auth\_username | string    | No       | SIP auth username                           |
| auth\_password | string    | No       | SIP auth password (masked in responses)     |
| transport      | string    | No       | `tcp` (default), `udp`, or `tls`            |
| port           | string    | No       | SIP port (default `5060`)                   |
| source\_ips    | string\[] | No       | Carrier source-IP allow-list (CIDR allowed) |

<ResponseExample>
  ```json 201 theme={null}
  {
    "status_code": 201,
    "message": "Trunk created successfully.",
    "data": {
      "id": 21,
      "name": "My Carrier Trunk",
      "sip_url": "sip:carrier.net",
      "transport": "tcp",
      "port": "5060",
      "auth_username": "user",
      "auth_password": "pass",
      "allowed_ips": "1.2.3.4,5.6.7.0/24",
      "active": true,
      "org_handle": "acme.co"
    }
  }
  ```

  ```json 400 theme={null}
  {
    "status_code": 400,
    "message": "Invalid trunk payload",
    "error": { "sip_url": ["This field is required."] }
  }
  ```
</ResponseExample>

```bash cURL theme={null}
curl -s -X POST "https://unpod.ai/api/v2/platform/telephony/trunks/" \
  -H "Authorization: Token <your-api-key>" \
  -H "Org-Handle: <your-org-handle>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Carrier Trunk",
    "sip_url": "sip:carrier.net",
    "auth_username": "user",
    "auth_password": "pass",
    "transport": "tcp",
    "port": "5060",
    "source_ips": ["1.2.3.4", "5.6.7.0/24"]
  }'
```

<Tip>Copy the returned `id` - you'll need it to attach numbers, fetch, or delete the trunk.</Tip>


## OpenAPI

````yaml POST /api/v2/platform/telephony/trunks/
openapi: 3.0.3
info:
  title: Unpod API
  description: REST API for Unpod Voice AI Platform
  version: 2.0.0
servers:
  - url: https://unpod.ai/
    description: QA
  - url: https://unpod.ai/
    description: Production
security: []
tags:
  - name: Organisation
  - name: Spaces
  - name: Agents
  - name: Tasks
  - name: Runs
  - name: Call Logs
  - name: Analytics
  - name: Providers
  - name: Bridges
  - name: Numbers
  - name: Trunks
  - name: Telephony
  - name: Billing
paths:
  /api/v2/platform/telephony/trunks/:
    post:
      tags:
        - Trunks
      summary: Create Trunk
      operationId: createTrunk
      parameters:
        - $ref: '#/components/parameters/OrgHandle'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - sip_url
              properties:
                name:
                  type: string
                  example: My Carrier Trunk
                sip_url:
                  type: string
                  description: Carrier SIP URL / host.
                  example: sip:carrier.net
                auth_username:
                  type: string
                  example: user
                auth_password:
                  type: string
                  example: pass
                transport:
                  type: string
                  enum:
                    - tcp
                    - udp
                    - tls
                  default: tcp
                  example: tcp
                port:
                  type: string
                  default: '5060'
                  example: '5060'
                source_ips:
                  type: array
                  description: Carrier source IP allow-list (CIDR allowed).
                  items:
                    type: string
                  example:
                    - 1.2.3.4
                    - 5.6.7.0/24
            example:
              name: My Carrier Trunk
              sip_url: sip:carrier.net
              auth_username: user
              auth_password: pass
              transport: tcp
              port: '5060'
              source_ips:
                - 1.2.3.4
                - 5.6.7.0/24
      responses:
        '201':
          description: Trunk created (auth_password masked in response)
          content:
            application/json:
              example:
                status_code: 201
                message: Trunk created successfully.
                data:
                  id: 21
                  name: My Carrier Trunk
                  sip_url: sip:carrier.net
                  transport: tcp
                  port: '5060'
                  auth_username: user
                  auth_password: pass
                  allowed_ips: 1.2.3.4,5.6.7.0/24
                  active: true
                  org_handle: acme.co
        '400':
          description: Invalid trunk payload
          content:
            application/json:
              example:
                status_code: 400
                message: Invalid trunk payload
                error:
                  sip_url:
                    - This field is required.
        '401':
          $ref: '#/components/responses/Unauthorized'
      security:
        - TokenAuth: []
components:
  parameters:
    OrgHandle:
      name: Org-Handle
      in: header
      required: true
      schema:
        type: string
        example: unpod.tv
      description: Organization domain handle
  responses:
    Unauthorized:
      description: Unauthorized - Invalid or missing API token
      content:
        application/json:
          example:
            status_code: 401
            message: Authentication credentials were not provided.
  securitySchemes:
    TokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Format: Token <your-api-key>'

````