Assign Number to Trunk

Link a phone number to a specific SIP Trunk for call routing.

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

POSThttps://api.vobiz.ai/api/v1/account/{ACCOUNT_ID}/numbers/{PHONE_NUMBER}/assign

URL 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

NameTypeDescription
ACCOUNT_IDRequired
stringYour unique Vobiz account identifier (e.g., MA_BN2MZ1VV). Must match your X-Auth-ID header.
PHONE_NUMBERRequired
stringThe phone number to assign, URL-encoded. Use %2B instead of + (e.g., %2B912271264217).

Request Body

Request Parameters

NameTypeDescription
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).
Request Body Example
{
  "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.

Success Response - 204 No Content
HTTP/1.1 204 No Content
Date: Thu, 23 Jan 2026 07:07:24 GMT
Server: Vobiz API Gateway

Error Responses

Error Response - 404 Not Found (Invalid Phone Number Format)
{
  "error": "Number not found",
  "message": "The phone number could not be found. Ensure it is URL-encoded correctly."
}
Error Response - 400 Bad Request (Number Already Assigned)
{
  "error": "invalid request",
  "message": "This number is already assigned to a trunk."
}

Examples

cURL - Assign Number to Trunk

cURL Request
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 Template
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 Content response
  • URL Encoding: Always use %2B instead 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