# Overview ## Voicebot Tenant API 1.13.10 The tenant plane: what a tenant administers across its own accounts — account provisioning, the tenant’s own people and their API keys, and the roles its users hold. Reached with a tenant-level user’s session or API key; neither tenant nor account is a path segment — both resolve from the credential, with the scope-override headers for a principal broader than its target. A permission is named `:` or `::`, and the action is `read`, `write` or `manage`. On one resource `manage` includes `write`, and `write` includes `read`. Every tenant has five fixed roles: the `account` roles `reader`, `writer` and `account_admin`, and the `tenant` roles `tenant_admin` and `tenant_dpu`. `tenant_dpu` holds what `account_admin` holds, reads the accounts of the tenant and changes their `lines`, also on an account that carries an `external_id`. Any other write that `managed_resources` restricts is refused to it; only `tenant_admin` makes that write. A tenant’s own role may inherit a fixed `account` role. Each operation names the permission it needs in `x-athena-permission`; `none` means the operation checks no permission. A list refuses a `limit` above its maximum, and an `order_by`, `filter_or` or `include` name that its parameter does not accept. ## Request tracing Every response carries the trace id of its request in the `X-Trace-ID` header, as 32 lowercase hexadecimal characters. A path that differs from a route only by a trailing slash is answered with a redirect to that route, and the redirect carries no `X-Trace-ID` header. A request may name its own trace id, in the W3C `traceparent` header or in `X-Trace-ID`. An `X-Trace-ID` value is 32 hexadecimal characters or a UUID; the response returns it in lowercase and without dashes. A valid `traceparent` takes precedence over `X-Trace-ID`. A request with no valid id in either header is served under a new id. ## Errors An error response carries an `error` field that names the case. A client branches on `error`; the text in `message` is for people. ### Common to every resource These errors have the same status and meaning on every resource. An operation that cannot answer one, or answers it in its own way, says so in its responses. | Status | `error` | Meaning | | ------ | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 401 | `unauthenticated` | Refuses a request that cannot be authenticated. Returned when: - The request carries no usable credential. - The user, account or tenant behind the credential is not active. | | 403 | `permission_denied` | The credential is valid and in scope, but the caller’s roles do not grant the permission the operation needs. | | 404 | `not_found` | Refuses an identifier that names no resource the caller can use. Returned when: - No live resource with this identifier is visible to the caller. - The resource the identifier names belongs to another account. | | 405 | `method_not_allowed` | The path exists and does not accept this method. | | 500 | `internal` | The server failed to answer; the request did not take effect and may be retried. Any operation can answer it, so no operation lists it. | ### All errors Every error this API answers itself. An operation lists the ones it can answer in its responses. | Status | `error` | Meaning | | -------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 400 | `bad_request` | Refuses a request whose form is wrong. Returned when: - The body, a path parameter or a query parameter does not parse. - `Content-Encoding` names a compression the API does not accept, or the body cannot be decompressed as named. - A brick to validate names a type or a version the API does not know. - A data field path or a column name in the body is not well formed, or a key of a row’s `data` is empty or holds a dot. - A node `position` in the constructor of a scenario save carries one of `x` and `y` without the other. - The operation needs a WebSocket upgrade, and the request is not one. `message` names what failed. | | 400 | `email_required` | The tenant declares `account` in `managed_resources`, which makes `email` required, and the request carries none. | | 400 | `external_id_required` | The tenant declares this resource type in `managed_resources`, which makes `external_id` required, and the request carries none. | | 400 | `missing_scope_header` | The credential acts for a tenant or for the platform, and the request names no account in `X-Account-Sid` (or no tenant in `X-Tenant-Sid`). | | 400 | `scope_conflict` | Refuses the value of the scope header. Returned when: - The scope header names an account or tenant the credential does not cover. - The scope header carries a value that is not an id of that kind. | | 400, 422 | `validation_failed` | Refuses a body that does not pass validation. Returned when: - The body does not parse. - The body lacks a required field. - The body carries a value that is not accepted. `message` names the field. | | 401 | `unauthenticated` | Refuses a request that cannot be authenticated. Returned when: - The request carries no usable credential. - The user, account or tenant behind the credential is not active. | | 403 | `access_denied` | Refuses the request because of a permission the caller does not hold. Returned when: - The request assigns, creates, edits or deletes a role that carries a permission the caller does not hold. - The request writes to a user whose roles carry such a permission. | | 403 | `permission_denied` | The credential is valid and in scope, but the caller’s roles do not grant the permission the operation needs. | | 403 | `self_administration` | The target is the caller’s own user, which the user operations do not change or delete. `PATCH /v1/a/profile` on the account plane edits the caller’s own `name` and `email`. | | 404 | `audio_not_found` | Refuses the audio file name in the request. Returned when: - No stored file with this name is in the caller’s account. - The name is malformed. | | 404 | `not_found` | Refuses an identifier that names no resource the caller can use. Returned when: - No live resource with this identifier is visible to the caller. - The resource the identifier names belongs to another account. | | 405 | `method_not_allowed` | The path exists and does not accept this method. | | 409 | `account_calls_in_flight` | A call of the account, or of an account under the tenant, is being dialled or is in progress. | | 409 | `conflict` | The write collides with the current state of the resource; `message` says what collided. | | 409 | `email_conflict` | Another live user, at either level, already holds the email address. | | 409 | `external_id_conflict` | Another live resource of the same kind and scope already holds the external identifier. | | 409 | `role_fixed` | The role is defined by the platform and cannot be edited or deleted. | | 409 | `role_in_use` | Refuses the request while the role is in use. Returned when: - A live user of the tenant holds the role. - A live role inherits it. The data: - `data.users`: names the users that hold the role. - `data.roles`: names the roles that inherit it. | | 413 | `payload_too_large` | The body exceeds the size limit of the operation. | | 422 | `invalid_role` | Refuses a role named in the request. Returned when: - The role does not exist. - The role is a `tenant` role named for an account-level user. | | 422 | `scenario_validation_failed` | The constructor is missing, or the constructor or a brick checked alone does not pass validation; `data.errors.scenario` lists each failure. | | 500 | `internal` | The server failed to answer; the request did not take effect and may be retried. Any operation can answer it, so no operation lists it. | Apifonica Support - Information - OpenAPI version: `3.1.0` ## Operations GET [/v1/t/account](https://docs.aiva.apifonica.com/api/tenant/operations/listaccounts/)List accounts POST [/v1/t/account](https://docs.aiva.apifonica.com/api/tenant/operations/createaccount/)Create account GET [/v1/t/account/-/external/{external\_id}](https://docs.aiva.apifonica.com/api/tenant/operations/getaccountbyexternalid/)Get account by external identifier DELETE [/v1/t/account/-/external/{external\_id}](https://docs.aiva.apifonica.com/api/tenant/operations/deleteaccountbyexternalid/)Delete account by external identifier GET [/v1/t/account/{sid}](https://docs.aiva.apifonica.com/api/tenant/operations/getaccount/)Get account DELETE [/v1/t/account/{sid}](https://docs.aiva.apifonica.com/api/tenant/operations/deleteaccount/)Delete account PATCH [/v1/t/account/{sid}](https://docs.aiva.apifonica.com/api/tenant/operations/patchaccount/)Update account GET [/v1/t/openapi.yaml](https://docs.aiva.apifonica.com/api/tenant/operations/gettenantopenapidocument/)Tenant API document GET [/v1/changelog.md](https://docs.aiva.apifonica.com/api/tenant/operations/getchangelog/)Changelog GET [/v1/t/user](https://docs.aiva.apifonica.com/api/tenant/operations/listtenantusers/)List tenant-level users POST [/v1/t/user](https://docs.aiva.apifonica.com/api/tenant/operations/createtenantuser/)Create tenant-level user GET [/v1/t/user/-/external/{external\_id}](https://docs.aiva.apifonica.com/api/tenant/operations/gettenantuserbyexternalid/)Get tenant-level user by external identifier DELETE [/v1/t/user/-/external/{external\_id}](https://docs.aiva.apifonica.com/api/tenant/operations/deletetenantuserbyexternalid/)Delete tenant-level user by external identifier GET [/v1/t/user/{sid}](https://docs.aiva.apifonica.com/api/tenant/operations/gettenantuser/)Get tenant-level user DELETE [/v1/t/user/{sid}](https://docs.aiva.apifonica.com/api/tenant/operations/deletetenantuser/)Delete tenant-level user PATCH [/v1/t/user/{sid}](https://docs.aiva.apifonica.com/api/tenant/operations/patchtenantuser/)Update tenant-level user POST [/v1/t/user/{sid}/magic-link/request](https://docs.aiva.apifonica.com/api/tenant/operations/issuetenantusermagiclink/)Request tenant-level user magic link GET [/v1/t/user/-/api-key](https://docs.aiva.apifonica.com/api/tenant/operations/listtenantapikeys/)List the tenant-level users' API keys GET [/v1/t/user/{sid}/api-key](https://docs.aiva.apifonica.com/api/tenant/operations/listtenantuserapikeys/)List a tenant-level user's API keys POST [/v1/t/user/{sid}/api-key](https://docs.aiva.apifonica.com/api/tenant/operations/issuetenantuserapikey/)Issue tenant-level user API key DELETE [/v1/t/user/{sid}/api-key/{key\_sid}](https://docs.aiva.apifonica.com/api/tenant/operations/revoketenantuserapikey/)Revoke a tenant-level user's API key GET [/v1/t/permission](https://docs.aiva.apifonica.com/api/tenant/operations/listpermissions/)List the permission catalog GET [/v1/t/role](https://docs.aiva.apifonica.com/api/tenant/operations/listroles/)List roles POST [/v1/t/role](https://docs.aiva.apifonica.com/api/tenant/operations/createrole/)Create role GET [/v1/t/role/{sid}](https://docs.aiva.apifonica.com/api/tenant/operations/getrole/)Get role DELETE [/v1/t/role/{sid}](https://docs.aiva.apifonica.com/api/tenant/operations/deleterole/)Delete role PATCH [/v1/t/role/{sid}](https://docs.aiva.apifonica.com/api/tenant/operations/patchrole/)Update role GET [/v1/t/scenario-template](https://docs.aiva.apifonica.com/api/tenant/operations/listtenantscenariotemplates/)List scenario templates POST [/v1/t/scenario-template](https://docs.aiva.apifonica.com/api/tenant/operations/createscenariotemplate/)Create scenario template GET [/v1/t/scenario-template/{id}](https://docs.aiva.apifonica.com/api/tenant/operations/gettenantscenariotemplate/)Get scenario template DELETE [/v1/t/scenario-template/{id}](https://docs.aiva.apifonica.com/api/tenant/operations/deletescenariotemplate/)Delete scenario template PATCH [/v1/t/scenario-template/{id}](https://docs.aiva.apifonica.com/api/tenant/operations/patchscenariotemplate/)Update scenario template POST [/v1/t/audio](https://docs.aiva.apifonica.com/api/tenant/operations/uploadtenantaudio/)Upload an audio file of the tenant's scenario templates GET [/v1/t/audio/{filename}](https://docs.aiva.apifonica.com/api/tenant/operations/gettenantaudio/)Get an audio file of the tenant's scenario templates GET [/v1/t/adapters/llm/rag/document/{id}](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapterllmgetragdocumentid/)Download a RAG document file PUT [/v1/t/adapters/llm/rag/document/{id}](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapterllmputragdocumentid/)Upload a RAG document for an account DELETE [/v1/t/adapters/llm/rag/document/{id}](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapterllmdeleteragdocumentid/)Delete a RAG document for an account GET [/v1/t/adapters/llm/rag/document/list](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapterllmgetragdocumentlist/)List RAG documents for an account GET [/v1/t/adapters/llm/rag/document/search](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapterllmgetragdocumentsearch/)Semantic search over an account's RAG documents PUT [/v1/t/adapters/ids/classifier/{id}](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteridsputclassifierid/)Save classifier content DELETE [/v1/t/adapters/ids/classifier/{id}](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteridsdeleteclassifierid/)Delete a classifier GET [/v1/t/adapters/ids/classifier](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteridsgetclassifier/)List an account's classifier versions POST [/v1/t/adapters/ids/classifier](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteridspostclassifier/)Create a classifier GET [/v1/t/adapters/ids/classifier/{id}/version/{version}](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteridsgetclassifieridversionversion/)Get one version POST [/v1/t/adapters/ids/classifier/{id}/version/{version}/classify](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteridspostclassifieridversionversionclassify/)Classify a phrase against one version GET [/v1/t/adapters/edge/functions/{slug}/{version}](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteredgegetfunctionsslugversion/)Get a function version by slug and version POST [/v1/t/adapters/edge/functions/{slug}/{version}](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteredgepostfunctionsslugversion/)Run a function version by slug and version DELETE [/v1/t/adapters/edge/functions/{slug}/{version}](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteredgedeletefunctionsslugversion/)Delete a function version GET [/v1/t/adapters/edge/functions](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteredgegetfunctions/)List the latest version of every function POST [/v1/t/adapters/edge/functions](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteredgepostfunctions/)Create a function version GET [/v1/t/adapters/edge/functions/by-id/{id}](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteredgegetfunctionsbyidid/)Get a function version by id POST [/v1/t/adapters/edge/functions/by-id/{id}](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteredgepostfunctionsbyidid/)Run a function version by id GET [/v1/t/adapters/edge/functions/{slug}/versions](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteredgegetfunctionsslugversions/)List every version of a function POST [/v1/t/adapters/edge/functions/{slug}/{version}/warmup](https://docs.aiva.apifonica.com/api/tenant/operations/tenantadapteredgepostfunctionsslugversionwarmup/)Put the bundle of a version into the local cache ## Authentication ### bearerAuth A tenant API key, issued by the platform operator. **Security scheme type: **http