---
title: "Create destination"
method: POST
path: "/api/v1/purchases/{purchase_id}/destinations"
tags: ["Inbound Destinations"]
---

# Create destination

`POST /api/v1/purchases/{purchase_id}/destinations`

## Request

- Base URL: `https://app.didlogic.com`
- URL: `https://app.didlogic.com/api/v1/purchases/{purchase_id}/destinations`
- Auth: HTTP bearer

Add a new inbound destination for a DID number.

**Destination Types:**
- SIP addresses (e.g., `sip:user@domain.com`)
- Phone numbers (e.g., `18005551234`)
- Extensions (SIP accounts created within didlogic)

**Parameters:**
- `destination` - The forwarding target (SIP URI or phone number)
- `dialing_type` - Dialing mode: `sequence`, `ring_all` or `random`
- `callhunt` - Legacy two-state mirror of `dialing_type` (boolean); ignored when `dialing_type` is sent
- `active` - Enable/disable this destination (boolean)
- `transport` - Transport type code (1 = SIP URI, 4 = Phone number, 5 = SIP device, 10 = Webphone,
  12 = WebSocket)

`transport: 12` streams the call to a WebSocket endpoint of your own instead of
ringing a phone or a SIP device, and `destination` is then its public `wss://`
URL. It is available only to accounts enabled for voice streaming; any other
account is refused with `422`. The endpoint has to speak our protocol — see
[WebSocket Calls](https://docs.didlogic.com/docs/guides/apps-developer-tools/websocket-calls).

`did_destination.id` feeds purchases_destinations_update and purchases_destinations_destroy as `id`.
Rows: purchases_destinations_index.

## Path parameters

- `purchase_id` string, required

## Request body

- object
  - `destination` object, required
    - `destination` string: Forwarding target (SIP URI or phone number). Required for every transport except Webphone (10), which rings your webphone and takes no address.
    - `callhunt` boolean: Enable callhunt (ring all). Ignored when `destination[dialing_type]` is sent.
    - `dialing_type` 'sequence' | 'ring_all' | 'random': Dialing mode of the group this destination belongs to: `sequence` tries it alone, `ring_all` dials the whole group at once, `random` picks group members in a random order. Mirrors `callhunt` (`ring_all` maps to true). Takes precedence over `callhunt`.
    - `active` boolean: Activate this destination
    - `transport` 1 | 4 | 5 | 10 | 12, required: Transport type (1=SIP URI, 4=Phone number, 5=SIP device, 10=Webphone, 12=WebSocket). 12 requires an account enabled for voice streaming.

## Response `200`

Successfully creates destination and returns destination details

- object
  - `did_destination` object, required: Created destination details
    - `id` integer, required: Destination ID
    - `transport` 1 | 4 | 5 | 10 | 12, required: Transport type
    - `destination` string, required: Forwarding target
    - `priority` integer, required: Destination priority
    - `callhunt` boolean, required: Whether callhunt is enabled
    - `dialing_type` 'sequence' | 'ring_all' | 'random', required: Dialing mode of the group this destination belongs to: `sequence` tries it alone, `ring_all` dials the whole group at once, `random` picks group members in a random order. Mirrors `callhunt` (`ring_all` maps to true).
    - `active` boolean, required: Whether destination is active
    - `ai_agent_id` integer, nullable, required: Linked AI agent ID (null when the destination is not an AI agent)
    - `ai_agent_name` string, nullable, required: Linked AI agent name (null when the destination is not an AI agent)

## Other responses

- `403`: Returns 403 error when API token is incorrect
- `404`: Returns the 404 error envelope {"errors":{"base":["data not found"]}} when neither the DID phone number nor its inventory id matches a DID you own.
- `422`: Returns 422 error with validation messages when destination is incorrect

---

[API](https://skmtc.dev/didlogic/apis/get-started.md) · [All operations](https://skmtc.dev/didlogic/apis/get-started/llms.txt) · [OpenAPI document](https://skmtc.dev/didlogic/apis/get-started/revisions/dc972d592b34?raw)
