OpenAPI
Overview
openapi.php is the JSON API endpoint based on the OpenAPI specification.
The API uses the existing API keys:
- Full API key:
APIKEY - Read-only API key:
READONLYAPIKEY
Both global and tenant-level keys are supported.
The first implemented API object is extension. It provides a list endpoint returning the extension ID, extension number, extension name, and extension technology.
OpenAPI Specification
The OpenAPI specification is available from:
openapi.php openapi.php?spec=1 openapi.php/openapi.json openapi.php/swagger.json
The response is an OpenAPI 3.0.3 JSON document.
Authentication
The API key can be provided in any of these ways.
Query Parameter
openapi.php/extensions?tenant=TENANTCODE&key=APIKEY
Header
X-API-Key: APIKEY
Bearer Token
Authorization: Bearer APIKEY
API Key Scope
Tenant API Key
When using a tenant-level API key, the tenant parameter is required.
openapi.php/extensions?tenant=TENANTCODE&key=TENANT_API_KEY
Global API Key
When using a global API key, tenant is optional.
If tenant is provided, only that tenant's extensions are returned.
If tenant is omitted, extensions from all tenants are returned.
openapi.php/extensions?key=GLOBAL_API_KEY
List Extensions
Endpoint
GET openapi.php/extensions
Alternative compatibility format:
openapi.php?object=extension&action=list
Parameters
| Name | Required | Description |
|---|---|---|
key
|
Yes, unless using header authentication | Full or read-only API key |
tenant
|
Required for tenant keys | Tenant code or tenant name |
Example Request
curl "https://pbx.example.com/openapi.php/extensions?tenant=TENANTCODE&key=APIKEY"
Using header authentication:
curl \ -H "X-API-Key: APIKEY" \ "https://pbx.example.com/openapi.php/extensions?tenant=TENANTCODE"
Using bearer authentication:
curl \ -H "Authorization: Bearer APIKEY" \ "https://pbx.example.com/openapi.php/extensions?tenant=TENANTCODE"
Example Response
[
{
"id": 101,
"number": "100",
"name": "Reception",
"tech": "PJSIP"
},
{
"id": 102,
"number": "101",
"name": "Office",
"tech": "SIP"
}
]
Response Fields
| Field | Type | Description |
|---|---|---|
id
|
integer | Extension internal ID |
number
|
string | Extension number |
name
|
string | Extension display name |
tech
|
string | Extension technology, for example SIP, PJSIP, VIRTUAL, or CUSTOM
|
Error Responses
Errors are returned as JSON.
Missing API Key
{
"error": {
"code": "missing_api_key",
"message": "Missing API key."
}
}
Invalid API Key
{
"error": {
"code": "invalid_api_key",
"message": "Invalid API key."
}
}
Tenant Not Found
{
"error": {
"code": "tenant_not_found",
"message": "Tenant not found."
}
}
Endpoint Not Found
{
"error": {
"code": "not_found",
"message": "Endpoint not found."
}
}
Method Not Allowed
Only GET is currently supported.
{
"error": {
"code": "method_not_allowed",
"message": "Only GET is supported by this endpoint."
}
}
Notes
- Read-only API keys are allowed for the extension list endpoint.
- The endpoint does not create a web session.
- Responses are always JSON.
- CORS is enabled with
Access-Control-Allow-Origin: *. OPTIONSrequests return HTTP204for browser preflight support.