Appearance
API reference
Everything the PBXsight UI does goes through this JSON API. New to it? Start with Automate with the API: a token, a saved test and a CI gate in three steps. This page lists every endpoint.
First step: create an API token on your Account page, then try GET /api/tests with it — the Automate with the API page walks through a full CI example.
Basics
Address. The same address you open the UI on, e.g. http://127.0.0.1:8080 (or https://… with HTTPS on). All endpoints start with /api/.
Logging in. Send an API token with every request:
sh
curl -H "Authorization: Bearer $PBXSIGHT_TOKEN" "$PBXSIGHT_URL/api/tests?limit=5"(Scripts can also log in with a user name and password and keep a cookie — see Browser sessions. Tokens are better: they don't log anyone out.)
Sending data. Bodies are JSON with Content-Type: application/json (file uploads: multipart/form-data). Unknown fields are rejected, so a typo gives an error instead of being ignored. Durations are strings like "30s", "10m", "2h"; times are ISO 8601 / RFC 3339 ("2026-11-30T14:10:48Z").
Roles. Each endpoint below names the lowest role it needs:
| Role | May |
|---|---|
| viewer | read everything except the admin pages: runs, results, exports, schedules, profiles, status |
| operator | also start, stop, label and delete tests; schedules; extension sets; connection tests |
| admin | also PBX profiles, licence, settings, users, the activity log and the support bundle |
A token has the role chosen when it was created (never more than its user's). Endpoints marked browser only — managing users, tokens and passwords — refuse every token, even an admin's.
Errors are JSON: {"error": "…", "details": ["…"]} — details lists every problem when there are several (e.g. invalid test settings).
| Status | Means |
|---|---|
| 200, 201, 202, 204 | OK, created, accepted (stop), done with no body (deletes) |
| 400 | invalid JSON, unknown field, bad id or parameter |
| 401 | not logged in, wrong or expired token |
| 402 | a test start refused: no valid licence |
| 403 | role too low, or a browser only endpoint called with a token |
| 404 | no such run, schedule, profile, set, user or token |
| 409 | conflicts: another test is running, the run isn't running (stop) or hasn't finished (export), profile in use |
| 410 | the per-second data of a run was removed by data retention |
| 415 | a body that isn't JSON (or a file upload) |
| 422 | the values were checked and refused — the reasons are in details |
| 429 | too many failed logins or wrong tokens from this address; Retry-After says how many seconds to wait |
| 500 | internal error (also written to the app log) |
Several PBX profiles. Lists show all profiles; add ?profile=ID to show one. Bodies take profile_id; it may be left out while there's only one profile. Details: ?profile=.
Endpoints at a glance
| Endpoint | Role | What it does | |
|---|---|---|---|
| Tests | POST /api/tests | operator | start a test (optionally wait for its verdict) |
GET /api/tests/{id}/result | viewer | verdict + exit code of a run (optionally wait) | |
GET /api/tests | viewer | list runs, newest first | |
GET /api/tests/{id} | viewer | one run with all its results | |
GET /api/tests/current | viewer | the run going on now | |
POST /api/tests/{id}/stop | operator | stop a running test | |
PATCH /api/tests/{id} | operator | label, keep, mark as baseline | |
DELETE /api/tests/{id} | operator | delete a run | |
GET /api/tests/{id}/samples, …/logs | viewer | per-second data, log files | |
| Export | GET /api/tests/{id}/export | viewer | HTML report, JSON, CSV |
GET /api/tests/export | viewer | all runs as CSV | |
| Schedules | POST /api/schedules/{id}/run | operator | run a saved test now (optionally wait) |
GET, POST, PUT, PATCH, DELETE /api/schedules… | viewer / operator | list and edit schedules | |
| Profiles | GET /api/profiles… | viewer | PBX profiles |
POST, PUT, DELETE /api/profiles… | admin | create, change, delete profiles | |
POST /api/profiles/test | operator | test a profile's connections | |
| Extensions | /api/extension-sets… | viewer / operator | list, upload, delete extension sets |
| Status | GET /api/health, /api/pbx/…, /api/license… | viewer | app, PBX and licence status |
| Capacity | GET /api/capacity?profile= | viewer | real peak load vs the measured limit: headroom, weekly trend |
| Settings | /api/settings/retention…, /api/settings/alerts… | admin | data retention, e-mail alerts |
| Admin | /api/users…, /api/tokens… | admin / any — browser only | users and API tokens |
GET /api/audit, GET /api/support-bundle | admin | activity log, support bundle | |
| Live | GET /ws | viewer | live updates every second (what the UI's charts use) |
Tests
Start a test
POST /api/tests · operator
Starts a test with the settings in the body. Only one test runs at a time.
sh
curl -s -H "$AUTH" -H 'Content-Type: application/json' "$PBXSIGHT_URL/api/tests" -d '{
"type": "call",
"profile_id": 1,
"extension_set_id": 3,
"call": {"destination": "9196", "callers": 10, "cps": 2, "hold_seconds": 30,
"mode": "total", "total_calls": 100}
}'Answer: 201 with the new run (as in Get a run; status is pending or running). Add ?wait=10m to wait for the end instead: the answer is then 200 with the result. wait is a duration up to 10m; wait=true means 10m.
Errors: 402 no valid licence · 409 a test is already running; stop it first · 422 the test was not started with every problem in details, e.g. cps 500 exceeds safety limit safety.max_cps (50) · 400 a bad wait (nothing is started).
Body:
| Field | |
|---|---|
type | registration, call, busy_hour, limit (find the limit), ivr (IVR / voicemail check) or watch |
profile_id | the PBX profile; may be left out while there's only one |
extension_set_id | the test extensions to use (not for watch) |
target_ip | optional: one of the addresses the profile's SIP host resolves to (e.g. one of several Kamailios); default: a random one |
criteria | optional: pass/fail criteria for this run only, with the keys of the profile's criteria (configuration). It replaces the profile's criteria: a criterion left out isn't checked |
registration / call / busy_hour / limit / ivr / watch | the test's settings — one object, named like type: |
registration — Registration test
| Field | |
|---|---|
extensions | how many extensions of the set (from the top; 0 = all) |
rate | new extensions registered per second |
expires | Expires sent in REGISTER (seconds) |
reregister_interval | seconds between re-registrations (0 = 90 % of expires) |
mode | cycles (register each extension cycles times) or duration (keep re-registering for duration) |
cycles, duration | see mode |
unregister | un-register at the end (true / false) |
client | sip (default: SIP phones over the profile's transport) or webrtc (web clients over the profile's webrtc.ws_urls; mode must be duration, reregister_interval doesn't apply) |
storm | web clients only, optional: {"mode": "reconnect" | "reload", "first_after_s": ≥ 10, "every_s": 0 = once, "count": 1–20, "spread_s": 0–60}; must fit into duration |
call — Calls
| Field | |
|---|---|
destination_mode | number (default: dial destination) or extensions (calls between test extensions) |
destination | the number dialled; must be allowed by the profile's safety limits |
callers | extensions that place calls (0 = all; with extensions: all that aren't callees) |
callees | with extensions: how many extensions after the callers answer |
cps | calls started per second |
ramp_start_cps, ramp_seconds | start at ramp_start_cps and rise to cps over ramp_seconds (0 = no ramp) |
max_concurrent | most calls at once (0 = the safety limit) |
hold_seconds | how long each answered call stays up |
mode | total (place total_calls calls) or duration (place calls for duration) |
total_calls, duration | see mode |
codec | G722 (default), PCMA or PCMU |
dtmf | optional: digits every answered call sends during the hold — see below |
caller_client | sip (default: SIP phones) or webrtc (web clients: SIP over WebSocket, ICE + DTLS-SRTP; needs a profile webrtc.ws_urls entry, media srtp, codec G722 or PCMA) |
callee_client | with extensions: sip (default) or webrtc |
call.dtmf — Send DTMF (call tests only; media rtp or srtp)
| Field | |
|---|---|
digits | 1 to 32 of 0-9 * # A-D |
method | rfc2833 (default) or inband |
after_s | seconds after the answer (default 2) |
duration_ms, gap_ms | per digit (default 100; 40–500) and between digits (default 100; 40–1000) |
The hold must be at least 1 s longer than after_s + digits × (duration + gap).
busy_hour — Busy hour
| Field | |
|---|---|
phones | extensions taking part (0 = all) |
calls_per_phone_hour | calls each phone places per hour (it receives as many) |
avg_hold_seconds | average call length |
duration | how long calls are placed |
ramp_seconds | rise from 10 % to the full rate (0 = full rate at once) |
max_concurrent | most calls at once (0 = the safety limit) |
expires | the phones' registration expiry (default 300) |
window_seconds | trend window size (default 300) |
codec | as for call |
limit — Find the limit
| Field | |
|---|---|
destination_mode, destination, callers, callees, hold_seconds, max_concurrent, codec, caller_client, callee_client | as for call |
start_cps, step_cps, max_cps | the steps: start_cps, then + step_cps each step, up to max_cps |
step_seconds | how long each step runs |
stop_after_failed_steps | stop after this many failed steps in a row (default 1; 0 = run every step) |
warm_up_seconds | calls at start_cps before step 1, not checked (default 10; 0 = none) |
ivr — IVR / voicemail check (media rtp or srtp)
| Field | |
|---|---|
destination | the number dialled; must be allowed by the profile's safety limits |
callers | extensions that place calls (0 = all) |
total_calls, cps, max_concurrent | default 1 call at 1 CPS; max concurrent 0 = the safety limit |
codec | as for call |
dtmf_method, duration_ms, gap_ms | how send_dtmf steps send: rfc2833 (default) or inband, 100 / 100 ms |
audio_threshold_dbov | a received frame at or above this level is audio (default −40) |
steps | 1 to 20 of: {"kind":"expect_audio","timeout_s":5,"min_ms":300}, {"kind":"send_dtmf","digits":"{ext}#"} ({ext} = the caller's extension), {"kind":"wait","seconds":2}, {"kind":"expect_hangup","timeout_s":5} |
sh
curl -s -H "$AUTH" -H 'Content-Type: application/json' "$PBXSIGHT_URL/api/tests?wait=5m" -d '{
"type": "ivr", "extension_set_id": 3,
"ivr": {"destination": "8000", "steps": [
{"kind": "expect_audio", "timeout_s": 10}, {"kind": "send_dtmf", "digits": "1"},
{"kind": "expect_audio", "timeout_s": 10}, {"kind": "send_dtmf", "digits": "#"},
{"kind": "expect_hangup", "timeout_s": 10}]}
}'The run's summary.ivr holds steps (per step reached, passed, failed, reasons, tta_p50_ms / tta_p95_ms for expect_audio), calls (placed, answered, not_answered, passed, failed, pass_pct), dtmf and the first 100 failures. A call test with dtmf has summary.call.dtmf: source (callee, esl or none), verified, calls, calls_ok, ok_pct (null when not verified), digits_sent, digits_received, missing, extra, wrong, received_by, fs_heard, came_back, latency_avg_ms, latency_p95_ms, mismatches (first 100).
A call or limit run with web clients has summary.call.caller_client / callee_client and summary.call.media.webrtc: legs, connected, ice_failed, dtls_failed, not_webrtc (the PBX answered without a DTLS fingerprint / ICE), connect_p50_ms, connect_p95_ms (SDP answer → SRTP ready).
A registration run with web clients has summary.registration.client = webrtc and summary.registration.web: clients, urls, registered_peak, registered_lowest, ws_drops, conn_lost, rereg_ok, rereg_failed, storms (first 20: at, offset_s, triggerreconnect / reload / detected, dropped, recovered, time_to_all_s (null when not all came back), p50_s, p95_s, max_s, failures, not_recovered), storms_total, storms_incomplete, not_recovered, worst_recovery_s, storm_failures. Its samples add web_registered, ws_open, ws_lost; the live /ws run object adds web_reg (the same summary so far).
watch — PBX watch
| Field | |
|---|---|
duration | how long to watch |
window | trend window size (default 5m) |
Get the body from the UI
Start the test once in the UI, then copy its settings: params.request of the run (GET /api/tests/{id}) is exactly this body.
Result and exit code
GET /api/tests/{id}/result · viewer
A short answer for scripts: did the run pass, and with which exit code should a CI job end.
sh
curl -s -H "$AUTH" "$PBXSIGHT_URL/api/tests/20261130-151021-q2nq/result?wait=10m"json
{
"id": "20261130-151021-q2nq",
"type": "call",
"profile": "default",
"status": "completed",
"finished": true,
"verdict": "failed",
"exit_code": 1,
"reason": "verdict failed: Answer rate 95.5 % (limit >= 99 %)",
"checks": [
{"name": "Answer rate", "op": ">=", "threshold": 99, "value": 95.5, "unit": "%", "status": "failed"},
{"name": "Setup time p95", "op": "<=", "threshold": 500, "value": 2.1, "unit": "ms", "status": "passed"},
{"name": "MOS (FreeSWITCH)", "op": ">=", "threshold": 4, "value": null, "status": "skipped",
"note": "no media sent (the profile's media mode is none)"}
],
"error": "",
"started_at": "2026-11-30T14:10:21Z",
"finished_at": "2026-11-30T14:10:24Z",
"report_url": "/api/tests/20261130-151021-q2nq/export?format=html",
"run_url": "/tests/20261130-151021-q2nq"
}exit_code | Meaning |
|---|---|
| 0 | finished, verdict passed — or none (no criteria to check) |
| 1 | finished, verdict failed (reason names the failed checks) |
| 2 | the run ended with an error or was stopped: it didn't complete |
| 3 | not finished yet: ask again |
| Field | |
|---|---|
status | pending, running, completed, stopped or failed |
verdict | passed, failed, none (no criteria), or null while running |
checks | each criterion: value null = no data; status passed, failed or skipped (with a note) |
error | why a run failed (status failed) |
report_url, run_url | the HTML report and the run's page in the UI; full addresses when the app URL of the e-mail alert settings is set |
?wait= (up to 10m, true = 10m) holds the answer until the run has finished or the wait is over. Either way the answer is 200: a failed test is a successful request, so use exit_code, not curl --fail. For runs longer than 10 minutes, ask again while exit_code is 3. A client that hangs up ends only its wait, never the run; when PBXsight shuts down, waiting requests answer at once with the current state (exit_code 3). Behind a reverse proxy, its read timeout must be longer than the wait.
Errors: 404 no such run · 400 a bad wait.
A segment of the always-on watch can be read here too; it ends only at midnight.
List runs
GET /api/tests · viewer
Runs, newest first. Parameters: type (e.g. call), profile, limit (default 200, max 1000), offset (for paging). The header X-Total-Count has the number of runs matching the filter.
sh
curl -s -H "$AUTH" "$PBXSIGHT_URL/api/tests?type=call&limit=5" \
| jq -r '.[] | [.id, .status, (.summary.verdict.result // "-")] | @tsv'Each run is shaped as in Get a run, without counters, hints and vs_baseline; instead it has vs_baseline_headline — the test type's main number compared with its baseline ({baseline_id, fallback, delta}, or null).
Get a run
GET /api/tests/{id} · viewer — one run with all its results.GET /api/tests/current · viewer — the run going on now (shaped like run in the WebSocket message), or null.
sh
curl -s -H "$AUTH" "$PBXSIGHT_URL/api/tests/20261130-151047-t8s7" | jq '{id, status, verdict: .summary.verdict.result}'The main fields:
| Field | |
|---|---|
id, type, status | as in the result |
label | the name given on the run page |
profile_id, profile_name, extension_set_id, schedule_id | what it ran against; schedule_id when started from a schedule |
created_by | the user who started it (also when started with that user's token) |
created_at, started_at, finished_at | times |
params | the settings: params.request is the start body, the rest is what PBXsight resolved from it |
summary | all results; the verdict is summary.verdict (result, passed, failed, skipped, checks), the numbers are under the test type (summary.call.answer_rate, setup_p95_ms, …) |
counters | SIP response codes and hangup causes |
hints | "What to look at" for finished runs |
error | why the run failed |
keep, baseline, pruned_at | pinned (never pruned) · the baseline of its test · when its per-second data was removed |
vs_baseline | for finished runs whose test has a baseline: baseline_id, baseline_label, baseline_created_at, baseline_pruned, fallback (a scheduled run compared with the hand-run baseline), settings_differ (e.g. "CPS 3 vs 2 (baseline)") and deltas — one row per metric with key, name, unit, value, baseline, diff, diff_pct, better (higher/lower), assessment (better/worse/same/n/a), note |
live | while running: the latest numbers |
Stop a run
POST /api/tests/{id}/stop · operator → 202 {"status": "stopping"}. Works while the phones are still registering too. Errors: 409 this run is not running.
Change or delete a run
PATCH /api/tests/{id} · operator — body with any of:
| Field | |
|---|---|
label | a name for the run (max 200 characters) |
keep | true pins the run: data retention never removes its data |
baseline | true makes it the baseline of its test (replacing the previous one) |
Answer: 200 with the run. Only completed or stopped runs can become the baseline (409 otherwise).
DELETE /api/tests/{id} · operator → 204; deletes the run and its files. 409 while it runs.
Samples and logs
GET /api/tests/{id}/samples· viewer → the per-second samples ([]after data retention removed them).GET /api/tests/{id}/logs?file=caller|phones|watch&lines=N· viewer →{"file", "text"}, the lastNlines (default 300, max 5000).404for an unknown run or file.
Export
Finished runs only (409 the run has not finished yet; export it when it is done). See Export and reports.
| Endpoint | Returns |
|---|---|
GET /api/tests/{id}/export?format=html | the self-contained HTML report; add &download=1 to get it as a file |
GET /api/tests/{id}/export?format=json | everything about the run (pbx-run-<id>.json) |
GET /api/tests/{id}/export?format=csv | the per-second samples (pbx-run-<id>-samples.csv); 410 when data retention removed them |
GET /api/tests/{id}/export?format=csv&table=windows | trend windows / limit steps; 404 for runs without windows |
GET /api/tests/export?format=csv | the runs list with key results; filters type, profile, limit (default 10000) |
All viewer. Other format / table values: 400. A run whose per-second data was removed still exports: the JSON has "samples": [] and pruned_at, the HTML report says the data was removed instead of drawing charts. The JSON has vs_baseline, the HTML report a vs baseline section, the runs CSV baseline and vs_baseline_headline columns. Find-the-limit and PBX watch runs also have capacity in the JSON and a Capacity section in the report, computed as of the run's end (below).
Schedules
A schedule is a saved test that runs once or on a timetable — or only when asked (switched off). See Scheduled runs.
Run a saved test now
POST /api/schedules/{id}/run · operator — starts the schedule's test now, whether the schedule is on or off. Answer: 201 with the run; with ?wait= (as for Start a test) 200 with the result. Errors as for Start a test.
sh
curl -s -X POST -H "$AUTH" "$PBXSIGHT_URL/api/schedules/4/run?wait=10m" | jq .exit_codeList and edit schedules
| Endpoint | Role | |
|---|---|---|
GET /api/schedules | viewer | all schedules (?profile= for one profile) with next_run_at and the last 30 history events |
GET /api/schedules/{id} | viewer | one schedule with up to 500 history events |
POST /api/schedules | operator | create → 201 |
PUT /api/schedules/{id} | operator | change → 200 |
PATCH /api/schedules/{id} | operator | body {"enabled": true|false} → 200; 422 for switching on a one-off whose time has passed |
DELETE /api/schedules/{id} | operator | delete → 204 |
GET /api/schedules/preview?cron=… | viewer | the next 5 times of a cron expression: {"next": […], "time_zone": "CET, UTC+01:00"}; 422 if invalid or never matching |
Body of POST / PUT:
json
{
"name": "nightly echo",
"enabled": true,
"alerts": true,
"cron": "0 2 * * *",
"request": {"type": "call", "profile_id": 1, "extension_set_id": 1,
"call": {"destination": "9196", "cps": 2, "hold_seconds": 10, "mode": "total", "total_calls": 20}}
}| Field | |
|---|---|
name | shown in the UI |
enabled | default true; false = runs only when asked |
alerts | e-mail when it fails (default true; left out on PUT = unchanged) |
cron or run_at | exactly one: a cron expression (minute hour day-of-month month day-of-week in the server's time zone, or @hourly, @daily, @weekly, @monthly, @yearly) or one time (in the future when enabled) |
request | a start body, checked now |
422 the schedule was not saved with the reasons in details.
History events: {id, at, source, outcome, run_id, run_status, verdict}. outcome is started, skipped (another test was running), missed (due more than 5 minutes ago while PBXsight wasn't running) or error (not started, with the reason, e.g. no licence). In GET /api/schedules/{id}, finished runs also carry vs_baseline_headline (against the schedule's baseline, else the hand-run one: fallback: true) and run_baseline when that run is the baseline.
PBX profiles
A profile is one PBX under test: its SIP address, FreeSWITCH ESL, optional Kamailio and rtpengine sources, safety limits and criteria. See PBX profiles.
| Endpoint | Role | |
|---|---|---|
GET /api/profiles | viewer | all profiles |
GET /api/profiles/{id} | viewer | one, with usage (its runs, sets, schedules) |
GET /api/profiles/defaults | viewer | the settings a new profile starts with |
POST /api/profiles | admin | create → 201 |
PUT /api/profiles/{id} | admin | change → 200 |
DELETE /api/profiles/{id} | admin | delete → 204; also deletes its extension sets and schedules (runs stay). 409 while in use |
A profile: {"id", "name", "config", "has_esl_password", "has_rtpengine_token", "created_at", "updated_at", "esl", "warnings", "in_use"}. Passwords and tokens are never returned, only whether one is set.
Body of POST / PUT:
json
{
"name": "qa",
"config": {
"pbx": {"sip_host": "sip.example.com", "sip_port": 5061, "transport": "tls",
"default_domain": "loadtest.example.com", "sofia_profile": "internal"},
"webrtc": {"ws_urls": ["wss://sip.example.com:7443/ws"], "stun": []},
"media": {"mode": "srtp"},
"esl": {"enabled": true, "host": "10.0.0.10", "port": 8021}
},
"secrets": {"esl_password": "use-a-real-secret"}
}confighas the sectionspbx,webrtc,media,esl,kamailio,rtpengine,stuck_calls,safety,criteria, with the keys of the configuration reference.- Left out: on
PUTthe stored value stays, onPOSTthe default is used — exceptcriteria: a sentcriteriareplaces the stored one (a criterion left out is then not checked). secrets.esl_password,secrets.rtpengine_token: left out = keep the stored one,""= none.- Errors:
422the profile was not savedwith details ·409while a test on the profile is starting or running.
Connection test
POST /api/profiles/test · operator — tests one source of a profile, step by step, without saving anything. Same as Test connection on the profile page.
json
{"source": "sip", "profile_id": 1, "profile": {"name": "qa", "config": {…}}, "extension_set_id": 3, "extension": "1001"}source:sip,webrtc,esl,kamailioorrtpengine(tested even when switched off).webrtctests eachwebrtc.ws_urlsentry: resolve, connect (TLS forwss), WebSocket upgrade with subprotocolsip, OPTIONS and the optional REGISTER over the WebSocket (several URLs: oneitemsentry each, checked one after the other); without a URL its one step is skipped.profile: the profile's values to test (as in the body above); withprofile_id, passwords left out come from the stored profile.extension_set_id(sipandwebrtc): also try one REGISTER + un-REGISTER, withextension(default: the first).
Answer: {"source", "ok", "steps": [{"name", "ok", "status": "ok|warn|fail|skip", "detail", "ms"}], "items": [{"url", "ok", "steps"}]} (items: one per Kamailio node / agent). Errors: 400 unknown source, invalid values, a set of another profile · 409 a test REGISTER while a test on the profile runs.
Extension sets
The test extensions (user, password, domain) a test registers. See Extensions.
| Endpoint | Role | |
|---|---|---|
GET /api/extension-sets | viewer | all sets (?profile= for one), without passwords |
GET /api/extension-sets/{id} | viewer | one set with its extensions, without passwords |
POST /api/extension-sets | operator | upload a CSV → 201 |
DELETE /api/extension-sets/{id} | operator | delete → 204 |
sh
curl -s -H "$AUTH" -F file=@extensions.csv -F name=loadtest -F profile_id=1 \
"$PBXSIGHT_URL/api/extension-sets"Upload fields: file (CSV, max 10 MB), name (default: the file name), profile_id. A bad file gives 400 the CSV file has problems; nothing was imported with one detail per bad line.
Status and licence
| Endpoint | Role | |
|---|---|---|
GET /api/health | viewer | app version, uptime, and per source (ESL, Kamailio, rtpengine) whether it's connected |
GET /api/pbx/status | viewer | FreeSWITCH as seen over ESL: connection, calls, CPU, … |
GET /api/pbx/targets | viewer | the addresses the profile's SIP host resolves to (for target_ip) |
GET /api/setup-checklist | viewer | the Dashboard's Get started steps and which are done |
GET /api/config | viewer | app-wide settings, without secrets |
GET /api/license | viewer | the licence: state, can_start, message, plan, customer, expires_at, days_left, … |
PUT /api/license | admin | body {"key": "PBXS1.…"} → 200 with the new state; 422 for an invalid or ended key, or one the licence server refuses; 502 when the licence server can't be reached (nothing saved) |
POST /api/license/check | admin | check an online key with the licence server now → 200 with the state (last_check_error when it failed); 409 for an offline key |
DELETE /api/license | admin | remove the key → 200; an online key is first freed on the licence server (Move licence): 502 when it can't be reached, ?force=1 removes it here anyway |
The status endpoints take ?profile=ID. Licence state: missing, invalid, valid, expiring (7 days or less left), expired, clock (offline keys: the clock was set back), not_activated, refused or unreachable (online keys). Without a valid licence every test start answers 402; reading results keeps working.
Capacity
GET /api/capacity?profile=ID[&days=7&weeks=8] (viewer, API tokens too) — the profile's capacity summary: the busiest PBX watch window of the last days (1–31, default 7) against the newest find-the-limit result, and a trend over the last weeks local weeks (1–26, default 8). Computed on request from stored run summaries. profile is required (400 without it, 404 for an unknown one); days / weeks out of range: 400.
sh
curl -s -H "Authorization: Bearer $PBXSIGHT_TOKEN" "https://pbxsight.example.com/api/capacity?profile=1" \
| jq '{status, headroom, headroom_text, headline}'json
{
"profile_id": 1, "profile": "lab", "as_of": "2026-11-30T15:00:00Z", "days": 7, "weeks": 8,
"status": "ok",
"headline": "peak 0.6 CPS, limit 3 CPS → 5×",
"message": "At least 2× headroom between the busiest window and the limit.",
"headroom": 5, "headroom_text": "5×", "headroom_bound": "",
"peak": { "cps": 0.6, "calls": 180, "window_s": 300, "at": "2026-11-26T13:05:00Z", "run_id": "…", "monitor": true,
"one_sec_cps": 4, "peak_concurrent": 22, "windows": 1890, "watch_hours": 157.5, "runs": 7, … },
"limit": { "run_id": "…", "finished_at": "2026-11-18T09:12:40Z", "age_days": 12, "outcome": "limit_found",
"cps": 3, "bound": "", "text": "3 CPS", "destination": "*9196", "stale": false, … },
"trend": [ { "start": "2026-10-12", "label": "W42", "peak_cps": 0.52, "peak_day": "Tue", "watch_hours": 120,
"limit_cps": 3, "limit_text": "3 CPS", … }, … ],
"limit_runs": [ { "run_id": "…", "at": "2026-11-18T09:12:40Z", "week": "2026-11-16", "text": "3 CPS", … } ],
"thresholds": { "over_below": 1, "tight_below": 2, "min_window_s": 60, "stale_after_days": 30 }
}| Field | |
|---|---|
status | ok (headroom ≥ 2×), tight (< 2×), over (< 1×), no_limit (no usable limit run yet), no_watch (no watch window of ≥ 60 s in the last days), no_calls (watched, no calls) |
headroom | limit ÷ peak CPS, null when one is missing; headroom_bound at_least (every step passed: ≥) or below (the first step failed: <) |
peak | the busiest window's average CPS and where it was; one_sec_cps and peak_concurrent are information only; null without watch data |
limit | the newest completed / stopped limit run with a result (incomplete runs skipped); stale + stale_note when it is older than 30 days or older than the profile's last edit |
trend | one entry per local week (Monday start), oldest first: the busiest window, hours watched, and the limit in effect at the week's end |
Settings
Data retention
See Data retention.
GET /api/settings/retention· viewer →{"days", "source": "config"|"ui", "config_days", "last_cleanup_at", "last_cleanup_pruned", "last_prune_at", "last_prune_pruned", "vacuum_pending", "db_bytes", "run_files_bytes"}.days0 = keep forever.PUT /api/settings/retention· admin, body{"days": N}(0–3650) →200; from then on it wins overstorage.retention_daysin the config file.POST /api/settings/retention/cleanup· admin → cleans up now:{"pruned", "freed_bytes", "vacuum_deferred", "db_bytes_before", "db_bytes_after"}.
E-mail alerts
See E-mail alerts.
GET /api/settings/alerts· admin →{"host", "port", "security": "none"|"starttls"|"tls", "username", "password_set", "insecure_skip_verify", "from", "recipients", "app_url", "events": {"run_failed", "schedule_not_started", "licence"}, "configured", "last_sent_at", "last_error"}. The password is never returned.PUT /api/settings/alerts· admin, the same fields pluspassword(left out or empty = keep) andclear_password: true→200.422with the problem per field (port, addresses, at most 20 recipients,app_urlan http(s) address). An emptyhostturns alerts off.POST /api/settings/alerts/test· admin, a body likePUT(unsaved values) → sends a test e-mail:{"source": "smtp", "ok", "steps": […]}within about 15 s.GET /api/settings/alerts/status· viewer →{"configured", "events"}.
Users and tokens
All browser only: a token gets 403 not allowed with an API token; log in.
Your API tokens
| Endpoint | Role | |
|---|---|---|
GET /api/tokens | any | your tokens: id, name, role, prefix (first 8 characters after pbxs_), created_at, last_used_at, last_used_ip, expires_at, expired — never the token itself |
POST /api/tokens | any | body {"name", "role", "expires_in_days"} → 201 with the same fields plus token — the only time it is shown |
DELETE /api/tokens/{tokenId} | any | revoke → 204; the token stops working at once |
name: 1–64 characters, unique among your tokens. role: at most your own (default: yours, at most operator). expires_in_days: 0 or left out = never, else 1–3650. 422 the token was not created for a role above yours, a name you already use, more than 20 tokens or a bad expiry. last_used_* is updated at most once a minute.
Users (admin)
| Endpoint | |
|---|---|
GET /api/users | all users, each with tokens = their number of API tokens |
POST /api/users | body {"username", "role", "password", "disabled"} → 201; 409 if the name exists |
PUT /api/users/{id} | body {"username", "role", "disabled"} → 200; 400 when you'd disable or demote yourself or the last admin |
POST /api/users/{id}/password | body {"password"} → 204; that user is logged out |
DELETE /api/users/{id} | 204; deletes the user's tokens too. 400 for yourself or the last admin |
GET /api/users/{id}/tokens | that user's tokens (as GET /api/tokens) |
DELETE /api/users/{id}/tokens | revoke all of them → 200 {"revoked": N} |
DELETE /api/users/{id}/tokens/{tokenId} | revoke one → 204 |
Roles: admin, operator, viewer. Passwords: at least 10 characters, not the user name. User names: 1–64 characters, letters, digits and . _ - @. Admins can't create tokens for other users.
Your own login
GET /api/auth/me→{"id", "username", "role"}. Works with a token too: then it also has"via_token": {"name", "role"}androleis what the token may do — a quick check for a CI secret.POST /api/auth/logout→204(browser only).POST /api/auth/passwordbody{"current", "password"}→204; your other browser sessions end.400the current password is wrong(browser only).
Activity log
GET /api/audit?user=&action=&page=&limit= · admin → {"entries": […], "total", "users": […]}, newest first. limit default 100 (max 500), page from 1. action is an exact name (token.create) or a group ending in a dot (test. = test.start, test.stop, …); action=alerts = the e-mail alert entries. Actions done with a token show [token NAME] in their detail. See Users and roles.
Support bundle
GET /api/support-bundle[?run=ID][&profile=ID] · admin → a zip for bug reports: version, config and profiles with secrets removed, the recent app log, licence state, and with run that run's report and data. See Support bundle.
Live updates: WebSocket /ws
GET /ws[?profile=ID] · viewer — what the UI uses for its live charts. The server sends one message right away and then one every second; it expects nothing back. Log in as for every other endpoint (token in the Authorization header — never in the address — or the browser's cookie).
json
{
"type": "tick",
"ts": "2026-11-30T10:15:04.123Z",
"profile_id": 1,
"pbx": {"connection": {"state": "connected"}, "snapshot": {"...": "..."}, "global": {"...": "..."}},
"kamailio": {"enabled": true, "nodes": [{"...": "..."}]},
"rtpengine": {"enabled": false, "nodes": []},
"run": null,
"starting": null
}pbx,kamailio,rtpengine: the profile's sources (as in/api/healthand/api/pbx/status).run: the running test, whatever its profile, ornull—id,type,status,elapsed,estimated_s,sample(the latest second),countersand, by type,trend,watch,limit, ….starting: while a test's phones register before the first call —phones,registered,reg_failed, ….
The login is checked again every 30 s: a logout, a revoked or expired token or a disabled user closes the socket (status 1008 logged out). A client that can't keep up is closed (too slow). Behind a reverse proxy, /ws needs the WebSocket upgrade headers.
Details
Browser sessions
The UI logs in with a user name and password and keeps a cookie. A script can do the same, but a login ends the user's other session (one session per user) — so a script logging in as you logs you out. Use a token instead.
sh
curl -c jar -H 'Content-Type: application/json' \
-d '{"username":"anna","password":"a long password"}' "$PBXSIGHT_URL/api/auth/login"
curl -b jar "$PBXSIGHT_URL/api/tests?limit=5"GET /api/auth/state(no login) →{"setup_required", "setup_needs_token", "user", "https", "local", "session_idle_s"}— what the login page needs.POST /api/auth/login(no login), body{"username", "password"}→200{"id", "username", "role"}and the cookie.401wrong user name or password, or the account is disabled.POST /api/auth/setup(no login, only while there are no users), body{"username", "password", "token"}→ creates the first admin. From the app's own machinetokenisn't needed; otherwise it is the setup token printed in the app log (403if wrong).409once a user exists.
The cookie (pbxsight_session) ends after server.session_idle_timeout without a request (default 7 days), after server.session_max_age (default 30 days), on logout or a password change, when the user logs in from another browser (401 You were logged out: NAME logged in from another browser), or when the user is disabled or deleted.
Tokens in detail
- A token is
pbxs_followed by 43 characters. PBXsight stores only a SHA-256 hash of it. - It is accepted only in the
Authorizationheader — never in the address or a cookie — so it stays out of proxy and access logs. When a request has both a token and a cookie, the token decides. - Its role is the lower of the token's role and its user's current role.
- It stops working when revoked, when it expires, when its user is disabled (it works again when the user is re-enabled) or deleted. Logins, logouts and password changes don't affect it.
- Runs started with a token show its user as
created_by; the activity log shows[token NAME]. - Tokens don't count as users of the licence.
Failed logins
Wrong passwords are limited to 5 per user name and 20 per client address within 15 minutes; wrong tokens count toward the same 20 per address. Over the limit: 429 with Retry-After. While an address is blocked, valid tokens from it are refused too — CI runners behind one shared address share the block.
Request checks
- Requests that change something (POST, PUT, PATCH, DELETE) with a body must be JSON (or a file upload), else
415send JSON (Content-Type: application/json). - Browsers must also send their own address as
Origin; curl sends none and isn't affected. - The
Hostheader must belocalhost, an IP address or a name inserver.allowed_hosts, else403.
?profile=
Status endpoints (/api/health, /api/pbx/…, /ws) without ?profile= show the only profile when there is exactly one; with several they show an empty view. Lists (/api/tests, /api/extension-sets, /api/schedules, the runs CSV) without it show all profiles. Bodies with profile_id 0 or left out use the only profile; with several profiles it must be given (else 422).
Full role table
| Request | Role |
|---|---|
GET /api/auth/state, POST /api/auth/login, POST /api/auth/setup | none |
GET /api/auth/me | any logged-in user (also with a token) |
other /api/auth/… (logout, own password) | any logged-in user — browser only |
/api/tokens… | any logged-in user — browser only |
/api/users… | admin — browser only |
/api/audit, /api/support-bundle | admin |
/api/settings/alerts, /api/settings/alerts/test | admin (GET /api/settings/alerts/status: viewer) |
POST /api/profiles/test | operator |
any other GET (including /ws and exports) | viewer |
POST / PUT / PATCH / DELETE on /api/profiles…, /api/license, /api/settings… | admin |
every other POST / PUT / PATCH / DELETE (tests, schedules, extension sets) | operator |
Without a login: 401 log in first. With a role too low: 403 your role (viewer) may not do this; ask an admin.