Create an inbound SIP trunk
curl --request POST \
--url https://voice-api.onclarity.com/v1/projects/{projectId}/telephony/sip-trunks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Head office PBX",
"whitelist_cidrs": [
"203.0.113.10/32",
"198.51.100.0/24"
],
"secure_media": "disabled",
"sip_headers": [
{
"header": "X-Customer-Id",
"identifies_caller": true
}
]
}
'import requests
url = "https://voice-api.onclarity.com/v1/projects/{projectId}/telephony/sip-trunks"
payload = {
"name": "Head office PBX",
"whitelist_cidrs": ["203.0.113.10/32", "198.51.100.0/24"],
"secure_media": "disabled",
"sip_headers": [
{
"header": "X-Customer-Id",
"identifies_caller": True
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Head office PBX',
whitelist_cidrs: ['203.0.113.10/32', '198.51.100.0/24'],
secure_media: 'disabled',
sip_headers: [{header: 'X-Customer-Id', identifies_caller: true}]
})
};
fetch('https://voice-api.onclarity.com/v1/projects/{projectId}/telephony/sip-trunks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"sip_trunk": {
"id": "2d4f6a8c-0e1b-4c3d-8e5f-7a9b1c2d3e4f",
"project_id": "3f6c1a52-8d0e-4b8f-9a51-2c7d4e0b9f13",
"name": "Head office PBX",
"whitelist_cidrs": [
"203.0.113.10/32",
"198.51.100.0/24"
],
"allowed_e164s": [],
"status": "inactive",
"secure_media": "disabled",
"livekit_trunk_id": null,
"livekit_dispatch_rule_id": null,
"sip_headers": [
{
"header": "X-Customer-Id",
"identifies_caller": true
}
],
"created_at": "Mon Nov 09 2026 14:00:02 GMT+0000 (Coordinated Universal Time)",
"updated_at": "Mon Nov 09 2026 14:00:02 GMT+0000 (Coordinated Universal Time)"
}
}{
"error": "Invalid or revoked token"
}{
"error": "publish_capability_required",
"code": "PUBLISH_CAPABILITY_REQUIRED"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "SIP trunk \"Head office PBX\" already exists"
}{
"error": "whitelist_cidrs: invalid or catch-all CIDR",
"issues": [
{
"path": "whitelist_cidrs",
"code": "custom",
"message": "invalid or catch-all CIDR"
}
]
}Inbound SIP trunks
Create an inbound SIP trunk
Creates a trunk that accepts calls from the IP ranges in whitelist_cidrs. A new trunk starts inactive and takes no calls: bind at least one phone number to it (create or update a phone number with its sip_trunk_id), then activate it. Needs the publish permission, which organization API keys carry.
POST
/
v1
/
projects
/
{projectId}
/
telephony
/
sip-trunks
Create an inbound SIP trunk
curl --request POST \
--url https://voice-api.onclarity.com/v1/projects/{projectId}/telephony/sip-trunks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Head office PBX",
"whitelist_cidrs": [
"203.0.113.10/32",
"198.51.100.0/24"
],
"secure_media": "disabled",
"sip_headers": [
{
"header": "X-Customer-Id",
"identifies_caller": true
}
]
}
'import requests
url = "https://voice-api.onclarity.com/v1/projects/{projectId}/telephony/sip-trunks"
payload = {
"name": "Head office PBX",
"whitelist_cidrs": ["203.0.113.10/32", "198.51.100.0/24"],
"secure_media": "disabled",
"sip_headers": [
{
"header": "X-Customer-Id",
"identifies_caller": True
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Head office PBX',
whitelist_cidrs: ['203.0.113.10/32', '198.51.100.0/24'],
secure_media: 'disabled',
sip_headers: [{header: 'X-Customer-Id', identifies_caller: true}]
})
};
fetch('https://voice-api.onclarity.com/v1/projects/{projectId}/telephony/sip-trunks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"sip_trunk": {
"id": "2d4f6a8c-0e1b-4c3d-8e5f-7a9b1c2d3e4f",
"project_id": "3f6c1a52-8d0e-4b8f-9a51-2c7d4e0b9f13",
"name": "Head office PBX",
"whitelist_cidrs": [
"203.0.113.10/32",
"198.51.100.0/24"
],
"allowed_e164s": [],
"status": "inactive",
"secure_media": "disabled",
"livekit_trunk_id": null,
"livekit_dispatch_rule_id": null,
"sip_headers": [
{
"header": "X-Customer-Id",
"identifies_caller": true
}
],
"created_at": "Mon Nov 09 2026 14:00:02 GMT+0000 (Coordinated Universal Time)",
"updated_at": "Mon Nov 09 2026 14:00:02 GMT+0000 (Coordinated Universal Time)"
}
}{
"error": "Invalid or revoked token"
}{
"error": "publish_capability_required",
"code": "PUBLISH_CAPABILITY_REQUIRED"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "SIP trunk \"Head office PBX\" already exists"
}{
"error": "whitelist_cidrs: invalid or catch-all CIDR",
"issues": [
{
"path": "whitelist_cidrs",
"code": "custom",
"message": "invalid or catch-all CIDR"
}
]
}Authorizations
Your organization API key (it starts with anek_org_). The same key works on the Voice API and the Support API. See Authentication.
Body
application/json
Fields not listed here are ignored. Phone numbers are not set here: bind a number to the trunk with the number's sip_trunk_id.