openapi: 3.1.0 info: title: Voicebot Tenant API version: 1.13.10 contact: name: Apifonica Support email: support@apifonica.com description: '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. |' servers: - url: / security: - bearerAuth: [] tags: - name: Account description: Account CRUD. - name: Contract x-displayName: OpenAPI Document description: The API's own OpenAPI document and its changelog, served exactly as the deployment was built. - name: User description: 'Manages people with roles: create, read, update and delete them, and request magic links and password resets for them. By plane: - The account plane holds an account''s users. - The tenant plane holds the tenant''s own people.' - name: Role description: 'Manages named sets of permissions a tenant assigns to its users: the fixed roles every tenant has, and the roles the tenant defines. By plane: - The tenant plane serves the permission catalog and role CRUD. - The account plane serves the list of `account` roles.' - name: ScenarioTemplate x-displayName: Scenario Template description: 'A scenario that a tenant prepares for its accounts. An account copies it into a scenario of its own. By plane: - The tenant plane serves template CRUD. - The account plane lists the templates of the account''s tenant, reads one, and copies one into the account.' - name: Audio description: Audio files scenario bricks embed. Upload + serve (proxied or presigned link). - name: LLM Adapter description: Chat completion and streaming, embeddings, and retrieval over uploaded documents. - name: Classifier description: Classifiers and their immutable versions — lifecycle, training progress, and classification. - name: Edge Function description: The JavaScript functions a scenario brick runs — versions, their code, and a run. paths: /v1/t/account: get: tags: - Account operationId: ListAccounts x-athena-permission: account:read summary: List accounts description: The accounts of one tenant. Soft-deleted rows stay out unless `show_deleted` asks for them, and each row carries its own `deleted_at`. parameters: - name: show_deleted in: query required: false description: Include soft-deleted rows in the listing. schema: type: boolean - $ref: '#/components/parameters/XTenantSidHeader' - name: filter_or in: query required: false description: 'Names the fields, comma-separated, that filter_query OR-searches. Values: - `sid`: matched exactly. - `name`: matched as a substring, case-insensitive. - `email`: matched as a substring, case-insensitive. It is supplied together with filter_query. Refused when: - One of the two is sent without the other. - A field is unknown.' schema: type: string - name: filter_query in: query required: false description: Search term matched across the fields named in filter_or. schema: type: string - name: order_by in: query required: false description: 'Sort field. Accepted: created_at, name, email (default created_at).' schema: type: string - name: order in: query required: false description: 'Sort direction: asc | desc (default desc).' schema: type: string - name: limit in: query required: false description: Page size, max 500 (default 100). schema: type: integer maximum: 500 - name: offset in: query required: false schema: type: integer responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AccountList' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' post: tags: - Account operationId: CreateAccount x-athena-permission: account:manage summary: Create account description: 'Creates the account row and nothing else (no API key, no segments, no flags) and starts it active on the allocation `lines` gives it. Rules: - `name`: need not be unique. - `external_id`: required while the tenant declares `account` in `managed_resources`.' parameters: - $ref: '#/components/parameters/XTenantSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateAccountRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Account' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeEmailRequired' - $ref: '#/components/schemas/ErrorCodeExternalIdRequired' - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeConflict' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeValidationFailed' /v1/t/account/-/external/{external_id}: get: tags: - Account operationId: GetAccountByExternalID x-athena-permission: account:read summary: Get account by external identifier description: 'Resolves the account the client system gave this key, without the caller knowing the platform sid. The key is unique within a tenant, so the lookup runs inside the caller''s tenant. By principal: - A tenant-scoped principal looks up in its own tenant. - A broader principal looks up in the tenant it names with `X-Tenant-Sid`.' parameters: - $ref: '#/components/parameters/AccountExternalIDPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Account' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' delete: tags: - Account operationId: DeleteAccountByExternalID x-athena-permission: account:manage summary: Delete account by external identifier description: 'Soft-deletes the account the client system gave this key, as a delete by sid does, without the caller knowing the platform sid. Resolution is the read''s, inside the caller''s tenant: its own, or the one it names with `X-Tenant-Sid`. Effects: - The delete cascades to the account''s users. - The key is released for reuse by a live account.' parameters: - $ref: '#/components/parameters/AccountExternalIDPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '204': description: No content '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAccountCallsInFlight' /v1/t/account/{sid}: get: tags: - Account operationId: GetAccount x-athena-permission: account:read summary: Get account description: One account of the tenant. parameters: - $ref: '#/components/parameters/AccountSidPath' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Account' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' patch: tags: - Account operationId: PatchAccount x-athena-permission: account:capacity:manage x-athena-field-permissions: name: account:manage email: account:manage external_id: account:manage country: account:manage timezone: account:manage phone: account:manage retention: account:manage contact_limits: account:manage status: account:manage summary: Update account description: 'Updates the account. Rules: - `tenant_sid` is not among the fields, so an account stays with the tenant it was created under. - A caller may hold the permission for `lines` without the permission for the other fields, and then changes `lines` only. - The permission for the other fields includes the permission for `lines`. - An archived agent holds no line, so it is neither counted nor reduced. When `lines` is lowered below what the account''s agents already hold: - The agents are fitted inside it rather than the request being refused. - They are reduced oldest first, each to the one line an agent needs to answer at all, until the total fits. - The agent the allocation runs out at keeps what is left of it. When `status` is set to inactive: - The account''s users are signed out. - Every credential scoped to the account stops authenticating. - The account''s API keys survive that: they refuse for as long as the hold lasts, then authenticate again unchanged. - The sessions do not come back. Refused when: - A caller with only the permission for `lines` sends a request that carries any other field. - The `lines` allocation is below the number of agents that are not archived.' parameters: - $ref: '#/components/parameters/AccountSidPath' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchAccountRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Account' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeConflict' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeValidationFailed' delete: tags: - Account operationId: DeleteAccount x-athena-permission: account:manage summary: Delete account description: 'Soft-deletes the account, cascading to its users, agents, scenarios, numbers, number pools, SMS providers, communications, results, contacts, segments, STT dictionaries, limit policies and automations. Effects: - Each cascaded record is marked deleted, and none is physically removed. - With `show_deleted=true` the account list still returns the account. - No other list on the account or tenant plane returns anything under the account. - Credentials are the one exception: they are deleted outright, so the account''s API keys and sessions stop authenticating immediately. There is no hard delete at account level; physical removal exists only for a tenant.' parameters: - $ref: '#/components/parameters/AccountSidPath' responses: '204': description: No content '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAccountCallsInFlight' /v1/t/user: get: tags: - User operationId: ListTenantUsers x-athena-permission: tenant:user:read summary: List tenant-level users description: 'The tenant-level users of the caller''s tenant: the people who belong to the tenant itself rather than to one of its accounts.' parameters: - $ref: '#/components/parameters/XTenantSidHeader' - name: show_deleted in: query required: false description: Include soft-deleted users in the listing. schema: type: boolean default: false - name: filter_or in: query required: false description: 'Names the fields, comma-separated, that `filter_query` searches with OR. It accepts `name` and `email`, each matched as a substring, case-insensitive. Refused when: - One of `filter_or` and `filter_query` is sent without the other. - A field is unknown.' schema: type: string - name: filter_query in: query required: false description: Search term matched across the fields named in filter_or. schema: type: string - name: order_by in: query required: false description: 'Sort field. Accepted: created_at, name, email (default created_at).' schema: type: string - name: order in: query required: false description: 'Sort direction: asc | desc (default desc).' schema: type: string - name: limit in: query required: false description: Page size, max 500 (default 100). schema: type: integer maximum: 500 - name: offset in: query required: false schema: type: integer responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/UserList' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' post: tags: - User operationId: CreateTenantUser x-athena-permission: tenant:user:manage summary: Create tenant-level user description: 'Creates the tenant-level user active. Rules: - The request carries no password: the user holds none, and sign-in is by magic link only. - `external_id` stays optional while the tenant declares `user` in `managed_resources`.' parameters: - $ref: '#/components/parameters/XTenantSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateTenantUserRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/User' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAccessDenied' - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeEmailConflict' - $ref: '#/components/schemas/ErrorCodeExternalIdConflict' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeInvalidRole' - $ref: '#/components/schemas/ErrorCodeValidationFailed' /v1/t/user/-/external/{external_id}: get: tags: - User operationId: GetTenantUserByExternalID x-athena-permission: tenant:user:read summary: Get tenant-level user by external identifier description: Reads the tenant-level user of the caller's tenant that carries this external identifier. The caller does not need the platform sid. parameters: - $ref: '#/components/parameters/UserExternalIDPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/User' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' delete: tags: - User operationId: DeleteTenantUserByExternalID x-athena-permission: tenant:user:manage summary: Delete tenant-level user by external identifier description: 'Deletes the tenant-level user of the caller''s tenant that carries this external identifier. Rules: - The delete is soft and has the same effect as the delete by sid. - After it, another user can take the identifier. Refused when: - The request is for the caller''s own user, with that user''s session or with that user''s API key. - The user''s roles carry a permission the caller does not hold.' parameters: - $ref: '#/components/parameters/UserExternalIDPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '204': description: No content '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAccessDenied' - $ref: '#/components/schemas/ErrorCodePermissionDenied' - $ref: '#/components/schemas/ErrorCodeSelfAdministration' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' /v1/t/user/{sid}: get: tags: - User operationId: GetTenantUser x-athena-permission: tenant:user:read summary: Get tenant-level user description: One tenant-level user. parameters: - $ref: '#/components/parameters/UserSidPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/User' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' patch: tags: - User operationId: PatchTenantUser x-athena-permission: tenant:user:manage summary: Update tenant-level user description: 'Updates the tenant-level user. Rules: - `email` replaces the address the user signs in with. - No password field exists at this level. On a move of `status` to `inactive`: - The user can no longer get a new session. - The sessions and magic links the user already holds end. - A move back restores none of them. Refused when: - The request is for the caller''s own user, with that user''s session or with that user''s API key. - The user''s roles carry a permission the caller does not hold.' parameters: - $ref: '#/components/parameters/UserSidPath' - $ref: '#/components/parameters/XTenantSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchTenantUserRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/User' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAccessDenied' - $ref: '#/components/schemas/ErrorCodePermissionDenied' - $ref: '#/components/schemas/ErrorCodeSelfAdministration' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeEmailConflict' - $ref: '#/components/schemas/ErrorCodeExternalIdConflict' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeInvalidRole' - $ref: '#/components/schemas/ErrorCodeValidationFailed' delete: tags: - User operationId: DeleteTenantUser x-athena-permission: tenant:user:manage summary: Delete tenant-level user description: 'Soft-deletes the tenant-level user. Rules: - The user reads as absent afterwards but still appears under `show_deleted`. - The email address is free to use again. Effects: - Its credentials are removed at once, so every session and outstanding magic link stops working. Refused when: - The request is for the caller''s own user, with that user''s session or with that user''s API key. - The user''s roles carry a permission the caller does not hold.' parameters: - $ref: '#/components/parameters/UserSidPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '204': description: No content '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAccessDenied' - $ref: '#/components/schemas/ErrorCodePermissionDenied' - $ref: '#/components/schemas/ErrorCodeSelfAdministration' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' /v1/t/user/{sid}/magic-link/request: post: tags: - User operationId: IssueTenantUserMagicLink x-athena-permission: tenant:sign_in:manage summary: Request tenant-level user magic link description: 'Returns a single-use magic-link token for the tenant-level user, with the consume URL and a browser link (`web_url`) into the web frontend that signs the person in. Rules: - This is the only way to sign in at tenant level; no password exists to reset. - The platform sends no email. - A new token invalidates the previous outstanding one. Refused when the user''s roles carry a permission the caller does not hold.' parameters: - $ref: '#/components/parameters/UserSidPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/MagicLinkHandoffResponse' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAccessDenied' - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeConflict' /v1/t/user/-/api-key: get: tags: - User operationId: ListTenantAPIKeys x-athena-permission: tenant:api_key:manage summary: List the tenant-level users' API keys description: The keys owned by the tenant's own people, newest first, without the secret. An account user's key is listed on the account plane, naming the account. parameters: - $ref: '#/components/parameters/XTenantSidHeader' - name: order_by in: query required: false description: 'Sort field. Accepted: created_at, name, expires_at, last_used_at (default created_at).' schema: type: string - name: order in: query required: false description: 'Sort direction: asc | desc (default desc).' schema: type: string - name: limit in: query required: false description: Page size, max 500 (default 100). schema: type: integer maximum: 500 - name: offset in: query required: false schema: type: integer responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/APIKeyList' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' /v1/t/user/{sid}/api-key: get: tags: - User operationId: ListTenantUserAPIKeys x-athena-permission: tenant:api_key:manage summary: List a tenant-level user's API keys description: The keys the tenant-level user owns, in the same shape as the tenant's list. parameters: - $ref: '#/components/parameters/UserSidPath' - $ref: '#/components/parameters/XTenantSidHeader' - name: order_by in: query required: false description: 'Sort field. Accepted: created_at, name, expires_at, last_used_at (default created_at).' schema: type: string - name: order in: query required: false description: 'Sort direction: asc | desc (default desc).' schema: type: string - name: limit in: query required: false description: Page size, max 500 (default 100). schema: type: integer maximum: 500 - name: offset in: query required: false schema: type: integer responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/APIKeyList' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' post: tags: - User operationId: IssueTenantUserAPIKey x-athena-permission: tenant:api_key:manage summary: Issue tenant-level user API key description: 'Creates an API key owned by the tenant-level user and returns its secret once; only a hash is kept, so a lost secret cannot be recovered. Rules: - The key acts with the user''s roles across the tenant''s accounts, naming its target with `X-Account-Sid` like the user''s own session. - The key stops authenticating while the user or their tenant is not active, and works again once they are. - Omitting `expires_at` creates a key that expires one year after issue. - Earlier keys stay valid: issuing revokes nothing. - A key stops working when its `expires_at` passes, its user is deleted or it is revoked. Refused when the user''s roles carry a permission the caller does not hold.' parameters: - $ref: '#/components/parameters/UserSidPath' - $ref: '#/components/parameters/XTenantSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/IssueAPIKeyRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/IssueAPIKeyResponse' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAccessDenied' - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeConflict' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeValidationFailed' /v1/t/user/{sid}/api-key/{key_sid}: delete: tags: - User operationId: RevokeTenantUserAPIKey x-athena-permission: tenant:api_key:manage summary: Revoke a tenant-level user's API key description: 'Deletes the key. Rules: - The key authenticates nothing from the next request on. - The user''s other keys are untouched. Refused when the user''s roles carry a permission the caller does not hold.' parameters: - $ref: '#/components/parameters/UserSidPath' - $ref: '#/components/parameters/KeySidPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '204': description: No content '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAccessDenied' - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' /v1/t/permission: get: tags: - Role operationId: ListPermissions x-athena-permission: tenant:role:read summary: List the permission catalog description: The permissions a role of the tenant may name, each with its level. parameters: - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/PermissionList' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' /v1/t/role: get: tags: - Role operationId: ListRoles x-athena-permission: tenant:role:read summary: List roles description: 'The live roles of the caller''s tenant: the fixed roles, marked `fixed`, then the tenant''s own roles of both levels.' parameters: - $ref: '#/components/parameters/XTenantSidHeader' - $ref: '#/components/parameters/RoleOrderBy' - $ref: '#/components/parameters/RoleOrder' - $ref: '#/components/parameters/RoleLimit' - $ref: '#/components/parameters/RoleOffset' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/RoleList' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' post: tags: - Role operationId: CreateRole x-athena-permission: tenant:role:manage summary: Create role description: 'Creates a role of the caller''s tenant. Refused when: - The parent is not a live role of the tenant. - The parent is a fixed `tenant` role. - The role is an `account` role with a `tenant` parent. - A live role of the tenant holds the name, whatever its letter case. - The role''s permissions, with those of its parents, go beyond the caller''s own.' parameters: - $ref: '#/components/parameters/XTenantSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateRoleRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Role' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAccessDenied' - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeConflict' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeValidationFailed' /v1/t/role/{sid}: get: tags: - Role operationId: GetRole x-athena-permission: tenant:role:read summary: Get role description: One role of the caller's tenant. parameters: - $ref: '#/components/parameters/RoleSidPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Role' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' patch: tags: - Role operationId: PatchRole x-athena-permission: tenant:role:manage summary: Update role description: 'Updates the role partially. Rules: - An omitted field preserves the current value. - A list that is sent replaces the stored list. - The level stays as created. - A rename is applied to every user of the tenant holding the role. Refused when: - The role as it would be after the update meets a refusal of `POST /v1/t/role`. - The parent inherits this role, directly or through other roles. - The role as stored carries a permission the caller does not hold. - The role is a fixed role.' parameters: - $ref: '#/components/parameters/RoleSidPath' - $ref: '#/components/parameters/XTenantSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchRoleRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Role' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAccessDenied' - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeConflict' - $ref: '#/components/schemas/ErrorCodeRoleFixed' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeValidationFailed' delete: tags: - Role operationId: DeleteRole x-athena-permission: tenant:role:manage summary: Delete role description: 'Soft-deletes the role. Rules: - The role is no longer listed. - Its name can be used again. Refused when: - A live user of the tenant holds the role, or a live role inherits it. - The role carries a permission the caller does not hold. - The role is fixed.' parameters: - $ref: '#/components/parameters/RoleSidPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '204': description: No content '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAccessDenied' - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeRoleFixed' - $ref: '#/components/schemas/ErrorCodeRoleInUse' /v1/t/scenario-template: get: tags: - ScenarioTemplate operationId: ListTenantScenarioTemplates x-athena-permission: scenario:template:read summary: List scenario templates description: The live templates of the caller's tenant, without `constructor`. parameters: - $ref: '#/components/parameters/XTenantSidHeader' - $ref: '#/components/parameters/ScenarioTemplateOrderBy' - $ref: '#/components/parameters/ScenarioTemplateOrder' - $ref: '#/components/parameters/ScenarioTemplateLimit' - $ref: '#/components/parameters/ScenarioTemplateOffset' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ScenarioTemplateList' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' post: tags: - ScenarioTemplate operationId: CreateScenarioTemplate x-athena-permission: tenant:scenario_template:manage summary: Create scenario template description: 'Creates a template of the caller''s tenant. Rules: - The resources the constructor names belong to the tenant.' parameters: - $ref: '#/components/parameters/XTenantSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateScenarioTemplateRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/ScenarioTemplate' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeScenarioValidationFailed' - $ref: '#/components/schemas/ErrorCodeValidationFailed' /v1/t/scenario-template/{id}: get: tags: - ScenarioTemplate operationId: GetTenantScenarioTemplate x-athena-permission: scenario:template:read summary: Get scenario template description: One template of the caller's tenant, with `constructor`. parameters: - $ref: '#/components/parameters/ScenarioTemplateIdPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ScenarioTemplate' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' patch: tags: - ScenarioTemplate operationId: PatchScenarioTemplate x-athena-permission: tenant:scenario_template:manage summary: Update scenario template description: 'Updates the template partially. Rules: - An omitted field preserves the current value. - The resources the constructor names belong to the tenant.' parameters: - $ref: '#/components/parameters/ScenarioTemplateIdPath' - $ref: '#/components/parameters/XTenantSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchScenarioTemplateRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ScenarioTemplate' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeScenarioValidationFailed' - $ref: '#/components/schemas/ErrorCodeValidationFailed' delete: tags: - ScenarioTemplate operationId: DeleteScenarioTemplate x-athena-permission: tenant:scenario_template:manage summary: Delete scenario template description: 'Soft-deletes the template. Rules: - The template is no longer listed and cannot be copied.' parameters: - $ref: '#/components/parameters/ScenarioTemplateIdPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '204': description: No content '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' /v1/t/audio: post: tags: - Audio operationId: UploadTenantAudio x-athena-permission: tenant:scenario_template:manage summary: Upload an audio file of the tenant's scenario templates description: 'Stores a file for the bricks of the tenant''s scenario templates to play. Rules: - The part''s own content type is preserved, and `audio/wav` is used when it carries none. - The client filename is kept as provenance.' parameters: - $ref: '#/components/parameters/XTenantSidHeader' requestBody: required: true content: multipart/form-data: schema: type: object required: - file properties: file: type: string format: binary responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/AudioAsset' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeBadRequest' - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '413': description: Request body exceeds the 32 MiB upload limit content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePayloadTooLarge' '500': $ref: '#/components/responses/InternalError' /v1/t/audio/{filename}: get: tags: - Audio operationId: GetTenantAudio x-athena-permission: scenario:template:read summary: Get an audio file of the tenant's scenario templates description: 'Serves a stored file of the tenant''s scenario templates. By mode: - The default: the bytes stream back with the content type they were stored under. - `mode=url`: the answer is a time-bounded presigned link instead.' parameters: - $ref: '#/components/parameters/AudioFilenamePath' - $ref: '#/components/parameters/AudioServeMode' - $ref: '#/components/parameters/AudioServeExpire' - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': description: 'Returns what the mode asks for. By mode: - `url`: returns a presigned link. - Any other mode: returns the raw audio bytes.' content: application/json: schema: $ref: '#/components/schemas/SignedLink' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeBadRequest' - $ref: '#/components/schemas/ErrorCodeMissingScopeHeader' - $ref: '#/components/schemas/ErrorCodeScopeConflict' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '403': description: Forbidden content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePermissionDenied' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAudioNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/t/adapters/edge/functions/{slug}/{version}: delete: description: 'Deletes the row, then removes the bundle from the bucket and the local version folder. A run after that gets `404` and cannot rebuild the bundle. If the removal fails, the call is `500` and goes to Sentry with both paths; the row is already gone. A missing local folder is fine, the cache cron may have removed it. Deleting the latest version does not make an older one latest. ' operationId: TenantAdapterEdgeDeleteFunctionsSlugVersion parameters: - $ref: '#/components/parameters/Slug' - $ref: '#/components/parameters/Version' - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': content: application/json: schema: $ref: '#/components/schemas/DeleteFunctionResponse' description: Deleted '400': $ref: '#/components/responses/DomainError' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFound' '422': $ref: '#/components/responses/ValidationFailed' '500': $ref: '#/components/responses/InternalError-2' '502': description: Bad gateway (upstream adapter error) summary: Delete a function version tags: - Edge Function x-athena-permission: tenant:scenario_template:manage get: operationId: TenantAdapterEdgeGetFunctionsSlugVersion parameters: - $ref: '#/components/parameters/Slug' - $ref: '#/components/parameters/Version' - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': content: application/json: schema: $ref: '#/components/schemas/GetFunctionResponse' description: The version '400': $ref: '#/components/responses/DomainError' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFound' '422': $ref: '#/components/responses/ValidationFailed' '500': $ref: '#/components/responses/InternalError-2' '502': description: Bad gateway (upstream adapter error) summary: Get a function version by slug and version tags: - Edge Function x-athena-permission: scenario:template:read post: description: Same behaviour and response as `POST /api/functions/by-id/{id}`. operationId: TenantAdapterEdgePostFunctionsSlugVersion parameters: - $ref: '#/components/parameters/Slug' - $ref: '#/components/parameters/Version' - $ref: '#/components/parameters/XTenantSidHeader' requestBody: $ref: '#/components/requestBodies/InvokeBody' responses: '200': $ref: '#/components/responses/InvokeResult' '400': $ref: '#/components/responses/DomainError' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFound' '422': $ref: '#/components/responses/ValidationFailed' '500': $ref: '#/components/responses/InternalError-2' '502': description: Bad gateway (upstream adapter error) summary: Run a function version by slug and version tags: - Edge Function x-athena-permission: tenant:scenario_template:manage /v1/t/adapters/edge/functions: get: description: Only versions with `is_latest = true`, newest first by `created_at`. operationId: TenantAdapterEdgeGetFunctions parameters: - in: query name: offset schema: default: 0 minimum: 0 type: integer - in: query name: limit schema: default: 10 minimum: 1 type: integer - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': content: application/json: schema: $ref: '#/components/schemas/ListFunctionsResponse' description: One page of functions '400': $ref: '#/components/responses/DomainError' '401': description: Unauthorized '403': description: Forbidden '422': $ref: '#/components/responses/ValidationFailed' '500': $ref: '#/components/responses/InternalError-2' '502': description: Bad gateway (upstream adapter error) summary: List the latest version of every function tags: - Edge Function x-athena-permission: scenario:template:read post: description: 'Validates the code, bundles it and stores a new version of `slug`. If the latest version of `slug` has exactly the same `code`, nothing is bundled: the existing version is returned. Otherwise the version is the latest one plus 1 (the first one is 1) and it becomes the latest. Validation runs inside the request and can take seconds: forbidden lexemes, `deno check` against the runtime globals, ESLint. Bundling (`deno install` + `deno bundle`) runs inside the request too. ' operationId: TenantAdapterEdgePostFunctions parameters: - $ref: '#/components/parameters/XTenantSidHeader' requestBody: content: application/json: schema: $ref: '#/components/schemas/CreateFunctionBody' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/CreateFunctionResponse' description: Version created, or the latest one reused '400': $ref: '#/components/responses/DomainError' '401': description: Unauthorized '403': description: Forbidden '422': $ref: '#/components/responses/ValidationFailed' '500': $ref: '#/components/responses/InternalError-2' '502': description: Bad gateway (upstream adapter error) summary: Create a function version tags: - Edge Function x-athena-permission: tenant:scenario_template:manage /v1/t/adapters/edge/functions/by-id/{id}: get: operationId: TenantAdapterEdgeGetFunctionsByIdId parameters: - $ref: '#/components/parameters/Id' - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': content: application/json: schema: $ref: '#/components/schemas/GetFunctionResponse' description: The version '400': $ref: '#/components/responses/DomainError' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFound' '422': $ref: '#/components/responses/ValidationFailed' '500': $ref: '#/components/responses/InternalError-2' '502': description: Bad gateway (upstream adapter error) summary: Get a function version by id tags: - Edge Function x-athena-permission: scenario:template:read post: description: 'The route the Iris backend uses to run a brick. A failed run (the code throws, timeout, memory limit) is still `200` with `ok: false` and `error`. Only a missing version and a broken request get another status. ' operationId: TenantAdapterEdgePostFunctionsByIdId parameters: - $ref: '#/components/parameters/Id' - $ref: '#/components/parameters/XTenantSidHeader' requestBody: $ref: '#/components/requestBodies/InvokeBody' responses: '200': $ref: '#/components/responses/InvokeResult' '400': $ref: '#/components/responses/DomainError' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFound' '422': $ref: '#/components/responses/ValidationFailed' '500': $ref: '#/components/responses/InternalError-2' '502': description: Bad gateway (upstream adapter error) summary: Run a function version by id tags: - Edge Function x-athena-permission: tenant:scenario_template:manage /v1/t/adapters/edge/functions/{slug}/versions: get: description: Newest version first. An unknown slug gives an empty list, not 404. operationId: TenantAdapterEdgeGetFunctionsSlugVersions parameters: - $ref: '#/components/parameters/Slug' - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': content: application/json: schema: $ref: '#/components/schemas/ListVersionsResponse' description: All versions of the slug '400': $ref: '#/components/responses/DomainError' '401': description: Unauthorized '403': description: Forbidden '422': $ref: '#/components/responses/ValidationFailed' '500': $ref: '#/components/responses/InternalError-2' '502': description: Bad gateway (upstream adapter error) summary: List every version of a function tags: - Edge Function x-athena-permission: scenario:template:read /v1/t/adapters/edge/functions/{slug}/{version}/warmup: post: description: 'Makes the next run skip the bundle download. Does nothing when the bundle is already on the local disk. Otherwise downloads it from the bucket or rebuilds it from `original_code`. ' operationId: TenantAdapterEdgePostFunctionsSlugVersionWarmup parameters: - $ref: '#/components/parameters/Slug' - $ref: '#/components/parameters/Version' - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': content: application/json: schema: $ref: '#/components/schemas/WarmupResponse' description: The bundle is on the local disk '400': $ref: '#/components/responses/DomainError' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFound' '422': $ref: '#/components/responses/ValidationFailed' '500': $ref: '#/components/responses/InternalError-2' '502': description: Bad gateway (upstream adapter error) summary: Put the bundle of a version into the local cache tags: - Edge Function x-athena-permission: tenant:scenario_template:manage /v1/t/adapters/ids/classifier/{id}: delete: description: 'Soft-deletes the classifier and every version of it: the records stay in the database but disappear from reads, are never trained again, and never satisfy content dedupe. Version history is kept so past calls remain explainable. Physical removal happens only when the owning account is purged.' operationId: TenantAdapterIdsDeleteClassifierId parameters: - $ref: '#/components/parameters/ClassifierIdPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '204': description: Deleted '400': $ref: '#/components/responses/BadRequest' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFound-2' '500': $ref: '#/components/responses/InternalError-3' '502': description: Bad gateway (upstream adapter error) summary: Delete a classifier tags: - Classifier x-athena-permission: tenant:scenario_template:manage put: description: 'Records the supplied training-relevant content as the next version of the classifier and queues training for it (`201`). Content identical to a version the classifier already holds resolves to that version instead and trains nothing (`200`), which is what keeps a publish from triggering a mass retrain. Recorded versions are immutable, so this never alters an existing one. Queueing is never refused, however much an account already has waiting: training capacity is shared out when a run starts, not here.' operationId: TenantAdapterIdsPutClassifierId parameters: - $ref: '#/components/parameters/ClassifierIdPath' - $ref: '#/components/parameters/XTenantSidHeader' requestBody: content: application/json: schema: $ref: '#/components/schemas/ClassifierRequest' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/Classifier' description: Content resolved to a version the classifier already holds '201': content: application/json: schema: $ref: '#/components/schemas/Classifier' description: Version recorded and queued for training '400': $ref: '#/components/responses/BadRequest' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFound-2' '409': content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' description: Concurrent writers kept taking the version this save was going to record. The save is safe to repeat. '500': $ref: '#/components/responses/InternalError-3' '502': description: Bad gateway (upstream adapter error) summary: Save classifier content tags: - Classifier x-athena-permission: tenant:scenario_template:manage /v1/t/adapters/ids/classifier: get: description: 'Every live version the account owns, each as its own entry: a version is the addressable thing, so several entries can share a classifier id and differ only by version.' operationId: TenantAdapterIdsGetClassifier parameters: - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': content: application/json: schema: $ref: '#/components/schemas/ClassifierList' description: OK '400': $ref: '#/components/responses/BadRequest' '401': description: Unauthorized '403': description: Forbidden '500': $ref: '#/components/responses/InternalError-3' '502': description: Bad gateway (upstream adapter error) summary: List an account's classifier versions tags: - Classifier x-athena-permission: tenant:scenario_template:manage post: description: Records a new classifier at its first version (`0`) owned by the account, and queues its training. Later content changes are saved with `PUT /v1/classifier/{id}/account/{account_sid}`, which records the next version rather than altering this one. operationId: TenantAdapterIdsPostClassifier parameters: - $ref: '#/components/parameters/XTenantSidHeader' requestBody: content: application/json: schema: $ref: '#/components/schemas/ClassifierRequest' required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/Classifier' description: Created '400': $ref: '#/components/responses/BadRequest' '401': description: Unauthorized '403': description: Forbidden '500': $ref: '#/components/responses/InternalError-3' '502': description: Bad gateway (upstream adapter error) summary: Create a classifier tags: - Classifier x-athena-permission: tenant:scenario_template:manage /v1/t/adapters/ids/classifier/{id}/version/{version}: get: description: Returns the recorded content of one version together with its training state — including why the last training run failed, and when it was queued and last changed. A version's content never changes once recorded, so a consumer that pinned this version always resolves exactly what it pinned. operationId: TenantAdapterIdsGetClassifierIdVersionVersion parameters: - $ref: '#/components/parameters/ClassifierIdPath' - $ref: '#/components/parameters/ClassifierVersionPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': content: application/json: schema: $ref: '#/components/schemas/Classifier' description: OK '400': $ref: '#/components/responses/BadRequest' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFound-2' '500': $ref: '#/components/responses/InternalError-3' '502': description: Bad gateway (upstream adapter error) summary: Get one version tags: - Classifier x-athena-permission: tenant:scenario_template:manage /v1/t/adapters/ids/classifier/{id}/version/{version}/classify: post: description: Classifies a phrase using the trained artefact of the addressed version, so a caller that pinned a version keeps getting that version's behavior while another version is being trained. Classification is bound to a short deadline; exceeding it yields 504, a client cancellation 499. operationId: TenantAdapterIdsPostClassifierIdVersionVersionClassify parameters: - $ref: '#/components/parameters/ClassifierIdPath' - $ref: '#/components/parameters/ClassifierVersionPath' - $ref: '#/components/parameters/XTenantSidHeader' requestBody: content: application/json: schema: $ref: '#/components/schemas/ClassifyRequest' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/ClassifiedIntents' description: OK '400': $ref: '#/components/responses/BadRequest' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFound-2' '500': $ref: '#/components/responses/InternalError-3' '502': description: Bad gateway (upstream adapter error) '504': content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' description: Classification deadline exceeded summary: Classify a phrase against one version tags: - Classifier x-athena-permission: tenant:scenario_template:manage /v1/t/adapters/llm/rag/document/{id}: delete: operationId: TenantAdapterLlmDeleteRagDocumentId parameters: - $ref: '#/components/parameters/DocumentIdPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '204': content: application/json: schema: $ref: '#/components/schemas/MessageResponse' description: Deleted '400': $ref: '#/components/responses/BadRequestMessage' '401': description: Unauthorized '403': description: Forbidden '502': description: Bad gateway (upstream adapter error) summary: Delete a RAG document for an account tags: - LLM Adapter x-athena-permission: tenant:scenario_template:manage get: operationId: TenantAdapterLlmGetRagDocumentId parameters: - $ref: '#/components/parameters/DocumentIdPath' - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': content: application/octet-stream: schema: format: binary type: string description: Document file stream '400': $ref: '#/components/responses/BadRequestMessage' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFoundMessage' '500': $ref: '#/components/responses/InternalErrorMessage' '502': description: Bad gateway (upstream adapter error) summary: Download a RAG document file tags: - LLM Adapter x-athena-permission: tenant:scenario_template:manage put: description: Accepts either a JSON text body or a multipart file upload, selected by Content-Type. operationId: TenantAdapterLlmPutRagDocumentId parameters: - $ref: '#/components/parameters/DocumentIdPath' - $ref: '#/components/parameters/ModeQuery' - in: query name: index_type required: false schema: enum: - vector - fulltext type: string - in: query name: chunk_size required: false schema: type: integer - $ref: '#/components/parameters/XTenantSidHeader' requestBody: content: application/json: schema: $ref: '#/components/schemas/RagDocumentUploadText' multipart/form-data: schema: $ref: '#/components/schemas/RagDocumentUploadForm' required: true responses: '202': content: application/json: schema: $ref: '#/components/schemas/MessageResponse' description: Accepted '400': $ref: '#/components/responses/BadRequestMessage' '401': description: Unauthorized '403': description: Forbidden '409': $ref: '#/components/responses/ConflictMessage' '502': description: Bad gateway (upstream adapter error) summary: Upload a RAG document for an account tags: - LLM Adapter x-athena-permission: tenant:scenario_template:manage /v1/t/adapters/llm/rag/document/list: get: description: Returns one page of the account's documents, newest first. operationId: TenantAdapterLlmGetRagDocumentList parameters: - description: Page size. A value above 500 is reduced to 500. in: query name: limit required: false schema: default: 100 maximum: 500 type: integer - description: Number of documents to skip. A negative value is read as 0. in: query name: offset required: false schema: default: 0 type: integer - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': content: application/json: schema: $ref: '#/components/schemas/RagDocumentListResponse' description: OK '400': $ref: '#/components/responses/BadRequestMessage' '401': description: Unauthorized '403': description: Forbidden '500': $ref: '#/components/responses/InternalErrorMessage' '502': description: Bad gateway (upstream adapter error) summary: List RAG documents for an account tags: - LLM Adapter x-athena-permission: tenant:scenario_template:manage /v1/t/adapters/llm/rag/document/search: get: operationId: TenantAdapterLlmGetRagDocumentSearch parameters: - in: query name: query required: true schema: type: string - in: query name: document_id required: false schema: items: type: string type: array - in: query name: top_k required: false schema: type: integer - in: query name: threshold required: false schema: format: float type: number - $ref: '#/components/parameters/XTenantSidHeader' responses: '200': content: application/json: schema: $ref: '#/components/schemas/RagSearchResponse' description: OK '400': $ref: '#/components/responses/BadRequestMessage' '401': description: Unauthorized '403': description: Forbidden '500': $ref: '#/components/responses/InternalErrorMessage' '502': description: Bad gateway (upstream adapter error) summary: Semantic search over an account's RAG documents tags: - LLM Adapter x-athena-permission: tenant:scenario_template:manage /v1/t/openapi.yaml: get: tags: - Contract operationId: GetTenantOpenAPIDocument x-athena-permission: none summary: Tenant API document description: The OpenAPI 3.0 document of the Tenant API, byte-identical to the committed bundle this deployment was built from. Served without a credential; generate clients from it. security: [] responses: '200': description: The Tenant API document, as `application/yaml`. content: application/yaml: schema: type: string '500': $ref: '#/components/responses/InternalError' /v1/changelog.md: get: tags: - Contract operationId: GetChangelog x-athena-permission: none summary: Changelog description: The release notes of the Account API and the Tenant API up to the version this deployment was built from, newest version first, as one Markdown document. Each version lists its changes under Added, Changed, Deprecated, Removed and Fixed. Served without a credential. security: [] responses: '200': description: The changelog, as `text/markdown`. content: text/markdown: schema: type: string '500': $ref: '#/components/responses/InternalError' components: securitySchemes: bearerAuth: type: http scheme: bearer description: A tenant API key, issued by the platform operator. parameters: XTenantSidHeader: name: X-Tenant-Sid in: header required: false description: 'Names the target tenant. By principal: - A tenant-scoped principal may omit it. - A principal with no tenant of its own names one here. Refused when: - A tenant-scoped principal sends a value naming any other tenant. - A principal with no tenant of its own omits it.' schema: type: string AccountExternalIDPath: name: external_id in: path required: true schema: type: string AccountSidPath: name: sid in: path required: true schema: type: string UserExternalIDPath: name: external_id in: path required: true schema: type: string UserSidPath: name: sid in: path required: true schema: type: string KeySidPath: name: key_sid in: path required: true schema: type: string RoleOrderBy: name: order_by in: query required: false description: 'Sort field. Accepted: created_at, name (default created_at).' schema: type: string RoleOrder: name: order in: query required: false description: 'Sort direction: asc | desc (default desc).' schema: type: string RoleLimit: name: limit in: query required: false description: Page size, max 500 (default 100). schema: type: integer maximum: 500 RoleOffset: name: offset in: query required: false schema: type: integer RoleSidPath: name: sid in: path required: true description: The role's `id`. schema: type: string ScenarioTemplateOrderBy: name: order_by in: query required: false description: 'Sort field. Accepted: created_at, name (default created_at).' schema: type: string ScenarioTemplateOrder: name: order in: query required: false description: 'Sort direction: asc | desc (default desc).' schema: type: string ScenarioTemplateLimit: name: limit in: query required: false description: Page size, max 500 (default 100). schema: type: integer maximum: 500 ScenarioTemplateOffset: name: offset in: query required: false schema: type: integer ScenarioTemplateIdPath: name: id in: path required: true description: The template's `id`. schema: type: string AudioFilenamePath: name: filename in: path required: true description: Stored audio basename, `aud_.wav`; anything else is not found. schema: type: string AudioServeMode: name: mode in: query schema: type: string description: 'Sets how the audio is served. Values: - `url`: returns a presigned download link. - Every other value, including the default, streams the audio through athena.' AudioServeExpire: name: expire in: query schema: type: integer description: 'Sets the presigned link lifetime in seconds. Rules: - It applies in url mode only. - The default is 3600 (1h). - Anything outside 1 to 604800 (7d) is refused.' Slug: name: slug in: path required: true schema: $ref: '#/components/schemas/Slug' Version: name: version in: path required: true schema: type: integer minimum: 1 Id: name: id in: path required: true description: Version id, a UUID schema: type: string format: uuid ClassifierIdPath: name: id in: path required: true description: Classifier id (UUID). schema: type: string format: uuid ClassifierVersionPath: name: version in: path required: true description: Classifier version. Version 0 is the one every classifier created before versioning occupies. schema: type: integer minimum: 0 DocumentIdPath: name: id in: path required: true description: RAG document id. schema: type: string ModeQuery: name: mode in: query required: false description: Document split mode. schema: type: string schemas: RetentionConfiguration: type: object description: 'Carries the retention periods this level sets, in days. For a `null` period: - An account follows its tenant. - A tenant follows the global retention period of 365 days.' required: - communication - contact properties: communication: type: - integer - 'null' description: Sets how many days a communication and its data are kept after its creation. An SMS is kept the same number of days after its creation. contact: type: - integer - 'null' description: Sets how many days a contact and its data are kept after its last communication or its last update, whichever is later. A contact is kept while it has a communication. ContactLimits: type: object description: 'Records the contact limits set on this account. A `null` limit is the platform''s. The platform''s limits: - `data_fields` is 30. - `value_bytes` is 100. - `array_items` is 100. - `contacts` is 100 000.' required: - data_fields - value_bytes - array_items - contacts properties: data_fields: type: - integer - 'null' description: Bounds the fields of a contact's data, counted at any depth, an array as one field. value_bytes: type: - integer - 'null' description: Bounds the bytes of one value of a contact's data, and of each item of an array. array_items: type: - integer - 'null' description: Bounds the items of an array in a contact's data. contacts: type: - integer - 'null' description: Bounds the contacts the account holds. EntityStatus: type: string enum: - active - inactive x-enum-varnames: - EntityStatusActive - EntityStatusInactive Account: type: object required: - sid - tenant_sid - name - email - external_id - country - timezone - phone - lines - retention - contact_limits - status - deleted_at properties: sid: type: string tenant_sid: type: string name: type: string email: type: string external_id: type: string country: type: string timezone: type: string phone: type: string lines: type: integer description: Simultaneous calls the account may hold across its agents. retention: $ref: '#/components/schemas/RetentionConfiguration' contact_limits: $ref: '#/components/schemas/ContactLimits' status: $ref: '#/components/schemas/EntityStatus' deleted_at: type: - string - 'null' format: date-time AccountList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/Account' total: type: integer format: int64 description: Counts the accounts matching the query, ignoring paging. limit: type: integer description: Reports the page size applied to this request. offset: type: integer description: Reports the offset applied to this request. has_more: type: boolean description: Says whether records beyond this page match the query. RowRejectionReason: type: string enum: - number_missing - number_no_digits - identifier_invalid - number_not_international - number_not_for_country - country_code_required - value_too_long - type_mismatch x-enum-varnames: - RowRejectionReasonNumberMissing - RowRejectionReasonNumberNoDigits - RowRejectionReasonIdentifierInvalid - RowRejectionReasonNumberNotInternational - RowRejectionReasonNumberNotForCountry - RowRejectionReasonCountryCodeRequired - RowRejectionReasonValueTooLong - RowRejectionReasonTypeMismatch description: 'Names why a number or a row is refused. Values: - `number_missing`: the number is missing or blank. - `number_no_digits`: the number holds no digits. - `identifier_invalid`: an alphanumeric identifier does not start with a letter or a digit. - `number_not_international`: the number is written as international and is not a valid one. - `number_not_for_country`: the number is not valid for the stated `country_code`. - `country_code_required`: the number is not international, and no `country_code` was stated to read it by. - `value_too_long`: a data value is longer than the account''s value limit in bytes. Given for a row only. - `type_mismatch`: a data value does not read as the type its field holds across the account''s contacts. Given for a row only.' ScenarioValidationError: type: object properties: code: type: string description: Carries the SCN1xx constructor validation code. message: type: string summary: type: string tree_id: type: string node_id: type: string output_type: type: string duplicate_tree_index: type: string duplicate_node_index: type: string property: type: string invalid_value: type: string AgentHolder: type: object description: An agent a delete or a scenario publish was rejected for. required: - id - name properties: id: type: string name: type: string AutomationHolder: type: object description: A live automation that holds the resource a delete was rejected for. required: - id - name properties: id: type: string name: type: string RoutingHolder: type: object description: A live routing of an agent that is not archived, which holds the resource a delete was rejected for. required: - id - name - agent_sid properties: id: type: string name: type: string agent_sid: type: string UserHolder: type: object description: A live user that holds the role a delete was rejected for. required: - id - email properties: id: type: string email: type: string RoleHolder: type: object description: A live role that inherits the role a delete was rejected for. required: - id - name properties: id: type: string name: type: string RowRejectionReasons: type: object description: How many rows of a refused file were rejected for each reason; a reason no row had is absent. properties: number_missing: type: integer format: int64 description: The number cell is blank. number_no_digits: type: integer format: int64 description: The number holds no digits. identifier_invalid: type: integer format: int64 description: An alphanumeric identifier does not start with a letter or a digit. number_not_international: type: integer format: int64 description: The number is written as international and is not a valid one. number_not_for_country: type: integer format: int64 description: The number is not valid for the stated `country_code`. country_code_required: type: integer format: int64 description: The number is not international, and no `country_code` was stated to read it by. value_too_long: type: integer format: int64 description: A data cell holds a value longer than the account's value limit in bytes. type_mismatch: type: integer format: int64 description: A data cell does not read as the type its field holds across the account's contacts. ContactDataTrigger: type: string enum: - too_many_fields - value_too_long - too_many_array_items - array_item_not_scalar - type_mismatch x-enum-varnames: - ContactDataTriggerTooManyFields - ContactDataTriggerValueTooLong - ContactDataTriggerTooManyArrayItems - ContactDataTriggerArrayItemNotScalar - ContactDataTriggerTypeMismatch description: 'Names the rule the contact data breaks. Values: - `array_item_not_scalar`: an array item is an object, an array or null. - `type_mismatch`: a value has another type than its field holds across the account''s contacts, or is an object where the field holds a value, or a value where it holds an object.' ContactDataLimitParams: type: object description: 'Carries the details of the breach. By breach: - For a broken limit, it carries the numbers of the limit. - For a type mismatch, it carries the two types. - For an array item that is not a scalar, it is empty.' properties: limit: type: integer description: Reports the account's limit. current: type: integer description: 'Reports the value the data would have: the fields, the bytes or the items.' type: type: string description: Names the type the field holds across the account's contacts. got: type: string description: Names the type of the new value. ErrorData: type: object description: 'Carries structured detail, present only where there is structure to carry it. By failure: - A validation failure carries the topic `validation` and per-entity `errors`. - A delete conflict carries the topic `conflict`; its referencing dependents are in `agents`, `automations`, `routings`, `users` or `roles`, depending on what holds the resource. - A scenario publish refused because of its agents carries the topic `conflict`, with `agents`. - An agent change refused because of its automations carries the topic `conflict`, with `automations`. - A file none of whose rows is usable carries the topic `rows_rejected`, with `rows` and `reasons`. - Contact data past a limit of its account carries `trigger`, `field` and `params`. - A data field rename that cannot be applied carries `field` and, when a contact stops it, `contact`. - A contact number that is refused carries `reason`.' properties: topic: type: string reason: $ref: '#/components/schemas/RowRejectionReason' errors: type: object description: Groups the validation errors by entity. properties: scenario: type: array items: $ref: '#/components/schemas/ScenarioValidationError' agents: type: array description: Lists the agents a delete or a scenario publish was rejected for, capped at the first 20; `message` carries the total count. items: $ref: '#/components/schemas/AgentHolder' automations: type: array description: Lists the live automations referencing the resource a delete was rejected for, capped at the first 20; `message` carries the total count. items: $ref: '#/components/schemas/AutomationHolder' routings: type: array description: Lists the live routings of agents that are not archived whose condition or scenario holds the resource a delete was rejected for, capped at the first 20; `message` carries the total count. items: $ref: '#/components/schemas/RoutingHolder' users: type: array description: Lists the live users holding the role a delete was rejected for, capped at the first 20; `message` carries the total count. items: $ref: '#/components/schemas/UserHolder' roles: type: array description: Lists the live roles inheriting the role a delete was rejected for, capped at the first 20; `message` carries the total count. items: $ref: '#/components/schemas/RoleHolder' rows: type: integer format: int64 description: Lists the rows of the refused file, a row repeating an earlier row's number as written counted once. reasons: $ref: '#/components/schemas/RowRejectionReasons' trigger: $ref: '#/components/schemas/ContactDataTrigger' field: type: string description: 'Names the field by its path. By failure: - For a broken limit, it is the field that breaks the limit. - For too many fields, it is the first new field past the limit. - For a rename, it is the field that stops the rename.' contact: type: string description: Names the first contact whose data stops a rename; absent when the two paths alone conflict. params: $ref: '#/components/schemas/ContactDataLimitParams' Error: type: object required: - error - code - message properties: error: type: string description: Carries the stable lower_snake_case usecase code, such as `scenario_not_found`. code: type: string description: 'Carries the registered machine code, stable once assigned. The codes: - `ERRxxx`: is a generic code that follows from the status class. - `ERR001`–`ERR020`: are reserved for generic codes. - `SCN1xx` and other entity-prefixed codes: appear only inside validation details.' message: type: string data: $ref: '#/components/schemas/ErrorData' RetentionConfigurationInput: type: object description: Sets both retention periods of this level, in days. required: - communication - contact properties: communication: type: integer minimum: 1 maximum: 3650 description: Sets how many days a communication and its data are kept after its creation. An SMS is kept the same number of days after its creation. contact: type: integer minimum: 1 maximum: 3650 description: Sets how many days a contact and its data are kept after its last communication or its last update, whichever is later. A contact is kept while it has a communication. ContactLimitsInput: type: object description: Sets the account's contact limits. A limit left out is the platform's. properties: data_fields: type: integer minimum: 1 maximum: 100 description: Bounds the fields of a contact's data, counted at any depth, an array as one field. value_bytes: type: integer minimum: 1 maximum: 1000 description: Bounds the bytes of one value of a contact's data, and of each item of an array. array_items: type: integer minimum: 1 maximum: 500 description: Bounds the items of an array in a contact's data. contacts: type: integer minimum: 1 maximum: 200000 description: Bounds the contacts the account holds. CreateAccountRequest: type: object required: - name - email - lines properties: name: type: string email: type: string format: email x-go-type: string external_id: type: string country: type: string timezone: type: string phone: type: string pattern: ^[0-9]*$ description: Digits only, no separators. lines: type: integer minimum: 1 description: Simultaneous calls the account may hold across its agents. retention: $ref: '#/components/schemas/RetentionConfigurationInput' contact_limits: $ref: '#/components/schemas/ContactLimitsInput' PatchAccountRequest: type: object description: 'Carries a partial update of the account. Rules: - An omitted field preserves the current value. - An explicit empty `external_id` clears it.' properties: name: type: string email: type: string format: email x-go-type: string external_id: type: string country: type: string timezone: type: string phone: type: string pattern: ^[0-9]*$ description: Digits only, no separators. lines: type: integer minimum: 1 description: Simultaneous calls the account may hold across its agents. retention: description: Replaces both periods. An explicit `null` clears both, and the account follows its tenant again. anyOf: - $ref: '#/components/schemas/RetentionConfigurationInput' - type: 'null' x-go-type: nullable.Nullable[RetentionConfigurationInput] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true contact_limits: description: 'Replaces the account''s contact limits. Rules: - A limit left out is the platform''s. - An explicit `null` makes every limit the platform''s. - Data already stored past a lowered limit is kept. A later write to a contact whose data is past a lowered limit, a dispatch included, is refused while it leaves the data past the limit.' anyOf: - $ref: '#/components/schemas/ContactLimitsInput' - type: 'null' x-go-type: nullable.Nullable[ContactLimitsInput] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true status: $ref: '#/components/schemas/EntityStatus' User: type: object required: - sid - account_sid - tenant_sid - level - email - name - external_id - roles - status - has_password - last_login_at - deleted_at properties: sid: type: string account_sid: type: - string - 'null' description: Names the owning account; null for a tenant-level user. tenant_sid: type: - string - 'null' description: Names the owning tenant; null for an account-level user. level: type: string enum: - account - tenant x-enum-varnames: - UserLevelAccount - UserLevelTenant description: 'Declares the owner of the user: account or tenant.' email: type: string name: type: string external_id: type: string description: Carries the key the client system provisioning this user assigned to them. When set, unique among the live users of the account, or among the live tenant-level users of the tenant. roles: type: array items: type: string description: Lists the names of the roles the user holds. status: $ref: '#/components/schemas/EntityStatus' has_password: type: boolean description: Says whether the user can sign in with a password. One created without one gets in only through a magic link or a password reset. last_login_at: type: - string - 'null' format: date-time deleted_at: type: - string - 'null' format: date-time UserList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/User' total: type: integer format: int64 description: Counts the users matching the query, ignoring paging. limit: type: integer description: Reports the page size applied to this request. offset: type: integer description: Reports the offset applied to this request. has_more: type: boolean description: Says whether records beyond this page match the query. CreateTenantUserRequest: type: object required: - email properties: email: type: string format: email x-go-type: string name: type: string external_id: type: string roles: type: array items: type: string description: Names of roles listed by `GET /v1/t/role`; omitted means no roles until a patch assigns them. PatchTenantUserRequest: type: object description: 'Carries a partial update of the tenant-level user. Rules: - An omitted field preserves the current value. - An explicit empty `external_id` clears it.' properties: name: type: string email: type: string format: email x-go-type: string description: Replaces the address the user signs in with; unique among the live users of its level. external_id: type: string roles: type: array items: type: string description: Replaces the user's roles outright with names of roles listed by `GET /v1/t/role`. status: $ref: '#/components/schemas/EntityStatus' MagicLinkHandoffResponse: type: object required: - token - expires_at - consume_url - web_url properties: token: type: string expires_at: type: string format: date-time consume_url: type: string description: Points at the public consume endpoint the token is redeemed at. web_url: type: string description: Signs the person in from a browser link — the web frontend's consume page carrying the token. APIKey: type: object required: - sid - name - user_sid - account_sid - level - metadata - created_at - expires_at - last_used_at properties: sid: type: string name: type: string user_sid: type: string description: Names the owner. account_sid: type: - string - 'null' description: Names the owner's account; null for a tenant-level owner. level: type: string enum: - account - tenant x-enum-varnames: - APIKeyLevelAccount - APIKeyLevelTenant description: 'Declares the owner''s level: account or tenant.' metadata: type: object additionalProperties: true description: Carries the object given at issue, as given. created_at: type: string format: date-time expires_at: type: - string - 'null' format: date-time description: Records when the key stops authenticating. last_used_at: type: - string - 'null' format: date-time description: Records the last request the key authenticated; null while it has not been used. APIKeyList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/APIKey' total: type: integer format: int64 description: Counts the keys matching the query, ignoring paging. limit: type: integer description: Reports the page size applied to this request. offset: type: integer description: Reports the offset applied to this request. has_more: type: boolean description: Says whether records beyond this page match the query. IssueAPIKeyRequest: type: object required: - name properties: name: type: string description: Labels the key in listings. expires_at: type: string format: date-time description: Sets when the key stops authenticating. Omitted, the key expires one year after issue. metadata: type: object additionalProperties: true description: Carries the caller's own note on the key, held and returned as given. Nothing in it is read by the platform. IssueAPIKeyResponse: type: object required: - sid - secret properties: sid: type: string secret: type: string PermissionName: type: string x-go-type: string description: The name of a permission of the catalog, `:` or `::`. example: agent:read enum: - agent:read - agent:write - agent:manage - agent:automation:read - agent:automation:write - agent:automation:manage - agent:routing:read - agent:routing:write - agent:routing:manage - scenario:read - scenario:write - scenario:manage - communication:read - communication:write - communication:manage - number:read - number:write - number:manage - number:pool:read - number:pool:write - number:pool:manage - contact:read - contact:write - contact:manage - segment:read - segment:write - segment:manage - integration:sms:read - integration:sms:write - integration:sms:manage - account:read - account:manage - account:capacity:manage - tenant:user:read - tenant:user:manage - tenant:api_key:manage - tenant:sign_in:manage - tenant:role:read - tenant:role:manage - tenant:scenario_template:manage - scenario:template:read - analytics:read - account:user:manage - account:api_key:manage - account:sign_in:manage - account:profile:write - account:role:read - tts:synthesize:manage - tts:voice:read - llm:chat:manage - llm:document:manage - llm:model:read - ids:classifier:write - ids:classifier:manage - ids:entity:write - ids:model:read - stt:recognition:write - stt:dictionary:read - stt:dictionary:write - stt:dictionary:manage - edge:function:read - edge:function:write - edge:function:manage RoleLevel: type: string enum: - account - tenant x-enum-varnames: - RoleLevelAccount - RoleLevelTenant Permission: type: object required: - name - level properties: name: allOf: - $ref: '#/components/schemas/PermissionName' description: Carries the name a route requires. level: allOf: - $ref: '#/components/schemas/RoleLevel' description: 'Sets the roles that may name the permission. Values: - `account`: roles of either level may name it. - `tenant`: only `tenant` roles may name it.' PermissionList: type: object required: - items properties: items: type: array items: $ref: '#/components/schemas/Permission' Role: type: object required: - id - name - level - permissions - inherits - fixed - created_at - updated_at properties: id: type: string description: Prefixed `rol_…`. name: type: string level: allOf: - $ref: '#/components/schemas/RoleLevel' description: 'Declares who holds the role. Values: - `account`: the role is held by users of either level. - `tenant`: the role is held by tenant-level users only.' permissions: type: array items: $ref: '#/components/schemas/PermissionName' description: Lists the role's own permissions, without the ones its parents carry. example: - agent:read - contact:read - segment:read inherits: type: array items: type: string description: Lists the `id` of every parent role, a role whose permissions this one inherits. fixed: type: boolean description: 'Declares a role defined by the platform. Refused when: - A fixed role is edited. - A fixed role is deleted.' created_at: type: string format: date-time updated_at: type: string format: date-time RoleList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/Role' total: type: integer format: int64 description: Counts the roles matching the query, ignoring paging. limit: type: integer description: Reports the page size applied to this request. offset: type: integer description: Reports the offset applied to this request. has_more: type: boolean description: Says whether records beyond this page match the query. CreateRoleRequest: type: object required: - name properties: name: type: string level: allOf: - $ref: '#/components/schemas/RoleLevel' description: Sets who holds the role; a later edit does not change it. Omitted means `account`. permissions: type: array items: $ref: '#/components/schemas/PermissionName' description: Names from the permission catalog; omitted means none. inherits: type: array items: type: string description: Lists the `id` of every parent role; omitted means none. PatchRoleRequest: type: object properties: name: type: string permissions: type: array items: $ref: '#/components/schemas/PermissionName' inherits: type: array items: type: string ScenarioTemplateSummary: type: object required: - id - name - description - created_at - updated_at properties: id: type: string description: Prefixed `sct_…`. name: type: string description: type: string created_at: type: string format: date-time updated_at: type: string format: date-time ScenarioTemplateList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/ScenarioTemplateSummary' total: type: integer format: int64 description: Counts the templates matching the query, ignoring paging. limit: type: integer description: Reports the page size applied to this request. offset: type: integer description: Reports the offset applied to this request. has_more: type: boolean description: Says whether records beyond this page match the query. ConstructorPlayMode: type: string description: 'Picks which of the brick''s `audios` it plays. Refused when: - A publish carries no value. - A publish carries an undeclared value.' enum: - all - one_next - one_random x-enum-varnames: - ConstructorPlayModeAll - ConstructorPlayModeOneNext - ConstructorPlayModeOneRandom ConstructorAudioPropertiesTTS: type: object properties: text: type: string AudioFile: type: object properties: url: type: string ConstructorAudioV1Audio: type: object properties: mode: type: string tts_properties: $ref: '#/components/schemas/ConstructorAudioPropertiesTTS' file_properties: $ref: '#/components/schemas/AudioFile' ConstructorTTSDefault: type: object properties: language: type: string voice: type: string engine: type: string speed: type: number format: float model: type: string ConstructorAudioProperties: type: object properties: play_mode: $ref: '#/components/schemas/ConstructorPlayMode' audios: type: array items: $ref: '#/components/schemas/ConstructorAudioV1Audio' tts_general: $ref: '#/components/schemas/ConstructorTTSDefault' ConstructorBrickOutput: type: object properties: type: type: string description: type: string ConstructorAudioV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorAudioProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorAudio: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorAudioV1' ConstructorAudioFileProperties: type: object properties: url: type: string ConstructorAudioFileV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorAudioFileProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorAudioFile: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorAudioFileV1' ConstructorAudioTTSProperties: type: object properties: text: type: string language: type: string voice: type: string engine: type: string model: type: string ConstructorAudioTTSV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorAudioTTSProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorAudioTTS: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorAudioTTSV1' SMS: type: object description: Message content only. Provider, credentials, and sender identity resolve from the agent's SMS settings at send time. properties: to: type: string description: Overrides the recipient; empty means the communication recipient. text: type: string ConstructorSmsV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/SMS' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorSms: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorSmsV1' ConstructorGoalProperties: type: object properties: goal: type: string ConstructorGoalV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorGoalProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorGoal: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorGoalV1' ConstructorEndCallProperties: type: object properties: signal: type: string ConstructorEndCallV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorEndCallProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorEndCall: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorEndCallV1' ConstructorAssignmentVariables: type: object properties: name: type: string value: type: string ConstructorAssignmentProperties: type: object properties: variables: type: array items: $ref: '#/components/schemas/ConstructorAssignmentVariables' ConstructorAssignmentV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorAssignmentProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorAssignment: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorAssignmentV1' ConstructorIncrementVariables: type: object properties: variable: type: string ConstructorIncrementProperties: type: object properties: variables: type: array items: $ref: '#/components/schemas/ConstructorIncrementVariables' ConstructorIncrementV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorIncrementProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorIncrement: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorIncrementV1' ConstructorConditionOperator: type: string description: How a condition joins its elements. enum: - and - or x-enum-varnames: - ConstructorConditionOperatorAnd - ConstructorConditionOperatorOr ConstructorConditionElementOperator: type: string description: How one condition element compares its variable against its value. enum: - equal - not_equal - greater_than - less_than - greater_than_equal - less_than_equal - in - not_in - contains - not_contains - starts_with x-enum-varnames: - ConstructorConditionElementOperatorEqual - ConstructorConditionElementOperatorNotEqual - ConstructorConditionElementOperatorGreaterThan - ConstructorConditionElementOperatorLessThan - ConstructorConditionElementOperatorGreaterThanEqual - ConstructorConditionElementOperatorLessThanEqual - ConstructorConditionElementOperatorIn - ConstructorConditionElementOperatorNotIn - ConstructorConditionElementOperatorContains - ConstructorConditionElementOperatorNotContains - ConstructorConditionElementOperatorStartsWith ScenarioConstructorConditionElement: type: object properties: variable: type: string element_operator: $ref: '#/components/schemas/ConstructorConditionElementOperator' value: type: string ConstructorConditionGroupPropertiesConditionConditions: type: object properties: condition_id: type: string description: type: string condition_operator: $ref: '#/components/schemas/ConstructorConditionOperator' elements: type: array items: $ref: '#/components/schemas/ScenarioConstructorConditionElement' ConstructorConditionGroupPropertiesCondition: type: object properties: conditions: type: array items: $ref: '#/components/schemas/ConstructorConditionGroupPropertiesConditionConditions' ConstructorConditionGroupProperties: type: object properties: condition: $ref: '#/components/schemas/ConstructorConditionGroupPropertiesCondition' ConstructorConditionGroupV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorConditionGroupProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorConditionGroup: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorConditionGroupV1' ConstructorStartTreeV1Properties: type: object ConstructorStartTreeV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorStartTreeV1Properties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorStartTree: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorStartTreeV1' ConstructorSTTEngine: type: string enum: - gsr - gsr@v2 - azuresr - experimental - mohir - soniox - elevenlabs ConstructorQuestionV1STTEndpointDetection: type: object description: 'Ends the caller''s turn when the recognition engine reports the end of the phrase, before the speech timeout. Rules: - A call reads it from the settings of a question. - A call reads it from the settings of an AI agent. - A call does not read it from `stt_general`.' properties: enabled: type: boolean description: 'Switches endpoint detection on. Values: - `true`: is allowed only where the `engine` of the same settings is `soniox`. - `false`: the other values are stored and not checked.' latency_adjustment_level: type: integer description: Sets the engine's endpoint latency adjustment level, from 0 to 3. Omitting it is the same as sending 0. sensitivity: type: number format: float description: Sets the engine's endpoint sensitivity, from -1.0 to 1.0. Omitting it is the same as sending 0. max_delay_ms: type: integer description: Sets the engine's maximum endpoint delay in milliseconds, from 500 to 3000. Required while `enabled` is true. ConstructorSTTDefault: type: object properties: language: type: string engine: $ref: '#/components/schemas/ConstructorSTTEngine' model: type: string primary_language: type: string fallback_languages: type: array items: type: string endpoint_detection: $ref: '#/components/schemas/ConstructorQuestionV1STTEndpointDetection' ConstructorStartCallProperties: type: object properties: stt_general: $ref: '#/components/schemas/ConstructorSTTDefault' tts_general: $ref: '#/components/schemas/ConstructorTTSDefault' ConstructorStartCallV1: type: object required: - id description: Starts the call and hands it to the `outbound_call` or the `inbound_call` brick. Replaced by `v2`. properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorStartCallProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorStartCallV2Properties: type: object properties: stt_general: $ref: '#/components/schemas/ConstructorSTTDefault' tts_general: $ref: '#/components/schemas/ConstructorTTSDefault' voicemail_enabled: type: boolean description: Turns on answering machine detection for an outbound call, which then follows the `voicemail` output. Replaces the agent's `voicemail_enabled` for this scenario. false when absent. ConstructorStartCallV2: type: object required: - id description: 'Starts the call and routes it by the call outcome. The outputs: - `outbound`: an outbound call is answered. Required. - `inbound`: an inbound call is answered. Required. - `voicemail`: an answering machine answers an outbound call. Required while `voicemail_enabled` is true. - `busy`: the line of an outbound call is busy. Required. - `unanswered`: nobody answers an outbound call. Required. Rules: - After `busy` and `unanswered` there is no call: a brick that needs the call takes its fallback output, and a brick that needs no call runs. - A scenario ends on `busy` or `unanswered` through a link to an `end` brick. - An output with no link ends the scenario.' properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorStartCallV2Properties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorStartCall: type: object properties: v1: type: array deprecated: true items: $ref: '#/components/schemas/ConstructorStartCallV1' v2: type: array items: $ref: '#/components/schemas/ConstructorStartCallV2' ConstructorOutboundCallProperties: type: object properties: is_voicemail: type: boolean ConstructorOutboundCallV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorOutboundCallProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorOutboundCall: type: object properties: v1: type: array deprecated: true items: $ref: '#/components/schemas/ConstructorOutboundCallV1' ConstructorInboundCallProperties: type: object ConstructorInboundCallV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorInboundCallProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorInboundCall: type: object properties: v1: type: array deprecated: true items: $ref: '#/components/schemas/ConstructorInboundCallV1' ConstructorEndProperties: type: object ConstructorEndV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorEndProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorEnd: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorEndV1' ConstructorWhisperTTS: type: object properties: text: type: string ConstructorWhisperFile: type: object properties: url: type: string ConstructorWhisperProperties: type: object properties: mode: type: string tts: $ref: '#/components/schemas/ConstructorWhisperTTS' file: $ref: '#/components/schemas/ConstructorWhisperFile' ConstructorTTSProperties: type: object properties: language: type: string voice: type: string engine: type: string model: type: string ConstructorCallTransferSIPHeader: type: object properties: name: type: string value: type: string ConstructorCallTransferSIPHeaderProperties: type: object properties: sip_headers: type: array items: $ref: '#/components/schemas/ConstructorCallTransferSIPHeader' ConstructorCallTransferProperties: type: object properties: from: type: string number: type: string message_to_manager: $ref: '#/components/schemas/ConstructorWhisperProperties' message_to_client: $ref: '#/components/schemas/ConstructorWhisperProperties' timeout: type: integer tts_properties: $ref: '#/components/schemas/ConstructorTTSProperties' sip_header: $ref: '#/components/schemas/ConstructorCallTransferSIPHeaderProperties' transfer_mode: type: string description: 'Picks how the call is handed over. Values: - `bridge`: keeps both legs on the platform. It is the default when omitted or empty. - `refer`: transfers the call with a SIP REFER. Another value is refused on publish.' ConstructorCallTransferV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorCallTransferProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorCallTransfer: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorCallTransferV1' ConstructorQuestionV1TTSProperties: type: object properties: language: type: string voice: type: string engine: type: string speed: type: number format: float model: type: string ConstructorQuestionV1DTMFProperties: type: object properties: dtmf_timeout: type: number format: float no_input_timeout: type: number format: float min_symbols: type: integer max_symbols: type: integer finish_on_key: type: string ConstructorSTTShiftDirection: type: string description: The direction the recognition window moves, by `duration`. enum: - backward - forward x-enum-varnames: - ConstructorSTTShiftDirectionBackward - ConstructorSTTShiftDirectionForward ConstructorQuestionV1STTShift: type: object properties: direction: $ref: '#/components/schemas/ConstructorSTTShiftDirection' duration: type: number format: float ConstructorQuestionV1STTGrammarParam: type: object properties: key: type: string value: type: string ConstructorQuestionV1STTGrammarParameter: type: object properties: parameters: type: array items: $ref: '#/components/schemas/ConstructorQuestionV1STTGrammarParam' ConstructorQuestionV1STTClassToken: type: object properties: tokens: type: array items: type: string ConstructorQuestionV1STTFilter: type: object properties: filters: type: array items: type: string ConstructorQuestionV1IntentClassifier: type: object description: The classifier a question brick classifies against. properties: id: type: string version: type: integer minimum: 0 description: 'Pins the classifier version this brick classifies against. Rules: - `0` is an ordinary version, the one a classifier is created at. - A read always states it. - On a write, omitting it is the same as sending `0`.' ConstructorChatMessageRole: type: string description: The party the chat message is attributed to. enum: - system - assistant - user - function x-enum-varnames: - ConstructorChatMessageRoleSystem - ConstructorChatMessageRoleAssistant - ConstructorChatMessageRoleUser - ConstructorChatMessageRoleFunction ConstructorOpenAIChatStreamRunV1Message: type: object properties: role: $ref: '#/components/schemas/ConstructorChatMessageRole' content: type: string ConstructorQuestionV1LLMProperties: type: object properties: engine: type: string model: type: string messages: type: array items: $ref: '#/components/schemas/ConstructorOpenAIChatStreamRunV1Message' temperature: type: number format: float provider: type: string gdpr_required: type: boolean ConstructorQuestionV1IntentProperties: type: object properties: classifier: $ref: '#/components/schemas/ConstructorQuestionV1IntentClassifier' model_id: type: string description: 'Identifies the intent model the caller chose for this brick. Rules: - It is stored as sent. - It is returned when set. - The platform does not read it.' llm_properties: $ref: '#/components/schemas/ConstructorQuestionV1LLMProperties' threshold: type: number format: float ConstructorQuestionV1STTProperties: type: object properties: speech_timeout: type: number format: float no_input_timeout: type: number format: float language: type: string recognition_shift: $ref: '#/components/schemas/ConstructorQuestionV1STTShift' engine: $ref: '#/components/schemas/ConstructorSTTEngine' grammar_parameter: $ref: '#/components/schemas/ConstructorQuestionV1STTGrammarParameter' class_token: $ref: '#/components/schemas/ConstructorQuestionV1STTClassToken' filter: $ref: '#/components/schemas/ConstructorQuestionV1STTFilter' tokens: type: array items: type: string intent_properties: $ref: '#/components/schemas/ConstructorQuestionV1IntentProperties' timezone: type: string recognition_mode: type: string enable_voice_activity_detection: type: boolean interruptible_dialog: type: boolean interruption_shift: $ref: '#/components/schemas/ConstructorQuestionV1STTShift' model: type: string primary_language: type: string fallback_languages: type: array items: type: string endpoint_detection: $ref: '#/components/schemas/ConstructorQuestionV1STTEndpointDetection' ConstructorQuestionV1TTS: type: object properties: text: type: string ConstructorQuestionV1AudioFile: type: object properties: url: type: string ConstructorQuestionV1Audio: type: object properties: mode: type: string tts: $ref: '#/components/schemas/ConstructorQuestionV1TTS' file: $ref: '#/components/schemas/ConstructorQuestionV1AudioFile' ConstructorQuestionV1Statement: type: object properties: audio: $ref: '#/components/schemas/ConstructorQuestionV1Audio' is_interruptible: type: boolean ConstructorSpeechInputType: type: string description: How the answer is matched against what the person said. enum: - token-based - intent-based - intent-llm-based - token-llm-based - token-intent-llm-based x-enum-varnames: - ConstructorSpeechInputTypeTokenBased - ConstructorSpeechInputTypeIntentBased - ConstructorSpeechInputTypeIntentLLMBased - ConstructorSpeechInputTypeTokenLLMBased - ConstructorSpeechInputTypeTokenIntentLLMBased ConstructionQuestionV1Intent: type: object properties: id: type: string ConstructorQuestionV1EntityVariable: type: object properties: name: type: string ConstructorQuestionV1Entity: type: object properties: type: type: string variable: $ref: '#/components/schemas/ConstructorQuestionV1EntityVariable' ConstructorQuestionV1EntityProperties: type: object properties: entities: type: array items: $ref: '#/components/schemas/ConstructorQuestionV1Entity' ConstructorQuestionV1SpeechInput: type: object properties: tokens: type: array items: type: string mode: $ref: '#/components/schemas/ConstructorSpeechInputType' intent: $ref: '#/components/schemas/ConstructionQuestionV1Intent' entity: $ref: '#/components/schemas/ConstructorQuestionV1EntityProperties' ConstructorQuestionV1DTMFInput: type: object properties: value: type: string ConstructorQuestionV1AnswerItem: type: object properties: answer_id: type: string description: type: string speech_input: $ref: '#/components/schemas/ConstructorQuestionV1SpeechInput' dtmf_input: $ref: '#/components/schemas/ConstructorQuestionV1DTMFInput' tag: type: string ConstructorQuestionV1Answer: type: object properties: answers: type: array items: $ref: '#/components/schemas/ConstructorQuestionV1AnswerItem' ConstructorQuestionFallbackType: type: string description: 'Picks what the fallback plays. Values: - `initial`: repeats the question''s own statement. - `custom`: plays the fallback''s own audio. - `llm`: generates a reply.' enum: - initial - custom - llm x-enum-varnames: - ConstructorQuestionFallbackTypeInitial - ConstructorQuestionFallbackTypeCustom - ConstructorQuestionFallbackTypeLLM ConstructorQuestionV1FallbackItem: type: object description: Sets one fallback of a question brick. `llm_properties` is stored only when `type` is `llm`; on any other fallback, and on one with no `type`, it is dropped on save. properties: is_repeat_statement: type: boolean audio: $ref: '#/components/schemas/ConstructorQuestionV1Audio' is_interruptible: type: boolean type: $ref: '#/components/schemas/ConstructorQuestionFallbackType' llm_properties: $ref: '#/components/schemas/ConstructorQuestionV1LLMProperties' ConstructorQuestionV1FallbackInvalid: type: object properties: fallbacks: type: array items: $ref: '#/components/schemas/ConstructorQuestionV1FallbackItem' entity: $ref: '#/components/schemas/ConstructorQuestionV1EntityProperties' ConstructorQuestionV1FallbackEmpty: type: object properties: fallbacks: type: array items: $ref: '#/components/schemas/ConstructorQuestionV1FallbackItem' ConstructorQuestionV1Properties: type: object properties: tts_properties: $ref: '#/components/schemas/ConstructorQuestionV1TTSProperties' dtmf_properties: $ref: '#/components/schemas/ConstructorQuestionV1DTMFProperties' stt_properties: $ref: '#/components/schemas/ConstructorQuestionV1STTProperties' statement: $ref: '#/components/schemas/ConstructorQuestionV1Statement' type: type: string description: 'Picks the question shape. Values: - `closed`: branches on a match in `answer.answers`, which must then be non-empty. - `open`: branches on `valid`. Any other value is refused on publish.' input_mode: type: string description: 'Picks how the reply is captured. Values: - `dtmf`: needs `dtmf_properties`. - `speech`: needs `stt_properties`. Anything else fails a publish.' answer: $ref: '#/components/schemas/ConstructorQuestionV1Answer' fallback_invalid: $ref: '#/components/schemas/ConstructorQuestionV1FallbackInvalid' fallback_empty: $ref: '#/components/schemas/ConstructorQuestionV1FallbackEmpty' entity: $ref: '#/components/schemas/ConstructorQuestionV1EntityProperties' ConstructorQuestionV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorQuestionV1Properties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorQuestion: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorQuestionV1' ConstructorWebhookV1RequestBodyFormValue: type: object properties: name: type: string value: type: string ConstructorWebhookV1RequestBody: type: object properties: data: type: string type: type: string form_values: type: array items: $ref: '#/components/schemas/ConstructorWebhookV1RequestBodyFormValue' ConstructorWebhookV1RequestAuthenticationBasic: type: object properties: username: type: string password: type: string ConstructorWebhookV1RequestAuthenticationBearer: type: object properties: token: type: string ConstructorWebhookV1RequestAuthentication: type: object properties: type: type: string basic: $ref: '#/components/schemas/ConstructorWebhookV1RequestAuthenticationBasic' bearer: $ref: '#/components/schemas/ConstructorWebhookV1RequestAuthenticationBearer' ConstructorWebhookV1RequestHeaderItem: type: object properties: name: type: string value: type: string ConstructorWebhookV1RequestHeader: type: object properties: headers: type: array items: $ref: '#/components/schemas/ConstructorWebhookV1RequestHeaderItem' ConstructorWebhookV1RequestProxy: type: object properties: url: type: string ConstructorWebhookV1Request: type: object required: - method - url properties: method: type: string url: type: string body: $ref: '#/components/schemas/ConstructorWebhookV1RequestBody' authentication: $ref: '#/components/schemas/ConstructorWebhookV1RequestAuthentication' header: $ref: '#/components/schemas/ConstructorWebhookV1RequestHeader' insecure_skip_verify: type: boolean proxy: $ref: '#/components/schemas/ConstructorWebhookV1RequestProxy' attach_call_metadata: type: boolean timeout: type: number format: float ConstructorWebhookV1Options: type: object properties: async: type: boolean timeout: type: number format: float ConstructorWebhookV1ResponseMappingVariable: type: object properties: name: type: string pattern: ^\{\{[A-Za-z0-9\-_.]+\}\}$ description: Names the target variable, written as a placeholder. Returned unwrapped in `variables`. source: type: string description: 'Picks where the value is read from. Values: - `body`: `path` holds a JSONPath. - `header`: `path` holds the header name.' path: type: string set_if_not_found: type: string ConstructorWebhookV1ResponseMapping: type: object properties: variables: type: array items: $ref: '#/components/schemas/ConstructorWebhookV1ResponseMappingVariable' ConstructorWebhookV1Properties: type: object required: - request properties: request: $ref: '#/components/schemas/ConstructorWebhookV1Request' options: $ref: '#/components/schemas/ConstructorWebhookV1Options' response_mapping: $ref: '#/components/schemas/ConstructorWebhookV1ResponseMapping' ConstructorWebhookV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorWebhookV1Properties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorWebhook: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorWebhookV1' ConstructorDataMappingV1ResponseMappingVariable: type: object properties: name: type: string path: type: string set_if_not_found: type: string ConstructorDataMappingV1Properties: type: object properties: input: type: string variables: type: array items: $ref: '#/components/schemas/ConstructorDataMappingV1ResponseMappingVariable' ConstructorDataMappingV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorDataMappingV1Properties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorDataMapping: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorDataMappingV1' ConstructorRunTreeV1PropertiesTree: type: object properties: id: type: string ConstructorRunTreeV1Properties: type: object properties: tree: $ref: '#/components/schemas/ConstructorRunTreeV1PropertiesTree' ConstructorRunTreeV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorRunTreeV1Properties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorRunTree: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorRunTreeV1' ConstructorEndTreeV1PropertiesOutput: type: object properties: type: type: string description: type: string ConstructorEndTreeV1Properties: type: object properties: output: $ref: '#/components/schemas/ConstructorEndTreeV1PropertiesOutput' ConstructorEndTreeV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorEndTreeV1Properties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorEndTree: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorEndTreeV1' ConstructorBackgroundAudioV1AudioItem: type: object properties: mode: type: string file_properties: $ref: '#/components/schemas/AudioFile' volume: type: integer ConstructorBackgroundAudioV1Audio: type: object properties: audios: type: array items: $ref: '#/components/schemas/ConstructorBackgroundAudioV1AudioItem' ConstructorBackgroundAudioV1Properties: type: object properties: audio: $ref: '#/components/schemas/ConstructorBackgroundAudioV1Audio' ConstructorBackgroundAudioV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorBackgroundAudioV1Properties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorBackgroundAudio: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorBackgroundAudioV1' ConstructorJavaScriptV1Properties: type: object required: - id properties: id: type: string description: 'Names the deployed edge function version the brick runs, as its uuid. Refused when: - A publish carries an empty value. - A publish carries a value that is not a uuid.' input_variables: type: array items: type: string ConstructorJavaScriptV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorJavaScriptV1Properties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorJavaScript: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorJavaScriptV1' ConstructorWarmUpTTSV1PropertiesBrickItem: type: object properties: id: type: string type: type: string ConstructorWarmUpTTSV1PropertiesBrick: type: object properties: bricks: type: array items: $ref: '#/components/schemas/ConstructorWarmUpTTSV1PropertiesBrickItem' ConstructorWarmUpTTSV1Properties: type: object properties: brick: $ref: '#/components/schemas/ConstructorWarmUpTTSV1PropertiesBrick' ConstructorWarmUpTTSV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorWarmUpTTSV1Properties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorWarmUpTTS: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorWarmUpTTSV1' ConstructorBusinessMetricProperties: type: object properties: key: type: string value: type: string ConstructorBusinessMetricV1: type: object required: - id properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorBusinessMetricProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorBusinessMetric: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorBusinessMetricV1' ConstructorAIAgentV1PromptsRestrictions: type: object properties: content: type: string ConstructorAIAgentV1PromptsRole: type: object properties: content: type: string ConstructorAIAgentV1PromptsInitialPhrase: type: object properties: content: type: string is_interruptible: type: boolean ConstructorAIAgentV1Prompts: type: object properties: restrictions: $ref: '#/components/schemas/ConstructorAIAgentV1PromptsRestrictions' role: $ref: '#/components/schemas/ConstructorAIAgentV1PromptsRole' initial_phrase: $ref: '#/components/schemas/ConstructorAIAgentV1PromptsInitialPhrase' ConstructorAIAgentV1SkillProperty: type: object properties: type: type: string description: type: string variable_name: type: string enum: type: array items: type: string default: type: string ConstructorAIAgentV1SkillParameters: type: object properties: type: type: string properties: type: object additionalProperties: $ref: '#/components/schemas/ConstructorAIAgentV1SkillProperty' required: type: array items: type: string additional_properties: type: boolean ConstructorAIAgentV1SkillItem: type: object required: - id - description properties: id: type: string name: type: string function_name: type: string description: type: string parameters: $ref: '#/components/schemas/ConstructorAIAgentV1SkillParameters' ConstructorAIAgentV1Skill: type: object properties: skills: type: array items: $ref: '#/components/schemas/ConstructorAIAgentV1SkillItem' ConstructorAIAgentV1KnowledgeBasePrompt: type: object properties: content: type: string ConstructorAIAgentV1KnowledgeBaseRAGDocument: type: object properties: ids: type: array items: type: string number: type: integer threshold: type: number format: float ConstructorAIAgentV1KnowledgeBaseRAG: type: object properties: document: $ref: '#/components/schemas/ConstructorAIAgentV1KnowledgeBaseRAGDocument' ConstructorAIAgentV1KnowledgeBase: type: object properties: type: type: string prompt: $ref: '#/components/schemas/ConstructorAIAgentV1KnowledgeBasePrompt' rag: $ref: '#/components/schemas/ConstructorAIAgentV1KnowledgeBaseRAG' ConstructorAIAgentV1FallbacksError: type: object properties: counter: type: integer ConstructorAIAgentV1FallbacksEmpty: type: object properties: counter: type: integer ConstructorAIAgentV1Fallbacks: type: object properties: error: $ref: '#/components/schemas/ConstructorAIAgentV1FallbacksError' empty: $ref: '#/components/schemas/ConstructorAIAgentV1FallbacksEmpty' ConstructorAIAgentV1ConfigurationLLM: type: object properties: engine: type: string model: type: string temperature: type: number format: float description: Sets the sampling temperature of the model, from 0 to 1. `0` or no value uses the default of the model. max_tokens: type: integer provider: type: string gdpr_required: type: boolean ConstructorAIAgentV1ConfigurationDialog: type: object properties: context_mode: type: string max_turns: type: integer ConstructorAIAgentV1Configuration: type: object properties: llm: $ref: '#/components/schemas/ConstructorAIAgentV1ConfigurationLLM' tts: $ref: '#/components/schemas/ConstructorQuestionV1TTSProperties' stt: $ref: '#/components/schemas/ConstructorQuestionV1STTProperties' dialog: $ref: '#/components/schemas/ConstructorAIAgentV1ConfigurationDialog' ConstructorAIAgentV1Properties: type: object properties: prompts: $ref: '#/components/schemas/ConstructorAIAgentV1Prompts' skill: $ref: '#/components/schemas/ConstructorAIAgentV1Skill' knowledge_base: $ref: '#/components/schemas/ConstructorAIAgentV1KnowledgeBase' fallbacks: $ref: '#/components/schemas/ConstructorAIAgentV1Fallbacks' configuration: $ref: '#/components/schemas/ConstructorAIAgentV1Configuration' ConstructorAIAgentV1: type: object required: - id - description properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorAIAgentV1Properties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorAIAgent: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorAIAgentV1' ConstructorSendDTMFV1Properties: type: object properties: digits: type: string interval: type: integer duration: type: integer ConstructorSendDTMFV1: type: object required: - id - description properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorSendDTMFV1Properties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorSendDTMF: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorSendDTMFV1' ConstructorRecordingSetupProperties: type: object ConstructorRecordingSetupV1: type: object required: - id - description properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorRecordingSetupProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorRecordingSetup: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorRecordingSetupV1' ConstructorTranscriptionSourceType: type: string description: 'Picks what is transcribed. Values: - `last_recording`: the call''s last recording is transcribed. - `url`: audio fetched from `url` is transcribed.' enum: - last_recording - url x-enum-varnames: - ConstructorTranscriptionSourceTypeLastRecording - ConstructorTranscriptionSourceTypeURL ConstructorTranscriptionSource: type: object properties: type: $ref: '#/components/schemas/ConstructorTranscriptionSourceType' url: type: string ConstructorTranscriptionEngine: type: string description: The engine that transcribes the source. enum: - whisper x-enum-varnames: - ConstructorTranscriptionEngineWhisper ConstructorTranscriptionRequestItem: type: object properties: source: $ref: '#/components/schemas/ConstructorTranscriptionSource' engine: $ref: '#/components/schemas/ConstructorTranscriptionEngine' prompt: type: string model: type: string ConstructorTranscriptionRequest: type: object properties: requests: type: array items: $ref: '#/components/schemas/ConstructorTranscriptionRequestItem' ConstructorTranscriptionProperties: type: object properties: request: $ref: '#/components/schemas/ConstructorTranscriptionRequest' ConstructorTranscriptionV1: type: object required: - id - description properties: id: type: string description: type: string properties: $ref: '#/components/schemas/ConstructorTranscriptionProperties' outputs: type: array items: $ref: '#/components/schemas/ConstructorBrickOutput' ConstructorTranscription: type: object properties: v1: type: array items: $ref: '#/components/schemas/ConstructorTranscriptionV1' ConstructorBricks: type: object description: 'Holds the properties of a brick, one key per brick type. Rules: - A text property reads a variable when it holds `{{name}}`, and a contact field when it holds `{{contact.}}`; the call puts the value in place when the brick runs. - A number, a boolean and an enum property take no variable. - `start_call`, `inbound_call`, `outbound_call`, `recording_setup`, `tree`, `start_tree`, `end_tree` and `end`: no property takes a variable. - `condition_group` and `assignment`: only `value` takes a variable. - `webhook`: only the method, the URL, the body, the names and values of the headers and of the form fields, the basic-auth username and password, the bearer token, the proxy URL, and the `path` and `set_if_not_found` of a response mapping take a variable. - A property that names a variable to write, such as `variable` of a response mapping or of `increment`, is written to and not read. - The guide with examples: https://docs.aiva.apifonica.com/guides/build/variables/' properties: audio: $ref: '#/components/schemas/ConstructorAudio' audio_file: $ref: '#/components/schemas/ConstructorAudioFile' audio_tts: $ref: '#/components/schemas/ConstructorAudioTTS' sms: $ref: '#/components/schemas/ConstructorSms' goal: $ref: '#/components/schemas/ConstructorGoal' end_call: $ref: '#/components/schemas/ConstructorEndCall' assignment: $ref: '#/components/schemas/ConstructorAssignment' increment: $ref: '#/components/schemas/ConstructorIncrement' condition_group: $ref: '#/components/schemas/ConstructorConditionGroup' start_tree: $ref: '#/components/schemas/ConstructorStartTree' start_call: $ref: '#/components/schemas/ConstructorStartCall' outbound_call: $ref: '#/components/schemas/ConstructorOutboundCall' inbound_call: $ref: '#/components/schemas/ConstructorInboundCall' end: $ref: '#/components/schemas/ConstructorEnd' call_transfer: $ref: '#/components/schemas/ConstructorCallTransfer' question: $ref: '#/components/schemas/ConstructorQuestion' webhook: $ref: '#/components/schemas/ConstructorWebhook' data_mapping: $ref: '#/components/schemas/ConstructorDataMapping' tree: $ref: '#/components/schemas/ConstructorRunTree' end_tree: $ref: '#/components/schemas/ConstructorEndTree' background_audio: $ref: '#/components/schemas/ConstructorBackgroundAudio' javascript: $ref: '#/components/schemas/ConstructorJavaScript' warm_up_tts: $ref: '#/components/schemas/ConstructorWarmUpTTS' business_metric: $ref: '#/components/schemas/ConstructorBusinessMetric' ai_agent: $ref: '#/components/schemas/ConstructorAIAgent' send_dtmf: $ref: '#/components/schemas/ConstructorSendDTMF' recording_setup: $ref: '#/components/schemas/ConstructorRecordingSetup' transcription: $ref: '#/components/schemas/ConstructorTranscription' ConstructorBrickType: type: string enum: - ai_agent - assignment - audio - audio_file - audio_tts - background_audio - call_transfer - condition_group - data_mapping - end - end_call - end_tree - goal - inbound_call - increment - javascript - outbound_call - question - sms - start_call - start_tree - transcription - tree - warm_up_tts - webhook x-enum-varnames: - ConstructorBrickTypeAIAgent - ConstructorBrickTypeAssignment - ConstructorBrickTypeAudio - ConstructorBrickTypeAudioFile - ConstructorBrickTypeAudioTTS - ConstructorBrickTypeBackgroundAudio - ConstructorBrickTypeCallTransfer - ConstructorBrickTypeConditionGroup - ConstructorBrickTypeDataMapping - ConstructorBrickTypeEnd - ConstructorBrickTypeEndCall - ConstructorBrickTypeEndTree - ConstructorBrickTypeGoal - ConstructorBrickTypeInboundCall - ConstructorBrickTypeIncrement - ConstructorBrickTypeJavascript - ConstructorBrickTypeOutboundCall - ConstructorBrickTypeQuestion - ConstructorBrickTypeSms - ConstructorBrickTypeStartCall - ConstructorBrickTypeStartTree - ConstructorBrickTypeTranscription - ConstructorBrickTypeTree - ConstructorBrickTypeWarmUpTTS - ConstructorBrickTypeWebhook Brick: type: object properties: id: type: string type: $ref: '#/components/schemas/ConstructorBrickType' version: type: string ConstructorTreeNodeLinkReference: type: object properties: tree_id: type: string node_id: type: string ConstructorTreeNodeLink: type: object properties: output_type: type: string reference: $ref: '#/components/schemas/ConstructorTreeNodeLinkReference' return: $ref: '#/components/schemas/ConstructorTreeNodeLinkReference' ConstructorNodePosition: type: object required: - x - y properties: x: type: number format: double x-go-type: '*float64' y: type: number format: double x-go-type: '*float64' ConstructorTreeNode: type: object properties: id: type: string brick: $ref: '#/components/schemas/Brick' links: type: array items: $ref: '#/components/schemas/ConstructorTreeNodeLink' position: description: 'Records where the brick of the node stands on the builder canvas. When a save gives a node no position, or `null`: - The start brick of a tree is placed at the top left. - A node that a placed node links to is placed to the right of that node and a little lower. - Any other node is placed in a stack under the start brick of its tree. The value is `null` when the record was stored with no position for the node.' anyOf: - $ref: '#/components/schemas/ConstructorNodePosition' - type: 'null' x-go-type: nullable.Nullable[ConstructorNodePosition] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true ConstructorTree: type: object properties: description: type: string tree_id: type: string nodes: type: array items: $ref: '#/components/schemas/ConstructorTreeNode' ConstructorForest: type: object properties: trees: type: array items: $ref: '#/components/schemas/ConstructorTree' ConstructorProperties: type: object properties: engine_version: type: string enum: - v3 description: Any value sent is stored as v3. Constructor: type: object properties: bricks: $ref: '#/components/schemas/ConstructorBricks' forest: $ref: '#/components/schemas/ConstructorForest' properties: $ref: '#/components/schemas/ConstructorProperties' CreateScenarioTemplateRequest: type: object required: - name - constructor properties: name: type: string minLength: 1 maxLength: 949 description: type: string description: Omitted means empty. constructor: $ref: '#/components/schemas/Constructor' ScenarioTemplate: type: object required: - id - name - description - constructor - created_at - updated_at properties: id: type: string description: Prefixed `sct_…`. name: type: string description: type: string constructor: $ref: '#/components/schemas/Constructor' created_at: type: string format: date-time updated_at: type: string format: date-time PatchScenarioTemplateRequest: type: object properties: name: type: string minLength: 1 maxLength: 949 description: type: string constructor: $ref: '#/components/schemas/Constructor' AudioAsset: type: object required: - id - location - filename - content_type - url - provider properties: id: type: string location: type: string description: Serves the file over the API. It never expires, and fetching it needs the same credentials and account scope as the rest of the API, which makes it the reference for API consumers and authoring preview. filename: type: string description: 'Names the stored file: aud_.wav.' content_type: type: string description: Declares the content type the file is stored and served with. url: type: string description: Points at the stored object by its permanent canonical storage URI (e.g. gs:///) — the reference a scenario brick embeds, read straight from storage by the call runtime. provider: type: string description: Names the storage provider holding the object (e.g. gcs); discriminates the url scheme. SignedLink: type: object required: - signed_url - expires_at description: Time-bounded presigned download link for a stored object (call history, recording, or audio file). properties: signed_url: type: string expires_at: type: string format: date-time Slug: type: string minLength: 1 maxLength: 100 description: 'Function name inside the account. Needs at least one `[A-Za-z0-9_]` character and must not be `by-id`. Other characters are not rejected. ' FunctionSummary: type: object required: - slug - version - original_code properties: slug: type: string version: type: integer original_code: type: string GetFunctionResponse: type: object required: - ok - edgeFunction properties: ok: type: boolean enum: - true edgeFunction: $ref: '#/components/schemas/FunctionSummary' ErrorCode: type: string enum: - UNAUTHORIZED - FORBIDDEN - NOT_FOUND - BAD_REQUEST - INTERNAL_SERVER_ERROR - VALIDATION_ERROR ErrorResponse: type: object required: - ok - error - err_code properties: ok: type: boolean enum: - false error: type: string err_code: $ref: '#/components/schemas/ErrorCode' ValidationErrorResponse: type: object required: - ok - error - issues properties: ok: type: boolean enum: - false error: type: string enum: - Validation failed issues: type: array description: zod issues as is items: type: object required: - code - path - message properties: code: type: string path: type: array items: oneOf: - type: string - type: integer message: type: string VariableValue: description: Input value. Objects and arrays are rejected, pass them as JSON strings. oneOf: - type: - string - 'null' - type: number format: double - type: boolean InvokeBody: type: object properties: variables: type: object description: 'Scenario variables. Read in the code with `storage.get(key)` and passed to the handler as the second argument. ' additionalProperties: $ref: '#/components/schemas/VariableValue' args: type: object description: Passed to the handler as the first argument. Iris sends `{}`. additionalProperties: $ref: '#/components/schemas/VariableValue' InvokeResponse: type: object required: - ok - return - variables - stdout - stderr - execution_time properties: ok: type: boolean return: type: string description: 'What the handler returned. A string as is, an object or array as JSON, `null` and `undefined` as an empty string, the rest via `String()`. ' variables: type: object description: 'Only the keys the run wrote with `storage.set`, every value as a string (objects as JSON, `null` and `undefined` as an empty string). Iris writes them back into the scenario variables. ' additionalProperties: type: string stdout: type: string description: '`console.log` lines, cut at 1 KiB with `... [truncated]`' stderr: type: string description: '`console.error` lines plus the thrown message, cut at 1 KiB' error: type: string description: Present only when `ok` is false execution_time: type: integer description: Milliseconds, including the bundle download DeleteFunctionResponse: type: object required: - ok - deleted properties: ok: type: boolean enum: - true deleted: type: boolean enum: - true ListFunctionsResponse: type: object required: - ok - total - hasMore - results properties: ok: type: boolean enum: - true total: type: integer hasMore: type: boolean results: type: array items: $ref: '#/components/schemas/FunctionSummary' CreateFunctionBody: type: object additionalProperties: false required: - slug - code properties: slug: $ref: '#/components/schemas/Slug' code: type: string minLength: 1 maxLength: 10000 description: 'TypeScript or JavaScript module with a default export (or a `handler` export). Rejected with `422` when it has a forbidden lexeme, fails `deno check` against the runtime globals, or fails ESLint. See FLOW.md for the lists. ' StorageKeys: type: array description: 'Keys found in the code as string literals of `storage.get` / `storage.unpack` (reads) or `storage.set` (writes). Keys built at runtime are not found. ' items: type: string CreateFunctionResponse: type: object required: - ok - id - version - storage_reads - storage_writes properties: ok: type: boolean enum: - true id: type: string format: uuid version: type: integer minimum: 1 storage_reads: $ref: '#/components/schemas/StorageKeys' storage_writes: $ref: '#/components/schemas/StorageKeys' FunctionStatus: type: string description: See the status lifecycle in FLOW.md enum: - deployed - error - pending - expired - cleaning - archived FunctionVersion: type: object required: - id - version - status - created_at - updated_at - original_code - is_latest - storage_reads - storage_writes properties: id: type: string format: uuid version: type: integer status: $ref: '#/components/schemas/FunctionStatus' created_at: type: string format: date-time updated_at: type: string format: date-time original_code: type: string is_latest: type: boolean storage_reads: $ref: '#/components/schemas/StorageKeys' storage_writes: $ref: '#/components/schemas/StorageKeys' ListVersionsResponse: type: object required: - ok - versions properties: ok: type: boolean enum: - true versions: type: array items: $ref: '#/components/schemas/FunctionVersion' WarmupResponse: type: object required: - ok - warmed_up - version properties: ok: type: boolean enum: - true warmed_up: type: boolean enum: - true version: type: integer IntentPhrase: type: object properties: phrases: type: array items: type: string minItems: 1 required: - phrases Intent: type: object properties: id: type: string maxLength: 36 description: type: string maxLength: 1024 phrase: $ref: '#/components/schemas/IntentPhrase' required: - id - phrase ClassifierIntent: type: object properties: intents: type: array items: $ref: '#/components/schemas/Intent' required: - intents ClassifierRequest: description: Training-relevant content of a classifier. type: object properties: model_id: type: string format: uuid description: type: string maxLength: 1024 intent: $ref: '#/components/schemas/ClassifierIntent' required: - model_id - intent ClassifierTrainingDetail: description: Why the last training run of this version ended as it did. Present on a single-version read; absent from list entries. type: object properties: error: description: Why the last training run failed. Absent unless it failed. type: string created_at: description: When the training run was queued. Absent if none was ever queued. type: string format: date-time updated_at: description: When the training run last changed state. Absent if none was ever queued. type: string format: date-time Classifier: description: One immutable version of a classifier, addressed by the account, the classifier id and the version number. type: object properties: id: type: string version: description: Version number. `0` is an ordinary version like any other — the first one a classifier gets, and the one existing scenario bricks name. type: integer minimum: 0 account_sid: type: string model_id: type: string description: type: string intent: $ref: '#/components/schemas/ClassifierIntent' content_hash: description: Identity of this version's training-relevant content. Two versions of one classifier can never carry the same value; it is what lets identical content resolve to an existing version instead of training again. type: string state: type: string enum: - new - training - fail - success - unknown training: $ref: '#/components/schemas/ClassifierTrainingDetail' required: - id - version - account_sid - model_id - description - intent - content_hash - state ErrorResponse-2: type: object properties: name: type: string message: type: string code: type: integer status: type: integer required: - name - message - code - status ClassifierList: type: array items: $ref: '#/components/schemas/Classifier' ClassifyRequest: type: object properties: phrase: type: string required: - phrase ClassifiedIntents: type: object properties: intents: type: object additionalProperties: type: number format: float required: - intents ErrorMessage: type: object description: 'Flat error shape emitted by the RAG document, public models and admin registry handlers. `details` is present only on validation failures that carry per-field diagnostics.' required: - error properties: error: type: string details: type: string RagDocumentUploadText: type: object required: - content - type properties: content: type: string type: type: string enum: - txt - csv RagDocumentUploadForm: type: object required: - document properties: document: type: string format: binary MessageResponse: type: object properties: message: type: string RagDocument: type: object required: - id - name - size - status - content_type - mode - index_type - chunk_size - uploaded_at properties: id: type: string format: uuid name: type: string size: type: integer format: int64 description: Size of the uploaded file in bytes. status: type: string enum: - pending - processed - error error: type: string description: The reason of the failure. Present only when status is error. content_type: type: string mode: type: string enum: - chunk - lines index_type: type: string enum: - fulltext - vector chunk_size: type: integer embedding_model: type: string embedding_provider: type: string uploaded_at: type: string format: date-time RagDocumentListResponse: type: object required: - documents - total - limit - offset - has_more properties: documents: type: array items: $ref: '#/components/schemas/RagDocument' total: type: integer format: int64 description: Number of the account's documents. limit: type: integer description: The page size applied. offset: type: integer description: The offset applied. has_more: type: boolean description: True when more documents follow this page. RagSearchResponse: type: object properties: chunks: type: array items: type: object additionalProperties: true ErrorCodeAccessDenied: type: string enum: - access_denied description: '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.' ErrorCodeAccountCallsInFlight: type: string enum: - account_calls_in_flight description: A call of the account, or of an account under the tenant, is being dialled or is in progress. ErrorCodeAudioNotFound: type: string enum: - audio_not_found description: '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.' ErrorCodeBadRequest: type: string enum: - bad_request description: '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.' ErrorCodeConflict: type: string enum: - conflict description: The write collides with the current state of the resource; `message` says what collided. ErrorCodeEmailConflict: type: string enum: - email_conflict description: Another live user, at either level, already holds the email address. ErrorCodeEmailRequired: type: string enum: - email_required description: The tenant declares `account` in `managed_resources`, which makes `email` required, and the request carries none. ErrorCodeExternalIdConflict: type: string enum: - external_id_conflict description: Another live resource of the same kind and scope already holds the external identifier. ErrorCodeExternalIdRequired: type: string enum: - external_id_required description: The tenant declares this resource type in `managed_resources`, which makes `external_id` required, and the request carries none. ErrorCodeInvalidRole: type: string enum: - invalid_role description: '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.' ErrorCodeMissingScopeHeader: type: string enum: - missing_scope_header description: 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`). ErrorCodeNotFound: type: string enum: - not_found description: '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.' ErrorCodePayloadTooLarge: type: string enum: - payload_too_large description: The body exceeds the size limit of the operation. ErrorCodePermissionDenied: type: string enum: - permission_denied description: The credential is valid and in scope, but the caller's roles do not grant the permission the operation needs. ErrorCodeRoleFixed: type: string enum: - role_fixed description: The role is defined by the platform and cannot be edited or deleted. ErrorCodeRoleInUse: type: string enum: - role_in_use description: '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.' ErrorCodeScenarioValidationFailed: type: string enum: - scenario_validation_failed description: The constructor is missing, or the constructor or a brick checked alone does not pass validation; `data.errors.scenario` lists each failure. ErrorCodeScopeConflict: type: string enum: - scope_conflict description: '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.' ErrorCodeSelfAdministration: type: string enum: - self_administration description: 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`. ErrorCodeUnauthenticated: type: string enum: - unauthenticated description: '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.' ErrorCodeValidationFailed: type: string enum: - validation_failed description: '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.' responses: InternalError: description: Internal server error content: application/json: schema: $ref: '#/components/schemas/Error' DomainError: description: 'Domain error. A failed bundle comes as `400` with `err_code: INTERNAL_SERVER_ERROR`. On a run route a bundle that could not be rebuilt is this `400` too. ' content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' NotFound: description: No version with these keys in the account content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: ok: false error: Function not found err_code: NOT_FOUND ValidationFailed: description: The body, query or path params did not pass the zod schema content: application/json: schema: $ref: '#/components/schemas/ValidationErrorResponse' InternalError-2: description: 'Unexpected error, for example a database or a disk failure. The body has `err_code: INTERNAL_SERVER_ERROR`. ' content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' InvokeResult: description: 'The run finished. `ok: true` when the handler returned, `ok: false` with `error` when it threw or the sandbox stopped it. ' content: application/json: schema: $ref: '#/components/schemas/InvokeResponse' examples: success: value: ok: true return: '{"greeting":"Hello, Ann"}' variables: greeted: 'true' stdout: greeting Ann stderr: '' execution_time: 84 thrown: value: ok: false return: '' variables: {} stdout: '' stderr: name is required error: name is required execution_time: 61 timeout: value: ok: false return: '' variables: {} stdout: '' stderr: '' error: Function exceeded timeout execution_time: 30004 BadRequest: description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' NotFound-2: description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' InternalError-3: description: Internal server error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-2' BadRequestMessage: description: Invalid request body or parameters content: application/json: schema: $ref: '#/components/schemas/ErrorMessage' NotFoundMessage: description: Resource does not exist content: application/json: schema: $ref: '#/components/schemas/ErrorMessage' InternalErrorMessage: description: Internal server error content: application/json: schema: $ref: '#/components/schemas/ErrorMessage' ConflictMessage: description: Resource busy content: application/json: schema: $ref: '#/components/schemas/ErrorMessage' requestBodies: InvokeBody: required: false content: application/json: schema: $ref: '#/components/schemas/InvokeBody' x-tagGroups: - name: Tenant tags: - Account - User - Role - ScenarioTemplate - Contract - name: Scenario template resources tags: - Audio - LLM Adapter - Classifier - Edge Function