Jump to content

TuCloudAPI: Difference between revisions

From Wiki 7Kas
API docs — add #41/#42 getreports (statistics)
Fix {{Note}} 1= (func=help)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Note|New here? Start with '''[[TuCloudAPI help|the self-discovery endpoint]]'''. This reference is generated from <code>func=help</code>, so it never drifts.}}
{{Note|1=New here? Start with '''[[TuCloudAPI help|the self-discovery endpoint]]'''. This reference is generated from <code>func=help</code>, so it never drifts.}}


== Overview ==
== Overview ==
'''TuCloudAPI''' is the REST API to manage '''tucloud''' (the multi-tenant PBX, a.k.a. futurepbx). '''HTTPS, GET, JSON.''' Base URL:
'''TuCloudAPI''' is the REST API to manage '''FuturePBX''' (the multi-tenant cloud PBX). '''HTTPS, GET, JSON.''' Base URL:
  https://tucloudapi.7kas.com:9087/tucloud?func=NAME&ukey=YOUR_KEY&pbx=PBX_NAME
  https://tucloudapi.7kas.com:9087/tucloud?func=NAME&ukey=YOUR_KEY&pbx=PBX_NAME


Line 32: Line 32:
* [[TuCloudAPI getroutes]] — List inbound routes for the PBX with step counts.
* [[TuCloudAPI getroutes]] — List inbound routes for the PBX with step counts.
* [[TuCloudAPI getroute]] — Get one route header plus its ordered steps (destinations).
* [[TuCloudAPI getroute]] — Get one route header plus its ordered steps (destinations).
* [[TuCloudAPI getroutelookups]] — Tenant-scoped destination pickers for the step editor: the app enum plus extensions, groups, locutions, schedules, calendars and routes.
* [[TuCloudAPI getroutelookups]] — Tenant-scoped destination pickers for the step editor: the app enum plus extensions, groups, locutions, schedules, calendars, routes and queues (app=10 "Cola": _id = the stable voip_queue.id stored in the step appdata, label = the queue title).
* [[TuCloudAPI addroute]] — Create an inbound route (header only; add steps with addroutestep).
* [[TuCloudAPI addroute]] — Create an inbound route (header only; add steps with addroutestep).
* [[TuCloudAPI updateroute]] — Rename/annotate a route header.
* [[TuCloudAPI updateroute]] — Rename/annotate a route header.
Line 104: Line 104:
* [[TuCloudAPI getqueues]] — List the PBX call queues (ACD) with member counts.
* [[TuCloudAPI getqueues]] — List the PBX call queues (ACD) with member counts.
* [[TuCloudAPI getqueue]] — Get one queue's config.
* [[TuCloudAPI getqueue]] — Get one queue's config.
* [[TuCloudAPI getqueuelookups]] — Tenant-scoped pickers for the queue form: music (MOH classes) and the strategy enum.
* [[TuCloudAPI getqueuelookups]] — Tenant-scoped pickers for the queue form: music (MOH classes), the strategy enum, and next_free (the create-form exten prefill = first free 3-digit queue number, null if 900-999 full).
* [[TuCloudAPI addqueue]] — Create a call queue.
* [[TuCloudAPI addqueue]] — Create a call queue.
* [[TuCloudAPI updatequeue]] — Edit a queue's config.
* [[TuCloudAPI updatequeue]] — Edit a queue's config.
* [[TuCloudAPI deletequeue]] — Delete a queue.
* [[TuCloudAPI deletequeue]] — Delete a queue.
=== Agents / queue members (Agentes) ===
* [[TuCloudAPI getagents]] — List the PBX agents (queue members) with the queue title and the agent's extension name resolved.
* [[TuCloudAPI getagentlookups]] — Dropdown data for the agent screens: this PBX's queues (assign an agent to a queue) and its extensions {_id,num,name}.
* [[TuCloudAPI addagent]] — Add an extension to a queue as a static member.
* [[TuCloudAPI updateagent]] — Update a queue member's penalty / paused / reason_paused (partial — only the fields sent are changed).
* [[TuCloudAPI deleteagent]] — Remove a queue member (agent) by _id.
=== Portal admin users (Usuarios) ===
=== Portal admin users (Usuarios) ===
* [[TuCloudAPI getadminusers]] — List this PBX's portal admin users (tucloud_sec_users).
* [[TuCloudAPI getadminusers]] — List this PBX's portal admin users (tucloud_sec_users).
Line 137: Line 143:
=== Reports / statistics (Informes) ===
=== Reports / statistics (Informes) ===
* [[TuCloudAPI getreports]] — Call-volume statistics (Informes / Estadisticas de Llamadas) for a month — VOLUME ONLY, no prices.
* [[TuCloudAPI getreports]] — Call-volume statistics (Informes / Estadisticas de Llamadas) for a month — VOLUME ONLY, no prices.
=== AI assistant (Asistente IA) ===
* [[TuCloudAPI aichat]] — AI assistant for this PBX (Spanish).
=== Scheduled tasks (Tareas programadas) ===
=== Scheduled tasks (Tareas programadas) ===
* [[TuCloudAPI gettasks]] — List scheduled tasks (tareas programadas) for the PBX, with schedule + status labels and step counts.
* [[TuCloudAPI gettasks]] — List scheduled tasks (tareas programadas) for the PBX, with schedule + status labels and step counts.
Line 157: Line 165:
=== Audio files ===
=== 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.
* [[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.
=== Tucloud PBX ===
=== FuturePBX ===
* [[TuCloudAPI getpbxloclog]] — Tucloud PBX IVR/locution DTMF key-press log for a period.
* [[TuCloudAPI getpbxloclog]] — FuturePBX IVR/locution DTMF key-press log for a period.
=== Meta / discovery ===
=== 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.
* [[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.

Latest revision as of 14:51, 3 August 2026

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, GET, JSON. 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). The tasks functions also need 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 the key owns it (SuperRoot any PBX; Operator its own root; Client its own account). It never trusts a numeric tenant from the caller.

Response format

Always HTTP 200. The tasks functions always return a JSON envelope: success {"ok":true, ...}, empty {"ok":true,"rows":[]}, error {"ok":false,"code":...,"message":...} (codes: missing_pbx, unknown_pbx, forbidden, invalid_param, not_found, db_error, server_busy). IDs are exposed as _id. Base/legacy functions return their data object directly, or {} on error/empty.

Functions

Dashboard (landing counts)

Extensions (Extensiones)

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)

PBX settings (Configuracion)

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)

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.