Skip to content

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:

RoleMay
viewerread everything except the admin pages: runs, results, exports, schedules, profiles, status
operatoralso start, stop, label and delete tests; schedules; extension sets; connection tests
adminalso 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).

StatusMeans
200, 201, 202, 204OK, created, accepted (stop), done with no body (deletes)
400invalid JSON, unknown field, bad id or parameter
401not logged in, wrong or expired token
402a test start refused: no valid licence
403role too low, or a browser only endpoint called with a token
404no such run, schedule, profile, set, user or token
409conflicts: another test is running, the run isn't running (stop) or hasn't finished (export), profile in use
410the per-second data of a run was removed by data retention
415a body that isn't JSON (or a file upload)
422the values were checked and refused — the reasons are in details
429too many failed logins or wrong tokens from this address; Retry-After says how many seconds to wait
500internal 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 ​

EndpointRoleWhat it does
TestsPOST /api/testsoperatorstart a test (optionally wait for its verdict)
GET /api/tests/{id}/resultviewerverdict + exit code of a run (optionally wait)
GET /api/testsviewerlist runs, newest first
GET /api/tests/{id}viewerone run with all its results
GET /api/tests/currentviewerthe run going on now
POST /api/tests/{id}/stopoperatorstop a running test
PATCH /api/tests/{id}operatorlabel, keep, mark as baseline
DELETE /api/tests/{id}operatordelete a run
GET /api/tests/{id}/samples, …/logsviewerper-second data, log files
ExportGET /api/tests/{id}/exportviewerHTML report, JSON, CSV
GET /api/tests/exportviewerall runs as CSV
SchedulesPOST /api/schedules/{id}/runoperatorrun a saved test now (optionally wait)
GET, POST, PUT, PATCH, DELETE /api/schedules…viewer / operatorlist and edit schedules
ProfilesGET /api/profiles…viewerPBX profiles
POST, PUT, DELETE /api/profiles…admincreate, change, delete profiles
POST /api/profiles/testoperatortest a profile's connections
Extensions/api/extension-sets…viewer / operatorlist, upload, delete extension sets
StatusGET /api/health, /api/pbx/…, /api/license…viewerapp, PBX and licence status
CapacityGET /api/capacity?profile=viewerreal peak load vs the measured limit: headroom, weekly trend
Settings/api/settings/retention…, /api/settings/alerts…admindata retention, e-mail alerts
Admin/api/users…, /api/tokens…admin / any — browser onlyusers and API tokens
GET /api/audit, GET /api/support-bundleadminactivity log, support bundle
LiveGET /wsviewerlive 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
typeregistration, call, busy_hour, limit (find the limit), ivr (IVR / voicemail check) or watch
profile_idthe PBX profile; may be left out while there's only one
extension_set_idthe test extensions to use (not for watch)
target_ipoptional: one of the addresses the profile's SIP host resolves to (e.g. one of several Kamailios); default: a random one
criteriaoptional: 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 / watchthe test's settings — one object, named like type:

registration — Registration test

Field
extensionshow many extensions of the set (from the top; 0 = all)
ratenew extensions registered per second
expiresExpires sent in REGISTER (seconds)
reregister_intervalseconds between re-registrations (0 = 90 % of expires)
modecycles (register each extension cycles times) or duration (keep re-registering for duration)
cycles, durationsee mode
unregisterun-register at the end (true / false)
clientsip (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)
stormweb 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_modenumber (default: dial destination) or extensions (calls between test extensions)
destinationthe number dialled; must be allowed by the profile's safety limits
callersextensions that place calls (0 = all; with extensions: all that aren't callees)
calleeswith extensions: how many extensions after the callers answer
cpscalls started per second
ramp_start_cps, ramp_secondsstart at ramp_start_cps and rise to cps over ramp_seconds (0 = no ramp)
max_concurrentmost calls at once (0 = the safety limit)
hold_secondshow long each answered call stays up
modetotal (place total_calls calls) or duration (place calls for duration)
total_calls, durationsee mode
codecG722 (default), PCMA or PCMU
dtmfoptional: digits every answered call sends during the hold — see below
caller_clientsip (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_clientwith extensions: sip (default) or webrtc

call.dtmf — Send DTMF (call tests only; media rtp or srtp)

Field
digits1 to 32 of 0-9 * # A-D
methodrfc2833 (default) or inband
after_sseconds after the answer (default 2)
duration_ms, gap_msper 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
phonesextensions taking part (0 = all)
calls_per_phone_hourcalls each phone places per hour (it receives as many)
avg_hold_secondsaverage call length
durationhow long calls are placed
ramp_secondsrise from 10 % to the full rate (0 = full rate at once)
max_concurrentmost calls at once (0 = the safety limit)
expiresthe phones' registration expiry (default 300)
window_secondstrend window size (default 300)
codecas for call

limit — Find the limit

Field
destination_mode, destination, callers, callees, hold_seconds, max_concurrent, codec, caller_client, callee_clientas for call
start_cps, step_cps, max_cpsthe steps: start_cps, then + step_cps each step, up to max_cps
step_secondshow long each step runs
stop_after_failed_stepsstop after this many failed steps in a row (default 1; 0 = run every step)
warm_up_secondscalls at start_cps before step 1, not checked (default 10; 0 = none)

ivr — IVR / voicemail check (media rtp or srtp)

Field
destinationthe number dialled; must be allowed by the profile's safety limits
callersextensions that place calls (0 = all)
total_calls, cps, max_concurrentdefault 1 call at 1 CPS; max concurrent 0 = the safety limit
codecas for call
dtmf_method, duration_ms, gap_mshow send_dtmf steps send: rfc2833 (default) or inband, 100 / 100 ms
audio_threshold_dbova received frame at or above this level is audio (default −40)
steps1 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
durationhow long to watch
windowtrend 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_codeMeaning
0finished, verdict passed — or none (no criteria to check)
1finished, verdict failed (reason names the failed checks)
2the run ended with an error or was stopped: it didn't complete
3not finished yet: ask again
Field
statuspending, running, completed, stopped or failed
verdictpassed, failed, none (no criteria), or null while running
checkseach criterion: value null = no data; status passed, failed or skipped (with a note)
errorwhy a run failed (status failed)
report_url, run_urlthe 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, statusas in the result
labelthe name given on the run page
profile_id, profile_name, extension_set_id, schedule_idwhat it ran against; schedule_id when started from a schedule
created_bythe user who started it (also when started with that user's token)
created_at, started_at, finished_attimes
paramsthe settings: params.request is the start body, the rest is what PBXsight resolved from it
summaryall 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, …)
countersSIP response codes and hangup causes
hints"What to look at" for finished runs
errorwhy the run failed
keep, baseline, pruned_atpinned (never pruned) · the baseline of its test · when its per-second data was removed
vs_baselinefor 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
livewhile 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
labela name for the run (max 200 characters)
keeptrue pins the run: data retention never removes its data
baselinetrue 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 last N lines (default 300, max 5000). 404 for 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.

EndpointReturns
GET /api/tests/{id}/export?format=htmlthe self-contained HTML report; add &download=1 to get it as a file
GET /api/tests/{id}/export?format=jsoneverything about the run (pbx-run-<id>.json)
GET /api/tests/{id}/export?format=csvthe per-second samples (pbx-run-<id>-samples.csv); 410 when data retention removed them
GET /api/tests/{id}/export?format=csv&table=windowstrend windows / limit steps; 404 for runs without windows
GET /api/tests/export?format=csvthe 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_code

List and edit schedules ​

EndpointRole
GET /api/schedulesviewerall schedules (?profile= for one profile) with next_run_at and the last 30 history events
GET /api/schedules/{id}viewerone schedule with up to 500 history events
POST /api/schedulesoperatorcreate → 201
PUT /api/schedules/{id}operatorchange → 200
PATCH /api/schedules/{id}operatorbody {"enabled": true|false} → 200; 422 for switching on a one-off whose time has passed
DELETE /api/schedules/{id}operatordelete → 204
GET /api/schedules/preview?cron=…viewerthe 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
nameshown in the UI
enableddefault true; false = runs only when asked
alertse-mail when it fails (default true; left out on PUT = unchanged)
cron or run_atexactly 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)
requesta 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.

EndpointRole
GET /api/profilesviewerall profiles
GET /api/profiles/{id}viewerone, with usage (its runs, sets, schedules)
GET /api/profiles/defaultsviewerthe settings a new profile starts with
POST /api/profilesadmincreate → 201
PUT /api/profiles/{id}adminchange → 200
DELETE /api/profiles/{id}admindelete → 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"}
}
  • config has the sections pbx, webrtc, media, esl, kamailio, rtpengine, stuck_calls, safety, criteria, with the keys of the configuration reference.
  • Left out: on PUT the stored value stays, on POST the default is used — except criteria: a sent criteria replaces 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: 422 the profile was not saved with details · 409 while 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, kamailio or rtpengine (tested even when switched off). webrtc tests each webrtc.ws_urls entry: resolve, connect (TLS for wss), WebSocket upgrade with subprotocol sip, OPTIONS and the optional REGISTER over the WebSocket (several URLs: one items entry 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); with profile_id, passwords left out come from the stored profile.
  • extension_set_id (sip and webrtc): also try one REGISTER + un-REGISTER, with extension (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.

EndpointRole
GET /api/extension-setsviewerall sets (?profile= for one), without passwords
GET /api/extension-sets/{id}viewerone set with its extensions, without passwords
POST /api/extension-setsoperatorupload a CSV → 201
DELETE /api/extension-sets/{id}operatordelete → 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 ​

EndpointRole
GET /api/healthviewerapp version, uptime, and per source (ESL, Kamailio, rtpengine) whether it's connected
GET /api/pbx/statusviewerFreeSWITCH as seen over ESL: connection, calls, CPU, …
GET /api/pbx/targetsviewerthe addresses the profile's SIP host resolves to (for target_ip)
GET /api/setup-checklistviewerthe Dashboard's Get started steps and which are done
GET /api/configviewerapp-wide settings, without secrets
GET /api/licenseviewerthe licence: state, can_start, message, plan, customer, expires_at, days_left, …
PUT /api/licenseadminbody {"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/checkadmincheck 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/licenseadminremove 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
statusok (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)
headroomlimit ÷ peak CPS, null when one is missing; headroom_bound at_least (every step passed: ≥) or below (the first step failed: <)
peakthe busiest window's average CPS and where it was; one_sec_cps and peak_concurrent are information only; null without watch data
limitthe 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
trendone 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"}. days 0 = keep forever.
  • PUT /api/settings/retention · admin, body {"days": N} (0–3650) → 200; from then on it wins over storage.retention_days in 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 plus password (left out or empty = keep) and clear_password: true → 200. 422 with the problem per field (port, addresses, at most 20 recipients, app_url an http(s) address). An empty host turns alerts off.
  • POST /api/settings/alerts/test · admin, a body like PUT (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 ​

EndpointRole
GET /api/tokensanyyour 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/tokensanybody {"name", "role", "expires_in_days"} → 201 with the same fields plus token — the only time it is shown
DELETE /api/tokens/{tokenId}anyrevoke → 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/usersall users, each with tokens = their number of API tokens
POST /api/usersbody {"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}/passwordbody {"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}/tokensthat user's tokens (as GET /api/tokens)
DELETE /api/users/{id}/tokensrevoke 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"} and role is what the token may do — a quick check for a CI secret.
  • POST /api/auth/logout → 204 (browser only).
  • POST /api/auth/password body {"current", "password"} → 204; your other browser sessions end. 400 the 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/health and /api/pbx/status).
  • run: the running test, whatever its profile, or null — id, type, status, elapsed, estimated_s, sample (the latest second), counters and, 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. 401 wrong 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 machine token isn't needed; otherwise it is the setup token printed in the app log (403 if wrong). 409 once 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 Authorization header — 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 415 send JSON (Content-Type: application/json).
  • Browsers must also send their own address as Origin; curl sends none and isn't affected.
  • The Host header must be localhost, an IP address or a name in server.allowed_hosts, else 403.

?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 ​

RequestRole
GET /api/auth/state, POST /api/auth/login, POST /api/auth/setupnone
GET /api/auth/meany 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-bundleadmin
/api/settings/alerts, /api/settings/alerts/testadmin (GET /api/settings/alerts/status: viewer)
POST /api/profiles/testoperator
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.

PBXsight — load testing and monitoring for FreeSWITCH PBXes. Only test systems you own or may test.