SIP DIDs
4 endpoints. Every path below is relative to the API base URL and already includes the /api/v1 prefix — see conventions for authentication, pagination, errors and idempotency.
| Endpoint | ||
|---|---|---|
| GET | /telephony/sip-trunks/{trunkId}/dids | List a trunk's DID mappings in match order, paginated |
| POST | /telephony/sip-trunks/{trunkId}/dids | Map an inbound DID or pattern on a trunk to a destination |
| PATCH | /telephony/sip-trunks/{trunkId}/dids/{id} | Update a DID mapping's pattern, match type, priority or destination, returning the refreshed row |
| DELETE | /telephony/sip-trunks/{trunkId}/dids/{id} | Delete a DID mapping, scoped to its trunk |
Endpoints
List a trunk's DID mappings in match order, paginated
GET/telephony/sip-trunks/{trunkId}/dids
- No scope is enforced in the handler — any valid key may call it.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
trunkId | string | yes |
bash
curl -X GET "$CALLAGENT_API_URL/telephony/sip-trunks/01JQ0000000000000000000000/dids" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks/01JQ0000000000000000000000/dids`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();php
<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks/01JQ0000000000000000000000/dids');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];python
import os, requests
response = requests.get(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks/01JQ0000000000000000000000/dids",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Responses
| Status | Body |
|---|---|
200 | data-wrapped array |
Errors
| Status | When it happens |
|---|---|
404 | No such trunk for this tenant |
Example response, generated from the schema:
json
{
"data": [
"string"
],
"meta": {
"page": 1,
"limit": 25,
"total": 1,
"pages": 1
}
}Map an inbound DID or pattern on a trunk to a destination
POST/telephony/sip-trunks/{trunkId}/dids
- No scope is enforced in the handler — any valid key may call it.
- camelCase body keys (matchType, phoneNumberId, destinationType);
numberis required unlesspatternis set
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
trunkId | string | yes |
bash
curl -X POST "$CALLAGENT_API_URL/telephony/sip-trunks/01JQ0000000000000000000000/dids" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks/01JQ0000000000000000000000/dids`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();php
<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks/01JQ0000000000000000000000/dids');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];python
import os, requests
response = requests.post(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks/01JQ0000000000000000000000/dids",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Responses
| Status | Body |
|---|---|
201 | data-wrapped SipDid |
Errors
| Status | When it happens |
|---|---|
404 | No such trunk for this tenant |
422 | Validation failed, or neither number nor pattern was supplied |
Example response, generated from the schema:
json
{
"data": {
"id": "01JQ0000000000000000000000",
"organization_id": "01JQ0000000000000000000000",
"sip_trunk_id": "01JQ0000000000000000000000",
"number": "+40712345678",
"pattern": "string",
"match_type": "string",
"priority": 1,
"label": "string",
"country": "string",
"phone_number_id": "01JQ0000000000000000000000",
"destination_type": "assistant",
"destination_id": "01JQ0000000000000000000000",
"destination_value": "string",
"enabled": true,
"metadata": {},
"created_at": "2026-01-01T12:00:00+00:00",
"updated_at": "2026-01-01T12:00:00+00:00"
}
}Update a DID mapping's pattern, match type, priority or destination, returning the refreshed row
PATCH/telephony/sip-trunks/{trunkId}/dids/{id}
- No scope is enforced in the handler — any valid key may call it.
- Request body keys are camelCase (e.g. matchType, phoneNumberId, destinationType), not the snake_case the rest of the wire format uses
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
trunkId | string | yes | |
id | string | yes |
bash
curl -X PATCH "$CALLAGENT_API_URL/telephony/sip-trunks/01JQ0000000000000000000000/dids/01JQ0000000000000000000000" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks/01JQ0000000000000000000000/dids/01JQ0000000000000000000000`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();php
<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks/01JQ0000000000000000000000/dids/01JQ0000000000000000000000');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];python
import os, requests
response = requests.patch(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks/01JQ0000000000000000000000/dids/01JQ0000000000000000000000",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Responses
| Status | Body |
|---|---|
200 | data-wrapped object |
Errors
| Status | When it happens |
|---|---|
404 | No such DID mapping on this trunk |
422 | Validation failed |
Example response, generated from the schema:
json
{
"data": {
"id": "01JQ0000000000000000000000",
"organization_id": "01JQ0000000000000000000000",
"sip_trunk_id": "01JQ0000000000000000000000",
"number": "+40712345678",
"pattern": "string",
"match_type": "string",
"priority": 1,
"label": "string",
"country": "string",
"phone_number_id": "01JQ0000000000000000000000",
"destination_type": "assistant",
"destination_id": "01JQ0000000000000000000000",
"destination_value": "string",
"enabled": true,
"metadata": {},
"created_at": "2026-01-01T12:00:00+00:00",
"updated_at": "2026-01-01T12:00:00+00:00"
}
}Delete a DID mapping, scoped to its trunk
DELETE/telephony/sip-trunks/{trunkId}/dids/{id}
- No scope is enforced in the handler — any valid key may call it.
- This response is not
data-wrapped.
Path parameters
| Name | Type | Required | Notes |
|---|---|---|---|
trunkId | string | yes | |
id | string | yes |
bash
curl -X DELETE "$CALLAGENT_API_URL/telephony/sip-trunks/01JQ0000000000000000000000/dids/01JQ0000000000000000000000" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks/01JQ0000000000000000000000/dids/01JQ0000000000000000000000`, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();php
<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks/01JQ0000000000000000000000/dids/01JQ0000000000000000000000');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];python
import os, requests
response = requests.delete(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks/01JQ0000000000000000000000/dids/01JQ0000000000000000000000",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Responses
| Status | Body |
|---|---|
204 | No content |
Errors
| Status | When it happens |
|---|---|
404 | No such DID mapping on this trunk |