Skip to content

Create a caller identity (user, pbx)

post /caller-identities

Gives an owner (the PBX, a user, a group or a SIP device) a phone number to present as its caller ID, optionally with a suffix.

Needed: phone_number_id (a phone number of this PBX), owner_type and owner_id (a record of that type in this PBX; for pbx the PBX's own id). suffix follows the same rule as in Cockpit: for a user or SIP device 1 to 5 digits, for a group or the PBX up to 5 digits and an optional trailing *, and only a root phone number takes one. The same phone number with the same suffix cannot be given to the same owner twice (422). When order is left out the identity goes after the owner's last one.

Required scope. An API key needs the caller-identities:write scope. A user bearer token passes only for a user who may change the owner in Cockpit: write users for a user, write groups for a group, write sip devices for a SIP device, write settings for the PBX; otherwise 403. A key that only holds caller-identities can read but not write: 403.

Tenancy. The PBX is the key's or the user's own and cannot be sent in the body. A phone number or owner of another PBX answers 422. A write marks the PBX for a configuration push and is recorded in the change log under the API key.

Text fields. A name, label, prefix or announcement text that holds ${, $[, a line break or another control character (below 0x20, a tab excepted) is refused with 422 on that field, because the PBX dialplan would evaluate it. Free text such as comment, description and notes may hold line breaks.

HTTP: bearerAuth

User bearer token. Default authentication for customer-facing endpoints. Obtain a token by calling POST /login with your credentials, then send it on every subsequent request as Authorization: Bearer <token>. The token inherits the permissions and PBX scope of the authenticated user.

HTTP Authorization Scheme
bearer
Bearer format
Bearer <token>
HTTP: IntegrationApiKey

API key created on the Cockpit Integrations page (an "API key" integration). It is a bearer token owned by the customer's PBX and limited to the scopes selected when the key was created (e.g. phone-numbers, push-configuration).

Send it in the Authorization header:

Authorization: Bearer <api_key>

Manage keys (create / reveal / revoke) from Integrations → New integration → API key.

HTTP Authorization Scheme
bearer
accept header · string
example: application/json

Request body · required · application/json

Request schema
phone_number_idstring · uuid
A phone number of this PBX (not in the trash).
suffixstring | null
For a user or SIP device owner 1 to 5 digits; for a group or the PBX up to 5 digits and an optional trailing `*`. Only a root phone number takes a suffix.
labelstring | null
length: 0–255
owner_typestring
Whom the identity belongs to.
enum: pbx user group sip_device
owner_idstring · uuid
A record of that type in this PBX. For `pbx` it must be the PBX's own id.
orderinteger
Position among the owner's caller identities. Left out on create, it goes after the owner's last one.
≥ 1

Responses

Created. The caller identity.
Response schema
id*string · uuid
read-only
example: 550e8400-e29b-41d4-a716-446655440000
pbx_id*string · uuid
read-only
example: 550e8400-e29b-41d4-a716-446655440001
phone_number_id*string | null · uuid
example: 550e8400-e29b-41d4-a716-446655440002
suffixstring | null
Digits appended to the number. For a user or SIP device owner 1 to 5 digits; for a group or the PBX up to 5 digits and an optional trailing `*` (the caller's extension). Only a root phone number takes a suffix.
example: 23
labelstring | null
length: 0–255
example: Sales line
orderinteger
Position among the owner's caller identities.
example: 1
owner_type*string | null
enum: pbx user group sip_device
example: user
owner_id*string · uuid
The owner record. For `pbx` it is the PBX itself.
example: 550e8400-e29b-41d4-a716-446655440003
owner_namestring | null
Name of the owner. Present on reads and writes.
read-only
example: Alex Example
caller_identity_target_typestring
The stored form of `owner_type` (a class name). Kept for existing readers; use `owner_type`.
read-only
example: App\Models\User
caller_identity_target_idstring · uuid
Same as `owner_id`.
read-only
example: 550e8400-e29b-41d4-a716-446655440003
phone_numberobject
External DID owned by the PBX. The optional `handling_strategy` JSON column carries the inbound routing for the number (the previous top-level `prefix_to_add`/`prefix_to_remove`/`routing` fields live inside it now).
id*string · uuid
Phone number identifier
read-only
example: 550e8400-e29b-41d4-a716-446655440000
pbx_id*string · uuid
Pbx identifier (tenant)
example: 550e8400-e29b-41d4-a716-446655440001
default_carrier_idstring | null · uuid
Default outbound SIP carrier for calls placed via this number
example: 550e8400-e29b-41d4-a716-446655440002
fallback_carrier_idstring | null · uuid
Fallback SIP carrier used when the default carrier is unreachable
example: 550e8400-e29b-41d4-a716-446655440003
namestring | null
Human-readable label for the number
length: 0–64
example: Support line
languagestring | null
Announcement language for calls to this number (channel language). `null` inherits the system default; ISO 639 code otherwise.
length: 0–10
example: fr
number*string
Phone number in E.164 (without leading +) or local format
length: 0–15
example: 12125550100
international_prefixstring | null
International dialling prefix associated with the number
length: 0–15
example: 1
is_rootboolean
Whether this DID is a root number (parent of suffixed CIDs)
example: 1
is_activeboolean
Whether the number is provisioned and routable
example: 1
sync_sourcestring
Provisioning origin of this number
enum: manual provision
example: manual
handling_strategyobject | null
Optional inbound routing configuration. `type` discriminates the shape of `config`.
typestring
enum: default rewrite call_flow extension user sip_device
example: call_flow
default_callflow_idstring | null · uuid
no_ext_match_callflow_idstring | null · uuid
prefix_to_removestring | null
prefix_to_addstring | null
call_flow_idstring | null · uuid
extension_idstring | null · uuid
user_idstring | null · uuid
sip_device_idstring | null · uuid
usersarray<string>
Ids of the users this number may be used by as an outgoing number (the "assigned to" lists of the number in Cockpit). Present on show and on a write, not on the list.
read-only
[]string · uuid
groupsarray<string>
Ids of the groups assigned to the number. Present on show and on a write, not on the list.
read-only
[]string · uuid
sip_devicesarray<string>
Ids of the SIP devices assigned to the number. Present on show and on a write, not on the list.
read-only
[]string · uuid
number_and_namestring
Convenience label combining the number and its name
read-only
example: 12125550100 (Support line)
number_without_international_prefixstring
The number with its international prefix stripped
read-only
example: 2125550100
created_atstring | null · date-time
read-only
example: 2024-03-01T08:29:07Z
updated_atstring | null · date-time
read-only
example: 2024-03-01T08:29:07Z
Authorization Token Missing. This error is returned when the authorization token is missing.
Response schema
errorstring
Error message
example: Authorization Token is missing
Forbidden. The bearer token authenticated successfully but does not carry the scope this endpoint requires. Re-create the Integrations API key with the missing scope selected (Integrations > New integration > API key). On a write with a user bearer token, the user lacks the Cockpit permission the same change needs (the message names it).
Response schema
messagestring
Unprocessable Entity. The write failed validation. `errors` maps each rejected field to its messages and `message` repeats the first one. Nothing was written.
Response schema
messagestring
The first validation message, repeated for convenience.
errorsobject
Field name to the list of messages for it.
Free-form object
Locked. A restore is running on the PBX, so changes to it are paused until the restore finishes. Nothing was saved. Retry after the number of seconds in the `Retry-After` header. Reads are not affected.
Response schema
messagestring
Too Many Requests. The rate limit for this action has been exceeded. Retry after the window indicated by the Retry-After header.
Response schema
messagestring
Server error. An unexpected condition was encountered on the server and the request could not be completed. The body is a generic JSON envelope with a `message` field. The response is logged on the server side; quote the request URL + timestamp when reporting an issue.
Response schema
messagestring
exceptionstring
Only present in non-production environments.
filestring
Only present in non-production environments.
lineinteger
Only present in non-production environments.
post https://cockpit.voxbi.com/api/v1/caller-identities
Base URL
Request sample
curl -X POST 'https://cockpit.voxbi.com/api/v1/caller-identities' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data '{"phone_number_id":"550e8400-e29b-41d4-a716-446655440002","owner_type":"user","owner_id":"550e8400-e29b-41d4-a716-446655440003","suffix":"23","label":"Sales line"}'
const response = await fetch('https://cockpit.voxbi.com/api/v1/caller-identities', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${YOUR_TOKEN}`,
  },
  body: JSON.stringify({
    "phone_number_id": "550e8400-e29b-41d4-a716-446655440002",
    "owner_type": "user",
    "owner_id": "550e8400-e29b-41d4-a716-446655440003",
    "suffix": "23",
    "label": "Sales line"
}),
});

const data = await response.json();
console.log(data);
import requests

response = requests.post('https://cockpit.voxbi.com/api/v1/caller-identities',
    headers={'Authorization': f'Bearer {YOUR_TOKEN}'},
    json={
    "phone_number_id": "550e8400-e29b-41d4-a716-446655440002",
    "owner_type": "user",
    "owner_id": "550e8400-e29b-41d4-a716-446655440003",
    "suffix": "23",
    "label": "Sales line"
}
)
response.raise_for_status()
data = response.json()
print(data)
<?php
$context = stream_context_create([
    'http' => [
        'method'  => 'POST',
        'header'  => "Content-Type: application/json\r\nAuthorization: Bearer YOUR_TOKEN",
        'content' => '{
    \"phone_number_id\": \"550e8400-e29b-41d4-a716-446655440002\",
    \"owner_type\": \"user\",
    \"owner_id\": \"550e8400-e29b-41d4-a716-446655440003\",
    \"suffix\": \"23\",
    \"label\": \"Sales line\"
}',
    ],
]);

$response = file_get_contents('https://cockpit.voxbi.com/api/v1/caller-identities', false, $context);
$data = json_decode($response, true);
print_r($data);
Sample request
{ … }
"phone_number_id": "550e8400-e29b-41d4-a716-446655440002",
"owner_type": "user",
"owner_id": "550e8400-e29b-41d4-a716-446655440003",
"suffix": "23",
"label": "Sales line"
}
{ … }
"id": "550e8400-e29b-41d4-a716-446655440000",
"pbx_id": "550e8400-e29b-41d4-a716-446655440001",
"phone_number_id": "550e8400-e29b-41d4-a716-446655440002",
"suffix": "23",
"label": "Sales line",
"order": 1,
"owner_type": "user",
"owner_id": "550e8400-e29b-41d4-a716-446655440003",
"owner_name": "Alex Example",
"caller_identity_target_type": "App\Models\User",
"caller_identity_target_id": "550e8400-e29b-41d4-a716-446655440003"
}
Host string
example: cockpit.voxbi.com
Date string
example: Mon, 16 Oct 2023 14:08:48 GMT
Connection string
example: close
Cache-Control string
example: no-cache, private
Content-Type string
example: application/json
X-RateLimit-Limit integer
example: 60
X-RateLimit-Remaining integer
example: 59
Vary string
example: Origin
{ … }
"error": "Authorization Token is missing"
}
Cache-Control string
example: private, must-revalidate
Connection string
example: keep-alive
Content-Type string
example: application/json
Vary string
example: Origin
X-RateLimit-Limit integer
Max requests allowed in the current rate-limit window.
example: 60
X-RateLimit-Remaining integer
Requests remaining in the current rate-limit window.
example: 57
{ … }
"message": "Invalid ability provided."
}
Content-Type string
example: application/json
{ … }
"message": "The phone number id field is required.",
"errors": { … }
"phone_number_id": [ … ],
"The phone number id field is required."
],
"owner_type": [ … ],
"The owner type field is required."
],
"owner_id": [ … ]
"The owner id field is required."
]
}
}
Content-Type string
example: application/json
{ … }
"message": "A restore is running on this PBX. Changes are paused until it finishes."
}
Retry-After integer
Seconds to wait before retrying the write.
example: 30
{ … }
"message": "Too Many Attempts."
}
Retry-After integer
Seconds to wait before retrying.
example: 60
Content-Type string
example: application/json
{ … }
"message": "Server Error"
}