Jump to content

TuCloudAPI

From Wiki 7Kas
ℹ New here? Start with the self-discovery endpoint. This reference is generated from func=help, so it never drifts.

Overview

TuCloudAPI is the REST API to manage FuturePBX (the multi-tenant cloud PBX). HTTPS + JSON, GET or POST (parameters form-urlencoded; audio uploads POST the file as the body). Base URL:

https://tucloudapi.7kas.com:9087/tucloud?func=NAME&ukey=YOUR_KEY&pbx=PBX_NAME

Authentication & tenant

Every call needs an API key (ukey). Every PBX-scoped function also needs pbx — the PBX name (e.g. tucall). The (ukey, pbx) pair is the tenant boundary: the server resolves the PBX name to its id and verifies that the key's OWN account owns it — for every role, SuperRoot included. A PBX that does not exist and one the key does not own both answer forbidden. It never trusts a numeric tenant from the caller.

Response format

Always HTTP 200. Every PBX-scoped function always returns a JSON envelope: success {"ok":true, ...}, empty {"ok":true,"rows":[]}, error {"ok":false,"code":...,"message":...} (common codes: missing_pbx, forbidden, invalid_param, not_found, conflict, in_use, db_error, server_busy). IDs are exposed as _id. A missing or invalid ukey answers a bare {} and nothing else. The legacy account functions return their data object directly, {} when there is nothing.

Functions

Dashboard (landing counts)

Extensions (Extensiones)

  • TuCloudAPI getextensions — List the PBX extensions (safe display fields; NEVER the SIP password).
  • TuCloudAPI getextension — Get one extension with all editable fields (NO password).
  • TuCloudAPI getextlookups — Tenant-scoped option lists for the extension form selects: caller IDs (clis), music-on-hold (music), outgoing services (outs), the extension list (exts, for Enviar a / backup monitor), registration servers (servers) and next_free: the create-form number prefill for a REGISTERED extension (3-4 digits, the same check as checkextnum), a string, or null when no number is free.
  • TuCloudAPI checkextnum — Is this number free for a NEW extension of this PBX? The same check addextension runs under its lock, so the two never disagree.
  • TuCloudAPI addextension — Create an extension.
  • TuCloudAPI updateextension — Edit an extension.
  • TuCloudAPI deleteextension — Delete an extension after a tenant + dependency check.
  • TuCloudAPI setextpassword — Rotate ONE extension's SIP password.
  • TuCloudAPI getextpassword — Plaintext SIP password for ONE extension (the portal's «Clave SIP» eye toggle).
  • TuCloudAPI getextqr — SIP provisioning QR for one extension, rendered server-side to a PNG (base64).

CLIs / DIDs (Numeracion)

Routes (Rutas)

Blacklist (inbound intercept)

Contacts (Agenda)

Calendar (date overrides)

Ring groups (Grupos)

Locutions / IVR (Locuciones)

Music on hold (MOH)

Schedules (Horarios)

Outbound routing (Rutas de salida)

Phonebooks (Agendas)

Call queues / ACD (Colas)

Agents / queue members (Agentes)

Portal admin users (Usuarios)

  • TuCloudAPI getadminusers — List this PBX's portal users (tucloud_sec_users).
  • TuCloudAPI getadminuser — Get one portal user by login (_id) within this PBX.
  • TuCloudAPI getadminuserlookups — Picker for the user form: the distinct roles used in this PBX (free-text datalist suggestions), and invite:true: users are created by email invitation, with no username and no password (always true on this build).
  • TuCloudAPI addadminuser — Invite a new portal user to THIS PBX.
  • TuCloudAPI updateadminuser — Edit a portal user in THIS PBX: name, active, priv_admin, role and phone are replaced as sent; disable_2fa=1 turns 2FA off and clears the secret (never enables).
  • TuCloudAPI requestadminuseremail — Ask to change a portal user's EMAIL (their magic-link login), the twin of requestpbxemail.
  • TuCloudAPI resendadminuseremail — Mail again the link of the user's open email change (the invitation of an invited user, or a change), pending or expired, with a fresh 24 hours; the previous link is then ignored.
  • TuCloudAPI canceladminuseremail — Drop the user's open email change (pending, or expired): its link is then ignored.
  • TuCloudAPI getadminuseremailchange — Status of the user's latest email change, from tucloudapi's own state (never magiclogin): none | pending (email, expires_in) | expired (until resent or cancelled) | done (notice: sent|failed|skipped, the informational mail to the old address) | failed (reason taken|error) | cancelled, with invite (true when it is the invitation) and its Spanish message.
  • TuCloudAPI deleteadminuser — Delete a portal user by login within this PBX; their open email change is cancelled with them.

PBX settings (Configuracion)

  • TuCloudAPI getpbxconfig — Get this PBX's settings (single record, no id needed, tenant from the binding).
  • TuCloudAPI getpbxconfiglookups — Picker for the admin_ext_id field: this PBX's extensions.
  • TuCloudAPI updatepbxconfig — Update this PBX's settings (strict set).
  • TuCloudAPI requestpbxemail — Ask to change this PBX's MASTER EMAIL (tucloud_pbx.email: the administrator's magic-link and password login).
  • TuCloudAPI getpbxemailchange — Status of this PBX's latest master-email change, from tucloudapi's own state (never magiclogin): none | pending (email, expires_in) | done (email, notice: sent|failed|skipped, the informational mail to the old address) | expired | failed (reason taken|error) | cancelled, each with its Spanish message.
  • TuCloudAPI cancelpbxemail — Cancel this PBX's pending master-email change (its link is then ignored).

Security profiles / ACL (Perfiles)

Call detail records (CDR)

  • TuCloudAPI getcdr — List a period of this PBX's call detail records (Registro de llamadas), newest first.
  • TuCloudAPI getcdrlookups — CDR form pickers: the selectable years + the result (disposition) label set.

Reports / statistics (Informes)

  • TuCloudAPI getreports — Call-volume statistics (Informes / Estadisticas de Llamadas) for a month — VOLUME ONLY, no prices.

AI assistant (Asistente IA)

Scheduled tasks (Tareas programadas)

Call simulator

  • TuCloudAPI simulatecall — Simulate how a call routes (inbound DID / outbound / internal) WITHOUT placing a real call, returning the ordered decision trace (flujo).

Audio files

  • TuCloudAPI getaudio — General-purpose audio file server (not only for the simulator): serve a locution or music-on-hold audio file base64-encoded (audio/wav) — for hover-preview, players, downloads, etc.

FuturePBX

Meta / discovery

  • TuCloudAPI help — Lists the API functions available to the role of the calling ukey, with each function's description, parameters (meaning, optional/default), an example call and the response format.

Diagnostics

Administration

Account management (inherited)

auth

queue_live

  • TuCloudAPI getqueueevents — Today's events of ONE queue (local day), newest first, at most 200, with the same deduplication as getqueuestats (core events; module EXITQUEUE FULL/JOINEMPTY kept as refused).
  • TuCloudAPI getlivestatus — LIVE state of the PBX as ONE snapshot of the presence feed: each extension's state (unregistered/idle/ringing/busy, "unknown" when it is not published) and its calls in progress (ringing/talking/hold/dialing, the other party, seconds since start and since answer), and each queue's live picture (agents logged in / available / paused, the waiting calls in queue order with their wait, every member with its status).

queue_stats

  • TuCloudAPI getqueuestats — Call-center history from voip_queue_log (gabpbx contract v1, 2026-10-31): totals, per interval, per queue and per agent between two local days (Europe/Madrid, inclusive).

Related

Full technical reference (architecture, auth model, side effects): see the project repo doc/TUCLOUDAPI_REFERENCE.md. Scheduled-tasks engine: the 6 tucloud_pbx_tasks* tables + the .231 crontab trigger.