Create an outbound SIP trunk
curl --request POST \
--url https://voice-api.onclarity.com/v1/projects/{projectId}/telephony/outbound-trunks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Carrier primary",
"address": "sip.carrier.example.com",
"auth": {
"type": "basic",
"username": "clarity-outbound",
"password": "example-password-not-real"
},
"transport": "tls",
"media_encryption": "enabled"
}
'import requests
url = "https://voice-api.onclarity.com/v1/projects/{projectId}/telephony/outbound-trunks"
payload = {
"name": "Carrier primary",
"address": "sip.carrier.example.com",
"auth": {
"type": "basic",
"username": "clarity-outbound",
"password": "example-password-not-real"
},
"transport": "tls",
"media_encryption": "enabled"
}
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: 'Carrier primary',
address: 'sip.carrier.example.com',
auth: {
type: 'basic',
username: 'clarity-outbound',
password: 'example-password-not-real'
},
transport: 'tls',
media_encryption: 'enabled'
})
};
fetch('https://voice-api.onclarity.com/v1/projects/{projectId}/telephony/outbound-trunks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"outbound_trunk": {
"id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
"project_id": "3f6c1a52-8d0e-4b8f-9a51-2c7d4e0b9f13",
"name": "Carrier primary",
"address": "sip.carrier.example.com",
"auth": {
"type": "basic",
"username": "clarity-outbound",
"has_secret": true
},
"status": "active",
"transport": "tls",
"media_encryption": "enabled",
"created_at": "Mon Nov 09 2026 13:58:20 GMT+0000 (Coordinated Universal Time)",
"updated_at": "Mon Nov 09 2026 13:58:20 GMT+0000 (Coordinated Universal Time)"
}
}{
"error": "Invalid or revoked token"
}{
"error": "publish_capability_required",
"code": "PUBLISH_CAPABILITY_REQUIRED"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "Outbound trunk \"Carrier primary\" already exists"
}{
"error": "name: String must contain at least 1 character(s)",
"issues": [
{
"path": "name",
"code": "too_small",
"message": "String must contain at least 1 character(s)",
"minimum": 1
}
]
}Outbound SIP trunks
Create an outbound SIP trunk
Adds a SIP endpoint to dial out through. Assign it to a phone number with outbound_trunk_ids to use it. With auth.type: basic, send the username and password; the password is write-only, and responses show has_secret instead. Needs the publish permission, which organization API keys carry.
POST
/
v1
/
projects
/
{projectId}
/
telephony
/
outbound-trunks
Create an outbound SIP trunk
curl --request POST \
--url https://voice-api.onclarity.com/v1/projects/{projectId}/telephony/outbound-trunks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Carrier primary",
"address": "sip.carrier.example.com",
"auth": {
"type": "basic",
"username": "clarity-outbound",
"password": "example-password-not-real"
},
"transport": "tls",
"media_encryption": "enabled"
}
'import requests
url = "https://voice-api.onclarity.com/v1/projects/{projectId}/telephony/outbound-trunks"
payload = {
"name": "Carrier primary",
"address": "sip.carrier.example.com",
"auth": {
"type": "basic",
"username": "clarity-outbound",
"password": "example-password-not-real"
},
"transport": "tls",
"media_encryption": "enabled"
}
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: 'Carrier primary',
address: 'sip.carrier.example.com',
auth: {
type: 'basic',
username: 'clarity-outbound',
password: 'example-password-not-real'
},
transport: 'tls',
media_encryption: 'enabled'
})
};
fetch('https://voice-api.onclarity.com/v1/projects/{projectId}/telephony/outbound-trunks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"outbound_trunk": {
"id": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
"project_id": "3f6c1a52-8d0e-4b8f-9a51-2c7d4e0b9f13",
"name": "Carrier primary",
"address": "sip.carrier.example.com",
"auth": {
"type": "basic",
"username": "clarity-outbound",
"has_secret": true
},
"status": "active",
"transport": "tls",
"media_encryption": "enabled",
"created_at": "Mon Nov 09 2026 13:58:20 GMT+0000 (Coordinated Universal Time)",
"updated_at": "Mon Nov 09 2026 13:58:20 GMT+0000 (Coordinated Universal Time)"
}
}{
"error": "Invalid or revoked token"
}{
"error": "publish_capability_required",
"code": "PUBLISH_CAPABILITY_REQUIRED"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "Outbound trunk \"Carrier primary\" already exists"
}{
"error": "name: String must contain at least 1 character(s)",
"issues": [
{
"path": "name",
"code": "too_small",
"message": "String must contain at least 1 character(s)",
"minimum": 1
}
]
}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.