Jump to content

TuCloudAPI addadminuser

From Wiki 7Kas

TuCloudAPI function to manage FuturePBX (the cloud PBX). Available to: SuperRoot, Operator, Client.

ℹ Requires the pbx parameter (the PBX name, e.g. tucall). The server verifies that your ukey's own account owns that PBX, whatever its role; otherwise, and also for a PBX that does not exist, it returns {"ok":false,"code":"forbidden"}.

Description

Invite a new portal user to THIS PBX. No login and no password: the server generates the login (_id) and the user logs in only with their email, by magic link. The user is created INVITED, with no confirmed email, and a link valid 24 hours is mailed to the address; when it is opened (completed by the server) the address becomes the user's email and the user can log in. The address is normalized (trim + lower-case); refusals carry field email and reason required | format | too_long | taken (another user's or a PBX's email) | rate_limited (3 per user and 20 per PBX per hour), and then nothing is created. A non-empty login or password is refused (field login|password, reason not_allowed); an empty one is ignored. tucloudpbx_id and root are set server-side. Follow the invitation with getadminuseremailchange. Requires a non-readonly ukey.

Call

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

GET, or POST with the parameters form-urlencoded in the body. Requires the ukey parameter. Always HTTP 200; the response is a JSON envelope.

Parameters

Parameter Type Required Default Meaning
pbx string Yes — FuturePBX NAME (e.g. tucall). The (ukey, pbx) pair is the tenant boundary; the server verifies the ukey owns this PBX and scopes every admin user to it.
email string Yes — The user's email (max 128): where the invitation goes, and their login.
name string No — Display name.
active integer No 1 1 = active, 0 = disabled.
priv_admin integer No 0 1 = super-admin flag.
role string No — Free-text role label.
phone string No — Phone.

Example

https://tucloudapi.7kas.com:9087/tucloud?func=addadminuser&ukey=KEY&pbx=tucall&email=ana@example.com&name=Ana

Response

{ok, user:{...}, status:"invited", email_pending, expires_in} | {ok:false, code, field, reason, message}.

Errors

Always HTTP 200. On failure the body is {"ok":false,"code":"...","message":"..."}. Common codes: missing_pbx, forbidden, invalid_param, not_found, conflict, in_use, db_error, server_busy; the Response section above lists any specific to this function.


Back to TuCloudAPI