AiPBX

REST API v1 & Outbound Webhooks

AiPBX provides a stateless JSON REST API under /api/v1/* with OpenAPI 3.1 discovery (/api/v1/openapi.json), scoped Bearer API keys (apbx_<token>), CIDR IP allowlists, per-key rate limiting, and HMAC-SHA256 signed outbound webhooks.


Authentication & API Keys

  1. In the web portal, open Integrations → API Keys (/api-keys).
  2. Create an API key, choose its Scopes, optional Allowed IPs (CIDR), and Rate Limit (requests/min).
  3. Copy the generated apbx_... token (shown only once; stored as SHA-256 hash in sys_api_tokens).
  4. Pass the token in the Authorization header on every request:
Authorization: Bearer apbx_your_token_here
Content-Type: application/json

Available Scopes

Scope Description
pbx:read Read extensions, trunks, DID/outbound routes, IVRs, queues, ring groups, conferences, time conditions, and web widgets
pbx:write Create, update (PATCH/PUT), or delete PBX routing and extension resources
calls:read Read active channels (/api/v1/calls/active) and live queue board (/api/v1/queues/live)
calls:write Originate calls (/api/v1/calls/originate) and hangup channels (/api/v1/calls/hangup)
cdr:read Query Call Detail Records (/api/v1/cdr)
voicemail:read List voicemails (/api/v1/voicemails)
users:read / users:write Manage portal users and inspect RBAC roles
system:read / system:write Read health/info/audit log, trigger Asterisk sync (/api/v1/system/apply-sync), and manage webhooks/plugins
* Full administrative access to all /api/v1/* endpoints

Standard JSON Envelope

Every /api/v1/* response uses a uniform envelope:

{
  "success": true,
  "data": { ... },
  "error": null,
  "meta": {
    "request_id": "req_9f4b2c10e8a14d20"
  }
}

Core Endpoints (/api/v1/*)


Outbound Webhooks (X-AiPBX-Signature-256)

Configure outbound webhooks in Integrations → Webhooks (/webhooks). Events are queued non-blockingly in sys_webhook_queue and dispatched by aipbx-webhook-worker.service (bin/webhook_worker.php) with exponential backoff and SSRF protection.

Supported Events

Verifying Webhook Signatures

Each webhook request includes: