Schedule or cancel a sub-account deletion
const url = 'https://api.siprtc.io/v1/Accounts/example/Tenants/Delete';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"is_deleted":true,"tenant_id":"AC000000000000000002"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.siprtc.io/v1/Accounts/example/Tenants/Delete \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "is_deleted": true, "tenant_id": "AC000000000000000002" }'With is_deleted: true, schedules the deletion of a sub-account directly under the authenticated account: a deletion job is queued to run 15 minutes later. With is_deleted: false, cancels the scheduled deletion. Any account type may call it, and the lookup is always among the authenticated account’s own sub-accounts, whatever {auth_id} says. tenant_id may be the sub-account’s Auth ID or email address.
Errors: 400 for a body that is not JSON or a missing tenant_id or is_deleted. Every other failure answers 404, including when the job scheduler refuses the request or cannot be reached; read message for the reason.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Your Auth ID (the authenticated account).
Request Bodyrequired
Section titled “ Request Bodyrequired ”The sub-account, and whether to schedule or cancel its deletion.
object
True schedules the deletion, false cancels a scheduled one.
Example
trueAuth ID (or email address) of the sub-account.
Example
AC000000000000000002Responses
Section titled “ Responses ”The job was scheduled or cancelled.
object
The is_deleted value sent.
“tenant delete job scheduled” or “tenant delete job unscheduled”.
Always “success”.
The sub-account named in the request.
Example
{ "is_deleted": true, "message": "tenant delete job scheduled", "status": "success", "tenant_id": "AC000000000000000002"}The body is not JSON, or tenant_id or is_deleted is missing.
object
The underlying error text. Only some 400 responses of the tenant list carry it.
What went wrong, in English.
Always “failed”.
Example
{ "error": "sql: connection is already closed", "message": "Account Details not found", "status": "failed"}Authentication failed: wrong or missing credentials, a disabled account, or an {auth_id} that is neither you nor your direct sub-account.
Example generated
exampleNo such sub-account, it has no email address, or the job could not be scheduled or cancelled.
object
The underlying error text. Only some 400 responses of the tenant list carry it.
What went wrong, in English.
Always “failed”.
Example
{ "error": "sql: connection is already closed", "message": "Account Details not found", "status": "failed"}