Jump to content

MediaWiki:Common.js: Difference between revisions

From Wiki 7Kas
API Console gadget
 
Append gated TuCloudAPI Console loader (additive; restapi console untouched)
 
(3 intermediate revisions by the same user not shown)
Line 7: Line 7:
  if (mw.config.get('wgPageName') !== 'API_Console') { return; }
  if (mw.config.get('wgPageName') !== 'API_Console') { return; }
  var API = 'https://api.7kas.com:9080/7Kas';
  var API = 'https://api.7kas.com:9080/7Kas';
  var CAT = {"help":{"cat":"meta","ex":"https://api.7kas.com:9080/7Kas?func=help&ukey=KEY","params":[{"n":"name","req":false,"def":"","type":"string","d":"Return only this function's documentation. Omit for the full catalogue.","notes":""}]},"helloworld":{"cat":"health","ex":"https://api.7kas.com:9080/7Kas?func=helloworld&ukey=KEY","params":[]},"SetDebugLevel":{"cat":"admin","ex":"https://api.7kas.com:9080/7Kas?func=SetDebugLevel&ukey=SRKEY&level=2","params":[{"n":"level","req":true,"def":"","type":"integer","d":"New debug level, 0 (off) to 3 (most verbose).","notes":""}]},"ReloadUsersKeys":{"cat":"admin","ex":"https://api.7kas.com:9080/7Kas?func=ReloadUsersKeys&ukey=SRKEY","params":[]},"getaccountcodeid":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=getaccountcodeid&ukey=OPKEY&limit=100","params":[{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code (exact). Omit for all.","notes":"max length 20"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows (up to 10000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getaccountcodedata":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=getaccountcodedata&ukey=OPKEY&accountcodeid=123","params":[{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id. Omit for all.","notes":""},{"n":"limit","req":false,"def":"1000","type":"integer","d":"Max rows.","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"lockaccountcode":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=lockaccountcode&ukey=OPKEY&accountcodeid=123","params":[{"n":"accountcodeid","req":true,"def":"","type":"integer","d":"Account id to lock.","notes":""}]},"unlockaccountcode":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=unlockaccountcode&ukey=OPKEY&accountcodeid=123","params":[{"n":"accountcodeid","req":true,"def":"","type":"integer","d":"Account id to unlock.","notes":""}]},"addaccountcode":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=addaccountcode&ukey=OPKEY&accountcode=NEW1&credit=0&password=secret&name=John","params":[{"n":"accountcode","req":true,"def":"","type":"string","d":"Account code (login). Required. Max 20.","notes":""},{"n":"credit","req":true,"def":"","type":"string","d":"Initial credit. Required. Max 20.","notes":""},{"n":"password","req":true,"def":"","type":"string","d":"Account password. Required. Max 40.","notes":""},{"n":"name","req":true,"def":"","type":"string","d":"Contact/holder name. Required. Max 100.","notes":""},{"n":"company","req":false,"def":"","type":"string","d":"Company name.","notes":"max 100"},{"n":"address","req":false,"def":"","type":"string","d":"Postal address.","notes":"max 200"},{"n":"phone","req":false,"def":"","type":"string","d":"Phone.","notes":"max 20"},{"n":"email","req":false,"def":"","type":"string","d":"Primary e-mail.","notes":"max 100"},{"n":"date_added","req":false,"def":"","type":"string","d":"Creation date.","notes":"max 20"},{"n":"description","req":false,"def":"","type":"string","d":"Free description.","notes":"max 200"},{"n":"language","req":false,"def":"","type":"string","d":"UI language code.","notes":"max 5"},{"n":"postal_code","req":false,"def":"","type":"string","d":"Postal code.","notes":"max 10"},{"n":"city","req":false,"def":"","type":"string","d":"City.","notes":"max 50"},{"n":"province","req":false,"def":"","type":"string","d":"Province.","notes":"max 50"},{"n":"nif","req":false,"def":"","type":"string","d":"Tax id (NIF/CIF).","notes":"max 20"},{"n":"blocked","req":false,"def":"","type":"string","d":"Blocked flag (SI/NO).","notes":"max 4"},{"n":"postpaid","req":false,"def":"","type":"string","d":"Postpaid flag.","notes":"max 4"},{"n":"admin","req":false,"def":"","type":"string","d":"Admin flag.","notes":"max 4"},{"n":"accountcode_comis","req":false,"def":"","type":"string","d":"Commissioner account this account belongs to.","notes":"max 20"},{"n":"comisionista","req":false,"def":"","type":"string","d":"Is-commissioner flag (SI/NO).","notes":"max 4"},{"n":"groups","req":false,"def":"","type":"string","d":"Group memberships.","notes":"max 100"},{"n":"movil_sms","req":false,"def":"","type":"string","d":"Mobile for SMS.","notes":"max 20"},{"n":"email2","req":false,"def":"","type":"string","d":"Secondary e-mail.","notes":"max 100"},{"n":"fax","req":false,"def":"","type":"string","d":"Fax.","notes":"max 20"},{"n":"nota","req":false,"def":"","type":"string","d":"Internal note.","notes":"max 500"},{"n":"web","req":false,"def":"","type":"string","d":"Website.","notes":"max 100"},{"n":"flags","req":false,"def":"","type":"string","d":"Account flags.","notes":"max 20"},{"n":"tariff","req":false,"def":"","type":"string","d":"Tariff code.","notes":"max 20"},{"n":"daycallmail","req":false,"def":"","type":"string","d":"Daily-call report e-mail(s).","notes":"max 100"},{"n":"root","req":false,"def":"","type":"integer","d":"Parent operator root. Forced to the caller's own unless SuperRoot.","notes":"numeric, max 10"},{"n":"credit_limit","req":false,"def":"","type":"integer","d":"Credit limit.","notes":"numeric"},{"n":"comis_minutos","req":false,"def":"","type":"integer","d":"Commission minutes.","notes":"numeric"},{"n":"ratio","req":false,"def":"","type":"integer","d":"Commission ratio.","notes":"numeric"},{"n":"creditalarm","req":false,"def":"","type":"integer","d":"Credit alarm threshold.","notes":"numeric"},{"n":"aindirecto_coste","req":false,"def":"","type":"integer","d":"Indirect-access cost.","notes":"numeric"},{"n":"intlimit","req":false,"def":"","type":"integer","d":"International limit.","notes":"numeric"},{"n":"daycall","req":false,"def":"","type":"integer","d":"Daily-call limit.","notes":"numeric"},{"n":"intlock","req":false,"def":"","type":"integer","d":"International lock flag.","notes":"numeric"}]},"getcredit":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=getcredit&ukey=KEY","params":[{"n":"accountcode","req":false,"def":"","type":"string","d":"Account to query (operators/SuperRoot only). Omit for your own.","notes":"max length 20"}]},"resetinternalkey":{"cat":"admin","ex":"https://api.7kas.com:9080/7Kas?func=resetinternalkey&ukey=SRKEY&accountcodeid=123","params":[{"n":"accountcodeid","req":true,"def":"","type":"integer","d":"Account id whose internal key is reset.","notes":""}]},"getcdr":{"cat":"cdr","ex":"https://api.7kas.com:9080/7Kas?func=getcdr&ukey=KEY&year=2026&month=7&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year of the records (e.g. 2026).","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day of month (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour (0-23).","notes":"only valid together with day"},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id. Ignored/forced to the caller's own for clients.","notes":""},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows. SHM fast-path up to 10000, PostgreSQL fallback up to 1000.","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getcallsbilling":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbilling&ukey=KEY&year=2026&month=7&model=voc&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year (e.g. 2026).","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"model","req":false,"def":"voc","type":"string","d":"voc = detailed calls; toc = totals.","notes":"valid: voc|toc (case-insensitive)"},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code (non-clients). Forced to own for clients.","notes":"max 20"},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":"model=voc only"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour (0-23).","notes":"model=voc only, requires day"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows. SHM up to 10000, PostgreSQL up to 1000.","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""},{"n":"search","req":false,"def":"","type":"string","d":"Server-side search pattern.","notes":"max 40"},{"n":"search_fields","req":false,"def":"","type":"string","d":"Comma-separated fields (whitelist: dst, cid_num, cid_name, cli_billing, dial_cid_num, accountcode, prefix, dtype, context, tariff, fromuri).","notes":"max 200"},{"n":"search_mode","req":false,"def":"contains","type":"string","d":"Match mode.","notes":"prefix|suffix|contains|exact"}]},"getcallsbillingtotalroot":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingtotalroot&ukey=SRKEY&year=2026&month=7&root=5","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"root","req":false,"def":"","type":"integer","d":"Root/operator id. Required for SuperRoot; operators use their own.","notes":"required when SuperRoot"}]},"getcallsbillingcount":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingcount&ukey=KEY&year=2026&month=7&model=voc","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"model","req":false,"def":"voc","type":"string","d":"voc or toc.","notes":"valid: voc|toc"},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code (non-clients).","notes":"max 20"},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day.","notes":"model=voc only"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"model=voc only, requires day"}]},"getcallsbillingtotal":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingtotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""}]},"getcallsbillingaccounttotal":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingaccounttotal&ukey=OPKEY&year=2026&month=7&accountcode=CLI1","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"accountcode","req":false,"def":"","type":"string","d":"Account code to total.","notes":"max 20"}]},"getcallsbillingdetailtotal":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingdetailtotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code (non-clients).","notes":"max 20"},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"requires day"},{"n":"search","req":false,"def":"","type":"string","d":"Server-side search pattern.","notes":"max 40"},{"n":"search_fields","req":false,"def":"","type":"string","d":"Comma-separated searchable fields.","notes":"max 200"},{"n":"search_mode","req":false,"def":"contains","type":"string","d":"Match mode.","notes":"prefix|suffix|contains|exact"}]},"getcallsbillingalltotalroots":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingalltotalroots&ukey=SRKEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""}]},"getcallsbillingcomis":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingcomis&ukey=COMISKEY&year=2026&month=7","params":[{"n":"year","req":false,"def":"","type":"integer","d":"Year. Optional (defaults applied server-side).","notes":""},{"n":"month","req":false,"def":"","type":"integer","d":"Month, 1-12. Optional.","notes":""}]},"getservices":{"cat":"services","ex":"https://api.7kas.com:9080/7Kas?func=getservices&ukey=KEY&year=2026&month=7&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"service","req":false,"def":"","type":"string","d":"Service prefix (e.g. osttrc). Omit for all services.","notes":"max 20"},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account (non-clients). Forced to own for clients.","notes":"max 20"},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"requires day"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows (SHM up to 10000, PostgreSQL up to 1000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getservicestotal":{"cat":"services","ex":"https://api.7kas.com:9080/7Kas?func=getservicestotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"service","req":false,"def":"","type":"string","d":"Service prefix. Omit for all.","notes":"max 20"},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account (non-clients).","notes":"max 20"}]},"getservicesalltotalroots":{"cat":"services","ex":"https://api.7kas.com:9080/7Kas?func=getservicesalltotalroots&ukey=SRKEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"service","req":false,"def":"","type":"string","d":"Service prefix. Omit for all services.","notes":"max 20"}]},"getincomingcalls":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcalls&ukey=KEY&year=2026&month=7&model=vic&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year (e.g. 2026).","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"model","req":false,"def":"vic","type":"string","d":"vic = detail records; tic = totals.","notes":"valid: vic|tic (case-insensitive)"},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id (non-clients). Forced to own for clients.","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":"model=vic only"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour (0-23).","notes":"model=vic only, requires day"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows. SHM up to 10000, PostgreSQL up to 1000.","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""},{"n":"search","req":false,"def":"","type":"string","d":"Server-side search pattern.","notes":"max 40"},{"n":"search_fields","req":false,"def":"","type":"string","d":"Comma-separated fields to search (whitelist: src, dst).","notes":"max 200"},{"n":"search_mode","req":false,"def":"contains","type":"string","d":"Match mode.","notes":"prefix|suffix|contains|exact"}]},"getincomingcallstotalroot":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallstotalroot&ukey=SRKEY&year=2026&month=7&root=5","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"root","req":false,"def":"","type":"integer","d":"Root/operator id. Required for SuperRoot; operators use their own.","notes":"required when SuperRoot"}]},"getincomingcallscount":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallscount&ukey=KEY&year=2026&month=7&model=vic","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"model","req":false,"def":"vic","type":"string","d":"vic or tic.","notes":"valid: vic|tic"},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id (non-clients).","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day.","notes":"model=vic only"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"model=vic only, requires day"}]},"getincomingcallstotal":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallstotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""}]},"getincomingcallsaccounttotal":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallsaccounttotal&ukey=OPKEY&year=2026&month=7&accountcodeid=123","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"accountcodeid","req":true,"def":"","type":"integer","d":"Account id.","notes":""}]},"getincomingcallsdetailtotal":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallsdetailtotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id (non-clients).","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"requires day"}]},"getincomingcallsalltotalroots":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallsalltotalroots&ukey=SRKEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""}]},"getclis":{"cat":"clis","ex":"https://api.7kas.com:9080/7Kas?func=getclis&ukey=KEY&limit=100","params":[{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code. Forced to the caller's own for clients.","notes":"max length 20"},{"n":"active","req":false,"def":"","type":"string","d":"Filter by active flag.","notes":"max length 2"},{"n":"route","req":false,"def":"","type":"string","d":"Filter by route.","notes":"max length 32"},{"n":"type","req":false,"def":"","type":"string","d":"Filter by CLI type.","notes":"max length 2"},{"n":"limit","req":false,"def":"1000","type":"integer","d":"Maximum rows to return (capped at 1000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getpoolstats":{"cat":"admin","ex":"https://api.7kas.com:9080/7Kas?func=getpoolstats&ukey=SRKEY","params":[]},"getwgpeers":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=getwgpeers&ukey=OPKEY&server_id=1","params":[{"n":"server_id","req":true,"def":"","type":"integer","d":"WireGuard server id.","notes":""}]},"setwgstatus":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=setwgstatus&ukey=OPKEY&host=h1&root=5&status=1","params":[{"n":"host","req":true,"def":"","type":"string","d":"Peer host id.","notes":""},{"n":"root","req":true,"def":"","type":"integer","d":"Operator root the peer belongs to.","notes":""},{"n":"status","req":true,"def":"","type":"integer","d":"New status (e.g. 0=disabled, 1=enabled).","notes":""}]},"registerwgserver":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=registerwgserver&ukey=OPKEY&server_id=1&wg_pubkey=...&wg_listen_port=51820&wg_endpoint=vpn.example.com:51820","params":[{"n":"server_id","req":true,"def":"","type":"integer","d":"Server id.","notes":""},{"n":"wg_pubkey","req":true,"def":"","type":"string","d":"Server WireGuard public key (max 44).","notes":""},{"n":"wg_listen_port","req":true,"def":"","type":"integer","d":"UDP listen port.","notes":""},{"n":"wg_endpoint","req":true,"def":"","type":"string","d":"Public endpoint host:port (max 64).","notes":""}]},"registerwgdevice":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=registerwgdevice&ukey=OPKEY&mac=AA:BB:CC:DD:EE:FF&wg_pubkey=...","params":[{"n":"mac","req":true,"def":"","type":"string","d":"Device MAC address (max 17).","notes":""},{"n":"wg_pubkey","req":true,"def":"","type":"string","d":"Device WireGuard public key (max 44).","notes":""}]},"getwgconfig":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=getwgconfig&ukey=KEY&password=DEVICEPASS","params":[{"n":"password","req":true,"def":"","type":"string","d":"The device vpnpassword (max 128).","notes":""}]},"registervpnwgdevice":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=registervpnwgdevice&ukey=KEY&host=h1&password=PASS&wg_pubkey=...","params":[{"n":"host","req":true,"def":"","type":"string","d":"VPN host id (max 32).","notes":""},{"n":"password","req":true,"def":"","type":"string","d":"VPN password (max 128).","notes":""},{"n":"wg_pubkey","req":true,"def":"","type":"string","d":"Device WireGuard public key (max 44).","notes":""}]},"getvpnwgconfig":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=getvpnwgconfig&ukey=KEY&host=h1&password=PASS","params":[{"n":"host","req":true,"def":"","type":"string","d":"VPN host id (max 32).","notes":""},{"n":"password","req":true,"def":"","type":"string","d":"VPN password (max 128).","notes":""}]},"getpbxloclog":{"cat":"tucloud","ex":"https://api.7kas.com:9080/7Kas?func=getpbxloclog&ukey=KEY&year=2026&month=7&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year (e.g. 2026).","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day of month (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour (0-23).","notes":"only valid together with day"},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id (non-clients). Forced to own for clients.","notes":""},{"n":"tucloudpbx_id","req":false,"def":"","type":"integer","d":"Filter by virtual PBX id.","notes":""},{"n":"loc_id","req":false,"def":"","type":"integer","d":"Filter by locution/IVR id.","notes":""},{"n":"pbxname","req":false,"def":"","type":"string","d":"Filter by PBX name.","notes":"max length 32"},{"n":"pressed","req":false,"def":"","type":"string","d":"Filter by DTMF key(s) pressed.","notes":"max length 80"},{"n":"src","req":false,"def":"","type":"string","d":"Filter by source number.","notes":"max length 80"},{"n":"dst","req":false,"def":"","type":"string","d":"Filter by destination number.","notes":"max length 80"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows (PostgreSQL up to 1000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]}};
  var CAT = {"help":{"cat":"meta","ex":"https://api.7kas.com:9080/7Kas?func=help&ukey=KEY","params":[{"n":"name","req":false,"def":"","type":"string","d":"Return only this function's documentation. Omit for the full catalogue.","notes":""}]},"helloworld":{"cat":"health","ex":"https://api.7kas.com:9080/7Kas?func=helloworld&ukey=KEY","params":[]},"SetDebugLevel":{"cat":"admin","ex":"https://api.7kas.com:9080/7Kas?func=SetDebugLevel&ukey=SRKEY&level=2","params":[{"n":"level","req":true,"def":"","type":"integer","d":"New debug level, 0 (off) to 3 (most verbose).","notes":""}]},"ReloadUsersKeys":{"cat":"admin","ex":"https://api.7kas.com:9080/7Kas?func=ReloadUsersKeys&ukey=SRKEY","params":[]},"getaccountcodeid":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=getaccountcodeid&ukey=OPKEY&limit=100","params":[{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code (exact). Omit for all.","notes":"max length 20"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows (up to 10000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getaccountcodedata":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=getaccountcodedata&ukey=OPKEY&accountcodeid=123","params":[{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id. Omit for all.","notes":""},{"n":"limit","req":false,"def":"1000","type":"integer","d":"Max rows.","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"lockaccountcode":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=lockaccountcode&ukey=OPKEY&accountcodeid=123","params":[{"n":"accountcodeid","req":true,"def":"","type":"integer","d":"Account id to lock.","notes":""}]},"unlockaccountcode":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=unlockaccountcode&ukey=OPKEY&accountcodeid=123","params":[{"n":"accountcodeid","req":true,"def":"","type":"integer","d":"Account id to unlock.","notes":""}]},"addaccountcode":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=addaccountcode&ukey=OPKEY&accountcode=NEW1&credit=0&password=secret&name=John","params":[{"n":"accountcode","req":true,"def":"","type":"string","d":"Account code (login). Required. Max 20.","notes":""},{"n":"credit","req":true,"def":"","type":"string","d":"Initial credit. Required. Max 20.","notes":""},{"n":"password","req":true,"def":"","type":"string","d":"Account password. Required. Max 40.","notes":""},{"n":"name","req":true,"def":"","type":"string","d":"Contact/holder name. Required. Max 100.","notes":""},{"n":"company","req":false,"def":"","type":"string","d":"Company name.","notes":"max 100"},{"n":"address","req":false,"def":"","type":"string","d":"Postal address.","notes":"max 200"},{"n":"phone","req":false,"def":"","type":"string","d":"Phone.","notes":"max 20"},{"n":"email","req":false,"def":"","type":"string","d":"Primary e-mail.","notes":"max 100"},{"n":"date_added","req":false,"def":"","type":"string","d":"Creation date.","notes":"max 20"},{"n":"description","req":false,"def":"","type":"string","d":"Free description.","notes":"max 200"},{"n":"language","req":false,"def":"","type":"string","d":"UI language code.","notes":"max 5"},{"n":"postal_code","req":false,"def":"","type":"string","d":"Postal code.","notes":"max 10"},{"n":"city","req":false,"def":"","type":"string","d":"City.","notes":"max 50"},{"n":"province","req":false,"def":"","type":"string","d":"Province.","notes":"max 50"},{"n":"nif","req":false,"def":"","type":"string","d":"Tax id (NIF/CIF).","notes":"max 20"},{"n":"blocked","req":false,"def":"","type":"string","d":"Blocked flag (SI/NO).","notes":"max 4"},{"n":"postpaid","req":false,"def":"","type":"string","d":"Postpaid flag.","notes":"max 4"},{"n":"admin","req":false,"def":"","type":"string","d":"Admin flag.","notes":"max 4"},{"n":"accountcode_comis","req":false,"def":"","type":"string","d":"Commissioner account this account belongs to.","notes":"max 20"},{"n":"comisionista","req":false,"def":"","type":"string","d":"Is-commissioner flag (SI/NO).","notes":"max 4"},{"n":"groups","req":false,"def":"","type":"string","d":"Group memberships.","notes":"max 100"},{"n":"movil_sms","req":false,"def":"","type":"string","d":"Mobile for SMS.","notes":"max 20"},{"n":"email2","req":false,"def":"","type":"string","d":"Secondary e-mail.","notes":"max 100"},{"n":"fax","req":false,"def":"","type":"string","d":"Fax.","notes":"max 20"},{"n":"nota","req":false,"def":"","type":"string","d":"Internal note.","notes":"max 500"},{"n":"web","req":false,"def":"","type":"string","d":"Website.","notes":"max 100"},{"n":"flags","req":false,"def":"","type":"string","d":"Account flags.","notes":"max 20"},{"n":"tariff","req":false,"def":"","type":"string","d":"Tariff code.","notes":"max 20"},{"n":"daycallmail","req":false,"def":"","type":"string","d":"Daily-call report e-mail(s).","notes":"max 100"},{"n":"root","req":false,"def":"","type":"integer","d":"Parent operator root. Forced to the caller's own unless SuperRoot.","notes":"numeric, max 10"},{"n":"credit_limit","req":false,"def":"","type":"integer","d":"Credit limit.","notes":"numeric"},{"n":"comis_minutos","req":false,"def":"","type":"integer","d":"Commission minutes.","notes":"numeric"},{"n":"ratio","req":false,"def":"","type":"integer","d":"Commission ratio.","notes":"numeric"},{"n":"creditalarm","req":false,"def":"","type":"integer","d":"Credit alarm threshold.","notes":"numeric"},{"n":"aindirecto_coste","req":false,"def":"","type":"integer","d":"Indirect-access cost.","notes":"numeric"},{"n":"intlimit","req":false,"def":"","type":"integer","d":"International limit.","notes":"numeric"},{"n":"daycall","req":false,"def":"","type":"integer","d":"Daily-call limit.","notes":"numeric"},{"n":"intlock","req":false,"def":"","type":"integer","d":"International lock flag.","notes":"numeric"}]},"getcredit":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=getcredit&ukey=KEY","params":[{"n":"accountcode","req":false,"def":"","type":"string","d":"Account to query (operators/SuperRoot only). Omit for your own.","notes":"max length 20"}]},"resetinternalkey":{"cat":"admin","ex":"https://api.7kas.com:9080/7Kas?func=resetinternalkey&ukey=SRKEY&accountcodeid=123","params":[{"n":"accountcodeid","req":true,"def":"","type":"integer","d":"Account id whose internal key is reset.","notes":""}]},"getcdr":{"cat":"cdr","ex":"https://api.7kas.com:9080/7Kas?func=getcdr&ukey=KEY&year=2026&month=7&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year of the records (e.g. 2026).","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day of month (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour (0-23).","notes":"only valid together with day"},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id. Ignored/forced to the caller's own for clients.","notes":""},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows. SHM fast-path up to 10000, PostgreSQL fallback up to 1000.","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getcallsbilling":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbilling&ukey=KEY&year=2026&month=7&model=voc&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year (e.g. 2026).","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"model","req":false,"def":"voc","type":"string","d":"voc = detailed calls; toc = totals.","notes":"valid: voc|toc (case-insensitive)"},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code (non-clients). Forced to own for clients.","notes":"max 20"},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":"model=voc only"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour (0-23).","notes":"model=voc only, requires day"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows. SHM up to 10000, PostgreSQL up to 1000.","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""},{"n":"search","req":false,"def":"","type":"string","d":"Server-side search pattern.","notes":"max 40"},{"n":"search_fields","req":false,"def":"","type":"string","d":"Comma-separated fields (whitelist: dst, cid_num, cid_name, cli_billing, dial_cid_num, accountcode, prefix, dtype, context, tariff, fromuri).","notes":"max 200"},{"n":"search_mode","req":false,"def":"contains","type":"string","d":"Match mode.","notes":"prefix|suffix|contains|exact"}]},"getcallsbillingtotalroot":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingtotalroot&ukey=SRKEY&year=2026&month=7&root=5","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"root","req":false,"def":"","type":"integer","d":"Root/operator id. Required for SuperRoot; operators use their own.","notes":"required when SuperRoot"}]},"getcallsbillingcount":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingcount&ukey=KEY&year=2026&month=7&model=voc","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"model","req":false,"def":"voc","type":"string","d":"voc or toc.","notes":"valid: voc|toc"},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code (non-clients).","notes":"max 20"},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day.","notes":"model=voc only"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"model=voc only, requires day"}]},"getcallsbillingtotal":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingtotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""}]},"getcallsbillingaccounttotal":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingaccounttotal&ukey=OPKEY&year=2026&month=7&accountcode=CLI1","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"accountcode","req":false,"def":"","type":"string","d":"Account code to total.","notes":"max 20"}]},"getcallsbillingdetailtotal":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingdetailtotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code (non-clients).","notes":"max 20"},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"requires day"},{"n":"search","req":false,"def":"","type":"string","d":"Server-side search pattern.","notes":"max 40"},{"n":"search_fields","req":false,"def":"","type":"string","d":"Comma-separated searchable fields.","notes":"max 200"},{"n":"search_mode","req":false,"def":"contains","type":"string","d":"Match mode.","notes":"prefix|suffix|contains|exact"}]},"getcallsbillingalltotalroots":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingalltotalroots&ukey=SRKEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""}]},"getcallsbillingcomis":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingcomis&ukey=COMISKEY&year=2026&month=7","params":[{"n":"year","req":false,"def":"","type":"integer","d":"Year. Optional (defaults applied server-side).","notes":""},{"n":"month","req":false,"def":"","type":"integer","d":"Month, 1-12. Optional.","notes":""}]},"getservices":{"cat":"services","ex":"https://api.7kas.com:9080/7Kas?func=getservices&ukey=KEY&year=2026&month=7&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"service","req":false,"def":"","type":"string","d":"Service prefix (e.g. osttrc). Omit for all services.","notes":"max 20"},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account (non-clients). Forced to own for clients.","notes":"max 20"},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"requires day"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows (SHM up to 10000, PostgreSQL up to 1000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getservicestotal":{"cat":"services","ex":"https://api.7kas.com:9080/7Kas?func=getservicestotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"service","req":false,"def":"","type":"string","d":"Service prefix. Omit for all.","notes":"max 20"},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account (non-clients).","notes":"max 20"}]},"getservicesalltotalroots":{"cat":"services","ex":"https://api.7kas.com:9080/7Kas?func=getservicesalltotalroots&ukey=SRKEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"service","req":false,"def":"","type":"string","d":"Service prefix. Omit for all services.","notes":"max 20"}]},"getincomingcalls":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcalls&ukey=KEY&year=2026&month=7&model=vic&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year (e.g. 2026).","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"model","req":false,"def":"vic","type":"string","d":"vic = detail records; tic = totals.","notes":"valid: vic|tic (case-insensitive)"},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id (non-clients). Forced to own for clients.","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":"model=vic only"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour (0-23).","notes":"model=vic only, requires day"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows. SHM up to 10000, PostgreSQL up to 1000.","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""},{"n":"search","req":false,"def":"","type":"string","d":"Server-side search pattern.","notes":"max 40"},{"n":"search_fields","req":false,"def":"","type":"string","d":"Comma-separated fields to search (whitelist: src, dst).","notes":"max 200"},{"n":"search_mode","req":false,"def":"contains","type":"string","d":"Match mode.","notes":"prefix|suffix|contains|exact"}]},"getincomingcallstotalroot":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallstotalroot&ukey=SRKEY&year=2026&month=7&root=5","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"root","req":false,"def":"","type":"integer","d":"Root/operator id. Required for SuperRoot; operators use their own.","notes":"required when SuperRoot"}]},"getincomingcallscount":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallscount&ukey=KEY&year=2026&month=7&model=vic","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"model","req":false,"def":"vic","type":"string","d":"vic or tic.","notes":"valid: vic|tic"},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id (non-clients).","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day.","notes":"model=vic only"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"model=vic only, requires day"}]},"getincomingcallstotal":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallstotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""}]},"getincomingcallsaccounttotal":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallsaccounttotal&ukey=OPKEY&year=2026&month=7&accountcodeid=123","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"accountcodeid","req":true,"def":"","type":"integer","d":"Account id.","notes":""}]},"getincomingcallsdetailtotal":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallsdetailtotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id (non-clients).","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"requires day"}]},"getincomingcallsalltotalroots":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallsalltotalroots&ukey=SRKEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""}]},"getclis":{"cat":"clis","ex":"https://api.7kas.com:9080/7Kas?func=getclis&ukey=KEY&limit=100","params":[{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code. Forced to the caller's own for clients.","notes":"max length 20"},{"n":"active","req":false,"def":"","type":"string","d":"Filter by active flag.","notes":"max length 2"},{"n":"route","req":false,"def":"","type":"string","d":"Filter by route.","notes":"max length 32"},{"n":"type","req":false,"def":"","type":"string","d":"Filter by CLI type.","notes":"max length 2"},{"n":"limit","req":false,"def":"1000","type":"integer","d":"Maximum rows to return (capped at 1000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getpoolstats":{"cat":"admin","ex":"https://api.7kas.com:9080/7Kas?func=getpoolstats&ukey=SRKEY","params":[]},"getwgpeers":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=getwgpeers&ukey=OPKEY&server_id=1","params":[{"n":"server_id","req":true,"def":"","type":"integer","d":"WireGuard server id.","notes":""}]},"setwgstatus":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=setwgstatus&ukey=OPKEY&host=h1&root=5&status=1","params":[{"n":"host","req":true,"def":"","type":"string","d":"Peer host id.","notes":""},{"n":"root","req":true,"def":"","type":"integer","d":"Operator root the peer belongs to.","notes":""},{"n":"status","req":true,"def":"","type":"integer","d":"New status (e.g. 0=disabled, 1=enabled).","notes":""}]},"registerwgserver":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=registerwgserver&ukey=OPKEY&server_id=1&wg_pubkey=...&wg_listen_port=51820&wg_endpoint=vpn.example.com:51820","params":[{"n":"server_id","req":true,"def":"","type":"integer","d":"Server id.","notes":""},{"n":"wg_pubkey","req":true,"def":"","type":"string","d":"Server WireGuard public key (max 44).","notes":""},{"n":"wg_listen_port","req":true,"def":"","type":"integer","d":"UDP listen port.","notes":""},{"n":"wg_endpoint","req":true,"def":"","type":"string","d":"Public endpoint host:port (max 64).","notes":""}]},"registerwgdevice":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=registerwgdevice&ukey=OPKEY&mac=AA:BB:CC:DD:EE:FF&wg_pubkey=...","params":[{"n":"mac","req":true,"def":"","type":"string","d":"Device MAC address (max 17).","notes":""},{"n":"wg_pubkey","req":true,"def":"","type":"string","d":"Device WireGuard public key (max 44).","notes":""}]},"getwgconfig":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=getwgconfig&ukey=KEY&password=DEVICEPASS","params":[{"n":"password","req":true,"def":"","type":"string","d":"The device vpnpassword (max 128).","notes":""}]},"registervpnwgdevice":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=registervpnwgdevice&ukey=KEY&host=h1&password=PASS&wg_pubkey=...","params":[{"n":"host","req":true,"def":"","type":"string","d":"VPN host id (max 32).","notes":""},{"n":"password","req":true,"def":"","type":"string","d":"VPN password (max 128).","notes":""},{"n":"wg_pubkey","req":true,"def":"","type":"string","d":"Device WireGuard public key (max 44).","notes":""}]},"getvpnwgconfig":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=getvpnwgconfig&ukey=KEY&host=h1&password=PASS","params":[{"n":"host","req":true,"def":"","type":"string","d":"VPN host id (max 32).","notes":""},{"n":"password","req":true,"def":"","type":"string","d":"VPN password (max 128).","notes":""}]},"getpbxloclog":{"cat":"tucloud","ex":"https://api.7kas.com:9080/7Kas?func=getpbxloclog&ukey=KEY&year=2026&month=7&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year (e.g. 2026).","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day of month (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour (0-23).","notes":"only valid together with day"},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id (non-clients). Forced to own for clients.","notes":""},{"n":"tucloudpbx_id","req":false,"def":"","type":"integer","d":"Filter by virtual PBX id.","notes":""},{"n":"loc_id","req":false,"def":"","type":"integer","d":"Filter by locution/IVR id.","notes":""},{"n":"pbxname","req":false,"def":"","type":"string","d":"Filter by PBX name.","notes":"max length 32"},{"n":"pressed","req":false,"def":"","type":"string","d":"Filter by DTMF key(s) pressed.","notes":"max length 80"},{"n":"src","req":false,"def":"","type":"string","d":"Filter by source number.","notes":"max length 80"},{"n":"dst","req":false,"def":"","type":"string","d":"Filter by destination number.","notes":"max length 80"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows (PostgreSQL up to 1000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getrecordings":{"cat":"recordings","ex":"https://api.7kas.com:9080/7Kas?func=getrecordings&ukey=KEY&from=2026-07-01&to=2026-07-31","params":[{"n":"from","req":false,"def":"","type":"string","d":"Start date. Default: 31 days ago.","notes":"YYYY-MM-DD"},{"n":"to","req":false,"def":"","type":"string","d":"End date (inclusive). Default: today.","notes":"YYYY-MM-DD"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter to one hour of the day. Returns recordings whose start time falls in that hour (e.g. hour=14 => 14:00-14:59).","notes":"0-23"},{"n":"withtranscript","req":false,"def":"","type":"integer","d":"1 = only recordings that already have a transcript.","notes":""},{"n":"withsummary","req":false,"def":"","type":"integer","d":"1 = only recordings that already have a summary.","notes":""},{"n":"accountcode","req":false,"def":"","type":"integer","d":"Operators/SuperRoot only: filter to one account. Ignored/forced for clients.","notes":"string, max 20"},{"n":"root","req":false,"def":"","type":"integer","d":"SuperRoot only: filter to one operator root.","notes":""},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows (up to 1000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getrecordingtranscript":{"cat":"recordings","ex":"https://api.7kas.com:9080/7Kas?func=getrecordingtranscript&ukey=KEY&id=5270558&summary=1&format=text","params":[{"n":"id","req":false,"def":"","type":"integer","d":"Recording id. Provide id OR uniqueid.","notes":""},{"n":"uniqueid","req":false,"def":"","type":"string","d":"Call uniqueid. Provide id OR uniqueid.","notes":"max 80"},{"n":"summary","req":false,"def":"","type":"integer","d":"1 = include the summary (resumen) when available.","notes":""},{"n":"format","req":false,"def":"json","type":"string","d":"json = object; text = downloadable .txt.","notes":"json|text"}]},"getrecordingfile":{"cat":"recordings","ex":"https://api.7kas.com:9080/7Kas?func=getrecordingfile&ukey=KEY&id=5270558&dl=1","params":[{"n":"id","req":false,"def":"","type":"integer","d":"Recording id. Provide id OR uniqueid.","notes":""},{"n":"uniqueid","req":false,"def":"","type":"string","d":"Call uniqueid. Provide id OR uniqueid.","notes":"max 80"},{"n":"dl","req":false,"def":"","type":"integer","d":"1 = force download (Content-Disposition attachment).","notes":""}]},"getrecordingcertification":{"cat":"recordings","ex":"https://api.7kas.com:9080/7Kas?func=getrecordingcertification&ukey=KEY&id=5270558","params":[{"n":"id","req":false,"def":"","type":"integer","d":"Recording id. Provide id OR uniqueid.","notes":""},{"n":"uniqueid","req":false,"def":"","type":"string","d":"Call uniqueid. Provide id OR uniqueid.","notes":"max 80"}]}};
  function el(t,a,x){var e=document.createElement(t);if(a){for(var k in a){e.setAttribute(k,a[k]);}}if(x!=null){e.textContent=x;}return e;}
  function el(t,a,x){var e=document.createElement(t);if(a){for(var k in a){e.setAttribute(k,a[k]);}}if(x!=null){e.textContent=x;}return e;}
  function byId(id){return document.getElementById(id);}
  function byId(id){return document.getElementById(id);}
Line 25: Line 25:
     if(p.req){lab.appendChild(el('span',{'class':'ac-req'},' *'));}
     if(p.req){lab.appendChild(el('span',{'class':'ac-req'},' *'));}
     row.appendChild(lab);
     row.appendChild(lab);
     var inp=el('input',{id:'ac-p-'+p.n,type:'text',placeholder:(p.d||'')+(p.notes?' '+p.notes:'')});
     var inp=el('input',{id:'ac-p-'+p.n,type:'text',placeholder:(p.d||'')+(p.notes?' -- '+p.notes:'')});
     if(p.def){inp.value=p.def;}
     if(p.def){inp.value=p.def;}
     inp.addEventListener('input',buildURL); row.appendChild(inp); box.appendChild(row);
     inp.addEventListener('input',buildURL); row.appendChild(inp); box.appendChild(row);
Line 54: Line 54:
  });
  });
})();
})();
/* TuCloudAPI Console loader (tucloudapi) -- gated to its own page; bulk in MediaWiki:TuCloudAPIConsole.js. */
if (mw.config.get('wgPageName') === 'TuCloudAPI_Console') {
  mw.loader.load('/index.php?title=MediaWiki:TuCloudAPIConsole.js&action=raw&ctype=text/javascript');
}

Latest revision as of 14:40, 3 August 2026

/* 7Kas API Console -- interactive explorer for [[API Console]].
   SAFE BY DESIGN: pure client-side URL builder. No wiki proxy, no cross-origin fetch;
   "Run" opens the real 7Kas API (api.7kas.com) in a new tab using the reader's OWN ukey.
   Identity is enforced server-side and each key is rate-limited (taskslimit), so this adds
   no attack surface beyond what the public API already exposes. */
(function(){
 if (mw.config.get('wgPageName') !== 'API_Console') { return; }
 var API = 'https://api.7kas.com:9080/7Kas';
 var CAT = {"help":{"cat":"meta","ex":"https://api.7kas.com:9080/7Kas?func=help&ukey=KEY","params":[{"n":"name","req":false,"def":"","type":"string","d":"Return only this function's documentation. Omit for the full catalogue.","notes":""}]},"helloworld":{"cat":"health","ex":"https://api.7kas.com:9080/7Kas?func=helloworld&ukey=KEY","params":[]},"SetDebugLevel":{"cat":"admin","ex":"https://api.7kas.com:9080/7Kas?func=SetDebugLevel&ukey=SRKEY&level=2","params":[{"n":"level","req":true,"def":"","type":"integer","d":"New debug level, 0 (off) to 3 (most verbose).","notes":""}]},"ReloadUsersKeys":{"cat":"admin","ex":"https://api.7kas.com:9080/7Kas?func=ReloadUsersKeys&ukey=SRKEY","params":[]},"getaccountcodeid":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=getaccountcodeid&ukey=OPKEY&limit=100","params":[{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code (exact). Omit for all.","notes":"max length 20"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows (up to 10000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getaccountcodedata":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=getaccountcodedata&ukey=OPKEY&accountcodeid=123","params":[{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id. Omit for all.","notes":""},{"n":"limit","req":false,"def":"1000","type":"integer","d":"Max rows.","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"lockaccountcode":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=lockaccountcode&ukey=OPKEY&accountcodeid=123","params":[{"n":"accountcodeid","req":true,"def":"","type":"integer","d":"Account id to lock.","notes":""}]},"unlockaccountcode":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=unlockaccountcode&ukey=OPKEY&accountcodeid=123","params":[{"n":"accountcodeid","req":true,"def":"","type":"integer","d":"Account id to unlock.","notes":""}]},"addaccountcode":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=addaccountcode&ukey=OPKEY&accountcode=NEW1&credit=0&password=secret&name=John","params":[{"n":"accountcode","req":true,"def":"","type":"string","d":"Account code (login). Required. Max 20.","notes":""},{"n":"credit","req":true,"def":"","type":"string","d":"Initial credit. Required. Max 20.","notes":""},{"n":"password","req":true,"def":"","type":"string","d":"Account password. Required. Max 40.","notes":""},{"n":"name","req":true,"def":"","type":"string","d":"Contact/holder name. Required. Max 100.","notes":""},{"n":"company","req":false,"def":"","type":"string","d":"Company name.","notes":"max 100"},{"n":"address","req":false,"def":"","type":"string","d":"Postal address.","notes":"max 200"},{"n":"phone","req":false,"def":"","type":"string","d":"Phone.","notes":"max 20"},{"n":"email","req":false,"def":"","type":"string","d":"Primary e-mail.","notes":"max 100"},{"n":"date_added","req":false,"def":"","type":"string","d":"Creation date.","notes":"max 20"},{"n":"description","req":false,"def":"","type":"string","d":"Free description.","notes":"max 200"},{"n":"language","req":false,"def":"","type":"string","d":"UI language code.","notes":"max 5"},{"n":"postal_code","req":false,"def":"","type":"string","d":"Postal code.","notes":"max 10"},{"n":"city","req":false,"def":"","type":"string","d":"City.","notes":"max 50"},{"n":"province","req":false,"def":"","type":"string","d":"Province.","notes":"max 50"},{"n":"nif","req":false,"def":"","type":"string","d":"Tax id (NIF/CIF).","notes":"max 20"},{"n":"blocked","req":false,"def":"","type":"string","d":"Blocked flag (SI/NO).","notes":"max 4"},{"n":"postpaid","req":false,"def":"","type":"string","d":"Postpaid flag.","notes":"max 4"},{"n":"admin","req":false,"def":"","type":"string","d":"Admin flag.","notes":"max 4"},{"n":"accountcode_comis","req":false,"def":"","type":"string","d":"Commissioner account this account belongs to.","notes":"max 20"},{"n":"comisionista","req":false,"def":"","type":"string","d":"Is-commissioner flag (SI/NO).","notes":"max 4"},{"n":"groups","req":false,"def":"","type":"string","d":"Group memberships.","notes":"max 100"},{"n":"movil_sms","req":false,"def":"","type":"string","d":"Mobile for SMS.","notes":"max 20"},{"n":"email2","req":false,"def":"","type":"string","d":"Secondary e-mail.","notes":"max 100"},{"n":"fax","req":false,"def":"","type":"string","d":"Fax.","notes":"max 20"},{"n":"nota","req":false,"def":"","type":"string","d":"Internal note.","notes":"max 500"},{"n":"web","req":false,"def":"","type":"string","d":"Website.","notes":"max 100"},{"n":"flags","req":false,"def":"","type":"string","d":"Account flags.","notes":"max 20"},{"n":"tariff","req":false,"def":"","type":"string","d":"Tariff code.","notes":"max 20"},{"n":"daycallmail","req":false,"def":"","type":"string","d":"Daily-call report e-mail(s).","notes":"max 100"},{"n":"root","req":false,"def":"","type":"integer","d":"Parent operator root. Forced to the caller's own unless SuperRoot.","notes":"numeric, max 10"},{"n":"credit_limit","req":false,"def":"","type":"integer","d":"Credit limit.","notes":"numeric"},{"n":"comis_minutos","req":false,"def":"","type":"integer","d":"Commission minutes.","notes":"numeric"},{"n":"ratio","req":false,"def":"","type":"integer","d":"Commission ratio.","notes":"numeric"},{"n":"creditalarm","req":false,"def":"","type":"integer","d":"Credit alarm threshold.","notes":"numeric"},{"n":"aindirecto_coste","req":false,"def":"","type":"integer","d":"Indirect-access cost.","notes":"numeric"},{"n":"intlimit","req":false,"def":"","type":"integer","d":"International limit.","notes":"numeric"},{"n":"daycall","req":false,"def":"","type":"integer","d":"Daily-call limit.","notes":"numeric"},{"n":"intlock","req":false,"def":"","type":"integer","d":"International lock flag.","notes":"numeric"}]},"getcredit":{"cat":"accounts","ex":"https://api.7kas.com:9080/7Kas?func=getcredit&ukey=KEY","params":[{"n":"accountcode","req":false,"def":"","type":"string","d":"Account to query (operators/SuperRoot only). Omit for your own.","notes":"max length 20"}]},"resetinternalkey":{"cat":"admin","ex":"https://api.7kas.com:9080/7Kas?func=resetinternalkey&ukey=SRKEY&accountcodeid=123","params":[{"n":"accountcodeid","req":true,"def":"","type":"integer","d":"Account id whose internal key is reset.","notes":""}]},"getcdr":{"cat":"cdr","ex":"https://api.7kas.com:9080/7Kas?func=getcdr&ukey=KEY&year=2026&month=7&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year of the records (e.g. 2026).","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day of month (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour (0-23).","notes":"only valid together with day"},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id. Ignored/forced to the caller's own for clients.","notes":""},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows. SHM fast-path up to 10000, PostgreSQL fallback up to 1000.","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getcallsbilling":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbilling&ukey=KEY&year=2026&month=7&model=voc&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year (e.g. 2026).","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"model","req":false,"def":"voc","type":"string","d":"voc = detailed calls; toc = totals.","notes":"valid: voc|toc (case-insensitive)"},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code (non-clients). Forced to own for clients.","notes":"max 20"},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":"model=voc only"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour (0-23).","notes":"model=voc only, requires day"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows. SHM up to 10000, PostgreSQL up to 1000.","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""},{"n":"search","req":false,"def":"","type":"string","d":"Server-side search pattern.","notes":"max 40"},{"n":"search_fields","req":false,"def":"","type":"string","d":"Comma-separated fields (whitelist: dst, cid_num, cid_name, cli_billing, dial_cid_num, accountcode, prefix, dtype, context, tariff, fromuri).","notes":"max 200"},{"n":"search_mode","req":false,"def":"contains","type":"string","d":"Match mode.","notes":"prefix|suffix|contains|exact"}]},"getcallsbillingtotalroot":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingtotalroot&ukey=SRKEY&year=2026&month=7&root=5","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"root","req":false,"def":"","type":"integer","d":"Root/operator id. Required for SuperRoot; operators use their own.","notes":"required when SuperRoot"}]},"getcallsbillingcount":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingcount&ukey=KEY&year=2026&month=7&model=voc","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"model","req":false,"def":"voc","type":"string","d":"voc or toc.","notes":"valid: voc|toc"},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code (non-clients).","notes":"max 20"},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day.","notes":"model=voc only"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"model=voc only, requires day"}]},"getcallsbillingtotal":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingtotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""}]},"getcallsbillingaccounttotal":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingaccounttotal&ukey=OPKEY&year=2026&month=7&accountcode=CLI1","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"accountcode","req":false,"def":"","type":"string","d":"Account code to total.","notes":"max 20"}]},"getcallsbillingdetailtotal":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingdetailtotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code (non-clients).","notes":"max 20"},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"requires day"},{"n":"search","req":false,"def":"","type":"string","d":"Server-side search pattern.","notes":"max 40"},{"n":"search_fields","req":false,"def":"","type":"string","d":"Comma-separated searchable fields.","notes":"max 200"},{"n":"search_mode","req":false,"def":"contains","type":"string","d":"Match mode.","notes":"prefix|suffix|contains|exact"}]},"getcallsbillingalltotalroots":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingalltotalroots&ukey=SRKEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""}]},"getcallsbillingcomis":{"cat":"billing","ex":"https://api.7kas.com:9080/7Kas?func=getcallsbillingcomis&ukey=COMISKEY&year=2026&month=7","params":[{"n":"year","req":false,"def":"","type":"integer","d":"Year. Optional (defaults applied server-side).","notes":""},{"n":"month","req":false,"def":"","type":"integer","d":"Month, 1-12. Optional.","notes":""}]},"getservices":{"cat":"services","ex":"https://api.7kas.com:9080/7Kas?func=getservices&ukey=KEY&year=2026&month=7&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"service","req":false,"def":"","type":"string","d":"Service prefix (e.g. osttrc). Omit for all services.","notes":"max 20"},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account (non-clients). Forced to own for clients.","notes":"max 20"},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"requires day"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows (SHM up to 10000, PostgreSQL up to 1000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getservicestotal":{"cat":"services","ex":"https://api.7kas.com:9080/7Kas?func=getservicestotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"service","req":false,"def":"","type":"string","d":"Service prefix. Omit for all.","notes":"max 20"},{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account (non-clients).","notes":"max 20"}]},"getservicesalltotalroots":{"cat":"services","ex":"https://api.7kas.com:9080/7Kas?func=getservicesalltotalroots&ukey=SRKEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"service","req":false,"def":"","type":"string","d":"Service prefix. Omit for all services.","notes":"max 20"}]},"getincomingcalls":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcalls&ukey=KEY&year=2026&month=7&model=vic&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year (e.g. 2026).","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"model","req":false,"def":"vic","type":"string","d":"vic = detail records; tic = totals.","notes":"valid: vic|tic (case-insensitive)"},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id (non-clients). Forced to own for clients.","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":"model=vic only"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour (0-23).","notes":"model=vic only, requires day"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows. SHM up to 10000, PostgreSQL up to 1000.","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""},{"n":"search","req":false,"def":"","type":"string","d":"Server-side search pattern.","notes":"max 40"},{"n":"search_fields","req":false,"def":"","type":"string","d":"Comma-separated fields to search (whitelist: src, dst).","notes":"max 200"},{"n":"search_mode","req":false,"def":"contains","type":"string","d":"Match mode.","notes":"prefix|suffix|contains|exact"}]},"getincomingcallstotalroot":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallstotalroot&ukey=SRKEY&year=2026&month=7&root=5","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"root","req":false,"def":"","type":"integer","d":"Root/operator id. Required for SuperRoot; operators use their own.","notes":"required when SuperRoot"}]},"getincomingcallscount":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallscount&ukey=KEY&year=2026&month=7&model=vic","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"model","req":false,"def":"vic","type":"string","d":"vic or tic.","notes":"valid: vic|tic"},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id (non-clients).","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day.","notes":"model=vic only"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"model=vic only, requires day"}]},"getincomingcallstotal":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallstotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""}]},"getincomingcallsaccounttotal":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallsaccounttotal&ukey=OPKEY&year=2026&month=7&accountcodeid=123","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"accountcodeid","req":true,"def":"","type":"integer","d":"Account id.","notes":""}]},"getincomingcallsdetailtotal":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallsdetailtotal&ukey=KEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id (non-clients).","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour.","notes":"requires day"}]},"getincomingcallsalltotalroots":{"cat":"incomingcalls","ex":"https://api.7kas.com:9080/7Kas?func=getincomingcallsalltotalroots&ukey=SRKEY&year=2026&month=7","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year.","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""}]},"getclis":{"cat":"clis","ex":"https://api.7kas.com:9080/7Kas?func=getclis&ukey=KEY&limit=100","params":[{"n":"accountcode","req":false,"def":"","type":"string","d":"Filter by account code. Forced to the caller's own for clients.","notes":"max length 20"},{"n":"active","req":false,"def":"","type":"string","d":"Filter by active flag.","notes":"max length 2"},{"n":"route","req":false,"def":"","type":"string","d":"Filter by route.","notes":"max length 32"},{"n":"type","req":false,"def":"","type":"string","d":"Filter by CLI type.","notes":"max length 2"},{"n":"limit","req":false,"def":"1000","type":"integer","d":"Maximum rows to return (capped at 1000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getpoolstats":{"cat":"admin","ex":"https://api.7kas.com:9080/7Kas?func=getpoolstats&ukey=SRKEY","params":[]},"getwgpeers":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=getwgpeers&ukey=OPKEY&server_id=1","params":[{"n":"server_id","req":true,"def":"","type":"integer","d":"WireGuard server id.","notes":""}]},"setwgstatus":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=setwgstatus&ukey=OPKEY&host=h1&root=5&status=1","params":[{"n":"host","req":true,"def":"","type":"string","d":"Peer host id.","notes":""},{"n":"root","req":true,"def":"","type":"integer","d":"Operator root the peer belongs to.","notes":""},{"n":"status","req":true,"def":"","type":"integer","d":"New status (e.g. 0=disabled, 1=enabled).","notes":""}]},"registerwgserver":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=registerwgserver&ukey=OPKEY&server_id=1&wg_pubkey=...&wg_listen_port=51820&wg_endpoint=vpn.example.com:51820","params":[{"n":"server_id","req":true,"def":"","type":"integer","d":"Server id.","notes":""},{"n":"wg_pubkey","req":true,"def":"","type":"string","d":"Server WireGuard public key (max 44).","notes":""},{"n":"wg_listen_port","req":true,"def":"","type":"integer","d":"UDP listen port.","notes":""},{"n":"wg_endpoint","req":true,"def":"","type":"string","d":"Public endpoint host:port (max 64).","notes":""}]},"registerwgdevice":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=registerwgdevice&ukey=OPKEY&mac=AA:BB:CC:DD:EE:FF&wg_pubkey=...","params":[{"n":"mac","req":true,"def":"","type":"string","d":"Device MAC address (max 17).","notes":""},{"n":"wg_pubkey","req":true,"def":"","type":"string","d":"Device WireGuard public key (max 44).","notes":""}]},"getwgconfig":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=getwgconfig&ukey=KEY&password=DEVICEPASS","params":[{"n":"password","req":true,"def":"","type":"string","d":"The device vpnpassword (max 128).","notes":""}]},"registervpnwgdevice":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=registervpnwgdevice&ukey=KEY&host=h1&password=PASS&wg_pubkey=...","params":[{"n":"host","req":true,"def":"","type":"string","d":"VPN host id (max 32).","notes":""},{"n":"password","req":true,"def":"","type":"string","d":"VPN password (max 128).","notes":""},{"n":"wg_pubkey","req":true,"def":"","type":"string","d":"Device WireGuard public key (max 44).","notes":""}]},"getvpnwgconfig":{"cat":"wireguard","ex":"https://api.7kas.com:9080/7Kas?func=getvpnwgconfig&ukey=KEY&host=h1&password=PASS","params":[{"n":"host","req":true,"def":"","type":"string","d":"VPN host id (max 32).","notes":""},{"n":"password","req":true,"def":"","type":"string","d":"VPN password (max 128).","notes":""}]},"getpbxloclog":{"cat":"tucloud","ex":"https://api.7kas.com:9080/7Kas?func=getpbxloclog&ukey=KEY&year=2026&month=7&limit=100","params":[{"n":"year","req":true,"def":"","type":"integer","d":"Year (e.g. 2026).","notes":""},{"n":"month","req":true,"def":"","type":"integer","d":"Month, 1-12.","notes":""},{"n":"day","req":false,"def":"","type":"integer","d":"Filter by day of month (1-31).","notes":""},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter by hour (0-23).","notes":"only valid together with day"},{"n":"accountcodeid","req":false,"def":"","type":"integer","d":"Filter by account id (non-clients). Forced to own for clients.","notes":""},{"n":"tucloudpbx_id","req":false,"def":"","type":"integer","d":"Filter by virtual PBX id.","notes":""},{"n":"loc_id","req":false,"def":"","type":"integer","d":"Filter by locution/IVR id.","notes":""},{"n":"pbxname","req":false,"def":"","type":"string","d":"Filter by PBX name.","notes":"max length 32"},{"n":"pressed","req":false,"def":"","type":"string","d":"Filter by DTMF key(s) pressed.","notes":"max length 80"},{"n":"src","req":false,"def":"","type":"string","d":"Filter by source number.","notes":"max length 80"},{"n":"dst","req":false,"def":"","type":"string","d":"Filter by destination number.","notes":"max length 80"},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows (PostgreSQL up to 1000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getrecordings":{"cat":"recordings","ex":"https://api.7kas.com:9080/7Kas?func=getrecordings&ukey=KEY&from=2026-07-01&to=2026-07-31","params":[{"n":"from","req":false,"def":"","type":"string","d":"Start date. Default: 31 days ago.","notes":"YYYY-MM-DD"},{"n":"to","req":false,"def":"","type":"string","d":"End date (inclusive). Default: today.","notes":"YYYY-MM-DD"},{"n":"hour","req":false,"def":"","type":"integer","d":"Filter to one hour of the day. Returns recordings whose start time falls in that hour (e.g. hour=14 => 14:00-14:59).","notes":"0-23"},{"n":"withtranscript","req":false,"def":"","type":"integer","d":"1 = only recordings that already have a transcript.","notes":""},{"n":"withsummary","req":false,"def":"","type":"integer","d":"1 = only recordings that already have a summary.","notes":""},{"n":"accountcode","req":false,"def":"","type":"integer","d":"Operators/SuperRoot only: filter to one account. Ignored/forced for clients.","notes":"string, max 20"},{"n":"root","req":false,"def":"","type":"integer","d":"SuperRoot only: filter to one operator root.","notes":""},{"n":"limit","req":false,"def":"100","type":"integer","d":"Max rows (up to 1000).","notes":""},{"n":"offset","req":false,"def":"0","type":"integer","d":"Pagination offset.","notes":""}]},"getrecordingtranscript":{"cat":"recordings","ex":"https://api.7kas.com:9080/7Kas?func=getrecordingtranscript&ukey=KEY&id=5270558&summary=1&format=text","params":[{"n":"id","req":false,"def":"","type":"integer","d":"Recording id. Provide id OR uniqueid.","notes":""},{"n":"uniqueid","req":false,"def":"","type":"string","d":"Call uniqueid. Provide id OR uniqueid.","notes":"max 80"},{"n":"summary","req":false,"def":"","type":"integer","d":"1 = include the summary (resumen) when available.","notes":""},{"n":"format","req":false,"def":"json","type":"string","d":"json = object; text = downloadable .txt.","notes":"json|text"}]},"getrecordingfile":{"cat":"recordings","ex":"https://api.7kas.com:9080/7Kas?func=getrecordingfile&ukey=KEY&id=5270558&dl=1","params":[{"n":"id","req":false,"def":"","type":"integer","d":"Recording id. Provide id OR uniqueid.","notes":""},{"n":"uniqueid","req":false,"def":"","type":"string","d":"Call uniqueid. Provide id OR uniqueid.","notes":"max 80"},{"n":"dl","req":false,"def":"","type":"integer","d":"1 = force download (Content-Disposition attachment).","notes":""}]},"getrecordingcertification":{"cat":"recordings","ex":"https://api.7kas.com:9080/7Kas?func=getrecordingcertification&ukey=KEY&id=5270558","params":[{"n":"id","req":false,"def":"","type":"integer","d":"Recording id. Provide id OR uniqueid.","notes":""},{"n":"uniqueid","req":false,"def":"","type":"string","d":"Call uniqueid. Provide id OR uniqueid.","notes":"max 80"}]}};
 function el(t,a,x){var e=document.createElement(t);if(a){for(var k in a){e.setAttribute(k,a[k]);}}if(x!=null){e.textContent=x;}return e;}
 function byId(id){return document.getElementById(id);}
 function group(){var g={};Object.keys(CAT).forEach(function(n){var c=CAT[n].cat||'other';(g[c]=g[c]||[]).push(n);});return g;}
 function buildURL(){
   var uk=byId('ac-ukey').value.trim(), fn=byId('ac-func').value;
   var qs='?func='+encodeURIComponent(fn)+'&ukey='+encodeURIComponent(uk||'YOUR_KEY');
   (CAT[fn].params||[]).forEach(function(p){var e=byId('ac-p-'+p.n);var v=e?(''+e.value).trim():'';if(v){qs+='&'+encodeURIComponent(p.n)+'='+encodeURIComponent(v);}});
   var url=API+qs; byId('ac-url').value=url; return url;
 }
 function renderParams(){
   var fn=byId('ac-func').value, box=byId('ac-params'); box.innerHTML='';
   (CAT[fn].params||[]).forEach(function(p){
     var row=el('div',{'class':'ac-p'}), lab=el('label',{'for':'ac-p-'+p.n});
     lab.appendChild(el('span',null,p.n+' '));
     lab.appendChild(el('small',null,'('+p.type+(p.req?', required':', optional')+')'));
     if(p.req){lab.appendChild(el('span',{'class':'ac-req'},' *'));}
     row.appendChild(lab);
     var inp=el('input',{id:'ac-p-'+p.n,type:'text',placeholder:(p.d||'')+(p.notes?' -- '+p.notes:'')});
     if(p.def){inp.value=p.def;}
     inp.addEventListener('input',buildURL); row.appendChild(inp); box.appendChild(row);
   });
   buildURL();
 }
 $(function(){
   var host=byId('api-console-app'); if(!host||host.getAttribute('data-done')){return;} host.setAttribute('data-done','1'); host.innerHTML='';
   var r1=el('div',{'class':'ac-row'});
   r1.appendChild(el('label',{'for':'ac-ukey'},'Your API key (ukey)'));
   r1.appendChild(el('input',{id:'ac-ukey',type:'text',placeholder:'paste your ukey here',autocomplete:'off',spellcheck:'false'})); host.appendChild(r1);
   var r2=el('div',{'class':'ac-row'});
   r2.appendChild(el('label',{'for':'ac-func'},'Function'));
   var sel=el('select',{id:'ac-func'}), g=group();
   Object.keys(g).sort().forEach(function(c){var og=el('optgroup',{label:c});g[c].sort().forEach(function(n){og.appendChild(el('option',{value:n},n));});sel.appendChild(og);});
   sel.addEventListener('change',renderParams); r2.appendChild(sel); host.appendChild(r2);
   host.appendChild(el('div',{id:'ac-params'}));
   var r3=el('div',{'class':'ac-row'});
   r3.appendChild(el('label',{'for':'ac-url'},'Request URL'));
   r3.appendChild(el('textarea',{id:'ac-url',readonly:'readonly'})); host.appendChild(r3);
   var bar=el('div',{'class':'ac-row'});
   var run=el('button',null,'Run ▶  (open result)'); run.addEventListener('click',function(){window.open(buildURL(),'_blank','noopener');});
   var cp=el('button',null,'Copy URL'); cp.addEventListener('click',function(){byId('ac-url').select();try{document.execCommand('copy');}catch(e){}});
   bar.appendChild(run); bar.appendChild(cp); host.appendChild(bar);
   var note=el('div',{'class':'ac-note'}); note.innerHTML='This runs a <b>real</b> call with <b>your</b> key. You only ever see your own data (identity is forced server-side). The result opens in a new tab as JSON.';
   host.appendChild(note);
   if(sel.options.length){ sel.value=('getcdr' in CAT)?'getcdr':sel.options[0].value; renderParams(); }
 });
})();
/* TuCloudAPI Console loader (tucloudapi) -- gated to its own page; bulk in MediaWiki:TuCloudAPIConsole.js. */
if (mw.config.get('wgPageName') === 'TuCloudAPI_Console') {
  mw.loader.load('/index.php?title=MediaWiki:TuCloudAPIConsole.js&action=raw&ctype=text/javascript');
}