This API endpoint allows you to assign a phone number to a specific SIP trunk. Once assigned, all inbound calls to that phone number will be routed through the designated trunk according to your trunk's configuration.
Important: The phone number must already be in your account inventory. You can purchase numbers using the Purchase Number endpoint before assigning them to a trunk.
HTTP Request
https://api.vobiz.ai/api/v1/account/{ACCOUNT_ID}/numbers/{PHONE_NUMBER}/assignURL Encoding Notice:
Always encode the phone number in the URL. Use %2B instead of the + symbol. For example:%2B912271264217 (not +912271264217). Failure to encode properly may result in a 404 error.
Authentication Required:
- • X-Auth-ID: Your account ID (e.g., MA_BN2MZ1VV)
- • X-Auth-Token: Your account Auth Token
- • Content-Type: application/json
URL Parameters
Path Parameters
| Name | Type | Description |
|---|---|---|
ACCOUNT_IDRequired | string | Your unique Vobiz account identifier (e.g., MA_BN2MZ1VV). Must match your X-Auth-ID header. |
PHONE_NUMBERRequired | string | The phone number to assign, URL-encoded. Use %2B instead of + (e.g., %2B912271264217). |
Request Body
Request Parameters
| Name | Type | Description |
|---|---|---|
trunk_group_idRequired | string (UUID) | The UUID of the trunk to which you want to assign this phone number (e.g., e3e55a78-1234-5678-90ab-cdef12345678). |
{
"trunk_group_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}Response
On successful assignment, the API returns a 204 No Content status with no response body. This indicates the number has been successfully linked to the trunk.
HTTP/1.1 204 No Content
Date: Thu, 23 Jan 2026 07:07:24 GMT
Server: Vobiz API GatewayError Responses
{
"error": "Number not found",
"message": "The phone number could not be found. Ensure it is URL-encoded correctly."
}{
"error": "invalid request",
"message": "This number is already assigned to a trunk."
}Examples
cURL - Assign Number to Trunk
curl -X POST "https://api.vobiz.ai/api/v1/account/{ACCOUNT_ID}/numbers/%2B1234567890/assign" \
-H "X-Auth-ID: {ACCOUNT_ID}" \
-H "X-Auth-Token: {AUTH_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"trunk_group_id": "{TRUNK_ID}"
}'Generic Template (Use Your Own Values)
curl -X POST "https://api.vobiz.ai/api/v1/account/{ACCOUNT_ID}/numbers/{PHONE_NUMBER}/assign" \
-H "X-Auth-ID: {ACCOUNT_ID}" \
-H "X-Auth-Token: {AUTH_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"trunk_group_id": "{TRUNK_ID}"
}'Quick Tips:
- • Success Code: Look for
204 No Contentresponse - • URL Encoding: Always use
%2Binstead of+in the phone number - • Trunk UUID: Get the trunk_group_id from the Create Trunk response
- • Number Format: Use E.164 format with country code (e.g., +1234567890)
Next Steps:
- • Verify the assignment by retrieving your trunk details
- • Configure your trunk's inbound routing rules
- • Test inbound calls to the assigned number
- • To remove the assignment, use the Unassign Number endpoint