openapi: 3.1.0 info: title: Voicebot API version: 1.94.2 contact: name: Apifonica Support email: support@apifonica.com x-logo: url: https://apifonica.com/public/img/logo.svg altText: Apifonica logo description: 'Serves the HTTP API of the Apifonica Voicebot: it manages scenarios, agents, numbers, contacts and segments, places calls and reads back what each one did, and administers an account''s users. ## Authentication Every authenticated request carries `Authorization: Bearer `. The same header accepts several credential kinds, told apart server-side. By credential: - Session token: issued to a user by `POST /v1/a/auth/regular` (email + password), by consuming a magic link, or by consuming a password reset; it is scoped to the user''s account, or to the tenant for a tenant-level user, and carries the user''s roles. - API key: issued to a user through `POST /v1/a/user/{sid}/api-key` or `POST /v1/t/user/{sid}/api-key`. It acts with that user''s roles at that user''s level: an account-level user''s key acts as the account, and a tenant-level user''s key acts across the tenant''s accounts. A key stops authenticating while its user is not active and works again once they are. A permission is named `:` or `::`, and the action is `read`, `write` or `manage`. On one resource `manage` includes `write`, and `write` includes `read`. A user gets permissions from the roles it holds. `GET /v1/a/profile` lists the caller''s permissions, and `GET /v1/a/role` lists the roles an account-level user can hold. The extensions: - `x-athena-permission`: names the permission the operation needs; `none` means the operation checks no permission. - `x-athena-field-permissions`: names the permission a field of the request body needs. - `x-athena-include-permissions`: names the permission a value of `include` needs. Tenant provisioning is performed by administrators over the internal network and is documented in the internal API reference. ### Operating on another scope By principal: - A tenant-level principal, a tenant-level user''s session or API key, acts across the tenant''s accounts, so it picks its target with the `X-Account-Sid` header. - An account-scoped principal may omit the header. The named account must belong to the principal''s tenant. Refused when: - A tenant-level principal omits the header. - An account-scoped principal names an account that is not its own. - The named account belongs to another tenant: it is refused as outside the credential''s scope. - The named account does not exist: it is not found. ## 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 a header. The headers: - `traceparent`: is the W3C header; a valid one takes precedence over `X-Trace-ID`. - `X-Trace-ID`: 32 hexadecimal characters or a UUID; the response returns it in lowercase and without dashes. A request with no valid id in either header is served under a new id. ## Compressed request bodies A request body may be compressed. The `Content-Encoding` header names the compression: `gzip` or `br`. Every limit of an endpoint applies to the decompressed body. Refused when: - `Content-Encoding` names another compression. - The body cannot be decompressed as named. - The decompressed body is larger than 128 MiB. ## Lists Refused when: - A `limit` is above the list''s maximum. - An `order_by`, `filter_or` or `include` name is one that its parameter does not accept. ## Errors An error response carries an `error` field that names the case. A client branches on `error`; the text in `message` is for people. Routes under `/v1/a/adapters/` list their errors in their own responses, and this section does not cover them. ### 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 | `country_code_invalid` | Refuses the `country_code` of the request.
Returned when:
- `country_code` is not a known country.
- `country_code` is not accepted with the `type` given. | | 400 | `external_id_required` | The tenant declares this resource type in `managed_resources`, which makes `external_id` required, and the request carries none. | | 400 | `file_column_name_too_long` | A heading of the file normalises to a key longer than 64 characters, or a path of the data of a list of rows is longer. | | 400 | `file_columns_clash` | Refuses the columns of the file.
Returned when:
- Two headings of the file normalise to the same key.
- A heading of the file normalises to a key that another heading nests under, such as `address` beside `address.city`.
- A column rename names the column itself or a column a row of the source already holds.
`message` names the key. | | 400 | `file_empty` | The file holds no row after its headings, or the list of rows is empty. | | 400 | `file_encoding_unsupported` | Refuses the encoding of the csv file.
Returned when:
- The csv file is not UTF-8 text.
- The csv file holds a NUL character. | | 400 | `file_malformed` | The file does not read as the type its `Content-Type` declares. | | 400 | `file_no_usable_rows` | Refuses the upload: it reads, and every row of it is rejected.
The data:
- `data.rows`: counts the rows of the upload.
- `data.reasons`: counts the rows by reason. | | 400 | `file_number_column_missing` | No heading of the file normalises to `number`. | | 400 | `file_too_many_columns` | The file holds more than 30 named columns, or the data of a list of rows more than 29 paths, the number counted as the 30th. | | 400 | `file_too_many_rows` | The file or the list of rows holds more than 100 000 rows. | | 400 | `file_type_unsupported` | The `Content-Type` of the `file` part is neither csv nor xlsx; the file is not read. | | 400 | `identifier_type_invalid` | `type` names an unknown way of reading a number. | | 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 | `query_invalid` | Refuses the `query` expression of a contact filter, or the `condition` of a routing, in the request.
Returned when:
- The expression cannot be read.
- A `data.` or a `contact.` names a field no contact of the account holds.
- A `data.` or a `contact.` names a field that holds fields of its own.
- A routing condition compares a field with a value or an operator the field does not take, or a `contact.` with a value of a type the field cannot hold.
- The expression holds too many comparisons or characters.
`message` names what is wrong and where. | | 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 | `magic_invalid` | Refuses the sign-in token.
Returned when:
- The token is unknown, already spent or expired.
- The user of the token is no longer active. | | 401 | `password_invalid` | Refuses a sign-in with an address and a password.
Returned when:
- The address is unknown.
- The password is wrong.
- The user is inactive.
- The user has no password set. | | 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 | `no_user_principal` | The credential has no person behind it, so a self endpoint cannot answer for it. | | 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`. | | 403 | `tenant_managed` | Refuses a write that belongs to the tenant, made by a caller without the role `tenant_admin`.
Returned when:
- The tenant declares this resource type in `managed_resources`.
- The tenant administers this SMS provider. | | 404 | `agent_not_found` | No live agent with this id. | | 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 | `automation_attempt_not_found` | No attempt of this automation with this id. | | 404 | `automation_contact_not_found` | The automation has not taken this contact. | | 404 | `automation_not_found` | No live automation with this id. | | 404 | `communication_not_found` | Refuses the communication id in the request.
Returned when:
- No communication has this id.
- The communication with this id was deleted. | | 404 | `communication_result_not_found` | No result delivery with this id. | | 404 | `contact_export_not_found` | Refuses the export job id in the request.
Returned when:
- No export job has this id.
- The job was removed 7 days after it finished. | | 404 | `contact_not_found` | No live contact with this id. | | 404 | `limit_policy_not_found` | No live limit policy with this id. | | 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. | | 404 | `number_not_found` | No live number of the account with this id or external identifier. | | 404 | `number_pool_not_found` | No live number pool of the account with this id or external identifier. | | 404 | `routing_not_found` | No live routing with this id on the agent. | | 404 | `scenario_not_found` | Refuses a scenario id the caller cannot see.
Returned when:
- No scenario with this id exists.
- The scenario belongs to an account outside the caller''s tenant.
- The scenario belongs to another account of the tenant and is not shared for copy. | | 404 | `scenario_version_not_found` | No version record of the scenario with this axis number and draft flag. | | 404 | `segment_not_found` | No live segment of the account with this id. | | 404 | `sms_provider_not_found` | No live SMS provider of the account with this id. | | 404 | `source_not_found` | No source with this id in the segment addressed. | | 404 | `source_row_not_found` | No row with this id in the source addressed. | | 405 | `method_not_allowed` | The path exists and does not accept this method. | | 409 | `agent_active_calls` | A call of the agent is being dialled or is in progress. | | 409 | `agent_concurrent_update` | Another write to the same agent landed first; read the agent again and retry. | | 409 | `automation_requires_published_scenario` | Refuses an agent change that activates the agent or gives an active agent a new scenario, while that scenario has no published version and the agent has automations that are not archived. `data.automations` names up to twenty of them. | | 409 | `communication_active` | The call is being dialled or is in progress; delete it once it ends, or with `hard=true`. | | 409 | `communication_result_target_conflict` | Another delivery of the same communication already holds the target URL. | | 409 | `conflict` | The write collides with the current state of the resource; `message` says what collided. | | 409 | `contact_changed` | The contact does not have the `revision` the request carries. | | 409 | `contact_field_in_use` | The condition of a live routing of an agent that is not archived reads the data field or a field under it; `data.routings` names them, the first twenty of them. | | 409 | `contact_in_use` | Live automations hold a segment the contact is in; `data.automations` names them. | | 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 | `limit_policy_in_use` | Live automations name the policy; `data.automations` names them. | | 409 | `number_external_id_conflict` | Another live number of the account holds the `external_id`. | | 409 | `number_identifier_conflict` | The identifier is registered platform-wide already, possibly by an account the caller cannot see. | | 409 | `number_in_use` | Agents that are not archived use the number, bound to it or to its pool; `data.agents` names them, the first twenty of them. | | 409 | `number_pool_external_id_conflict` | Another live pool of the account holds the `external_id`. | | 409 | `number_pool_in_use` | Agents use the pool; `data.agents` names them, the first twenty of them. | | 409 | `scenario_in_use` | Agents that are not archived reference the scenario, or live routings of agents that are not archived play it; `data.agents` and `data.routings` name them, the first twenty of each. | | 409 | `segment_default_read_only` | The account''s default segment takes no edit, no source and no delete. | | 409 | `segment_in_use` | Live automations hold the segment, or the condition of a live routing of an agent that is not archived names it; `data.automations` or `data.routings` names them. | | 409 | `segment_publish_running` | A publish of the segment''s sources is running; until it ends the sources take no write and no second publish. A publish that stopped without finishing counts as running for five minutes after it last worked. | | 409 | `sms_provider_in_use` | Agents that are not archived reference the provider; `data.agents` names them, the first twenty of them. | | 413 | `payload_too_large` | The body exceeds the size limit of the operation. | | 422 | `agent_archived` | The agent is archived and accepts no change. | | 422 | `agent_calling_schedule_invalid` | Refuses the calling schedule in the request.
Returned when:
- The calling schedule names an unknown strategy.
- The calling schedule carries no schedules.
- The calling schedule carries a schedule that never opens. | | 422 | `agent_gateway_inactive` | The agent is active and its gateway has no active number. | | 422 | `agent_invalid` | Refuses the agent in the request.
Returned when:
- The gateway is neither a number nor a pool.
- `scenario_sid` is empty.
- The body sets `status` to `archived`.
- A referenced scenario, number or pool is missing or deleted. | | 422 | `agent_lines_exceeded` | The `lines` figure takes the account''s agents past its allocation. | | 422 | `agent_lines_under_policies` | The `lines` figure is below what the agent''s limit policies reserve. | | 422 | `agent_name_in_use` | Another agent of the account holds the name; archived and deleted agents do not count. | | 422 | `agent_not_archived` | The agent is not archived, and only an archived agent can be deleted. | | 422 | `agent_number_in_pool` | The number belongs to a pool. | | 422 | `agent_number_in_use` | Another agent holds the number. | | 422 | `agent_timezone_invalid` | `timezone` is not an IANA zone name. | | 422 | `agent_timezone_required` | The calling schedule needs a `timezone`, and the agent has none. | | 422 | `automation_archived` | The automation is archived and accepts no change. | | 422 | `automation_attempt_end_missing` | The move leaves an attempt without an end anywhere but last in the schedule. | | 422 | `automation_attempt_ends_before_start` | `ends_at` is not after `starts_at`. | | 422 | `automation_attempt_opened` | An attempt of the automation has opened, so its agent, segment and mode no longer change. | | 422 | `automation_attempt_overlaps` | The window overlaps another attempt of the automation. | | 422 | `automation_attempt_past` | Refuses a moment or an attempt that is not in the future.
Returned when:
- The moment is in the past.
- The attempt is already running or past. | | 422 | `automation_attempts_waiting` | The automation holds attempts waiting to open, so its mode does not change. | | 422 | `automation_mode_manual` | The automation is in the manual mode, which takes no scheduled attempts. | | 422 | `automation_name_in_use` | Another live automation of the target agent holds the name. | | 422 | `automation_run_under_way` | A run is idle or in progress; the action waits for it to stop. | | 422 | `automation_scenario_unpublished` | The agent''s scenario has never been published. | | 422 | `automation_segment_claimed` | Another live automation holds the segment. | | 422 | `communication_invalid` | Refuses the dispatch body.
Returned when:
- The body names an agent, scenario, version, draft, recipient or variable that is missing, out of scope or malformed.
- A recipient is a phone number with no country calling code.
- A recipient is a placeholder for a withheld number.
- The body names an `automation_sid`.
- The body names an agent that is archived.
- A `data` key is a system variable.
- A `data` key holds null, an object or an array.
- A test call finds no account number to dial from.
- The body sends `is_test: false` with `scenario_sid`, `prefer_draft: true` or `draft: true`, or sends `prefer_draft` and `draft` with different values.
`message` says which. The `data` keys `contact` and `contact.{path}` are never refused. | | 422 | `connected_agent_sms_settings_not_set` | The version being published has an SMS brick, and agents that are not archived and have no SMS settings reference the scenario; `data.agents` names them, the first twenty of them. | | 422 | `contact_data_limit` | Refuses contact data the account cannot hold.
Returned when:
- The contact data would break a limit of its account.
- The contact data is already past a limit, and the write leaves it past.
- A value has another type than its field holds across the account''s contacts.
- An item of an array is an object, an array or `null`.
`data` names the limit, the field and the numbers or the types. | | 422 | `contact_field_conflict` | Refuses the rename of a field in the contact data.
Returned when:
- The new path lies inside the old one or holds it.
- A contact of the account holds a value at the new path or on the way to it.
- A contact holds a value that is not an object on the way to the new path.
`data.field` names the field in the way, and `data.contact` the first such contact when one is named. | | 422 | `contact_invalid` | Refuses the contact number in the request.
Returned when:
- The number is missing.
- The number cannot be brought to the stored form.
`data.reason` names why, as a code. | | 422 | `contact_limit_reached` | The account holds as many contacts as its limit allows, and the request would add one more. | | 422 | `contact_number_taken` | The account already holds a contact with this number. | | 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 | `limit_policy_name_in_use` | Another live policy of the same agent holds the name. | | 422 | `limit_policy_over_agent` | The policies of the agent, this one included, reserve more lines than the agent has. | | 422 | `number_identifier_invalid` | The identifier is not a SIP identity the platform accepts. | | 422 | `number_pool_invalid` | `name` is blank. | | 422 | `routing_default_locked` | The request changes, moves or deletes the default routing. | | 422 | `routing_invalid` | Refuses the routing in the request.
Returned when:
- The name is empty.
- The position is outside the agent''s list.
- The scenario does not exist on the account.
- The condition names a segment that the account does not hold. | | 422 | `routing_name_in_use` | Another live routing of the same agent holds the name, or the name is `default` in any letter case. | | 422 | `scenario_copy_failed` | A resource the scenario or template names cannot be copied, so nothing is created and no resource is left behind. | | 422 | `scenario_invalid` | The patch unsets `type`, `name` or `constructor`. | | 422 | `scenario_sms_sender_required` | The published version of the agent''s scenario has an SMS brick, and the agent has no SMS settings. | | 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. | | 422 | `scenario_version_immutable` | The record is a published version or a frozen draft; only the current work-in-progress draft is deletable. | | 422 | `segment_invalid` | Refuses the segment or source in the request.
Returned when:
- `name` is empty.
- The source kind is not one the platform offers.
- `auto_update` is set on a source kind that cannot be followed. | | 422 | `segment_name_in_use` | Another live segment of the account already holds the name; a deleted segment releases its name. | | 422 | `sms_provider_invalid` | Refuses the SMS configuration.
Returned when:
- The sender is missing.
- The alpha or number named is not the provider''s.
- The provider config is incomplete. | | 422 | `sms_provider_name_taken` | Another live provider of the account holds the name. | | 422 | `sms_send_invalid` | Refuses a send that names no usable target.
Returned when:
- `to` is missing.
- Neither an agent nor a provider with a sender is given. | | 422 | `sms_settings_missing` | The agent named has no SMS settings. | | 422 | `source_conflict` | Two draft sources supply the same number with different data. | | 422 | `source_contact_limit` | The batch would add more contacts than the account can take; `GET …/source/-/validate` shows how many it can. | | 422 | `source_data_limit` | A merged contact of the batch would break a data limit of the account; `GET …/source/-/validate` names it. | | 422 | `source_nothing_to_publish` | The segment has no draft source. | | 422 | `source_published` | The source is published; its rows and its `reset_reach` no longer change. | | 422 | `source_removed` | The source is removed and takes no write. | | 422 | `source_row_duplicate` | The source already holds a row with this number. | | 429 | `rate_limited` | More requests than the operation allows in its window; wait and retry. | | 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: Scenario description: Call-flow definitions the bot runs. CRUD, copy, placeholders, system variables, webhook test run. - name: ScenarioVersion x-displayName: Scenario Version description: Scenario version history — published versions and draft records. List, get one, delete the WIP draft. - name: Agent description: Binds a scenario to a number gateway with calling rules. CRUD and archive. - name: Limit policy description: A named slice of one agent's capacity, reserved for the automations that use it. CRUD. - name: Automation description: What causes an agent's calls — the segment it reaches, the agent it reaches them through, and whether it is switched on. CRUD + stop, start, archive. - name: Number x-displayName: Number description: SIP identity an agent answers on or calls from. CRUD. - name: NumberPool x-displayName: Number Pool description: Named group of numbers an agent can use as a gateway. CRUD. - name: Audio description: Audio files scenario bricks embed. Upload + serve (proxied or presigned link). - name: SMS description: The customer's own SMS gateway as configuration — provider configs (generic HTTP gateways), their senders, and test send. - name: Communication description: Communication create/read/delete. The row is immutable via the API after create; dial state is system-managed. - name: CommunicationResult x-displayName: Communication Result description: Per-communication dispatch outcome. List, get one, patch, resend. - name: Contact description: The person an account can call — number, the data held on them, and the log of what their calls did. CRUD. - name: Segment description: A group of the account's contacts, addressed as one. CRUD, its sources and its membership. - name: Auth description: User session lifecycle — login, magic-link / password-reset consume, password change, logout. - 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: Profile description: Authenticated caller's own user + account. Self-service, no path id. - name: Info description: Static reference datasets clients render pickers from. - name: Contract x-displayName: OpenAPI Document description: The API's own OpenAPI document and its changelog, served exactly as the deployment was built. - name: Analytics description: Counts over the account's calls by hour, day or month, its lines in use now, and its contacts against the contact limit, with the fields and bytes of their data. - 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: Routing description: The ordered rules of one agent that choose the scenario of each of its calls. CRUD. - 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: Source description: An origin a segment draws its contacts from. A source belongs to one segment and holds the rows supplied to it. - name: Source file description: The rows of a source supplied as a csv or xlsx file, and the rows the file could not use. - name: Source manual description: The rows of a source supplied as JSON, many in a batch or one at a time. - name: Source publishing description: The check and the publish that turn the draft rows of a segment's sources into contacts. - name: LLM Adapter description: Chat completion and streaming, embeddings, and retrieval over uploaded documents. - name: TTS Adapter description: Speech synthesis and the voice registry. - name: Classifier description: Classifiers and their immutable versions — lifecycle, training progress, and classification. - name: Entity description: Entity extraction from a phrase, and the entity types available per language. - name: Model description: The base models a classifier can be built on. - name: Edge Function description: The JavaScript functions a scenario brick runs — versions, their code, and a run. - name: STT Adapter description: Speech recognition — dispatch across the recognition nodes, the recognition catalog and tuning options, and the dictionaries. paths: /v1/a/scenario: get: tags: - Scenario operationId: GetScenariosList x-athena-permission: scenario:read summary: List scenarios description: 'The caller''s own account alone: a scenario another account shared for copy is readable by id, never listed here. Rows carry the whole constructor, so a page of them is large; other resources embed a trimmed form instead.' parameters: - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Offset' - $ref: '#/components/parameters/OrderBy' - $ref: '#/components/parameters/Order' - $ref: '#/components/parameters/TypeQuery' - $ref: '#/components/parameters/SidQuery' - $ref: '#/components/parameters/NameQuery' - $ref: '#/components/parameters/FilterOr' - $ref: '#/components/parameters/FilterQuery' - $ref: '#/components/parameters/IsPublishedQuery' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ScenarioList' '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/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' post: tags: - Scenario operationId: CreateScenario x-athena-permission: scenario:write summary: Create scenario description: 'Creates a scenario. A `fix_communication_ttl` that is omitted, or sent as 0, is stored as 3600. By mode: - Without `draft: true`, the scenario is published as version 1, and that version is filed in its history. - With `draft: true`, nothing is published: `version` stays 0 and the content lands as the work-in-progress draft. A publish is refused while a JavaScript brick names an edge function the account does not hold; a draft save is not refused.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateScenarioRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Scenario' '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/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeScenarioValidationFailed' '500': $ref: '#/components/responses/InternalError' /v1/a/scenario/{id}: get: tags: - Scenario operationId: GetScenario x-athena-permission: scenario:read summary: Get scenario description: 'Reads one scenario. For a scenario of another account: - One shared for copy is also readable by other accounts of the owning tenant. - Any other foreign scenario, and any scenario outside the owning tenant, reads as absent.' parameters: - $ref: '#/components/parameters/ScenarioIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Scenario' '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' - $ref: '#/components/schemas/ErrorCodeScenarioNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - Scenario operationId: PatchScenario x-athena-permission: scenario:write summary: Update scenario description: 'Saves the scenario, as a publish or as a draft. Only the owning account writes the scenario: a scenario another account shared for copy is readable but not writable. On a publish: - A change of `name` or `constructor` files the next version in the scenario''s history. - A move of a node or a new order of the outputs of a brick is not a change of `constructor`. - Without such a change, `version` stays. - Without such a change, the latest version takes the node positions and the order of outputs that the request sends. - Any pending draft is left untouched. Refused when: - A publish whose constructor has an SMS brick while an agent that is not archived references the scenario and has no SMS settings. - A publish has a JavaScript brick that names an edge function the account does not hold. A draft save is not refused for either.' parameters: - $ref: '#/components/parameters/ScenarioIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchScenarioRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Scenario' '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' - $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' - $ref: '#/components/schemas/ErrorCodeScenarioNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeConnectedAgentSmsSettingsNotSet' - $ref: '#/components/schemas/ErrorCodeScenarioInvalid' - $ref: '#/components/schemas/ErrorCodeScenarioValidationFailed' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '500': $ref: '#/components/responses/InternalError' delete: tags: - Scenario operationId: DeleteScenario x-athena-permission: scenario:manage summary: Delete scenario description: Soft delete. Refused while an agent references the scenario or a routing of an agent plays it; an archived agent and its routings do not count. parameters: - $ref: '#/components/parameters/ScenarioIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/DeleteScenarioResponse' '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' - $ref: '#/components/schemas/ErrorCodeScenarioNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeScenarioInUse' '500': $ref: '#/components/responses/InternalError' /v1/a/scenario/{id}/copy: post: tags: - Scenario operationId: CopyScenario x-athena-permission: scenario:write summary: Copy scenario description: 'Copies a scenario into the caller''s account. By source: - An own scenario is copied. - A shared-for-copy scenario of another account of the same tenant is copied. - Any other foreign scenario reads as absent. The copy starts unpublished: `version` 0, the content as its work-in-progress draft. Rules for a shared scenario of another account: - Every classifier, edge function, RAG document and audio file it names is created again in the caller''s account, and the copy names the new ones. - Webhook authentication is not copied. Refused when: - The scenario belongs to another account, and the account made another copy less than a minute ago. A copy of a template counts. - A resource of the shared scenario cannot be copied. Nothing is created then.' parameters: - $ref: '#/components/parameters/ScenarioIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Scenario' '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' - $ref: '#/components/schemas/ErrorCodeScenarioNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeScenarioCopyFailed' '429': description: Too many requests content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeRateLimited' '500': $ref: '#/components/responses/InternalError' /v1/a/scenario/{id}/placeholders: get: tags: - Scenario operationId: GetScenarioPlaceholders x-athena-permission: scenario:read summary: List scenario placeholders description: 'Lists every variable the stored scenario names, deduplicated: the keys to supply as `data` when dialling it. Rules: - A variable named in a `{{…}}` placeholder is listed. - A variable a brick sets is listed. - System variables are left out. A draft-only save leaves the set unchanged.' parameters: - $ref: '#/components/parameters/ScenarioIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/PlaceholdersResponse' '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' - $ref: '#/components/schemas/ErrorCodeScenarioNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/scenario/webhook/run: post: tags: - Scenario operationId: RunScenarioWebhook x-athena-permission: scenario:write summary: Run webhook brick configuration description: 'Runs the configuration against the supplied test variables; no stored scenario changes. Rules: - A target that cannot be reached gives a successful answer carrying `status: "fail"`. - A target that answers `300` or above gives a successful answer carrying `status: "fail"`. - Only an invalid configuration is an error response.' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/WebhookRunRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/WebhookRunResult' '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/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeScenarioValidationFailed' '500': $ref: '#/components/responses/InternalError' /v1/a/scenario/{id}/validate: post: tags: - Scenario operationId: ValidateScenario x-athena-permission: scenario:write summary: Validate scenario description: 'Runs the checks of a publish on a body and stores nothing: the constructor, the classifier versions its bricks pin, and the edge functions its JavaScript bricks name. By `id`: - `-`: runs the checks of publishing a new scenario. - The id of a stored scenario: runs the checks of publishing its next version, the SMS settings of the agents that run it included.' parameters: - name: id in: path required: true description: Names the stored scenario whose next version is checked, or `-` for a new scenario. schema: type: string - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ValidateScenarioRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ScenarioValidation' '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/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeScenarioNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeConnectedAgentSmsSettingsNotSet' - $ref: '#/components/schemas/ErrorCodeScenarioValidationFailed' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '500': $ref: '#/components/responses/InternalError' /v1/a/scenario/system-variables: get: tags: - Scenario operationId: GetSystemVariables x-athena-permission: scenario:read summary: List system variables description: 'Lists the system variables: the variables the platform sets during a call. Rules: - A scenario reads one without declaring it, by writing `{{name}}` in a brick property or a text. - The scenario''s placeholders leave it out. The name forms: - A fixed name, such as `call.id` or `last_webhook.body`, names one variable. - A name with a part in `{ }`, such as `action.webhook.{brick_id}.status` or `sip.headers.{header}`, names one variable for each value of that part. - `contact.{path}`: names one field of the contact''s data, the object `contact` holds. For a name with a part in `{ }`: - A scenario fills the part in when it reads the variable: `{{action.webhook.w1.status}}` for the webhook brick `w1`, `{{sip.headers.X-Customer-Id}}` for that SIP header. - The filled-in part holds no dot. For `contact.{path}`: - Its part in `{ }` is a path and may hold dots. - The path is one or more keys joined by single dots, each key made of Latin letters, digits, `-` and `_`. - A key of digits only is a position in a list, counted from 0: `{{contact.address.city}}` is `city` inside `address`, `{{contact.phones.0}}` is the first item of `phones`. On a read of a contact field: - A field is read as text: a number or a boolean as it is written in the data, an object or a list as JSON text. - A path that leads to no field, or to a field that holds `null`, is read as empty text. On a write of a contact field: - A write sets the field to text, whatever the field held before. - A write creates the objects and lists the path names when the data does not hold them. - A position in a list is written when the list holds it or when it is the next free one. - A write whose path does not fit the data changes nothing, and the call continues. When the call ends: - Each written field is stored on the contact as the type the field holds across the account''s contacts. - A value that does not read as that type, or that breaks a data limit of the account, is not stored, and the field keeps what it held. Static reference data: the same list for every caller, no paging, no filtering.' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SystemVariablesResponse' '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' '500': $ref: '#/components/responses/InternalError' /v1/a/brick/-/validate: post: tags: - Scenario operationId: ValidateBrick x-athena-permission: scenario:write summary: Validate one brick description: 'Checks one brick and answers with the errors the same brick gets when its scenario is saved; nothing is stored. Rules: - The checks that read the rest of the scenario are not run: the bricks and nodes it holds, the links in `forest`, the tree a `tree` brick runs, and the bricks a `warm_up_tts` brick names. - The errors carry no `tree_id` and no `node_id`.' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/BrickValidationRequest' responses: '204': description: No content '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' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeScenarioValidationFailed' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '500': $ref: '#/components/responses/InternalError' /v1/a/scenario-version: get: tags: - ScenarioVersion operationId: ListScenarioVersions x-athena-permission: scenario:read summary: List scenario versions description: 'Lists the history of one scenario. Rules: - `scenario_sid`: is required, because the list covers one scenario. - `draft`: picks an axis; without it, published versions and draft records interleave. Every row carries its whole snapshot, so a default page can hold 100 complete constructors.' parameters: - $ref: '#/components/parameters/ScenarioVersionScenarioSid' - $ref: '#/components/parameters/ScenarioVersionLimit' - $ref: '#/components/parameters/ScenarioVersionOffset' - $ref: '#/components/parameters/ScenarioVersionOrder' - $ref: '#/components/parameters/ScenarioVersionOrderBy' - $ref: '#/components/parameters/ScenarioVersionDraft' - $ref: '#/components/parameters/ScenarioVersionVersionFilter' - $ref: '#/components/parameters/ScenarioVersionDraftVersionFilter' - $ref: '#/components/parameters/ScenarioVersionFilterOr' - $ref: '#/components/parameters/ScenarioVersionFilterQuery' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ScenarioVersionList' '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/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeScenarioNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/scenario-version/by-scenario: get: tags: - ScenarioVersion operationId: GetScenarioVersionByScenario x-athena-permission: scenario:read summary: Get scenario version description: Addresses one version record by parent scenario plus axis number. parameters: - $ref: '#/components/parameters/ScenarioVersionByScenarioSid' - $ref: '#/components/parameters/ScenarioVersionAxisNumber' - $ref: '#/components/parameters/ScenarioVersionByScenarioDraft' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ScenarioVersion' '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/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeScenarioNotFound' - $ref: '#/components/schemas/ErrorCodeScenarioVersionNotFound' '500': $ref: '#/components/responses/InternalError' delete: tags: - ScenarioVersion operationId: DeleteScenarioVersionByScenario x-athena-permission: scenario:manage summary: Delete draft record description: 'Deletes the current work-in-progress draft (`draft_version` 0), addressed by parent scenario plus axis number. Refused when: - The record is a published version. - The record is a frozen draft record, which is immutable.' parameters: - $ref: '#/components/parameters/ScenarioVersionByScenarioSid' - $ref: '#/components/parameters/ScenarioVersionAxisNumber' - $ref: '#/components/parameters/ScenarioVersionByScenarioDraft' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: Deleted content: application/json: schema: $ref: '#/components/schemas/DeleteScenarioVersionResponse' '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/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeScenarioNotFound' - $ref: '#/components/schemas/ErrorCodeScenarioVersionNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeScenarioVersionImmutable' '500': $ref: '#/components/responses/InternalError' /v1/a/number: get: tags: - Number operationId: ListNumbers x-athena-permission: number:read x-athena-include-permissions: number_pool: number:pool:read agent: agent:read summary: List numbers description: 'Lists the numbers. The fields: - `is_used`: says whether an agent holds the number. - `agent_sid`: names the holding agent. - `pool_sid`: names the pool the number belongs to. The parameters: - `is_used=false`: returns only the numbers an agent can take. - `include=agent`: resolves the holding agent into `included`. - `include=number_pool`: resolves the pool into `included`.' parameters: - $ref: '#/components/parameters/NumberLimit' - $ref: '#/components/parameters/NumberOffset' - $ref: '#/components/parameters/NumberStatusQuery' - $ref: '#/components/parameters/NumberIdentifierQuery' - $ref: '#/components/parameters/NumberPoolSidQuery' - $ref: '#/components/parameters/NumberFilterOr' - $ref: '#/components/parameters/NumberFilterQuery' - $ref: '#/components/parameters/NumberOrderBy' - $ref: '#/components/parameters/NumberOrder' - $ref: '#/components/parameters/NumberIsUsed' - $ref: '#/components/parameters/NumberInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/NumberList' '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/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' post: tags: - Number operationId: CreateNumber x-athena-permission: number:write summary: Create number description: 'Registers a SIP identity for the account. Rules: - The identifier is unique platform-wide. - `status`: defaults to active. - `pool_sid`: places the number in a pool at creation. While the tenant declares `number` in `managed_resources`: - Only a caller with the role `tenant_admin` creates one. - `external_id` is required.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateNumberRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Number' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeBadRequest' - $ref: '#/components/schemas/ErrorCodeExternalIdRequired' - $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' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '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/ErrorCodeNumberExternalIdConflict' - $ref: '#/components/schemas/ErrorCodeNumberIdentifierConflict' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNumberIdentifierInvalid' '500': $ref: '#/components/responses/InternalError' /v1/a/number/-/external/{external_id}: get: tags: - Number operationId: GetNumberByExternalID x-athena-permission: number:read summary: Get number by external identifier description: Resolves the number the calling account gave this key, without the caller knowing the platform id. parameters: - $ref: '#/components/parameters/NumberExternalIDPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Number' '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' - $ref: '#/components/schemas/ErrorCodeNumberNotFound' '500': $ref: '#/components/responses/InternalError' delete: tags: - Number operationId: DeleteNumberByExternalID x-athena-permission: number:manage summary: Delete number by external identifier description: 'Soft-deletes, as by id, the number the calling account gave this key, without the caller knowing the platform id. The key is released for reuse by a live number. Refused when: - An agent uses the number, as by id. - The tenant declares `number` in `managed_resources` and the caller does not have the role `tenant_admin`.' parameters: - $ref: '#/components/parameters/NumberExternalIDPath' - $ref: '#/components/parameters/XAccountSidHeader' 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' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeNumberNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNumberInUse' '500': $ref: '#/components/responses/InternalError' /v1/a/number/{id}: get: tags: - Number operationId: GetNumber x-athena-permission: number:read x-athena-include-permissions: number_pool: number:pool:read agent: agent:read summary: Get number description: 'Returns the registered number. The fields: - `pool_sid`: names the pool the number sits in. - `agent_sid`: names the agent that holds it. The parameters: - `include=number_pool`: resolves the pool into `included`, the same map the list answers with. - `include=agent`: resolves the agent into `included`, the same map the list answers with.' parameters: - $ref: '#/components/parameters/NumberIdPath' - $ref: '#/components/parameters/NumberInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/NumberRead' '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/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeNumberNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - Number operationId: PatchNumber x-athena-permission: number:write summary: Update number description: 'Updates the number. Rules: - A new identifier stays subject to the platform-wide uniqueness rule. - While the tenant declares `number` in `managed_resources`, a caller without the role `tenant_admin` may send `status`, in either direction, and nothing else. - A number an agent holds does not join a pool. Effects: - `status: inactive` switches off the active agent that holds the number. - A number that leaves its pool, or turns inactive, switches off the active agents of the pool when the pool keeps no active number. - `status: active` switches on no agent.' parameters: - $ref: '#/components/parameters/NumberIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchNumberRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Number' '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' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeNumberNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNumberExternalIdConflict' - $ref: '#/components/schemas/ErrorCodeNumberIdentifierConflict' - $ref: '#/components/schemas/ErrorCodeNumberInUse' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNumberIdentifierInvalid' '500': $ref: '#/components/responses/InternalError' delete: tags: - Number operationId: DeleteNumber x-athena-permission: number:manage summary: Delete number description: 'Deletes the number. Refused when: - An agent that is not archived is bound to the number. - An agent that is not archived is bound to the pool the number belongs to. - The tenant declares `number` in `managed_resources` and the caller does not have the role `tenant_admin`. Detaching the number from its pool releases it from the pool''s agents.' parameters: - $ref: '#/components/parameters/NumberIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '204': description: Deleted '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' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeNumberNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNumberInUse' '500': $ref: '#/components/responses/InternalError' /v1/a/number-pool: get: tags: - NumberPool operationId: ListNumberPools x-athena-permission: number:pool:read x-athena-include-permissions: number: number:read summary: List number pools description: 'A pool row names no members: membership is held on the number, as its `pool_sid`. Ask for `include=number` to resolve each pool''s numbers into `included`.' parameters: - $ref: '#/components/parameters/NumberPoolLimit' - $ref: '#/components/parameters/NumberPoolOffset' - $ref: '#/components/parameters/NumberPoolStatusQuery' - $ref: '#/components/parameters/NumberPoolFilterOr' - $ref: '#/components/parameters/NumberPoolFilterQuery' - $ref: '#/components/parameters/NumberPoolOrderBy' - $ref: '#/components/parameters/NumberPoolOrder' - $ref: '#/components/parameters/NumberPoolInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/NumberPoolList' '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/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' post: tags: - NumberPool operationId: CreateNumberPool x-athena-permission: number:pool:write summary: Create number pool description: 'Creates an empty pool. Rules: - Numbers join by being patched into it, not by being named here. - `status`: defaults to active. While the tenant declares `number_pool` in `managed_resources`: - Only a caller with the role `tenant_admin` creates one. - `external_id` is required.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateNumberPoolRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/NumberPool' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeBadRequest' - $ref: '#/components/schemas/ErrorCodeExternalIdRequired' - $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' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '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/ErrorCodeNumberPoolExternalIdConflict' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNumberPoolInvalid' '500': $ref: '#/components/responses/InternalError' /v1/a/number-pool/-/external/{external_id}: get: tags: - NumberPool operationId: GetNumberPoolByExternalID x-athena-permission: number:pool:read summary: Get number pool by external identifier description: Resolves the number pool the calling account gave this key, without the caller knowing the platform id. parameters: - $ref: '#/components/parameters/NumberPoolExternalIDPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/NumberPool' '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' - $ref: '#/components/schemas/ErrorCodeNumberPoolNotFound' '500': $ref: '#/components/responses/InternalError' delete: tags: - NumberPool operationId: DeleteNumberPoolByExternalID x-athena-permission: number:pool:manage summary: Delete number pool by external identifier description: 'Soft-deletes, as by id, the number pool the calling account gave this key, without the caller knowing the platform id. The key is released for reuse by a live pool. Refused when: - Agents use the pool. - The tenant declares `number_pool` in `managed_resources` and the caller does not have the role `tenant_admin`.' parameters: - $ref: '#/components/parameters/NumberPoolExternalIDPath' - $ref: '#/components/parameters/XAccountSidHeader' 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' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeNumberPoolNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNumberPoolInUse' '500': $ref: '#/components/responses/InternalError' /v1/a/number-pool/{id}: get: tags: - NumberPool operationId: GetNumberPool x-athena-permission: number:pool:read x-athena-include-permissions: number: number:read summary: Get number pool description: 'Returns the pool row, which names no members. Rules: - `include=number`: resolves the members into `included`, capped the way the list caps them. - `GET /v1/a/number?pool_sid=…`: pages through all the members.' parameters: - $ref: '#/components/parameters/NumberPoolIdPath' - $ref: '#/components/parameters/NumberPoolInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/NumberPoolRead' '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/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeNumberPoolNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - NumberPool operationId: PatchNumberPool x-athena-permission: number:pool:write summary: Update number pool description: 'Updates the pool''s own name, external identifier and status. Rules: - Membership is not here: a number joins or leaves by having its `pool_sid` patched. - While the tenant declares `number_pool` in `managed_resources`, a caller without the role `tenant_admin` may send `status`, in either direction, and nothing else. Effects: - `status: inactive` switches off the active agents of the pool. - `status: active` switches on no agent.' parameters: - $ref: '#/components/parameters/NumberPoolIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchNumberPoolRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/NumberPool' '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' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeNumberPoolNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNumberPoolExternalIdConflict' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNumberPoolInvalid' '500': $ref: '#/components/responses/InternalError' delete: tags: - NumberPool operationId: DeleteNumberPool x-athena-permission: number:pool:manage summary: Delete number pool description: 'Deletes the pool. Refused when: - Agents use the pool. - The tenant declares `number_pool` in `managed_resources` and the caller does not have the role `tenant_admin`.' parameters: - $ref: '#/components/parameters/NumberPoolIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '204': description: Deleted '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' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeNumberPoolNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNumberPoolInUse' '500': $ref: '#/components/responses/InternalError' /v1/a/communication: get: tags: - Communication operationId: ListCommunications x-athena-permission: communication:read x-athena-include-permissions: agent: agent:read scenario: scenario:read communication_result: communication:read contact: contact:read automation: agent:automation:read automation_attempt: agent:automation:read summary: List communications description: 'Lists the calls, newest first. Rules: - This resource takes no sort parameters. - Rows carry everything the single read does. - `include` resolves a row''s agent, scenario, result deliveries, contact, automation and run into `included`. - A call placed by hand resolves no automation and no run.' parameters: - $ref: '#/components/parameters/CommunicationLimit' - $ref: '#/components/parameters/CommunicationOffset' - $ref: '#/components/parameters/CommunicationShowDeleted' - $ref: '#/components/parameters/CommunicationFilterOr' - $ref: '#/components/parameters/CommunicationFilterQuery' - $ref: '#/components/parameters/CommunicationDraft' - $ref: '#/components/parameters/CommunicationVersion' - $ref: '#/components/parameters/CommunicationDraftVersion' - $ref: '#/components/parameters/CommunicationScenarioSid' - $ref: '#/components/parameters/CommunicationAgentSid' - $ref: '#/components/parameters/CommunicationRecipientQuery' - $ref: '#/components/parameters/CommunicationDirectionQuery' - $ref: '#/components/parameters/CommunicationCallSidQuery' - $ref: '#/components/parameters/CommunicationStatusQuery' - $ref: '#/components/parameters/CommunicationCallStatusQuery' - $ref: '#/components/parameters/CommunicationAutomationSid' - $ref: '#/components/parameters/CommunicationIsTest' - $ref: '#/components/parameters/CommunicationCreatedFrom' - $ref: '#/components/parameters/CommunicationCreatedTo' - $ref: '#/components/parameters/CommunicationDurationMin' - $ref: '#/components/parameters/CommunicationDurationMax' - $ref: '#/components/parameters/CommunicationInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CommunicationList' '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/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/communication/-/dispatch: post: tags: - Communication operationId: DispatchCommunication x-athena-permission: communication:write summary: Create communication (agent call or scenario test) description: 'Records the call and answers with the row in status `new`; the platform places it afterwards, so the outcome is read back from the row. Rules: - Exactly one of `agent_sid` and `scenario_sid` is given. - The recipient, in its stored form, is matched to the `number` of a contact of the account. - The answer names the contact in `contact_sid`. Effects: - When the account holds no such contact, one is created. - The contact stays when the call is deleted or never placed. Refused when: - A contact has to be created and the account already holds as many contacts as its limit allows. - A value of `contact.data` has another type than its field holds across the account''s contacts. - The contact''s data, with `contact.data` merged in, would be past a data limit of the account, data stored before the limit was lowered included. - A test call finds no free account number and its scenario has no agent that is not archived.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/DispatchCommunicationRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Communication' '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/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeCommunicationInvalid' - $ref: '#/components/schemas/ErrorCodeContactDataLimit' - $ref: '#/components/schemas/ErrorCodeContactLimitReached' '500': $ref: '#/components/responses/InternalError' /v1/a/communication/{id}: get: tags: - Communication operationId: GetCommunication x-athena-permission: communication:read x-athena-include-permissions: agent: agent:read scenario: scenario:read communication_result: communication:read contact: contact:read automation: agent:automation:read automation_attempt: agent:automation:read summary: Get communication description: 'Returns one call of the caller''s account; a deleted one reads as absent. Rules: - The recording and the saved call history are not in the row: `has_recording` and `has_call_history` say whether their sub-resources will serve anything. - `include` resolves the agent, scenario, result deliveries, contact, automation and run into `included`, the same maps the list answers with.' parameters: - $ref: '#/components/parameters/CommunicationIdPath' - $ref: '#/components/parameters/CommunicationInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CommunicationRead' '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/ErrorCodeCommunicationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' delete: tags: - Communication operationId: DeleteCommunication x-athena-permission: communication:manage summary: Delete communication description: 'Removes the communication from every list and read, except the communication list with `show_deleted=true`, and from the figures of the automation that placed it. The record is kept until its retention period ends, so an outcome that arrives afterwards still lands on it; a second delete finds nothing. `hard=true` erases the record instead, and takes no exceptions: it is what a caller reaches for once the ordinary delete has refused, since a call recorded as running when it is merely stuck otherwise leaves the record, and the account holding it, undeletable. The data of the communication is erased with the record; a part that could not be erased at that moment stays. An outcome arriving afterwards has nowhere to land.' parameters: - $ref: '#/components/parameters/CommunicationIdPath' - $ref: '#/components/parameters/XAccountSidHeader' - name: hard in: query required: false schema: type: boolean default: false description: Erases the record rather than marking it deleted. responses: '204': description: Deleted '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/ErrorCodeCommunicationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeCommunicationActive' '500': $ref: '#/components/responses/InternalError' /v1/a/communication/{id}/history: get: tags: - Communication operationId: GetCommunicationHistory x-athena-permission: communication:read summary: Get call history (proxied or presigned link) description: 'Serves the saved call history of the call. By mode: - `mode=proxy`: is the default and streams the JSON itself. - `mode=url`: answers with a time-bounded presigned link instead. A call with no stored history has nothing to serve.' parameters: - $ref: '#/components/parameters/CommunicationIdPath' - $ref: '#/components/parameters/CommunicationHistoryMode' - $ref: '#/components/parameters/CommunicationHistoryExpire' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: 'Returns what the mode asks for. By mode: - `url`: returns a presigned link. - `proxy`: returns the raw call-history JSON.' 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/ErrorCodeCommunicationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/communication/{id}/events: get: tags: - Communication operationId: StreamCommunicationEvents x-athena-permission: communication:read summary: Stream the call history events of a call (WebSocket) description: 'Opens a WebSocket that carries the call history events of the call, one event in each text frame. Rules: - While the call runs, a client first receives the events the call already produced, up to the first 1000, and then each new event as it happens. - The stream of a running call can leave an event out; a gap in `seq` shows it. - After the call, every stored event of the call is sent in `seq` order. - A call that has not started to dial has nothing to stream. - A finished call with no stored events has nothing to stream either: one that produced none, or one whose events are still being stored after its end. The connection: - It closes with the normal close code when the events end, and with an error close code when the stream breaks. - A connection that ends without the normal close code was lost. - A new connection sends the events from the first one again, and `seq` identifies the events a client already holds.' parameters: - $ref: '#/components/parameters/CommunicationIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '101': description: The connection is a WebSocket now; each text frame is one call history event. content: application/json: schema: $ref: '#/components/schemas/CallHistoryEvent' '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/ErrorCodeCommunicationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/communication/{id}/recording: get: tags: - Communication operationId: GetCommunicationRecording x-athena-permission: communication:read summary: Get call recording (proxied or presigned link) description: 'Serves the call''s recording. By mode: - `mode=proxy`: is the default and streams the audio itself. - `mode=url`: answers with a time-bounded presigned link instead. A call with no recording has nothing to serve.' parameters: - $ref: '#/components/parameters/CommunicationIdPath' - $ref: '#/components/parameters/CommunicationHistoryMode' - $ref: '#/components/parameters/CommunicationHistoryExpire' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: 'Returns what the mode asks for. By mode: - `url`: returns a presigned link. - `proxy`: returns the raw recording audio.' 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/ErrorCodeCommunicationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/communication/{id}/speech-recording: get: tags: - Communication operationId: GetCommunicationSpeechRecording x-athena-permission: communication:read summary: Get speech recording (proxied or presigned link) description: 'Serves one recognition recording of the call, located by the `path` a saved-history entry carries. By mode: - `mode=proxy`: is the default and streams the audio itself. - `mode=url`: answers with a time-bounded presigned link instead.' parameters: - $ref: '#/components/parameters/CommunicationIdPath' - $ref: '#/components/parameters/CommunicationSpeechRecordingPath' - $ref: '#/components/parameters/CommunicationHistoryMode' - $ref: '#/components/parameters/CommunicationHistoryExpire' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: 'Returns what the mode asks for. By mode: - `url`: returns a presigned link. - `proxy`: returns the raw recording audio.' 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/ErrorCodeCommunicationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/analytics/call: get: tags: - Analytics operationId: GetCallAnalytics x-athena-permission: analytics:read summary: Count calls description: 'Counts the account''s calls over one period, cut into buckets in the account''s time zone. By period: - `today`: has one bucket per hour from midnight. - `30d`: has one bucket per day over today and the 29 days before it. - `12m`: has one bucket per month over the current month and the 11 before it. Rules: - The buckets end with the one that holds the current time. - A bucket with no calls carries zeros. - A call whose communication was erased is not counted. - Test calls are left out unless `is_test=true`. - `group_by=agent`: fills `by_agent` in every bucket and returns those agents in `included.agents`; a call with no agent counts in its bucket and in `totals` only. - `group_by=routing`: fills `by_routing` in every bucket and returns those routings in `included.routings`; a call no routing chose counts in its bucket and in `totals` only. - `agent_sid`: counts one agent''s calls. Refused when `agent_sid` names an agent outside the account; it is answered as not found.' parameters: - $ref: '#/components/parameters/CallAnalyticsPeriodQuery' - $ref: '#/components/parameters/CallAnalyticsGroupBy' - $ref: '#/components/parameters/CallAnalyticsAgentSid' - $ref: '#/components/parameters/CallAnalyticsIsTest' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CallAnalytics' '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/ErrorCodeAgentNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/analytics/lines: get: tags: - Analytics operationId: GetLineAnalytics x-athena-permission: analytics:read summary: Read lines in use description: 'Reads the account''s lines at this moment: the lines the account may use, the lines given to its agents, and the calls held now. Rules: - A call is held from the moment it is dialled or answered until it ends. - Answered and placed calls count together. - A test call is counted like any call. The figures: - Every agent of the account that is not archived is listed with its own figures. - `lines_assigned` is the sum over the agents. - `lines_in_use` counts every call the account holds, a call with no agent included, so it can be above the sum over the agents.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/LineAnalytics' '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' '500': $ref: '#/components/responses/InternalError' /v1/a/analytics/contacts: get: tags: - Analytics operationId: GetContactAnalytics x-athena-permission: analytics:read summary: Read the account's use of its contact limits description: 'Reads how much of its contact limits the account uses: its contacts against the contact limit, the data fields its contacts hold, and the bytes of all their data. Rules: - The contacts and the fields are counted at the moment of the read. - The bytes are summed every 15 minutes.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ContactAnalytics' '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' '500': $ref: '#/components/responses/InternalError' /v1/a/communication-result: get: tags: - CommunicationResult operationId: ListResultDeliveries x-athena-permission: communication:read x-athena-include-permissions: communication: communication:read summary: List result deliveries description: 'Lists the result deliveries, which appear on their own. Rules: - One delivery is filed per distinct target configured on the call''s agent. - A delivery is filed when the call reaches a terminal status. - This API creates none and deletes none. Rows carry the attempt count and the full attempt history, here as much as in the single read.' parameters: - $ref: '#/components/parameters/CommunicationResultLimit' - $ref: '#/components/parameters/CommunicationResultOffset' - $ref: '#/components/parameters/CommunicationResultStatusQuery' - $ref: '#/components/parameters/CommunicationResultCommunicationSidQuery' - $ref: '#/components/parameters/CommunicationResultInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CommunicationResultList' '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/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/communication-result/{id}: get: tags: - CommunicationResult operationId: GetCommunicationResult x-athena-permission: communication:read x-athena-include-permissions: communication: communication:read summary: Get result delivery description: The target receives the call's `result_payload`; `include=communication` resolves the call into `included`, the same map the list answers with. parameters: - $ref: '#/components/parameters/CommunicationResultIdPath' - $ref: '#/components/parameters/CommunicationResultInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CommunicationResultRead' '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/ErrorCodeCommunicationResultNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - CommunicationResult operationId: PatchCommunicationResult x-athena-permission: communication:write summary: Update result delivery description: Edits the target; status, attempts and history stay system-managed. parameters: - $ref: '#/components/parameters/CommunicationResultIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchCommunicationResultRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CommunicationResult' '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/ErrorCodeCommunicationResultNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeCommunicationResultTargetConflict' '500': $ref: '#/components/responses/InternalError' /v1/a/communication-result/{id}/resend: post: tags: - CommunicationResult operationId: ResendCommunicationResult x-athena-permission: communication:write summary: Resend result delivery description: 'Resets the delivery whatever its current status: its status goes back to new and its attempt counters are cleared. The history survives, and the next delivery run picks the delivery up.' parameters: - $ref: '#/components/parameters/CommunicationResultIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CommunicationResult' '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/ErrorCodeCommunicationResultNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/contact: get: tags: - Contact operationId: ListContacts x-athena-permission: contact:read x-athena-include-permissions: segment: segment:read segment_membership: segment:read source: segment:read summary: List contacts description: 'Lists the contacts; rows carry no `communication_history`, so read one contact for it. The `include` values: - `segment`: resolves the segments the page''s contacts are in into `included`. - `segment_membership`: resolves into `included`, per contact, when it joined each segment, which source put it there and when it left. - `source`: resolves the sources those memberships name into `included`, with their `kind` and `filename`.' parameters: - $ref: '#/components/parameters/ContactLimit' - $ref: '#/components/parameters/ContactOffset' - $ref: '#/components/parameters/ContactFilterOr' - $ref: '#/components/parameters/ContactFilterQuery' - $ref: '#/components/parameters/ContactQuery' - $ref: '#/components/parameters/ContactOrderBy' - $ref: '#/components/parameters/ContactOrder' - $ref: '#/components/parameters/ContactInclude' - $ref: '#/components/parameters/ContactSegmentIds' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ContactList' '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/ErrorCodeQueryInvalid' - $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' '500': $ref: '#/components/responses/InternalError' post: tags: - Contact operationId: CreateContact x-athena-permission: contact:write summary: Create contact description: 'Stores the contact with its number in the stored form. Rules: - `+371 23-11-22-33`, `0037123112233` and `37123112233` all store as `37123112233`. - `0501111222` with `country_code` `pl` stores as `48501111222`. - A number without an international mark and without a `country_code` is taken as international without the sign. - A person the account has is changed by id, never created again. Refused when: - The account holds as many contacts as its limit allows. - A `data` value has another type than its field holds across the account''s contacts.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateContactRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Contact' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeBadRequest' - $ref: '#/components/schemas/ErrorCodeCountryCodeInvalid' - $ref: '#/components/schemas/ErrorCodeIdentifierTypeInvalid' - $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' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeContactDataLimit' - $ref: '#/components/schemas/ErrorCodeContactInvalid' - $ref: '#/components/schemas/ErrorCodeContactLimitReached' - $ref: '#/components/schemas/ErrorCodeContactNumberTaken' '500': $ref: '#/components/responses/InternalError' /v1/a/contact/-/data: post: tags: - Contact operationId: ChangeContactDataField x-athena-permission: contact:write summary: Rename or remove a data field on every contact description: 'Renames or removes one data field on every contact of the account that holds it, in one step. Refused when: - A rename finds a contact that holds a field at the new path, under it or on the way to it. No contact changes, the refusal names one such field, and the rename goes through once no contact holds any of them. - A removal names a field that the condition of a routing reads, or a field above one it reads, and the agent of that routing is not archived. No contact changes, and the refusal names the routings. Effects: - A rename rewrites every routing condition of the account that reads the field. - Scenarios that read the old field are not changed.' parameters: - $ref: '#/components/parameters/ContactDataOp' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ContactDataFieldChange' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ContactDataFieldChangeResult' '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' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeContactFieldInUse' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeContactFieldConflict' data: $ref: '#/components/schemas/ContactFieldConflict' '500': $ref: '#/components/responses/InternalError' /v1/a/contact/-/query-language: get: tags: - Contact operationId: GetContactQueryLanguage x-athena-permission: contact:read summary: List the fields and operators a query can use description: 'Lists what `query` on `GET /v1/a/contact` and on the export can name: the contact''s own fields, every data field a contact of the account holds with the type it holds there, and the comparison operators. A data field leaves the list when no contact holds it any more.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ContactQueryLanguage' '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' '500': $ref: '#/components/responses/InternalError' /v1/a/contact/-/export: post: tags: - Contact operationId: ExportContacts x-athena-permission: contact:read summary: Export contacts description: 'Starts a job that writes every contact the selection matches to one csv file, and answers with the job in status `queued`. The selection is the list''s own: `segment_ids`, `filter_or` + `filter_query`, `query` and `order_by` + `order` apply exactly as on `GET /v1/a/contact`. The file: - It is UTF-8 csv (RFC 4180). - The number is always the first column; `fields` orders the rest. - `data` unpacks at its position into one column per top-level key. - The header is the union of keys across the set, ordered by name. - A scalar is written as it is, a nested value as its JSON text, a key that is missing or `null` as an empty cell. - A data key or a data cell that begins with `=`, `+`, `-`, `@`, a tab or a carriage return, or with apostrophes before one of them, is written with one more leading apostrophe, so a spreadsheet does not read it as a formula. - The apostrophe stays visible in the cell, and it is removed when the file is supplied to a segment''s source. Poll `GET /v1/a/contact/-/export/{id}` for the download link.' parameters: - $ref: '#/components/parameters/ContactExportFormat' - $ref: '#/components/parameters/ContactExportFields' - $ref: '#/components/parameters/ContactSegmentIds' - $ref: '#/components/parameters/ContactFilterOr' - $ref: '#/components/parameters/ContactFilterQuery' - $ref: '#/components/parameters/ContactQuery' - $ref: '#/components/parameters/ContactOrderBy' - $ref: '#/components/parameters/ContactOrder' - $ref: '#/components/parameters/ContactExportLimit' - $ref: '#/components/parameters/ContactExportOffset' - $ref: '#/components/parameters/ContactExportInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '202': description: Accepted content: application/json: schema: $ref: '#/components/schemas/ContactExport' '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/ErrorCodeQueryInvalid' - $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' '500': $ref: '#/components/responses/InternalError' /v1/a/contact/-/export/{id}: get: tags: - Contact operationId: GetContactExport x-athena-permission: contact:read summary: Get export job description: The job's current state. A job stays readable for 7 days after it finishes. parameters: - $ref: '#/components/parameters/ContactExportIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ContactExport' '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/ErrorCodeContactExportNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/contact/{id}: get: tags: - Contact operationId: GetContact x-athena-permission: contact:read x-athena-include-permissions: segment: segment:read segment_membership: segment:read source: segment:read summary: Get contact description: 'Returns the whole contact, its call log included. The `include` values: - `segment`: resolves the segments in its `segment_sids` into `included`. - `segment_membership`: resolves into `included` every segment it is or has been in, with when it joined, which source put it there and when it left. - `source`: resolves the sources those memberships name into `included`. These are the same maps the list answers with.' parameters: - $ref: '#/components/parameters/ContactIdPath' - $ref: '#/components/parameters/ContactInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ContactRead' '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/ErrorCodeContactNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - Contact operationId: PatchContact x-athena-permission: contact:write summary: Update contact description: 'Updates the contact: an omitted `number`, `type`, `country_code` or `data` preserves the current value. The fields: - `number`: a submitted one is brought to the stored form by `type` and `country_code`, as on create. - `data`: a submitted object replaces the stored one wholesale, and `{}` clears it. - `communication_history`: is not writable. Refused when: - The `revision` is not the contact''s current one. - A `data` value has another type than its field holds across the account''s contacts. - The contact''s data would be past a data limit of the account after the write, data stored before a limit was lowered included.' parameters: - $ref: '#/components/parameters/ContactIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchContactRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Contact' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeBadRequest' - $ref: '#/components/schemas/ErrorCodeCountryCodeInvalid' - $ref: '#/components/schemas/ErrorCodeIdentifierTypeInvalid' - $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/ErrorCodeContactNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeContactChanged' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeContactDataLimit' - $ref: '#/components/schemas/ErrorCodeContactInvalid' - $ref: '#/components/schemas/ErrorCodeContactNumberTaken' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '500': $ref: '#/components/responses/InternalError' delete: tags: - Contact operationId: DeleteContact x-athena-permission: contact:manage summary: Delete contact description: 'Soft-deletes the contact: it reads as absent afterwards, and a re-delete finds nothing. Refused while a live automation holds a segment the contact is in, the account''s default segment included; the conflict names the automations, and archiving them releases the contact.' parameters: - $ref: '#/components/parameters/ContactIdPath' - $ref: '#/components/parameters/XAccountSidHeader' 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/ErrorCodeContactNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeContactInUse' '500': $ref: '#/components/responses/InternalError' /v1/a/segment: get: tags: - Segment operationId: ListSegments x-athena-permission: segment:read x-athena-include-permissions: source: segment:read automation: agent:automation:read summary: List segments description: 'Lists the segments, the account''s default segment included; the first read that finds no default segment creates it. Segments a live automation holds are listed alongside the rest. The parameters: - `is_used=false`: narrows the list to the segments an automation can take; the flag is returned on every segment, so a caller narrows here or decides from the rows. - `show_deleted=true`: adds the deleted segments, each with its `deleted_at`. - `include=source`: resolves each row''s sources into `included`. - `include=automation`: resolves the automation that holds a row into `included`, under its `automation_sid`.' parameters: - $ref: '#/components/parameters/SegmentIsUsed' - $ref: '#/components/parameters/SegmentShowDeleted' - $ref: '#/components/parameters/SegmentLimit' - $ref: '#/components/parameters/SegmentOffset' - $ref: '#/components/parameters/SegmentFilterOr' - $ref: '#/components/parameters/SegmentFilterQuery' - $ref: '#/components/parameters/SegmentOrderBy' - $ref: '#/components/parameters/SegmentOrder' - $ref: '#/components/parameters/SegmentInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SegmentList' '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/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' post: tags: - Segment operationId: CreateSegment x-athena-permission: segment:write summary: Create segment description: Creates the segment, holding nobody and usable at once. Sources are added to it afterwards, and its contacts appear as each source is published. parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateSegmentRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Segment' '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/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentInvalid' - $ref: '#/components/schemas/ErrorCodeSegmentNameInUse' '500': $ref: '#/components/responses/InternalError' /v1/a/segment/{id}: get: tags: - Segment operationId: GetSegment x-athena-permission: segment:read x-athena-include-permissions: source: segment:read automation: agent:automation:read summary: Get segment description: 'Returns the segment row. The parameters: - `include=source`: resolves its sources into `included`. - `include=automation`: resolves the automation that holds it into `included`. Each is the same map the list answers with, capped the way every to-many include is. The members are read with `GET /v1/a/contact?segment_ids=…`.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SegmentRead' '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/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - Segment operationId: PatchSegment x-athena-permission: segment:write summary: Update segment description: Renames the segment. The default segment is not editable at all. parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchSegmentRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Segment' '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/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentDefaultReadOnly' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentInvalid' - $ref: '#/components/schemas/ErrorCodeSegmentNameInUse' '500': $ref: '#/components/responses/InternalError' delete: tags: - Segment operationId: DeleteSegment x-athena-permission: segment:manage summary: Delete segment description: The segment is soft-deleted; its sources, their rows and the contacts it drew in stay. Refused while a live automation holds it or the condition of a routing names it; archiving that automation, changing or deleting that routing, or archiving its agent releases the segment. parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/XAccountSidHeader' 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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentDefaultReadOnly' - $ref: '#/components/schemas/ErrorCodeSegmentInUse' '500': $ref: '#/components/responses/InternalError' /v1/a/segment/{id}/source: get: tags: - Source operationId: ListSegmentSources x-athena-permission: segment:read summary: List segment sources description: 'Lists the sources of this segment. Rules: - The list is newest first, removed sources included. - `status`: narrows the list to `draft`, `published` or `removed`. - The counts are the source''s rows by row status, computed as they are read.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SourceStatusQuery' - $ref: '#/components/parameters/SegmentLimit' - $ref: '#/components/parameters/SegmentOffset' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SourceList' '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/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' '500': $ref: '#/components/responses/InternalError' post: tags: - Source operationId: CreateSegmentSource x-athena-permission: segment:write summary: Create source description: 'Creates an empty source of the given kind. Rules: - A file source takes its rows afterwards, on /v1/a/segment/{id}/source/{source_id}/file. - Each supply states its own `type` and `country_code`; the source keeps neither. - `reset_reach`: marks the source as one whose publish puts the contacts it supplies back on the list of the automation that holds the segment. Refused when: - The segment is the account''s default segment, which takes no sources at all. - A publish of the segment''s sources runs.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateSourceRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Source' '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/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentDefaultReadOnly' - $ref: '#/components/schemas/ErrorCodeSegmentPublishRunning' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentInvalid' '500': $ref: '#/components/responses/InternalError' /v1/a/segment/{id}/source/-/publish: post: tags: - Source publishing operationId: PublishSegmentSources x-athena-permission: segment:write summary: Publish the segment's draft sources description: 'Publishes every draft source of the segment as one batch. Effects: - The usable rows of all draft sources are merged by number into one contact per number, its data taken from the rows that supplied it. - A number the account does not hold becomes a new contact. - A number the account holds gets the row''s data written over its own, leaf by leaf: a nested object changes only the leaves it names. - A data value of `null` removes that field from the contact the number already names, and adds nothing to a new contact. - Every contact becomes a member of the segment once, recorded against the earliest created source that supplied it. - Rejected rows are skipped and stay downloadable until the contact retention period has passed since they were supplied. - Every source in the batch becomes `published`, and its usable rows with it. When a source in the batch carries `reset_reach` and a live automation holds the segment: - Every contact that source supplies that the automation records as reached, attempted or stopped is put back to waiting, in the same transaction that publishes the sources. - `reset_reach_processed` counts them. - A contact on a running call, and a contact no such source supplies, stays where it is. Refused when: - Another publish of the segment''s sources runs. - A merged contact is conflicting. - A merged contact would break a data limit of the account once merged into its contact. - The batch would create more contacts than the account can still take. The last three refuse the whole batch, with nothing written, and `GET …/source/-/validate` shows each of them first. A contact whose data stops fitting while the publish runs stops it with the same refusal; the contacts written before it stay, and a retry continues from that contact. A retry is safe: what already became a contact or a member is not repeated.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SourcePublishResult' '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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentDefaultReadOnly' - $ref: '#/components/schemas/ErrorCodeSegmentPublishRunning' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSourceConflict' - $ref: '#/components/schemas/ErrorCodeSourceContactLimit' - $ref: '#/components/schemas/ErrorCodeSourceDataLimit' - $ref: '#/components/schemas/ErrorCodeSourceNothingToPublish' '500': $ref: '#/components/responses/InternalError' /v1/a/segment/{id}/source/-/validate: get: tags: - Source publishing operationId: ValidateSegmentSources x-athena-permission: segment:read summary: Preview what publishing the draft sources would do description: 'Answers what `POST …/source/-/publish` would do with the segment''s draft sources, and changes nothing. The response: - `batch`: counts the merged contacts: how many would be created, how many would update a contact the account holds, how many rows are rejected, how many merged contacts are conflicting, and how many would break a data limit of the account. - `sources`: gives the same five for each draft source over its own rows. - `items`: is the paged list of merged contacts, one per number, each with the rows that supplied it. - A conflicting item shows which rows disagree. - An item''s `over_limit` names the limit the merged contact would break. The filters: - `is_conflicting=true`: narrows `items` and `total` to the conflicting ones. - `is_over_limit=true`: narrows `items` and `total` to the ones past a limit. With these filters, a paged call lists what has to be corrected before publish. After a publish, the batch is empty and every count in `batch` and `sources` is zero.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentLimit' - $ref: '#/components/parameters/SegmentOffset' - $ref: '#/components/parameters/SegmentIsConflicting' - $ref: '#/components/parameters/SegmentIsOverLimit' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SourceValidation' '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/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/segment/{id}/source/{source_id}: get: tags: - Source operationId: GetSegmentSource x-athena-permission: segment:read summary: Get source description: One source of the segment, with its counts. parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Source' '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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - Source operationId: PatchSegmentSource x-athena-permission: segment:write summary: Update source configuration description: 'Takes `auto_update` and `reset_reach`. Rules: - `reset_reach` changes only while the source is a draft. - A file source''s content is not here: it is the `file` sub-resource, and each supply carries its own `type` and `country_code`. Refused while a publish of the segment''s sources runs.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchSourceRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Source' '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/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentDefaultReadOnly' - $ref: '#/components/schemas/ErrorCodeSegmentPublishRunning' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentInvalid' - $ref: '#/components/schemas/ErrorCodeSourcePublished' - $ref: '#/components/schemas/ErrorCodeSourceRemoved' '500': $ref: '#/components/responses/InternalError' delete: tags: - Source operationId: DeleteSegmentSource x-athena-permission: segment:write summary: Delete a draft source or remove a published one description: 'Deletes the source. For a draft source: - The source is deleted with its rows. - Afterwards it reads as absent. For a published source: - The source is marked `removed` and kept. - It stays in the segment''s list, and the members it produced stay. - Its rows stay readable until they are erased: a row whose number no contact holds is erased once the contact retention period has passed since the row was supplied. Refused while a publish of the segment''s sources runs.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/XAccountSidHeader' 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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentDefaultReadOnly' - $ref: '#/components/schemas/ErrorCodeSegmentPublishRunning' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSourceRemoved' '500': $ref: '#/components/responses/InternalError' /v1/a/segment/{id}/source/{source_id}/file: put: tags: - Source file operationId: ReplaceSegmentSourceFile x-athena-permission: segment:write summary: Create or replace rows from a file description: 'Replaces the source''s rows with the rows of a csv or xlsx file: everything the source held is discarded and the new rows take its place. The file: - It is csv or xlsx, declared by the `Content-Type` of the `file` part: `text/csv` or `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`. - Of an xlsx, the first sheet is read. - A csv is UTF-8, with or without a byte order mark. - A csv separates its values by commas or by semicolons: the semicolon is taken when the heading row holds more semicolons than commas outside quotes. - The bounds are 100 000 rows, 30 columns, 64 characters in a column''s key and a 128 MiB body. Rules: - The headings are normalised to snake_case keys of the contact''s data. - A dot in a heading separates the parts of a nested key, and each part is normalised: `Address.City` is the key `city` inside `address`. - Every row''s number is brought by the request''s `type` and `country_code` parts to the stored form. - Rows already in the international form ignore `country_code`, so one file may carry several countries. - `+371 23-11-22-33`, `0037123112233` and `37123112233` are one row, and the last line is kept. - Each data value is trimmed, a line break or a tab inside it becomes a space, and other control characters are removed. - A data value is stored as the type its field holds across the account''s contacts. - One apostrophe at the start of a number or of a data value is removed when `=`, `+`, `-`, `@`, a tab or a carriage return follows it, directly or after more apostrophes: a contact export and a rejected rows file write such a cell with that apostrophe. - A number that cannot be brought to the stored form makes the row a rejected row, carrying its reason. - A data value that does not read as the type its field holds makes the row a rejected row. - A data value longer than the account''s value limit in bytes makes the row a rejected row. Refused when: - The file''s type is unsupported; this is checked before the file is read. - A publish of the segment''s sources runs. The rows are drafts until the segment''s sources are published.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: multipart/form-data: schema: type: object required: - file properties: file: type: string format: binary description: Carries the rows, as csv or xlsx; the part's `Content-Type` declares which. type: $ref: '#/components/schemas/IdentifierType' country_code: $ref: '#/components/schemas/CountryCode' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SourceFile' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeBadRequest' - $ref: '#/components/schemas/ErrorCodeCountryCodeInvalid' - $ref: '#/components/schemas/ErrorCodeFileColumnNameTooLong' - $ref: '#/components/schemas/ErrorCodeFileColumnsClash' - $ref: '#/components/schemas/ErrorCodeFileEmpty' - $ref: '#/components/schemas/ErrorCodeFileEncodingUnsupported' - $ref: '#/components/schemas/ErrorCodeFileMalformed' - $ref: '#/components/schemas/ErrorCodeFileNoUsableRows' - $ref: '#/components/schemas/ErrorCodeFileNumberColumnMissing' - $ref: '#/components/schemas/ErrorCodeFileTooManyColumns' - $ref: '#/components/schemas/ErrorCodeFileTooManyRows' - $ref: '#/components/schemas/ErrorCodeFileTypeUnsupported' - $ref: '#/components/schemas/ErrorCodeIdentifierTypeInvalid' - $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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentPublishRunning' '413': description: Request body exceeds the 128 MiB upload limit content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePayloadTooLarge' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSourcePublished' - $ref: '#/components/schemas/ErrorCodeSourceRemoved' '500': $ref: '#/components/responses/InternalError' patch: tags: - Source file operationId: AppendSegmentSourceFile x-athena-permission: segment:write summary: Add rows from a file description: 'Adds the rows of a csv or xlsx file to the source and keeps the rows the source already carried through. The file: - It is csv or xlsx, declared by the `Content-Type` of the `file` part. - The parsing, the `type` and `country_code` parts, the bounds (100 000 rows, 30 columns, 64 characters in a column''s key, a 128 MiB body) and the refusals of an unusable file are those of a replace. Rules: - A number already there is not added twice, so supplying the same file again adds nothing. - What the previous file could not use is dropped: the rejected rows describe the last file supplied, not every attempt. - A rejected row of the file whose number the source already holds is not stored: `counts.rejected` counts it, and the rejected rows do not hold it. Refused when: - The file''s type is unsupported; this is checked before the file is read. - A publish of the segment''s sources runs. The rows are drafts until the segment''s sources are published.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: multipart/form-data: schema: type: object required: - file properties: file: type: string format: binary description: Carries the rows, as csv or xlsx; the part's `Content-Type` declares which. type: $ref: '#/components/schemas/IdentifierType' country_code: $ref: '#/components/schemas/CountryCode' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SourceFile' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeBadRequest' - $ref: '#/components/schemas/ErrorCodeCountryCodeInvalid' - $ref: '#/components/schemas/ErrorCodeFileColumnNameTooLong' - $ref: '#/components/schemas/ErrorCodeFileColumnsClash' - $ref: '#/components/schemas/ErrorCodeFileEmpty' - $ref: '#/components/schemas/ErrorCodeFileEncodingUnsupported' - $ref: '#/components/schemas/ErrorCodeFileMalformed' - $ref: '#/components/schemas/ErrorCodeFileNoUsableRows' - $ref: '#/components/schemas/ErrorCodeFileNumberColumnMissing' - $ref: '#/components/schemas/ErrorCodeFileTooManyColumns' - $ref: '#/components/schemas/ErrorCodeFileTooManyRows' - $ref: '#/components/schemas/ErrorCodeFileTypeUnsupported' - $ref: '#/components/schemas/ErrorCodeIdentifierTypeInvalid' - $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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentPublishRunning' '413': description: Request body exceeds the 128 MiB upload limit content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePayloadTooLarge' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSourcePublished' - $ref: '#/components/schemas/ErrorCodeSourceRemoved' '500': $ref: '#/components/responses/InternalError' /v1/a/segment/{id}/source/{source_id}/file/rejected: get: tags: - Source file operationId: GetSegmentSourceRejectedRows x-athena-permission: segment:read summary: Download rejected rows as a file description: 'Returns the unusable rows as a csv, each with its reason, so they can be corrected in the tool the file came from and supplied again. The columns: - `number`: holds the row''s number. - The data paths follow, in name order: a nested value has one column per leaf, named by its dotted path. - `line`: holds the line of the supplied file a rejected row was read from, and is empty when the row records none. - `error`: holds the row''s reason. - `row_index`: holds the place of a rejected row in `rows` of the supplied list, and is empty when the row records none. Rules: - The header row is always present; with nothing rejected it is the whole body. - A number, a data key or a data value that begins with `=`, `+`, `-`, `@`, a tab or a carriage return, or with apostrophes before one of them, is written with one more leading apostrophe, so a spreadsheet does not read it as a formula. - The apostrophe stays visible in the cell, and it is removed when the file is supplied again. - A value that is not text is written as text. - The `line`, `error` and `row_index` columns of a file supplied again are read as data columns and become keys of the contact''s data.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: text/csv: schema: type: string '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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/segment/{id}/source/{source_id}/data: post: tags: - Source operationId: ChangeSourceColumn x-athena-permission: segment:write summary: Rename or remove a column of a draft source description: 'Renames or removes one column on every row of a draft source, in one step. Rules: - The changed rows are checked again against the account''s value limit. - The changed rows are checked again against the type each field holds across the account''s contacts. - A row rejected for one of its values becomes usable once its values fit both. Refused when: - A rename targets a column that a row of the source already holds. - A publish of the segment''s sources runs.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/ContactDataOp' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/SourceColumnChange' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SourceColumnChangeResult' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeBadRequest' - $ref: '#/components/schemas/ErrorCodeFileColumnsClash' - $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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentPublishRunning' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSourcePublished' - $ref: '#/components/schemas/ErrorCodeSourceRemoved' '500': $ref: '#/components/responses/InternalError' /v1/a/segment/{id}/source/{source_id}/batch-contact: put: tags: - Source manual operationId: ReplaceSourceContacts x-athena-permission: segment:write summary: Create or replace rows in a batch description: 'Replaces the source''s rows with a list of rows: everything the source held is discarded and the new rows take its place. The list: - Each row carries a `number` and optionally `data`. - The bounds are 100 000 rows and a 128 MiB body. - A key of `data` is not empty and holds no dot: a nested field is sent as a nested object. - The bounds of a file''s columns apply to the paths of `data` across all rows: 30 columns with `number` counted as one, and 64 characters in a path. Rules: - Every row''s number is brought by the request''s `type` and `country_code` to the stored form, as on a file upload. - Two rows that come to the same stored form are one row, and the later row is kept. - The keys of `data` are kept as sent, without the normalising a file''s headings get. - A data value is stored as the type its field holds across the account''s contacts. - A number that cannot be brought to the stored form makes the row a rejected row. - A data value that does not read as the type its field holds makes the row a rejected row. - A data value longer than the account''s value limit in bytes makes the row a rejected row. Refused when: - A publish of the segment''s sources runs. The rows are drafts until the segment''s sources are published.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/SupplySourceContactsRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SourceRowsResult' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeBadRequest' - $ref: '#/components/schemas/ErrorCodeCountryCodeInvalid' - $ref: '#/components/schemas/ErrorCodeFileColumnNameTooLong' - $ref: '#/components/schemas/ErrorCodeFileEmpty' - $ref: '#/components/schemas/ErrorCodeFileNoUsableRows' - $ref: '#/components/schemas/ErrorCodeFileTooManyColumns' - $ref: '#/components/schemas/ErrorCodeFileTooManyRows' - $ref: '#/components/schemas/ErrorCodeIdentifierTypeInvalid' - $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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentPublishRunning' '413': description: Request body exceeds the 128 MiB upload limit content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePayloadTooLarge' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSourcePublished' - $ref: '#/components/schemas/ErrorCodeSourceRemoved' '500': $ref: '#/components/responses/InternalError' patch: tags: - Source manual operationId: AppendSourceContacts x-athena-permission: segment:write summary: Add rows in a batch description: 'Adds a list of rows to the source and keeps the rows the source already carried through. The list: - The list, its bounds and the reading of each row are those of a replace. Rules: - A number already there is not added twice, so supplying the same list again adds nothing. - What the previous upload could not use is dropped: the rejected rows describe the last upload, not every attempt. - A rejected row whose number the source already holds is not stored: `counts.rejected` counts it, and the rejected rows do not hold it. Refused when: - A publish of the segment''s sources runs. The rows are drafts until the segment''s sources are published.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/SupplySourceContactsRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SourceRowsResult' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeBadRequest' - $ref: '#/components/schemas/ErrorCodeCountryCodeInvalid' - $ref: '#/components/schemas/ErrorCodeFileColumnNameTooLong' - $ref: '#/components/schemas/ErrorCodeFileEmpty' - $ref: '#/components/schemas/ErrorCodeFileNoUsableRows' - $ref: '#/components/schemas/ErrorCodeFileTooManyColumns' - $ref: '#/components/schemas/ErrorCodeFileTooManyRows' - $ref: '#/components/schemas/ErrorCodeIdentifierTypeInvalid' - $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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentPublishRunning' '413': description: Request body exceeds the 128 MiB upload limit content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePayloadTooLarge' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSourcePublished' - $ref: '#/components/schemas/ErrorCodeSourceRemoved' '500': $ref: '#/components/responses/InternalError' /v1/a/segment/{id}/source/{source_id}/contact: get: tags: - Source manual operationId: ListSourceContacts x-athena-permission: segment:read summary: List rows description: 'Every row the source holds, oldest first: rejected rows and rows already carried through into contacts alike. No filter narrows it to the rejected ones; download those as a csv instead.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/SegmentLimit' - $ref: '#/components/parameters/SegmentOffset' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SourceContactList' '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/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' '500': $ref: '#/components/responses/InternalError' post: tags: - Source manual operationId: CreateSourceContact x-athena-permission: segment:write summary: Add one row description: 'Adds a row to the source: the number that names the contact, and the data the contact should hold. Rules: - The row is read as on an upload, with one difference: a leading apostrophe in a value is kept. - A number that cannot be brought to the stored form by `type` and `country_code` makes the row a rejected row. - A data value longer than the account''s value limit in bytes makes the row a rejected row. - A data value that does not read as the type its field holds across the account''s contacts makes the row a rejected row. - A rejected row is stored with the reason in `error`. Refused when: - The source already holds the number. - A publish of the segment''s sources runs. The row stays a draft until the segment''s sources are published.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateSourceContactRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/SourceContact' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeBadRequest' - $ref: '#/components/schemas/ErrorCodeCountryCodeInvalid' - $ref: '#/components/schemas/ErrorCodeIdentifierTypeInvalid' - $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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentPublishRunning' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSourcePublished' - $ref: '#/components/schemas/ErrorCodeSourceRemoved' - $ref: '#/components/schemas/ErrorCodeSourceRowDuplicate' '500': $ref: '#/components/responses/InternalError' /v1/a/segment/{id}/source/{source_id}/contact/{row_id}: get: tags: - Source manual operationId: GetSourceContact x-athena-permission: segment:read summary: Get one row description: '`processed_at` says whether it has been carried through into a contact; whether it can still be corrected or removed depends on the source''s `status`, and on no publish of the segment''s sources running.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/SourceContactIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SourceContact' '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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' - $ref: '#/components/schemas/ErrorCodeSourceRowNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - Source manual operationId: PatchSourceContact x-athena-permission: segment:write summary: Correct one row description: 'Fixes a rejected number in place, rather than re-supplying the whole file. Rules: - The request''s `type` and `country_code` apply to the `number` it carries. - The top-level text values of `data` are trimmed and their control characters treated as on an upload. - A leading apostrophe is kept. - A row holding a top-level text value of `data` longer than the account''s value limit in bytes is a rejected row. - A row holding a data value that does not read as the type its field holds across the account''s contacts is a rejected row. - A rejected row becomes usable again when a correction leaves neither. Refused while a publish of the segment''s sources runs.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/SourceContactIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchSourceContactRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SourceContact' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeBadRequest' - $ref: '#/components/schemas/ErrorCodeCountryCodeInvalid' - $ref: '#/components/schemas/ErrorCodeIdentifierTypeInvalid' - $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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' - $ref: '#/components/schemas/ErrorCodeSourceRowNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentPublishRunning' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSourcePublished' - $ref: '#/components/schemas/ErrorCodeSourceRemoved' - $ref: '#/components/schemas/ErrorCodeSourceRowDuplicate' '500': $ref: '#/components/responses/InternalError' delete: tags: - Source manual operationId: DeleteSourceContact x-athena-permission: segment:write summary: Remove one row description: 'Removes a draft row. Refused when: - The row is published: published rows are members, and membership is not ended from here. - A publish of the segment''s sources runs.' parameters: - $ref: '#/components/parameters/SegmentIdPath' - $ref: '#/components/parameters/SegmentSourceIdPath' - $ref: '#/components/parameters/SourceContactIdPath' - $ref: '#/components/parameters/XAccountSidHeader' 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' - $ref: '#/components/schemas/ErrorCodeSegmentNotFound' - $ref: '#/components/schemas/ErrorCodeSourceNotFound' - $ref: '#/components/schemas/ErrorCodeSourceRowNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSegmentPublishRunning' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSourcePublished' - $ref: '#/components/schemas/ErrorCodeSourceRemoved' '500': $ref: '#/components/responses/InternalError' /v1/a/automation: get: tags: - Automation operationId: ListAutomations x-athena-permission: agent:automation:read x-athena-include-permissions: agent: agent:read segment: segment:read limit_policy: agent:read summary: List automations description: 'Lists the automations of the caller''s account, newest first, the archived ones left out. The parameters: - `agent_sid`: narrows the list to one agent. - `status`: narrows the list to one or more statuses; `archived` comes back only when `status` names it. - `include`: resolves a row''s agent, segment and limit policy into `included`.' parameters: - $ref: '#/components/parameters/AutomationLimit' - $ref: '#/components/parameters/AutomationOffset' - $ref: '#/components/parameters/AutomationAgentQuery' - $ref: '#/components/parameters/AutomationStatusQuery' - $ref: '#/components/parameters/AutomationFilterOr' - $ref: '#/components/parameters/AutomationFilterQuery' - $ref: '#/components/parameters/AutomationInclude' - $ref: '#/components/parameters/AutomationOrderBy' - $ref: '#/components/parameters/AutomationOrder' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AutomationList' '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/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' post: tags: - Automation operationId: CreateAutomation x-athena-permission: agent:automation:write summary: Create automation description: 'Binds a segment to an agent; the automation starts `new` and places no call until it is started. Refused when the agent''s scenario has no published version.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateAutomationRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Automation' '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' - $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/ErrorCodeAutomationNameInUse' - $ref: '#/components/schemas/ErrorCodeAutomationScenarioUnpublished' - $ref: '#/components/schemas/ErrorCodeAutomationSegmentClaimed' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '500': $ref: '#/components/responses/InternalError' /v1/a/automation/{id}: get: tags: - Automation operationId: GetAutomation x-athena-permission: agent:automation:read x-athena-include-permissions: agent: agent:read segment: segment:read limit_policy: agent:read summary: Get automation description: '`include` resolves the agent, segment and limit policy into `included`, the same maps the list answers with.' parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/AutomationInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AutomationRead' '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/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - Automation operationId: PatchAutomation x-athena-permission: agent:automation:write summary: Update automation description: 'Updates the automation partially. Rules: - The agent, the segment and the mode change until an attempt of the automation opens; after that only the current value is accepted. - The name and the limit policy are checked against the agent the automation has after the update. Refused when: - The automation is archived: every change is refused. - The request changes the mode while an attempt waits to open. - The agent belongs to another account, or is archived. - The segment belongs to another account, or another live automation holds it. - Another live automation of the agent the automation has after the update holds the name. - The policy belongs to an agent other than the one the automation has after the update, the current policy included when the agent changes. - The request moves the automation to an agent whose scenario has no published version.' parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchAutomationRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Automation' '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' - $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/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAutomationArchived' - $ref: '#/components/schemas/ErrorCodeAutomationAttemptOpened' - $ref: '#/components/schemas/ErrorCodeAutomationAttemptsWaiting' - $ref: '#/components/schemas/ErrorCodeAutomationNameInUse' - $ref: '#/components/schemas/ErrorCodeAutomationScenarioUnpublished' - $ref: '#/components/schemas/ErrorCodeAutomationSegmentClaimed' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '500': $ref: '#/components/responses/InternalError' delete: tags: - Automation operationId: DeleteAutomation x-athena-permission: agent:automation:manage summary: Delete automation description: 'Deletes the automation. Effects: - A run in progress is stopped first. - The segment and the name it held are freed. - Its calls and their communication results are deleted with it and leave every list and read, except the communication list with `show_deleted=true`. - A call being dialled or in progress is not deleted and stays listed after it ends.' parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/XAccountSidHeader' 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/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/automation/{id}/attempt: post: tags: - Automation operationId: AddAutomationAttempt x-athena-permission: agent:automation:write summary: Add a scheduled attempt description: 'Appends an attempt to a scheduled automation, to open at the moment given. Rules: - Attempts do not overlap. - An attempt before this one that had no end now ends where this one starts. - Removing this one gives that attempt its open end back.' parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateAutomationAttemptRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/AutomationAttempt' '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/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAutomationArchived' - $ref: '#/components/schemas/ErrorCodeAutomationAttemptEndsBeforeStart' - $ref: '#/components/schemas/ErrorCodeAutomationAttemptOverlaps' - $ref: '#/components/schemas/ErrorCodeAutomationAttemptPast' - $ref: '#/components/schemas/ErrorCodeAutomationModeManual' '500': $ref: '#/components/responses/InternalError' get: tags: - Automation operationId: ListAutomationAttempts x-athena-permission: agent:automation:read x-athena-include-permissions: automation: agent:automation:read summary: List automation runs description: Lists the runs of this automation by `starts_at`, earliest first; runs with no `starts_at` come last. Runs that start at the same moment keep a stable order between pages. `include=automation` resolves the automation the runs belong to into `included`. parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/AutomationLimit' - $ref: '#/components/parameters/AutomationOffset' - $ref: '#/components/parameters/AutomationAttemptInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AutomationAttemptList' '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/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/automation/{id}/attempt/{attempt_id}: get: tags: - Automation operationId: GetAutomationAttempt x-athena-permission: agent:automation:read x-athena-include-permissions: automation: agent:automation:read summary: Get automation run description: One run of the automation. `include=automation` resolves the automation into `included`, the same map the list answers with. parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/AutomationAttemptIdPath' - $ref: '#/components/parameters/AutomationAttemptInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AutomationAttemptRead' '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/ErrorCodeAutomationAttemptNotFound' - $ref: '#/components/schemas/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - Automation operationId: UpdateAutomationAttempt x-athena-permission: agent:automation:write summary: Move a scheduled attempt description: 'Moves the window of an attempt that has not opened. Rules: - The move changes that attempt alone. - The windows around it are left as they are. - The schedule that results has to hold. Refused on an archived automation.' parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/AutomationAttemptIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateAutomationAttemptRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AutomationAttempt' '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/ErrorCodeAutomationAttemptNotFound' - $ref: '#/components/schemas/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAutomationArchived' - $ref: '#/components/schemas/ErrorCodeAutomationAttemptEndMissing' - $ref: '#/components/schemas/ErrorCodeAutomationAttemptEndsBeforeStart' - $ref: '#/components/schemas/ErrorCodeAutomationAttemptOverlaps' - $ref: '#/components/schemas/ErrorCodeAutomationAttemptPast' '500': $ref: '#/components/responses/InternalError' delete: tags: - Automation operationId: RemoveAutomationAttempt x-athena-permission: agent:automation:write summary: Remove a scheduled attempt description: Drops an attempt that has not opened yet. Refused on an archived automation. parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/AutomationAttemptIdPath' - $ref: '#/components/parameters/XAccountSidHeader' 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/ErrorCodeAutomationAttemptNotFound' - $ref: '#/components/schemas/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAutomationArchived' - $ref: '#/components/schemas/ErrorCodeAutomationAttemptPast' '500': $ref: '#/components/responses/InternalError' /v1/a/automation/{id}/progress: get: tags: - Automation operationId: GetAutomationProgress x-athena-permission: agent:automation:read summary: Read an automation's progress description: 'Reads how far the outreach has progressed over the contacts it has taken. Rules: - Each contact falls in exactly one figure, so the total is the number of contacts the automation has taken across its runs. - Before the first run takes anyone, and while the automation is not archived, the total and the waiting figure are the live members of the segment, and the other figures are zero. - A contact put back on the list through `POST /v1/a/automation/{id}/reset-reach` reads as waiting at once.' parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AutomationProgress' '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/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/automation/{id}/attempt/{attempt_id}/progress: get: tags: - Automation operationId: GetAutomationAttemptProgress x-athena-permission: agent:automation:read summary: Read one run's progress description: 'Reads what this run did over the contacts it took when it opened. Rules: - The total is that audience: the contacts the run took when it opened. - The figures do not change when contacts are put back on the list afterwards.' parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/AutomationAttemptIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AutomationProgress' '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/ErrorCodeAutomationAttemptNotFound' - $ref: '#/components/schemas/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' /v1/a/automation/{id}/reset-reach: post: tags: - Automation operationId: ResetAutomationReach x-athena-permission: agent:automation:write summary: Put contacts back on the list description: 'Moves every contact the automation has reached, called without reaching, or stopped back to waiting, and answers how many were moved. Rules: - A contact whose call is running is not moved. - A run''s own figures do not change.' parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AutomationReachReset' '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/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAutomationArchived' '500': $ref: '#/components/responses/InternalError' /v1/a/automation/{id}/contact/{contact_id}/reset-reach: post: tags: - Automation operationId: ResetAutomationContactReach x-athena-permission: agent:automation:write summary: Put one contact back on the list description: 'Moves one contact the automation has reached, called without reaching, or stopped back to waiting. Rules: - When the contact is moved, the answer is `1`. - A contact whose call is running is not moved, and the answer is `0`. - A contact who is already waiting is not moved, and the answer is `0`.' parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/AutomationContactIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AutomationReachReset' '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/ErrorCodeAutomationContactNotFound' - $ref: '#/components/schemas/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAutomationArchived' '500': $ref: '#/components/responses/InternalError' /v1/a/automation/{id}/start: post: tags: - Automation operationId: StartAutomation x-athena-permission: agent:automation:write summary: Start automation description: 'Switches the automation on. By mode: - `manual`: adds one attempt starting now, and the automation reads `idle` until that attempt opens. - `scheduled`: clears the stop; the attempt that is due opens on its own, and the ones whose moment went by are marked `skipped`.' parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Automation' '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/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAutomationArchived' - $ref: '#/components/schemas/ErrorCodeAutomationRunUnderWay' - $ref: '#/components/schemas/ErrorCodeAutomationScenarioUnpublished' '500': $ref: '#/components/responses/InternalError' /v1/a/automation/{id}/stop: post: tags: - Automation operationId: StopAutomation x-athena-permission: agent:automation:write summary: Stop automation description: 'Switches the automation off and ends the run in progress. Effects: - The calls it asked for and never placed read `stopped`, and the contacts they were for are still to reach. - A call already dialling or in conversation finishes. Nothing starts again until a person starts it.' parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Automation' '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/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAutomationArchived' '500': $ref: '#/components/responses/InternalError' /v1/a/automation/{id}/archive: post: tags: - Automation operationId: ArchiveAutomation x-athena-permission: agent:automation:write summary: Archive automation description: 'Archives the automation permanently and frees its segment and its name for the next one. The attempts still waiting are marked as never run. Only an automation that is `new`, `stopped` or `done` is accepted. After the archive, the automation never runs again, and every later change is refused.' parameters: - $ref: '#/components/parameters/AutomationIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Automation' '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/ErrorCodeAutomationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAutomationArchived' - $ref: '#/components/schemas/ErrorCodeAutomationRunUnderWay' '500': $ref: '#/components/responses/InternalError' /v1/a/limit-policy: get: tags: - Limit policy operationId: ListLimitPolicies x-athena-permission: agent:read x-athena-include-permissions: agent: agent:read summary: List limit policies description: 'Lists every live policy of the caller''s account, newest first. The parameters: - `agent_sid`: narrows the list to one agent. - `include=agent`: resolves each row''s agent into `included`.' parameters: - $ref: '#/components/parameters/LimitPolicyLimit' - $ref: '#/components/parameters/LimitPolicyOffset' - $ref: '#/components/parameters/LimitPolicyAgentQuery' - $ref: '#/components/parameters/LimitPolicyFilterOr' - $ref: '#/components/parameters/LimitPolicyFilterQuery' - $ref: '#/components/parameters/LimitPolicyOrderBy' - $ref: '#/components/parameters/LimitPolicyOrder' - $ref: '#/components/parameters/LimitPolicyInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/LimitPolicyList' '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/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' post: tags: - Limit policy operationId: CreateLimitPolicy x-athena-permission: agent:write summary: Create limit policy description: Reserves part of one agent's capacity. parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateLimitPolicyRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/LimitPolicy' '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' - $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/ErrorCodeLimitPolicyNameInUse' - $ref: '#/components/schemas/ErrorCodeLimitPolicyOverAgent' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '500': $ref: '#/components/responses/InternalError' /v1/a/limit-policy/{id}: get: tags: - Limit policy operationId: GetLimitPolicy x-athena-permission: agent:read x-athena-include-permissions: agent: agent:read summary: Get limit policy description: '`include=agent` resolves the agent into `included`, the same map the list answers with.' parameters: - $ref: '#/components/parameters/LimitPolicyIdPath' - $ref: '#/components/parameters/LimitPolicyInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/LimitPolicyRead' '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/ErrorCodeLimitPolicyNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - Limit policy operationId: PatchLimitPolicy x-athena-permission: agent:write summary: Update limit policy description: Partial update. Refused while the policy's agent is archived. parameters: - $ref: '#/components/parameters/LimitPolicyIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchLimitPolicyRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/LimitPolicy' '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' - $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/ErrorCodeLimitPolicyNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeLimitPolicyNameInUse' - $ref: '#/components/schemas/ErrorCodeLimitPolicyOverAgent' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '500': $ref: '#/components/responses/InternalError' delete: tags: - Limit policy operationId: DeleteLimitPolicy x-athena-permission: agent:manage summary: Delete limit policy description: The capacity it reserved returns to what everything else on the agent draws on. Refused while a live automation names it; archiving that automation, or pointing it at another policy, releases this one. parameters: - $ref: '#/components/parameters/LimitPolicyIdPath' - $ref: '#/components/parameters/XAccountSidHeader' 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/ErrorCodeLimitPolicyNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeLimitPolicyInUse' '500': $ref: '#/components/responses/InternalError' /v1/a/agent: get: tags: - Agent operationId: ListAgents x-athena-permission: agent:read x-athena-include-permissions: scenario: scenario:read number: number:read number_pool: number:pool:read automation: agent:automation:read sms_provider: integration:sms:read summary: List agents description: 'Lists the agents of the account. The parameters: - `status`: the archived agents come back only when `status` names them. - `include`: resolves a row''s scenario, its number or its pool, its automations that are not archived and its SMS provider into `included`, each asked for by name.' parameters: - $ref: '#/components/parameters/AgentLimit' - $ref: '#/components/parameters/AgentOffset' - $ref: '#/components/parameters/AgentStatusQuery' - $ref: '#/components/parameters/AgentScenarioSidQuery' - $ref: '#/components/parameters/AgentNumberSidQuery' - $ref: '#/components/parameters/AgentNumberPoolSidQuery' - $ref: '#/components/parameters/AgentSmsProviderSidQuery' - $ref: '#/components/parameters/AgentFilterOr' - $ref: '#/components/parameters/AgentFilterQuery' - $ref: '#/components/parameters/AgentOrderBy' - $ref: '#/components/parameters/AgentOrder' - $ref: '#/components/parameters/AgentInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AgentList' '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/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' post: tags: - Agent operationId: CreateAgent x-athena-permission: agent:write summary: Create agent description: 'Binds the scenario to a gateway. Rules: - `status`: defaults to active. - A number carries at most one agent. - A number in a pool is not given to an agent; the agent takes the pool. - A pool is shared by as many agents as use it. - An active agent needs an active number, or an active pool with an active number. An agent with no SMS settings is refused while the published version of its scenario has an SMS brick.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateAgentRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Agent' '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' - $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' - $ref: '#/components/schemas/ErrorCodeSmsProviderNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAgentCallingScheduleInvalid' - $ref: '#/components/schemas/ErrorCodeAgentGatewayInactive' - $ref: '#/components/schemas/ErrorCodeAgentInvalid' - $ref: '#/components/schemas/ErrorCodeAgentLinesExceeded' - $ref: '#/components/schemas/ErrorCodeAgentLinesUnderPolicies' - $ref: '#/components/schemas/ErrorCodeAgentNameInUse' - $ref: '#/components/schemas/ErrorCodeAgentNumberInPool' - $ref: '#/components/schemas/ErrorCodeAgentNumberInUse' - $ref: '#/components/schemas/ErrorCodeAgentTimezoneInvalid' - $ref: '#/components/schemas/ErrorCodeAgentTimezoneRequired' - $ref: '#/components/schemas/ErrorCodeScenarioSmsSenderRequired' - $ref: '#/components/schemas/ErrorCodeSmsProviderInvalid' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '500': $ref: '#/components/responses/InternalError' /v1/a/agent/{id}: get: tags: - Agent operationId: GetAgent x-athena-permission: agent:read x-athena-include-permissions: scenario: scenario:read number: number:read number_pool: number:pool:read automation: agent:automation:read sms_provider: integration:sms:read summary: Get agent description: Finds an archived agent as well. `include` resolves the scenario, number, number pool, automations in every status and SMS provider into `included`. parameters: - $ref: '#/components/parameters/AgentIdPath' - $ref: '#/components/parameters/AgentInclude' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/AgentRead' '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/ErrorCodeAgentNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - Agent operationId: PatchAgent x-athena-permission: agent:write summary: Update agent description: 'Partial update; the same rules as on create apply to the result, except the gateway check. Rules: - A new `gateway_type` with its number or pool replaces the previous gateway. - Switching the agent on, or moving an active agent to another gateway, checks the gateway; other changes do not. Refused when: - The agent is archived. - The agent has automations that are not archived, and the change activates the agent or gives an active agent a new scenario, while that scenario has no published version.' parameters: - $ref: '#/components/parameters/AgentIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchAgentRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Agent' '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' - $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/ErrorCodeAgentNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeSmsProviderNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAgentConcurrentUpdate' - $ref: '#/components/schemas/ErrorCodeAutomationRequiresPublishedScenario' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAgentArchived' - $ref: '#/components/schemas/ErrorCodeAgentCallingScheduleInvalid' - $ref: '#/components/schemas/ErrorCodeAgentGatewayInactive' - $ref: '#/components/schemas/ErrorCodeAgentInvalid' - $ref: '#/components/schemas/ErrorCodeAgentLinesExceeded' - $ref: '#/components/schemas/ErrorCodeAgentLinesUnderPolicies' - $ref: '#/components/schemas/ErrorCodeAgentNameInUse' - $ref: '#/components/schemas/ErrorCodeAgentNumberInPool' - $ref: '#/components/schemas/ErrorCodeAgentNumberInUse' - $ref: '#/components/schemas/ErrorCodeAgentTimezoneInvalid' - $ref: '#/components/schemas/ErrorCodeAgentTimezoneRequired' - $ref: '#/components/schemas/ErrorCodeScenarioSmsSenderRequired' - $ref: '#/components/schemas/ErrorCodeSmsProviderInvalid' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '500': $ref: '#/components/responses/InternalError' delete: tags: - Agent operationId: DeleteAgent x-athena-permission: agent:manage summary: Delete agent description: 'Deletes an archived agent together with its automations, limit policies, routings, calls and their communication results. Afterwards none of them appears in a list or a read, except the calls in the communication list with `show_deleted=true`. Refused when: - The agent is in any status other than archived. - A call of the agent is being dialled or is in progress. A second delete finds nothing.' parameters: - $ref: '#/components/parameters/AgentIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '204': description: Deleted '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/ErrorCodeAgentNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAgentActiveCalls' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAgentNotArchived' '500': $ref: '#/components/responses/InternalError' /v1/a/agent/{id}/routing: get: tags: - Routing operationId: ListRoutings x-athena-permission: agent:routing:read summary: List the routings of an agent description: 'Lists the routings of the agent by position, the default routing last. A call of the agent plays the scenario of the first routing whose condition matches, or the default routing when none matches. A call that is not a test passes over a routing whose scenario has no published version.' parameters: - $ref: '#/components/parameters/AgentIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/RoutingList' '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/ErrorCodeAgentNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' post: tags: - Routing operationId: CreateRouting x-athena-permission: agent:routing:write summary: Create a routing description: 'Adds a routing to the agent at the position the request names, or last before the default routing. Refused when: - The agent is archived. - The condition names a segment the account does not hold. - The condition names a contact field no contact of the account holds, or one that holds fields of its own. - The condition compares a contact field with a value of a type the account''s contacts do not hold there.' parameters: - $ref: '#/components/parameters/AgentIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateRoutingRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Routing' '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/ErrorCodeQueryInvalid' - $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/ErrorCodeAgentNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAgentArchived' - $ref: '#/components/schemas/ErrorCodeRoutingInvalid' - $ref: '#/components/schemas/ErrorCodeRoutingNameInUse' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '500': $ref: '#/components/responses/InternalError' /v1/a/agent/{id}/routing/{routing_id}: get: tags: - Routing operationId: GetRouting x-athena-permission: agent:routing:read summary: Get a routing description: Reads one routing of the agent. The default routing is read by the id the list gives it. parameters: - $ref: '#/components/parameters/AgentIdPath' - $ref: '#/components/parameters/RoutingIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Routing' '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/ErrorCodeAgentNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeRoutingNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - Routing operationId: PatchRouting x-athena-permission: agent:routing:write summary: Update a routing description: 'Partial update; the same rules as on create apply to the result. Refused when: - The agent is archived. - The routing is the default routing. - The condition names a segment the account does not hold. - The condition names a contact field no contact of the account holds, or one that holds fields of its own. - The condition compares a contact field with a value of a type the account''s contacts do not hold there.' parameters: - $ref: '#/components/parameters/AgentIdPath' - $ref: '#/components/parameters/RoutingIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchRoutingRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Routing' '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/ErrorCodeQueryInvalid' - $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/ErrorCodeAgentNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeRoutingNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAgentArchived' - $ref: '#/components/schemas/ErrorCodeRoutingDefaultLocked' - $ref: '#/components/schemas/ErrorCodeRoutingInvalid' - $ref: '#/components/schemas/ErrorCodeRoutingNameInUse' - $ref: '#/components/schemas/ErrorCodeValidationFailed' '500': $ref: '#/components/responses/InternalError' delete: tags: - Routing operationId: DeleteRouting x-athena-permission: agent:routing:manage summary: Delete a routing description: Removes the routing and moves the routings after it one place up. Refused for the default routing and while the agent is archived. A second delete finds nothing. parameters: - $ref: '#/components/parameters/AgentIdPath' - $ref: '#/components/parameters/RoutingIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '204': description: Deleted '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/ErrorCodeAgentNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeRoutingNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAgentArchived' - $ref: '#/components/schemas/ErrorCodeRoutingDefaultLocked' '500': $ref: '#/components/responses/InternalError' /v1/a/agent/-/routing/-/query-language: get: tags: - Routing operationId: GetRoutingQueryLanguage x-athena-permission: agent:routing:read summary: List the fields and operators a routing condition can use description: 'Lists what a routing condition can name: the fields of the call, the time of the call in the agent''s time zone, the segments of the contact, and every data field a contact of the account holds with the type it holds there. A data field leaves the list when no contact holds it any more.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/RoutingQueryLanguage' '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' '500': $ref: '#/components/responses/InternalError' /v1/a/agent/{id}/archive: post: tags: - Agent operationId: ArchiveAgent x-athena-permission: agent:write summary: Archive agent description: 'Archives the agent together with every automation of it, in one step. Effects: - Each running attempt of those automations is stopped, and each waiting one is skipped. - Calls of the agent that were never dialled end as `stopped`, whether an automation placed them or not. - The agent releases its number or pool. - Its name and its lines become free for other agents. The agent stays readable; a patch or a second archive of it is refused.' parameters: - $ref: '#/components/parameters/AgentIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Agent' '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/ErrorCodeAgentNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAgentConcurrentUpdate' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeAgentArchived' '500': $ref: '#/components/responses/InternalError' /v1/a/integrations/sms/provider: get: tags: - SMS operationId: ListSmsProviders x-athena-permission: integration:sms:read summary: List SMS providers description: Each row carries its own registered alphas and numbers inline — the provider object is the one home of the account's senders. parameters: - $ref: '#/components/parameters/SmsProviderLimit' - $ref: '#/components/parameters/SmsProviderOffset' - $ref: '#/components/parameters/SmsProviderStatusQuery' - $ref: '#/components/parameters/SmsProviderAccessTypeQuery' - $ref: '#/components/parameters/SmsProviderFilterOr' - $ref: '#/components/parameters/SmsProviderFilterQuery' - $ref: '#/components/parameters/SmsProviderOrderBy' - $ref: '#/components/parameters/SmsProviderOrder' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SmsProviderList' '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/ErrorCodeNotFound' '500': $ref: '#/components/responses/InternalError' post: tags: - SMS operationId: CreateSmsProvider x-athena-permission: integration:sms:write summary: Create SMS provider description: 'Records the gateway; nothing is sent to it here, so a test send is what proves the configuration works. Rules: - `method`: defaults to POST. - `status`: defaults to active. By principal: - A caller with the role `tenant_admin` creates a tenant-administered config unless it sends `account`. - Any other caller creates an account-administered one, and `tenant` from it is ignored.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateSmsProviderRequest' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/SmsProvider' '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/ErrorCodeNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSmsProviderInvalid' - $ref: '#/components/schemas/ErrorCodeSmsProviderNameTaken' '500': $ref: '#/components/responses/InternalError' /v1/a/integrations/sms/provider/{id}: get: tags: - SMS operationId: GetSmsProvider x-athena-permission: integration:sms:read summary: Get SMS provider description: The gateway configuration, with the alphas and numbers registered on it inline. parameters: - $ref: '#/components/parameters/SmsProviderIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SmsProvider' '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' - $ref: '#/components/schemas/ErrorCodeSmsProviderNotFound' '500': $ref: '#/components/responses/InternalError' patch: tags: - SMS operationId: PatchSmsProvider x-athena-permission: integration:sms:write summary: Update SMS provider description: 'Updates the provider and validates the merged result, not the payload. Rules: - The gateway is not contacted. - A tenant-administered provider is read-only to a caller without the role `tenant_admin`, whichever field the request names. - `access_type` moves only for a caller with the role `tenant_admin`; submitted by anyone else it is ignored and the stored value stands.' parameters: - $ref: '#/components/parameters/SmsProviderIdPath' - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchSmsProviderRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SmsProvider' '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' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeSmsProviderNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSmsProviderInvalid' - $ref: '#/components/schemas/ErrorCodeSmsProviderNameTaken' '500': $ref: '#/components/responses/InternalError' delete: tags: - SMS operationId: DeleteSmsProvider x-athena-permission: integration:sms:manage summary: Delete SMS provider description: 'Deletes the provider. Refused when: - An agent that is not archived references the provider. - The provider is tenant-administered and the caller does not have the role `tenant_admin`.' parameters: - $ref: '#/components/parameters/SmsProviderIdPath' - $ref: '#/components/parameters/XAccountSidHeader' 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' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeSmsProviderNotFound' '409': description: Conflict content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSmsProviderInUse' '500': $ref: '#/components/responses/InternalError' /v1/a/integrations/sms/send: post: tags: - SMS operationId: SendSms x-athena-permission: integration:sms:write summary: Send SMS description: 'Sends the message and records the attempt. When the gateway refuses or the provider is inactive: - The call still succeeds and answers with the record. - The record carries `status: "failed"` and the reason.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/SmsSendRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SmsResult' '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/ErrorCodeCommunicationNotFound' - $ref: '#/components/schemas/ErrorCodeNotFound' - $ref: '#/components/schemas/ErrorCodeSmsProviderNotFound' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeSmsProviderInvalid' - $ref: '#/components/schemas/ErrorCodeSmsSendInvalid' - $ref: '#/components/schemas/ErrorCodeSmsSettingsMissing' '500': $ref: '#/components/responses/InternalError' /v1/a/audio: post: tags: - Audio operationId: UploadAudio x-athena-permission: scenario:write summary: Upload audio file description: 'Stores a file for scenario bricks 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/XAccountSidHeader' 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' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' '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/a/audio/{filename}: get: tags: - Audio operationId: GetAudio x-athena-permission: scenario:read summary: Get audio file (proxied or presigned link) description: 'Serves a stored file. 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/XAccountSidHeader' 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/a/auth/regular: post: tags: - Auth operationId: AuthRegularLogin x-athena-permission: none summary: Login description: Exchanges email + password for a session token. An unknown address, a wrong password, an inactive user and a user with no password set all answer alike. security: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/RegularLoginRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SessionResponse' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePasswordInvalid' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeValidationFailed' '429': description: Too many requests content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeRateLimited' '500': $ref: '#/components/responses/InternalError' /v1/a/auth/magic-link/consume: post: tags: - Auth operationId: AuthMagicConsume x-athena-permission: none summary: Consume magic link description: Exchanges a magic-link token, issued through the `/v1/a/user/{sid}/magic-link/request` handoff, for a session token. The exchange spends the token. security: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/MagicConsumeRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SessionResponse' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMagicInvalid' '429': description: Too many requests content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeRateLimited' '500': $ref: '#/components/responses/InternalError' /v1/a/auth/password/change: post: tags: - Auth operationId: AuthPasswordChange x-athena-permission: none summary: Change password description: 'Changes the password of the authenticated user. Effects: - The user''s other sessions are revoked. - The calling token keeps working. Only a session token opens this route.' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PasswordChangeRequest' responses: '204': description: No content '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodePasswordInvalid' - $ref: '#/components/schemas/ErrorCodeUnauthenticated' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeValidationFailed' '500': $ref: '#/components/responses/InternalError' /v1/a/auth/password-reset/consume: post: tags: - Auth operationId: AuthPasswordResetConsume x-athena-permission: none summary: Consume password reset description: 'Sets a new password from a password-reset token, issued through the `/v1/a/user/{sid}/password-reset/request` handoff, and returns a session. Effects: - The token is spent by the exchange. - Sessions the user already holds are left standing.' security: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PasswordResetConsumeRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/SessionResponse' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeValidationFailed' '401': description: Unauthorized content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeMagicInvalid' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeValidationFailed' '429': description: Too many requests content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeRateLimited' '500': $ref: '#/components/responses/InternalError' /v1/a/auth/logout: post: tags: - Auth operationId: AuthLogout x-athena-permission: none summary: Logout description: Revokes the current session token. responses: '204': description: No content '500': $ref: '#/components/responses/InternalError' /v1/a/user: get: tags: - User operationId: ListUsers x-athena-permission: account:user:manage summary: List users description: The users of one account. parameters: - $ref: '#/components/parameters/XAccountSidHeader' - 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: CreateUser x-athena-permission: account:user:manage x-athena-field-permissions: password: account:sign_in:manage summary: Create user description: Creates the user active. `password` is optional; without one the user gets in only through a magic-link or password-reset handoff. While the tenant declares `user` in `managed_resources`, only a caller with the role `tenant_admin` creates one, and `external_id` is required. parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateUserRequest' 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/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/ErrorCodeAccessDenied' - $ref: '#/components/schemas/ErrorCodePermissionDenied' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '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/a/user/-/external/{external_id}: get: tags: - User operationId: GetUserByExternalID x-athena-permission: account:user:manage summary: Get user by external identifier description: Resolves the user the calling account gave this key, without the caller knowing the platform sid. parameters: - $ref: '#/components/parameters/UserExternalIDPath' - $ref: '#/components/parameters/XAccountSidHeader' 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: DeleteUserByExternalID x-athena-permission: account:user:manage summary: Delete user by external identifier description: 'Deletes the user the calling account gave this key, without the caller knowing the platform sid. Rules: - The delete is soft, as by sid. - The key is released for reuse by a live user. Refused when: - The tenant declares `user` in `managed_resources` and the caller does not hold the role `tenant_admin`. - The user''s roles carry a permission the caller does not hold.' parameters: - $ref: '#/components/parameters/UserExternalIDPath' - $ref: '#/components/parameters/XAccountSidHeader' 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' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' /v1/a/user/{sid}: get: tags: - User operationId: GetUser x-athena-permission: account:user:manage summary: Get user description: One user of the account. parameters: - $ref: '#/components/parameters/UserSidPath' 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: PatchUser x-athena-permission: account:user:manage x-athena-field-permissions: password: account:sign_in:manage summary: Update user description: '`email` replaces the address the user signs in with. Setting `status` to inactive stops the user obtaining a new session, whether by password, magic link or password reset, and ends the sessions, magic links and reset tokens they already hold; setting it back to active restores none of them. While the tenant declares `user` in `managed_resources`, a caller without the role `tenant_admin` may send `status`, in either direction, and nothing else. The caller''s own user is edited through `/v1/a/profile`, never here. Refused when the user''s roles carry a permission the caller does not hold.' parameters: - $ref: '#/components/parameters/UserSidPath' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchUserRequest' 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' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '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: DeleteUser x-athena-permission: account:user:manage summary: Delete user description: 'Soft-deletes the 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 token stops working. Refused when: - The tenant declares `user` in `managed_resources` and the caller does not hold the role `tenant_admin`. - The user''s roles carry a permission the caller does not hold.' parameters: - $ref: '#/components/parameters/UserSidPath' 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' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' /v1/a/user/{sid}/magic-link/request: post: tags: - User operationId: IssueUserMagicLink x-athena-permission: account:sign_in:manage summary: Request user magic link description: 'Returns a single-use magic-link token for the user, with the consume URL and a browser link (`web_url`) into the web frontend that signs the person in. Rules: - The platform sends no email; the caller delivers the link, or the token, to the user through its own channel. - A new token invalidates the previous outstanding one. - Nothing is created for a user who could not use it. - The call stays open to every caller whatever the tenant declares in `managed_resources`. Refused when the user''s roles carry a permission the caller does not hold.' parameters: - $ref: '#/components/parameters/UserSidPath' 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/a/user/{sid}/password-reset/request: post: tags: - User operationId: IssueUserPasswordReset x-athena-permission: account:sign_in:manage summary: Request user password reset description: 'Creates a single-use password-reset token for the user and returns it with the consume URL. Rules: - Issuing a second one retires the first. - Delivery is the caller''s, since the platform sends no email. - While the tenant declares `user` in `managed_resources`, a caller without the role `tenant_admin` uses `/v1/a/user/{sid}/magic-link/request` instead. Refused when: - The tenant declares `user` in `managed_resources` and the caller does not hold the role `tenant_admin`. - The user''s roles carry a permission the caller does not hold.' parameters: - $ref: '#/components/parameters/UserSidPath' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/HandoffResponse' '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/ErrorCodeTenantManaged' '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/a/user/-/api-key: get: tags: - User operationId: ListAccountAPIKeys x-athena-permission: account:api_key:manage summary: List the account's API keys description: 'Lists the keys owned by the account''s users, newest first, without the secret. Rules: - A revoked key leaves the list. - A key leaves the list when its owner is deleted. - An expired key leaves the list.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' - 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/a/user/{sid}/api-key: get: tags: - User operationId: ListUserAPIKeys x-athena-permission: account:api_key:manage summary: List a user's API keys description: The keys the user owns, in the same shape as the account's list. parameters: - $ref: '#/components/parameters/UserSidPath' - $ref: '#/components/parameters/XAccountSidHeader' - 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: IssueUserAPIKey x-athena-permission: account:api_key:manage summary: Issue user API key description: 'Creates an API key owned by the 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 at the user''s account. - The key stops authenticating while the user, their account or its 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' 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/a/user/{sid}/api-key/{key_sid}: delete: tags: - User operationId: RevokeUserAPIKey x-athena-permission: account:api_key:manage summary: Revoke a 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/XAccountSidHeader' 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/a/role: get: tags: - Role operationId: ListAccountRoles x-athena-permission: account:role:read summary: List account roles description: 'The live `account` roles of the account''s tenant: the roles an account-level user can hold. The fixed roles come first.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' - $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' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' /v1/a/scenario-template: get: tags: - ScenarioTemplate operationId: ListAccountScenarioTemplates x-athena-permission: scenario:template:read summary: List scenario templates description: The live templates of the account's tenant, without `constructor`. parameters: - $ref: '#/components/parameters/XAccountSidHeader' - $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' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' /v1/a/scenario-template/{id}: get: tags: - ScenarioTemplate operationId: GetAccountScenarioTemplate x-athena-permission: scenario:template:read summary: Get scenario template description: One template of the account's tenant, with `constructor`. parameters: - $ref: '#/components/parameters/ScenarioTemplateIdPath' - $ref: '#/components/parameters/XAccountSidHeader' 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' /v1/a/scenario-template/{id}/copy: post: tags: - ScenarioTemplate operationId: CopyScenarioTemplate x-athena-permission: scenario:write summary: Copy scenario template into the account description: 'Creates a scenario in the caller''s account from a template of the account''s tenant. Rules: - The scenario starts unpublished: `version` 0, the template content as its work-in-progress draft. - Every classifier, edge function, RAG document and audio file the template names is created again in the account, and the scenario names the new ones. - Webhook authentication is not copied. - A later change or delete of the template does not change the scenario. Refused when: - The account made a copy, of a template or of a shared scenario, less than a minute ago. - A resource the template names cannot be copied. Nothing is created then.' parameters: - $ref: '#/components/parameters/ScenarioTemplateIdPath' - $ref: '#/components/parameters/XAccountSidHeader' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/Scenario' '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' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeScenarioCopyFailed' '429': description: Too many requests content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeRateLimited' /v1/a/profile: get: tags: - Profile operationId: GetProfile x-athena-permission: none summary: Get own profile description: Returns the caller's own user, the account it belongs to, the feature flags evaluated for that account, the permissions the caller holds and the links of the caller's tenant, resolved from the bearer token. The route needs a user behind the token. responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Profile' '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/ErrorCodeNoUserPrincipal' patch: tags: - Profile operationId: PatchProfile x-athena-permission: none x-athena-field-permissions: user.email: account:user:manage account: account:profile:write summary: Update own profile description: 'Partially updates the caller''s own user and account. The groups: - `user`: carries `name` and `email`. - `account`: carries `name`, `country`, `timezone` and `phone`. Rules: - An omitted group preserves the current value. - An omitted field within a group preserves the current value. A field outside these groups is refused, never ignored.' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchProfileRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Profile' '400': description: Bad request content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $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/ErrorCodeNoUserPrincipal' - $ref: '#/components/schemas/ErrorCodePermissionDenied' - $ref: '#/components/schemas/ErrorCodeTenantManaged' '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' '422': description: Unprocessable content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeValidationFailed' /v1/a/profile/api-key: get: tags: - Profile operationId: ListProfileAPIKeys x-athena-permission: none summary: List own API keys description: 'Lists the caller''s own keys, newest first, without the secret. Rules: - The route is open to every role. - The request must carry a session.' parameters: - 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/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/ErrorCodeNoUserPrincipal' post: tags: - Profile operationId: IssueProfileAPIKey x-athena-permission: none summary: Issue own API key description: 'Creates a key owned by the caller and returns its secret once; only a hash is kept. Rules: - The route is open to every role. - The request must carry a session.' 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/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/ErrorCodeNoUserPrincipal' '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/a/profile/api-key/{key_sid}: delete: tags: - Profile operationId: RevokeProfileAPIKey x-athena-permission: none summary: Revoke own API key description: 'Deletes one of the caller''s keys. Rules: - The request must carry a session. - The key authenticates nothing from the next request on. - The caller''s other keys are untouched.' parameters: - $ref: '#/components/parameters/KeySidPath' responses: '204': description: No content '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/ErrorCodeNoUserPrincipal' '404': description: Not found content: application/json: schema: allOf: - $ref: '#/components/schemas/Error' - properties: error: oneOf: - $ref: '#/components/schemas/ErrorCodeNotFound' /v1/a/info/countries: get: tags: - Info operationId: GetCountries x-athena-permission: none summary: List countries description: 'Returns the countries that `account.country` and a source''s `country_code` accept, as static reference data: ISO 3166-1 alpha-2 codes, lowercase, ordered by code. Rules: - The route takes no credential. - The list has no paging. - The list has no filtering.' security: [] responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/CountryList' /v1/a/info/regions: get: tags: - Info operationId: GetRegions x-athena-permission: none summary: List regions description: 'Returns every region a feature-flag rule may scope to, as a short code with its display name, ordered by code. Rules: - Every call returns the whole dataset. - The route takes no credential. - The list has no paging. - The list has no filters.' security: [] responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/RegionList' /v1/a/openapi.yaml: get: tags: - Contract operationId: GetAccountOpenAPIDocument x-athena-permission: none summary: Account API document description: The OpenAPI 3.0 document of the Account 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 Account 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' /v1/a/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: AdapterEdgeDeleteFunctionsSlugVersion parameters: - $ref: '#/components/parameters/Slug' - $ref: '#/components/parameters/Version' - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: edge:function:manage get: operationId: AdapterEdgeGetFunctionsSlugVersion parameters: - $ref: '#/components/parameters/Slug' - $ref: '#/components/parameters/Version' - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: edge:function:read post: description: Same behaviour and response as `POST /api/functions/by-id/{id}`. operationId: AdapterEdgePostFunctionsSlugVersion parameters: - $ref: '#/components/parameters/Slug' - $ref: '#/components/parameters/Version' - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: edge:function:write /v1/a/adapters/edge/functions: get: description: Only versions with `is_latest = true`, newest first by `created_at`. operationId: AdapterEdgeGetFunctions 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/AthenaAccountSidHeader' 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: edge:function: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: AdapterEdgePostFunctions parameters: - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: edge:function:manage /v1/a/adapters/edge/functions/by-id/{id}: get: operationId: AdapterEdgeGetFunctionsByIdId parameters: - $ref: '#/components/parameters/Id' - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: edge:function: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: AdapterEdgePostFunctionsByIdId parameters: - $ref: '#/components/parameters/Id' - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: edge:function:write /v1/a/adapters/edge/functions/{slug}/versions: get: description: Newest version first. An unknown slug gives an empty list, not 404. operationId: AdapterEdgeGetFunctionsSlugVersions parameters: - $ref: '#/components/parameters/Slug' - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: edge:function:read /v1/a/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: AdapterEdgePostFunctionsSlugVersionWarmup parameters: - $ref: '#/components/parameters/Slug' - $ref: '#/components/parameters/Version' - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: edge:function:manage /v1/a/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: AdapterIdsDeleteClassifierId parameters: - $ref: '#/components/parameters/ClassifierIdPath' - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: ids:classifier: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: AdapterIdsPutClassifierId parameters: - $ref: '#/components/parameters/ClassifierIdPath' - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: ids:classifier:manage /v1/a/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: AdapterIdsGetClassifier parameters: - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: ids:classifier: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: AdapterIdsPostClassifier parameters: - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: ids:classifier:manage /v1/a/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: AdapterIdsGetClassifierIdVersionVersion parameters: - $ref: '#/components/parameters/ClassifierIdPath' - $ref: '#/components/parameters/ClassifierVersionPath' - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: ids:classifier:manage /v1/a/adapters/ids/entities/types: get: operationId: AdapterIdsGetEntitiesTypes responses: '200': content: application/json: schema: $ref: '#/components/schemas/EntityTypeList' description: OK '401': description: Unauthorized '403': description: Forbidden '500': $ref: '#/components/responses/InternalError-3' '502': description: Bad gateway (upstream adapter error) summary: List entity types per language tags: - Entity x-athena-permission: ids:entity:write /v1/a/adapters/ids/models: get: operationId: AdapterIdsGetModels parameters: - $ref: '#/components/parameters/LanguageQuery' responses: '200': content: application/json: schema: $ref: '#/components/schemas/ModelList' description: OK '401': description: Unauthorized '403': description: Forbidden '500': $ref: '#/components/responses/InternalError-3' '502': description: Bad gateway (upstream adapter error) summary: List models tags: - Model x-athena-permission: ids:model:read /v1/a/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: AdapterIdsPostClassifierIdVersionVersionClassify parameters: - $ref: '#/components/parameters/ClassifierIdPath' - $ref: '#/components/parameters/ClassifierVersionPath' - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: ids:classifier:write /v1/a/adapters/ids/entities/extract: post: operationId: AdapterIdsPostEntitiesExtract requestBody: content: application/json: schema: $ref: '#/components/schemas/EntityExtractionRequest' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/ExtractedEntityList' description: OK '204': description: No entities extracted '400': $ref: '#/components/responses/BadRequest' '401': description: Unauthorized '403': description: Forbidden '502': description: Bad gateway (upstream adapter error) summary: Extract entities from a phrase tags: - Entity x-athena-permission: ids:entity:write /v1/a/adapters/llm/rag/document/{id}: delete: operationId: AdapterLlmDeleteRagDocumentId parameters: - $ref: '#/components/parameters/DocumentIdPath' - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: llm:document:manage get: operationId: AdapterLlmGetRagDocumentId parameters: - $ref: '#/components/parameters/DocumentIdPath' - $ref: '#/components/parameters/AthenaAccountSidHeader' 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: llm:document:manage put: description: Accepts either a JSON text body or a multipart file upload, selected by Content-Type. operationId: AdapterLlmPutRagDocumentId 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/AthenaAccountSidHeader' 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: llm:document:manage /v1/a/adapters/llm/chat/stream/info/{id}: get: operationId: AdapterLlmGetChatStreamInfoId parameters: - $ref: '#/components/parameters/StreamIdPath' responses: '200': content: application/json: schema: $ref: '#/components/schemas/ChatStreamInfoResponse' description: OK '400': $ref: '#/components/responses/BadRequest-2' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFound-3' '500': $ref: '#/components/responses/InternalError-4' '502': description: Bad gateway (upstream adapter error) summary: Get chat stream info tags: - LLM Adapter x-athena-permission: llm:chat:manage /v1/a/adapters/llm/chat/stream/{id}: get: operationId: AdapterLlmGetChatStreamId parameters: - $ref: '#/components/parameters/StreamIdPath' - $ref: '#/components/parameters/PartsBehaviorQuery' responses: '200': content: application/json: schema: $ref: '#/components/schemas/ChatStreamResultResponse' description: Stream completed and fully read '206': content: application/json: schema: $ref: '#/components/schemas/ChatStreamResultResponse' description: Stream in progress or finished but not fully read '400': $ref: '#/components/responses/BadRequest-2' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFound-3' '500': $ref: '#/components/responses/InternalError-4' '502': description: Bad gateway (upstream adapter error) summary: Poll chat stream result tags: - LLM Adapter x-athena-permission: llm:chat:manage /v1/a/adapters/llm/public/data/models: get: operationId: AdapterLlmGetPublicDataModels parameters: - in: query name: provider required: false schema: type: string - in: query name: type required: false schema: type: string - in: query name: mode required: false schema: enum: - flat - group type: string - in: query name: gdpr required: false schema: type: boolean - in: query name: enabled required: false schema: default: true type: boolean - in: query name: limit required: false schema: type: integer - in: query name: offset required: false schema: type: integer responses: '200': content: application/json: schema: oneOf: - $ref: '#/components/schemas/PublicModelList' - $ref: '#/components/schemas/PublicGroupedModelList' description: 'OK. By `mode`: - `flat`: the default. Each item is one model on one backend. - `group`: each item is one model of one provider, across its backends.' '401': description: Unauthorized '403': description: Forbidden '500': $ref: '#/components/responses/InternalErrorMessage' '502': description: Bad gateway (upstream adapter error) summary: List available models tags: - LLM Adapter x-athena-permission: llm:model:read /v1/a/adapters/llm/rag/document/list: get: description: Returns one page of the account's documents, newest first. operationId: AdapterLlmGetRagDocumentList 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/AthenaAccountSidHeader' 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: llm:document:manage /v1/a/adapters/llm/rag/document/search: get: operationId: AdapterLlmGetRagDocumentSearch 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/AthenaAccountSidHeader' 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: llm:document:manage /v1/a/adapters/llm/chat/completion: post: operationId: AdapterLlmPostChatCompletion requestBody: content: application/json: schema: $ref: '#/components/schemas/ChatCompletionRequest' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/ChatCompletionResponse' description: OK '400': $ref: '#/components/responses/BadRequest-2' '401': description: Unauthorized '403': description: Forbidden '408': $ref: '#/components/responses/RequestTimeout' '500': $ref: '#/components/responses/InternalError-4' '502': description: Bad gateway (upstream adapter error) summary: Chat completion (RAG-capable) tags: - LLM Adapter x-athena-permission: llm:chat:manage /v1/a/adapters/llm/chat/stream: post: operationId: AdapterLlmPostChatStream requestBody: content: application/json: schema: $ref: '#/components/schemas/ChatStreamRunRequest' required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/ChatStreamRunResponse' description: Created '400': $ref: '#/components/responses/BadRequest-2' '401': description: Unauthorized '403': description: Forbidden '500': $ref: '#/components/responses/InternalError-4' '502': description: Bad gateway (upstream adapter error) summary: Start a RAG-augmented chat stream tags: - LLM Adapter x-athena-permission: llm:chat:manage /v1/a/adapters/llm/chat/stream/{id}/{action}: post: operationId: AdapterLlmPostChatStreamIdAction parameters: - $ref: '#/components/parameters/StreamIdPath' - $ref: '#/components/parameters/ActionPath' responses: '202': description: Action accepted '400': $ref: '#/components/responses/BadRequest-2' '401': description: Unauthorized '403': description: Forbidden '404': $ref: '#/components/responses/NotFound-3' '500': $ref: '#/components/responses/InternalError-4' '502': description: Bad gateway (upstream adapter error) summary: Commit or cancel a chat stream tags: - LLM Adapter x-athena-permission: llm:chat:manage /v1/a/adapters/llm/embeddings: post: operationId: AdapterLlmPostEmbeddings requestBody: content: application/json: schema: $ref: '#/components/schemas/EmbeddingRequest' required: true responses: '201': content: application/json: schema: $ref: '#/components/schemas/EmbeddingResponse' description: Created '400': $ref: '#/components/responses/BadRequest-2' '401': description: Unauthorized '403': description: Forbidden '502': description: Bad gateway (upstream adapter error) summary: Create text embeddings tags: - LLM Adapter x-athena-permission: llm:chat:manage /v1/a/adapters/tts/{engine}: delete: description: Removes the cached audio for the request described in the JSON body. operationId: AdapterTtsDeleteEngine parameters: - $ref: '#/components/parameters/Engine' requestBody: content: application/json: schema: $ref: '#/components/schemas/SpeechRequest' required: true responses: '204': description: Cache entry removed. '400': $ref: '#/components/responses/Error' '401': description: Unauthorized '403': description: Forbidden '500': $ref: '#/components/responses/Error' '502': description: Bad gateway (upstream adapter error) summary: Drop the cached audio tags: - TTS Adapter x-athena-permission: tts:synthesize:manage get: description: 'Synthesizes speech from the query parameters and streams the audio. Either `text` or `text_b64` is required.' operationId: AdapterTtsGetEngine parameters: - $ref: '#/components/parameters/Engine' - $ref: '#/components/parameters/Voice' - $ref: '#/components/parameters/Language' - $ref: '#/components/parameters/Text' - $ref: '#/components/parameters/TextB64' - $ref: '#/components/parameters/Speed' - $ref: '#/components/parameters/Format' - $ref: '#/components/parameters/SampleRate' - $ref: '#/components/parameters/Model' - $ref: '#/components/parameters/Fallback' - $ref: '#/components/parameters/VoiceAlias' - $ref: '#/components/parameters/LanguageAlias' - $ref: '#/components/parameters/SpeedAlias' - $ref: '#/components/parameters/FormatAlias' - $ref: '#/components/parameters/SampleRateAlias' - $ref: '#/components/parameters/ModelAlias' - $ref: '#/components/parameters/FallbackAlias' - $ref: '#/components/parameters/AdvancedSettings' - $ref: '#/components/parameters/SkipUriLengthValidation' responses: '200': $ref: '#/components/responses/Audio' '400': $ref: '#/components/responses/Error' '401': description: Unauthorized '403': description: Forbidden '429': $ref: '#/components/responses/Error' '502': $ref: '#/components/responses/Error' summary: Synthesize speech (query params) tags: - TTS Adapter x-athena-permission: tts:synthesize:manage head: description: 'Checks the cache for the requested audio. Returns `200` on a cache hit, otherwise queues synthesis and returns `202`. Accepts the same query parameters as `GET /{engine}`.' operationId: AdapterTtsHeadEngine parameters: - $ref: '#/components/parameters/Engine' - $ref: '#/components/parameters/Voice' - $ref: '#/components/parameters/Language' - $ref: '#/components/parameters/Text' - $ref: '#/components/parameters/TextB64' - $ref: '#/components/parameters/Speed' - $ref: '#/components/parameters/Format' - $ref: '#/components/parameters/SampleRate' - $ref: '#/components/parameters/Model' - $ref: '#/components/parameters/Fallback' - $ref: '#/components/parameters/VoiceAlias' - $ref: '#/components/parameters/LanguageAlias' - $ref: '#/components/parameters/SpeedAlias' - $ref: '#/components/parameters/FormatAlias' - $ref: '#/components/parameters/SampleRateAlias' - $ref: '#/components/parameters/ModelAlias' - $ref: '#/components/parameters/FallbackAlias' - $ref: '#/components/parameters/AdvancedSettings' responses: '200': description: Audio already cached. '202': description: Synthesis queued. '400': $ref: '#/components/responses/Error' '401': description: Unauthorized '403': description: Forbidden '405': $ref: '#/components/responses/Error' '502': description: Bad gateway (upstream adapter error) summary: Prime the synthesis cache tags: - TTS Adapter x-athena-permission: tts:synthesize:manage post: description: Synthesizes speech from a JSON body and streams the audio. operationId: AdapterTtsPostEngine parameters: - $ref: '#/components/parameters/Engine' requestBody: content: application/json: schema: $ref: '#/components/schemas/SpeechRequest' required: true responses: '200': $ref: '#/components/responses/Audio' '400': $ref: '#/components/responses/Error' '401': description: Unauthorized '403': description: Forbidden '429': $ref: '#/components/responses/Error' '502': $ref: '#/components/responses/Error' summary: Synthesize speech (JSON body) tags: - TTS Adapter x-athena-permission: tts:synthesize:manage /v1/a/adapters/tts/lang: get: description: Lists the languages supported by an engine (default `gc`). operationId: AdapterTtsGetLang parameters: - in: query name: engine required: false schema: default: gc type: string responses: '200': content: application/json: schema: items: $ref: '#/components/schemas/Lang' type: array description: Languages. '400': $ref: '#/components/responses/Error' '401': description: Unauthorized '403': description: Forbidden '502': $ref: '#/components/responses/Error' summary: List languages tags: - TTS Adapter x-athena-permission: tts:voice:read /v1/a/adapters/tts/normalize/{path}: get: description: 'Rewrites synthesis parameters to platform-safe values: forces `f=wav`, sets `sr` (default 16000), strips `sampleRate`, `format` and `fsFix`. Every other parameter is returned unchanged. Requires `text` or `text_b64` in the query. The response holds the normalized query parameters. Send them as the query of a `GET` or `HEAD` synthesis request for the same engine. The audio is WAV for every engine and model.' operationId: AdapterTtsGetNormalizePath parameters: - description: Engine name, for example `gc`. The response is the same for every value. in: path name: path required: true schema: type: string - $ref: '#/components/parameters/Text' - $ref: '#/components/parameters/TextB64' responses: '200': content: application/json: schema: $ref: '#/components/schemas/NormalizedQuery' description: The normalized query parameters. '400': content: application/json: schema: properties: error: type: string type: object description: Missing text. '401': description: Unauthorized '403': description: Forbidden '502': description: Bad gateway (upstream adapter error) summary: Normalize synthesis parameters tags: - TTS Adapter x-athena-permission: tts:synthesize:manage /v1/a/adapters/tts/voice: get: description: Lists voices for an engine, optionally filtered by language and gender. operationId: AdapterTtsGetVoice parameters: - in: query name: engine required: false schema: default: gc type: string - in: query name: lang required: false schema: type: string - in: query name: gender required: false schema: type: string responses: '200': content: application/json: schema: items: $ref: '#/components/schemas/VoiceResponse' type: array description: Voices. '204': description: No voices matched the filter. '400': $ref: '#/components/responses/Error' '401': description: Unauthorized '403': description: Forbidden '502': $ref: '#/components/responses/Error' summary: List voices tags: - TTS Adapter x-athena-permission: tts:voice:read /v1/a/adapters/tts/voice/resolve: post: description: 'Resolves the active voice for the request, falling back to a compatible voice when the requested one is unavailable. The `fallback` flag in the response indicates whether a fallback was used.' operationId: AdapterTtsPostVoiceResolve requestBody: content: application/json: schema: $ref: '#/components/schemas/ResolveVoiceRequest' required: true responses: '200': content: application/json: schema: $ref: '#/components/schemas/ResolveVoiceResponse' description: Resolved voice. '400': $ref: '#/components/responses/Error' '401': description: Unauthorized '403': description: Forbidden '500': $ref: '#/components/responses/Error' '502': description: Bad gateway (upstream adapter error) '503': $ref: '#/components/responses/Error' summary: Resolve a voice tags: - TTS Adapter x-athena-permission: tts:voice:read /v1/a/adapters/stt/{engine_name}/run: post: tags: - STT Adapter operationId: RunSTTEngine summary: Run an STT engine over audio sources x-athena-permission: stt:recognition:write description: Runs the named engine over the supplied audio sources on a live hermes node, picked least-loaded from the shared snapshot. Request and response are hermes' `/v1/stt/{engine_name}/run` contract unchanged, referenced here from the vendored hermes spec. What athena adds is the bearer credential, the permission check, the account scope the flags are evaluated in, and a not-found answer for an engine those flags withhold. parameters: - $ref: '#/components/parameters/XAccountSidHeader' - name: engine_name in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/STTEngineRunRequest' responses: '200': description: The node's response, passed through. content: application/json: schema: $ref: '#/components/schemas/STTEngineRunResponse' '400': description: The node's rejection of the run, passed through. A request body athena cannot parse, or an account scope it cannot resolve, is refused before the node is reached and carries athena's own error envelope instead. content: application/json: schema: $ref: '#/components/schemas/Error-2' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': description: No such engine, or the caller's feature flags withhold it — a gated engine is indistinguishable from an absent one. content: application/json: schema: $ref: '#/components/schemas/Error' '500': description: The node's failure before it produced per-item results, passed through. Athena answers with its own error envelope when the caller's feature flags cannot be resolved. content: application/json: schema: $ref: '#/components/schemas/Error-2' '502': description: The selected hermes node failed to serve the recognition. content: application/json: schema: $ref: '#/components/schemas/Error' '503': description: No ready hermes node is available. content: application/json: schema: $ref: '#/components/schemas/Error' /v1/a/adapters/stt/transcribe: post: tags: - STT Adapter operationId: StartSTTTranscription summary: Start an asynchronous transcription of a WAV file x-athena-permission: stt:recognition:write description: 'Starts a job that transcribes every channel of a PCM WAV file and merges the channels into one dialog in time order. The audio: - `file`: a multipart upload of the WAV file. - `url` with `gs://`: a call recording of the caller''s account, or a shared test file in the `test-cases/` folder of the environment bucket. - `url` with `http://` or `https://`: a file on a public host. `engine` is one of the engines that `GET /v1/a/adapters/stt/info/transcribe` lists, and `model` is one of the models it lists for that engine. Refused when: - `engine` is absent, or the engine or the model is unknown. - The engine is not enabled for the caller''s account. - A `gs://` url names an object outside the call recordings of the caller''s account and outside the shared test files. The job belongs to the caller''s account and is kept for 1 hour.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/StartTranscriptionRequest' multipart/form-data: schema: $ref: '#/components/schemas/StartTranscriptionUpload' responses: '202': description: The queued job. content: application/json: schema: $ref: '#/components/schemas/TranscriptionJob' '400': description: '`engine` is absent, the engine or the model is unknown, the engine is not enabled for the caller''s account, or the audio or a field of the request is invalid.' content: application/json: schema: oneOf: - $ref: '#/components/schemas/Error' - $ref: '#/components/schemas/TranscriptionError' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': description: A gs:// url names no recording of the caller's account and no shared test file, or an http or https host answers 404. content: application/json: schema: oneOf: - $ref: '#/components/schemas/Error' - $ref: '#/components/schemas/TranscriptionError' '413': description: The body is larger than 65 MiB. content: application/json: schema: $ref: '#/components/schemas/Error' '500': description: The transcription service failed to start the job. content: application/json: schema: oneOf: - $ref: '#/components/schemas/Error' - $ref: '#/components/schemas/TranscriptionError' '502': description: The transcription service failed to serve the request. content: application/json: schema: $ref: '#/components/schemas/Error' '503': description: The transcription service cannot take a job now. content: application/json: schema: oneOf: - $ref: '#/components/schemas/Error' - $ref: '#/components/schemas/TranscriptionError' /v1/a/adapters/stt/transcribe/{id}: get: tags: - STT Adapter operationId: GetSTTTranscription summary: Get a transcription job x-athena-permission: stt:recognition:write description: 'Returns a transcription job of the caller''s account. A job that stops before it completes is `failed`, and `error` says why.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' - name: id in: path required: true schema: type: string responses: '200': description: The job. content: application/json: schema: $ref: '#/components/schemas/TranscriptionJob' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': description: The job is not found. content: application/json: schema: $ref: '#/components/schemas/TranscriptionError' '500': description: The transcription service failed to read the job. content: application/json: schema: $ref: '#/components/schemas/TranscriptionError' '502': description: The transcription service failed to serve the request. content: application/json: schema: $ref: '#/components/schemas/Error' '503': description: The transcription service is not available. content: application/json: schema: oneOf: - $ref: '#/components/schemas/Error' - $ref: '#/components/schemas/TranscriptionError' /v1/a/adapters/stt/info/transcribe: get: tags: - STT Adapter operationId: ListSTTTranscriptionModels summary: List transcription models x-athena-permission: stt:recognition:write description: Lists the engine models that transcribe a recorded file. A model of an engine not enabled for the caller's account is absent. parameters: - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: The transcription models. content: application/json: schema: $ref: '#/components/schemas/TranscriptionModelList' '400': $ref: '#/components/responses/BadRequest-3' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalError' /v1/a/adapters/stt/info/language: get: tags: - STT Adapter operationId: ListSTTLanguages summary: List recognition languages x-athena-permission: stt:recognition:write description: The recognition languages offered to the caller, each with its display name. A language served only by an engine the caller's feature flags withhold is absent. A bare two-character code appears only when no regional variant of that language exists. parameters: - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: The language list. content: application/json: schema: $ref: '#/components/schemas/RecognitionLanguageList' '400': $ref: '#/components/responses/BadRequest-3' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalError' /v1/a/adapters/stt/info/model: get: tags: - STT Adapter operationId: ListSTTModels summary: List recognition model options x-athena-permission: stt:recognition:write description: The engine / language / model combinations offered to the caller, each marked when it is the default model for its engine and language. A combination whose engine the caller's feature flags withhold is absent. Filters combine with AND. A bare `language` selects that whole family (`ru` → every `ru-*` locale); a locale also selects an engine that lists the language without a region (`ru-RU` → an engine offering `ru`). An unmatched language yields an empty page. parameters: - $ref: '#/components/parameters/XAccountSidHeader' - name: engine in: query required: false schema: type: string - name: language in: query required: false schema: type: string - name: model in: query required: false 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: The matching recognition model options. content: application/json: schema: $ref: '#/components/schemas/RecognitionModelOptionList' '400': $ref: '#/components/responses/BadRequest-3' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalError' /v1/a/adapters/stt/info/spec: get: tags: - STT Adapter operationId: ListSTTSpecs summary: List tuning options per engine and language x-athena-permission: stt:recognition:write description: 'Which tuning options apply to each engine / language pair the caller is offered: the grammar parameters that alter recognition, the class tokens the engine understands, and the filters applicable to the transcript. Each pair also states whether endpoint detection is available for its engine. A pair whose engine the caller''s feature flags withhold is absent. Both filters accept a comma-separated set; omitting one means no filter on it. A bare language in `languages` selects that whole family (`en` → every `en-*` locale); a locale also selects an engine that lists the language without a region (`en-US` → an engine offering `en`). A value that matches no language adds no pair.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' - name: engines in: query required: false description: Comma-separated engine names. schema: type: string - name: languages in: query required: false description: Comma-separated language codes. 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: The matching engine / language tuning options. content: application/json: schema: $ref: '#/components/schemas/RecognitionSpecList' '400': $ref: '#/components/responses/BadRequest-3' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalError' /v1/a/adapters/stt/data/dictionary: get: tags: - STT Adapter operationId: ListAccountSTTDictionaries summary: List STT dictionaries x-athena-permission: stt:dictionary:read description: The global presets plus the caller's own account dictionaries, told apart by `public`. The account is resolved from the principal — a broader principal targets one of its accounts with `X-Account-Sid`. parameters: - $ref: '#/components/parameters/XAccountSidHeader' - name: language in: query required: false description: Exact match on the language code; there is no partial match. schema: type: string - name: name in: query required: false description: The dictionary name, matched in full; a prefix selects nothing. 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: The matching dictionaries. content: application/json: schema: $ref: '#/components/schemas/STTDictionaryList' '400': $ref: '#/components/responses/BadRequest-3' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalError' post: tags: - STT Adapter operationId: CreateAccountSTTDictionary summary: Create an STT dictionary x-athena-permission: stt:dictionary:write description: Creates a dictionary owned by the caller's account. The global presets are operator-curated and cannot be created here. `name` and `language` are both required and refused when either is empty, and a name another live dictionary of the account holds for that language is refused. parameters: - $ref: '#/components/parameters/XAccountSidHeader' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateSTTDictionaryRequest' responses: '201': description: The created dictionary. content: application/json: schema: $ref: '#/components/schemas/STTDictionary' '400': $ref: '#/components/responses/BadRequest-3' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' /v1/a/adapters/stt/data/dictionary/{id}: get: tags: - STT Adapter operationId: GetAccountSTTDictionary summary: Get an STT dictionary x-athena-permission: stt:dictionary:read description: A global preset or one of the caller's own account dictionaries. parameters: - $ref: '#/components/parameters/XAccountSidHeader' - name: id in: path required: true schema: type: string responses: '200': description: The dictionary. content: application/json: schema: $ref: '#/components/schemas/STTDictionary' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound-4' '500': $ref: '#/components/responses/InternalError' patch: tags: - STT Adapter operationId: PatchAccountSTTDictionary summary: Update an STT dictionary x-athena-permission: stt:dictionary:write description: 'Updates one of the caller''s own dictionaries. Partial update: an omitted field preserves the current value. A global preset is operator-curated, so writing to one is refused. A name another live dictionary of the account holds for that language is refused.' parameters: - $ref: '#/components/parameters/XAccountSidHeader' - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchSTTDictionaryRequest' responses: '200': description: The updated dictionary. content: application/json: schema: $ref: '#/components/schemas/STTDictionary' '400': $ref: '#/components/responses/BadRequest-3' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound-4' '409': $ref: '#/components/responses/Conflict' '422': $ref: '#/components/responses/Unprocessable' '500': $ref: '#/components/responses/InternalError' delete: tags: - STT Adapter operationId: DeleteAccountSTTDictionary summary: Delete an STT dictionary x-athena-permission: stt:dictionary:manage description: Soft-deletes one of the caller's own dictionaries. A global preset is operator-curated, so deleting one is refused. parameters: - $ref: '#/components/parameters/XAccountSidHeader' - name: id in: path required: true schema: type: string responses: '204': description: Deleted '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound-4' '500': $ref: '#/components/responses/InternalError' /v1/a/adapters/tts/validation-rules: get: tags: - TTS Adapter operationId: ListTTSValidationRules summary: List speech text rules x-athena-permission: tts:voice:read description: The text rules of every speech engine offered to the caller, and the default rule of an engine that has no rule of its own. An engine the caller's feature flags withhold is absent. A limit applies to the text trimmed of spaces. parameters: - $ref: '#/components/parameters/XAccountSidHeader' responses: '200': description: The rules. content: application/json: schema: $ref: '#/components/schemas/TTSValidationRules' '400': $ref: '#/components/responses/BadRequest-3' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '500': $ref: '#/components/responses/InternalError' components: securitySchemes: bearerAuth: type: http scheme: bearer description: 'Carries a user session token or a user''s API key. By credential: - Session tokens come from `POST /v1/a/auth/regular` or a consumed magic link. - API keys are issued through the user and profile routes.' parameters: Limit: name: limit in: query description: Page size, max 500 (default 100). schema: type: integer maximum: 500 Offset: name: offset in: query schema: type: integer OrderBy: name: order_by in: query description: 'Sets the sort field: `created_at`, `name` or `is_published`. Values: - `created_at`: is the default. - `is_published`: with `desc`, puts the published scenarios first, newest first within each side.' schema: type: string Order: name: order in: query description: 'Sort direction: asc | desc (default desc). Anything else is refused.' schema: type: string TypeQuery: name: type in: query schema: type: string SidQuery: name: sid in: query schema: type: string NameQuery: name: name in: query schema: type: string description: 'Case-insensitive substring of the name. A `filter_or` search supersedes it: send both and this one is dropped.' FilterOr: name: filter_or in: query description: 'Names the fields, comma-separated, that filter_query OR-searches. Values: - `id`: matched exactly. - `name`: matched as a substring, case-insensitive.' schema: type: string FilterQuery: name: filter_query in: query description: Search term matched across the fields named in filter_or. Either one sent without the other is refused. schema: type: string IsPublishedQuery: name: is_published in: query description: 'Narrows the list by whether a version has been published. Values: - `false`: returns the scenarios that exist as a draft only. - Omitted: both are returned.' schema: type: boolean XAccountSidHeader: name: X-Account-Sid in: header required: false description: 'Names the target account for account-scoped resources. By principal: - A tenant API key carries no account scope of its own and names the account here. - An account-scoped principal may omit it. Refused when: - A tenant API key omits it. - An account-scoped principal sends a value naming any other account. - The named account belongs to another tenant. - The named account does not exist; it is answered as not found.' schema: type: string ScenarioIdPath: name: id in: path required: true schema: type: string ScenarioVersionScenarioSid: name: scenario_sid in: query required: true description: Scenario whose version records are listed. schema: type: string ScenarioVersionLimit: name: limit in: query description: Page size, max 500 (default 100). schema: type: integer maximum: 500 ScenarioVersionOffset: name: offset in: query schema: type: integer ScenarioVersionOrder: name: order in: query description: 'Sort direction: asc | desc (default desc). Anything else is refused.' schema: type: string ScenarioVersionOrderBy: name: order_by in: query description: 'Sort field. Accepted: created_at, version (default created_at).' schema: type: string ScenarioVersionDraft: name: draft in: query description: 'Selects the kind of record the list returns. Values: - `true`: lists draft records, by `draft_version`. - `false`: lists published versions, by `version`. - Omitted: lists both.' schema: type: boolean ScenarioVersionVersionFilter: name: version in: query description: Exact-match filter on the published axis number; AND-combined with the other list filters. schema: type: integer ScenarioVersionDraftVersionFilter: name: draft_version in: query description: Exact-match filter on the draft axis number; AND-combined with the other list filters. schema: type: integer ScenarioVersionFilterOr: name: filter_or in: query description: 'Names the fields to OR-search via `filter_query`, comma-separated. Values: - `id`: matched exactly. - `content_hash`: matched exactly.' schema: type: string ScenarioVersionFilterQuery: name: filter_query in: query description: Search term matched across the fields named in filter_or. Either one sent without the other is refused. schema: type: string ScenarioVersionByScenarioSid: name: scenario_sid in: query required: true description: Parent scenario whose version record is addressed. schema: type: string ScenarioVersionAxisNumber: name: version in: query required: true description: 'Addresses a record by its axis number. By `draft`: - `draft=false`: the number is the published `version`. - `draft=true`: the number is the `draft_version`. `draft_version` 0 is the current work-in-progress draft.' schema: type: integer ScenarioVersionByScenarioDraft: name: draft in: query description: 'Selects the axis; the default is `false`. Values: - `false`: selects the published record, where `version` equals the number. - `true`: selects the draft record, where `draft_version` equals the number.' schema: type: boolean NumberLimit: name: limit in: query description: Page size, max 500 (default 100). schema: type: integer maximum: 500 NumberOffset: name: offset in: query schema: type: integer NumberStatusQuery: name: status in: query schema: type: string NumberIdentifierQuery: name: identifier in: query schema: type: string description: Exact match on the whole identifier. Name `identifier` in `filter_or` to match a fragment of one. NumberPoolSidQuery: name: pool_sid in: query schema: type: string NumberFilterOr: name: filter_or in: query description: 'Comma-separated field names to OR-search via filter_query. Accepted: identifier, name (both substring, case-insensitive).' schema: type: string NumberFilterQuery: name: filter_query in: query description: Search term matched across the fields named in filter_or. schema: type: string NumberOrderBy: name: order_by in: query description: 'Sort field. Accepted: created_at, name, identifier (default created_at).' schema: type: string NumberOrder: name: order in: query description: 'Sort direction: asc | desc (default desc).' schema: type: string NumberIsUsed: name: is_used in: query description: 'Narrows the list by whether an agent already holds the number. Values: - `false`: returns the ones free for an agent to take. - Omitted: both are returned.' schema: type: boolean NumberInclude: name: include in: query description: 'Comma-separated related resources to resolve into `included`. Accepted: number_pool, agent.' schema: type: string NumberExternalIDPath: name: external_id in: path required: true schema: type: string NumberIdPath: name: id in: path required: true schema: type: string NumberPoolLimit: name: limit in: query description: Page size, max 500 (default 100). schema: type: integer maximum: 500 NumberPoolOffset: name: offset in: query schema: type: integer NumberPoolStatusQuery: name: status in: query schema: type: string NumberPoolFilterOr: name: filter_or in: query description: 'Names the fields, comma-separated, that filter_query OR-searches. Values: - `id`: matched exactly. - `name`: matched as a substring, case-insensitive.' schema: type: string NumberPoolFilterQuery: name: filter_query in: query description: Search term matched across the fields named in filter_or. schema: type: string NumberPoolOrderBy: name: order_by in: query description: 'Sort field. Accepted: created_at, name (default created_at).' schema: type: string NumberPoolOrder: name: order in: query description: 'Sort direction: asc | desc (default desc).' schema: type: string NumberPoolInclude: name: include in: query description: 'Comma-separated related resources to resolve into `included`. Accepted: number.' schema: type: string NumberPoolExternalIDPath: name: external_id in: path required: true schema: type: string NumberPoolIdPath: name: id in: path required: true schema: type: string CommunicationLimit: name: limit in: query schema: type: integer maximum: 500 description: Page size, max 500 (default 100). CommunicationOffset: name: offset in: query schema: type: integer CommunicationShowDeleted: name: show_deleted in: query schema: type: boolean description: Include soft-deleted rows when true. CommunicationFilterOr: name: filter_or in: query description: 'Names the fields, comma-separated, that filter_query OR-searches. Values: - `call_sid`: matched exactly. - `recipient`: matched as a substring, case-insensitive.' schema: type: string CommunicationFilterQuery: name: filter_query in: query description: Search term matched across the fields named in filter_or. schema: type: string CommunicationDraft: name: draft in: query schema: type: boolean description: 'Narrows the list by the kind of scenario version the run used. Values: - `true`: lists the runs on a draft, which have `draft_version` set. - `false`: lists the runs on a published version, which have `version` set. - Omitted: lists both kinds, and the calls of an agent not dialled yet, which have neither.' CommunicationVersion: name: version in: query schema: type: integer description: Published scenario version the run used. CommunicationDraftVersion: name: draft_version in: query schema: type: integer description: Draft scenario version the run used. CommunicationScenarioSid: name: scenario_sid in: query schema: type: string description: Filter by the scenario recorded on the communication. CommunicationAgentSid: name: agent_sid in: query schema: type: string CommunicationRecipientQuery: name: recipient in: query schema: type: string description: Exact match on the whole recipient as the communication records it; a dispatched phone number is recorded in the stored form, digits only. Name `recipient` in `filter_or` to match a fragment of one. CommunicationDirectionQuery: name: direction in: query schema: $ref: '#/components/schemas/CommunicationDirection' CommunicationCallSidQuery: name: call_sid in: query schema: type: string CommunicationStatusQuery: name: status in: query schema: $ref: '#/components/schemas/CommunicationStatus' CommunicationCallStatusQuery: name: call_status in: query schema: $ref: '#/components/schemas/CallStatus' CommunicationAutomationSid: name: automation_sid in: query description: Narrows the list to the calls one automation produced. schema: type: string CommunicationIsTest: name: is_test in: query schema: type: boolean CommunicationCreatedFrom: name: created_at_from in: query schema: type: string format: date-time CommunicationCreatedTo: name: created_at_to in: query schema: type: string format: date-time CommunicationDurationMin: name: duration_min in: query schema: type: integer description: Shortest call duration to return, in seconds, inclusive. CommunicationDurationMax: name: duration_max in: query schema: type: integer description: Longest call duration to return, in seconds, inclusive. CommunicationInclude: name: include in: query description: 'Comma-separated related resources to resolve into `included`. Accepted: agent, scenario, communication_result, contact, automation, automation_attempt.' schema: type: string CommunicationIdPath: name: id in: path required: true schema: type: string CommunicationHistoryMode: name: mode in: query schema: type: string description: 'Selects how the call history is returned; the default is `proxy`. Values: - `proxy`: streams the history JSON in the response body. - `url`: returns a presigned download link instead.' CommunicationHistoryExpire: 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.' CommunicationSpeechRecordingPath: name: path in: query required: true schema: type: string description: 'Names the recording by the storage reference the saved call history carries in `speech_recognition_recording`. Rules: - The reference is a `gs://` URI. - For a history saved before the URI form, the reference is a bucket-qualified path. Refused when: - The reference is unknown. - The reference is malformed. - The reference is out of scope.' CallAnalyticsPeriodQuery: name: period in: query required: true description: 'Sets the period the counts cover. Values: - `today`: counts by hour. - `30d`: counts by day. - `12m`: counts by month.' schema: $ref: '#/components/schemas/CallAnalyticsPeriod' CallAnalyticsGroupBy: name: group_by in: query description: 'Splits every bucket. Values: - `agent`: splits by agent. - `routing`: splits by the routing that chose the scenario of the call.' schema: $ref: '#/components/schemas/CallAnalyticsGroupBy' CallAnalyticsAgentSid: name: agent_sid in: query description: Narrows the counts to one agent of the account. schema: type: string CallAnalyticsIsTest: name: is_test in: query description: true counts test calls instead of customer calls. schema: type: boolean default: false CommunicationResultLimit: name: limit in: query description: Page size, max 500 (default 100). schema: type: integer format: int64 maximum: 500 CommunicationResultOffset: name: offset in: query schema: type: integer format: int64 CommunicationResultStatusQuery: name: status in: query schema: $ref: '#/components/schemas/CommunicationResultStatus' CommunicationResultCommunicationSidQuery: name: communication_sid in: query schema: type: string CommunicationResultInclude: name: include in: query description: 'Comma-separated related resources to resolve into `included`. Accepted: communication.' schema: type: string CommunicationResultIdPath: name: id in: path required: true schema: type: string ContactLimit: name: limit in: query description: Page size, max 500 (default 100). schema: type: integer maximum: 500 ContactOffset: name: offset in: query schema: type: integer ContactFilterOr: name: filter_or in: query description: 'Comma-separated field names to OR-search via filter_query. Accepted: number (substring, case-insensitive).' schema: type: string ContactFilterQuery: name: filter_query in: query description: Search term matched across the fields named in filter_or. schema: type: string ContactQuery: name: query in: query description: 'Narrows the set to the contacts an expression matches, for example `data.city = "Riga" AND last_call_at > 2026-10-01`. The expression: - A data field is written as `data.`, a nested one as `data.address.street`. - `id`, `number`, `created_at`, `updated_at` and `last_call_at` are written bare. - Comparisons are `=`, `!=`, `<`, `<=`, `>`, `>=`, `IN` and `NOT IN`, joined by `AND` and `OR` and grouped by parentheses. - `IN` takes a list of values in parentheses, `data.city IN ("Riga", "Tallinn")`, and matches when the field equals one of them. - `NOT IN` matches when the field equals none of them. - An `IN` or `NOT IN` list counts as one comparison. - A value is a number, `true` or `false`, a string in double quotes, a date `2026-10-01`, a time `18:00`, or a datetime in quotes `"2026-10-01 18:00"`. Rules: - Strings compare case-sensitively, byte by byte. - A date, a time and a datetime without an offset are read in the account''s timezone. - A data value is cast to the type of the value it is compared with, as JavaScript casts it. - A value that does not cast, an object and an array never match. - A data field a contact lacks, and `last_call_at` of a contact never called, read as the zero value of the type. - The expression applies together with every other filter. - An expression holds at most 10 comparisons and 2000 characters. Refused when: - A `data.` names a field no contact of the account holds. - A `data.` names a field that holds fields of its own, such as `data.address` when contacts hold `data.address.street`.' schema: type: string maxLength: 2000 ContactOrderBy: name: order_by in: query description: 'Sort field. Accepted: created_at, number (default created_at).' schema: type: string ContactOrder: name: order in: query description: 'Sort direction: asc | desc (default desc).' schema: type: string ContactInclude: name: include in: query description: 'Comma-separated related resources to resolve into `included`. Accepted: segment, segment_membership, source.' schema: type: string ContactSegmentIds: name: segment_ids in: query description: 'Narrows the set to the contacts in the given segments, named by comma-separated segment ids. Rules: - A contact in any of them qualifies. - Naming the account''s default segment matches every contact it holds. - An id naming no segment matches nothing rather than failing.' schema: type: string ContactDataOp: name: op in: query required: true description: Selects whether the request renames or removes. schema: $ref: '#/components/schemas/ContactDataOp' ContactExportFormat: name: format in: query description: 'File format. Accepted: csv (default). Any other value is refused.' schema: type: string ContactExportFields: name: fields in: query description: 'Lists the columns that follow the number, comma-separated, in the order given; the default is `number,data`. The accepted names are `id`, `number`, `data`, `created_at` and `updated_at`. Refused when: - A name is not on the list. - A name is repeated.' schema: type: string ContactExportLimit: name: limit in: query description: 'Accepted and ignored: an export is always the whole matching set.' schema: type: integer ContactExportOffset: name: offset in: query description: 'Accepted and ignored: an export is always the whole matching set.' schema: type: integer ContactExportInclude: name: include in: query description: 'Accepted and ignored: the file carries contacts only.' schema: type: string ContactExportIdPath: name: id in: path required: true schema: type: string ContactIdPath: name: id in: path required: true schema: type: string SegmentIsUsed: name: is_used in: query description: 'Narrows the list by whether a live automation already holds the segment. Values: - `false`: returns the segments free to be taken. - Omitted: both are returned.' schema: type: boolean SegmentShowDeleted: name: show_deleted in: query description: 'Sets whether deleted segments are returned. Values: - `true`: deleted segments are included, each carrying its `deleted_at`. - Omitted: only live segments are returned.' schema: type: boolean SegmentLimit: name: limit in: query description: Page size, max 500 (default 100). schema: type: integer maximum: 500 SegmentOffset: name: offset in: query schema: type: integer SegmentFilterOr: name: filter_or in: query description: 'Comma-separated field names to OR-search via filter_query. Accepted: name (substring, case-insensitive).' schema: type: string SegmentFilterQuery: name: filter_query in: query description: Search term matched across the fields named in filter_or. schema: type: string SegmentOrderBy: name: order_by in: query description: 'Sort field. Accepted: created_at, name (default created_at).' schema: type: string SegmentOrder: name: order in: query description: 'Sort direction: asc | desc (default desc).' schema: type: string SegmentInclude: name: include in: query description: 'Comma-separated related resources to resolve into `included`. Accepted: source, automation.' schema: type: string SegmentIdPath: name: id in: path required: true schema: type: string SourceStatusQuery: name: status in: query description: 'Narrows the list to the sources in one status: draft, published or removed. Omitted, every source is returned, removed ones included. A value that is not a status is refused.' schema: type: string SegmentIsConflicting: name: is_conflicting in: query description: 'Narrows the merged contacts by whether they are conflicting. Values: - `true`: returns only the ones whose rows disagree. - `false`: returns only the ones that agree. - Omitted: both are returned. The batch and source counts still cover the whole batch.' schema: type: boolean SegmentIsOverLimit: name: is_over_limit in: query description: 'Narrows the merged contacts by whether they would break a data limit of the account. Values: - `true`: returns only the contacts that would break a data limit. - `false`: returns only the others. - Omitted: both are returned. The batch and source counts still cover the whole batch.' schema: type: boolean SegmentSourceIdPath: name: source_id in: path required: true schema: type: string SourceContactIdPath: name: row_id in: path required: true schema: type: string AutomationLimit: name: limit in: query description: Page size, max 500 (default 100). schema: type: integer maximum: 500 AutomationOffset: name: offset in: query schema: type: integer AutomationAgentQuery: name: agent_sid in: query description: Narrows the list to one agent's automations. schema: type: string AutomationStatusQuery: name: status in: query description: 'Narrows the list to the automations in any of the given statuses. Rules: - The statuses are comma-separated. - Omitted, the list leaves out `archived`. - A value that is not a status is refused.' schema: type: string AutomationFilterOr: name: filter_or in: query description: 'Comma-separated field names to OR-search via filter_query. Accepted: name (substring, case-insensitive).' schema: type: string AutomationFilterQuery: name: filter_query in: query description: Search term matched across the fields named in filter_or. schema: type: string AutomationInclude: name: include in: query description: 'Comma-separated related resources to resolve into `included`. Accepted: agent, segment, limit_policy.' schema: type: string AutomationOrderBy: name: order_by in: query description: 'Sort field. Accepted: created_at, name (default created_at).' schema: type: string AutomationOrder: name: order in: query description: 'Sort direction: asc | desc (default desc).' schema: type: string AutomationIdPath: name: id in: path required: true schema: type: string AutomationAttemptInclude: name: include in: query description: 'Comma-separated related resources to resolve into `included`. Accepted: automation.' schema: type: string AutomationAttemptIdPath: name: attempt_id in: path required: true schema: type: string AutomationContactIdPath: name: contact_id in: path required: true schema: type: string LimitPolicyLimit: name: limit in: query description: Page size, max 500 (default 100). schema: type: integer maximum: 500 LimitPolicyOffset: name: offset in: query schema: type: integer LimitPolicyAgentQuery: name: agent_sid in: query description: Narrows the list to one agent's policies. schema: type: string LimitPolicyFilterOr: name: filter_or in: query description: 'Comma-separated field names to OR-search via filter_query. Accepted: name (substring, case-insensitive).' schema: type: string LimitPolicyFilterQuery: name: filter_query in: query description: Search term matched across the fields named in filter_or. schema: type: string LimitPolicyOrderBy: name: order_by in: query description: 'Sort field. Accepted: created_at, name (default created_at).' schema: type: string LimitPolicyOrder: name: order in: query description: 'Sort direction: asc | desc (default desc).' schema: type: string LimitPolicyInclude: name: include in: query description: 'Comma-separated related resources to resolve into `included`. Accepted: agent.' schema: type: string LimitPolicyIdPath: name: id in: path required: true schema: type: string AgentLimit: name: limit in: query description: Page size, max 500 (default 100). schema: type: integer maximum: 500 AgentOffset: name: offset in: query schema: type: integer AgentStatusQuery: name: status in: query description: Comma-separated statuses; an agent in any of them qualifies. Omitted, the list leaves out `archived`. A value that is not a status is refused. schema: type: string AgentScenarioSidQuery: name: scenario_sid in: query schema: type: string AgentNumberSidQuery: name: number_sid in: query description: Narrows the list to the agent whose gateway is this number. An unknown number gives an empty list. schema: type: string AgentNumberPoolSidQuery: name: number_pool_sid in: query description: Narrows the list to the agent whose gateway is this number pool. An unknown pool gives an empty list. schema: type: string AgentSmsProviderSidQuery: name: sms_provider_sid in: query description: Narrows the list to the agents that send SMS through this provider. An unknown provider gives an empty list. schema: type: string AgentFilterOr: name: filter_or in: query description: 'Names the fields, comma-separated, that filter_query OR-searches. Values: - `id`: matched exactly. - `name`: matched as a substring, case-insensitive.' schema: type: string AgentFilterQuery: name: filter_query in: query description: Search term matched across the fields named in filter_or. schema: type: string AgentOrderBy: name: order_by in: query description: 'Sort field. Accepted: created_at (default created_at).' schema: type: string AgentOrder: name: order in: query description: 'Sort direction: asc | desc (default desc).' schema: type: string AgentInclude: name: include in: query description: 'Comma-separated related resources to resolve into `included`. Accepted: scenario, number, number_pool, automation, sms_provider.' schema: type: string AgentIdPath: name: id in: path required: true schema: type: string RoutingIdPath: name: routing_id in: path required: true schema: type: string SmsProviderLimit: name: limit in: query description: Page size, max 500 (default 100). schema: type: integer maximum: 500 SmsProviderOffset: name: offset in: query schema: type: integer SmsProviderStatusQuery: name: status in: query schema: type: string SmsProviderAccessTypeQuery: name: access_type in: query description: 'Restrict the listing to one administrator: account or tenant. Omit it to list both.' schema: type: string SmsProviderFilterOr: name: filter_or in: query description: 'Names the fields, comma-separated, that filter_query OR-searches. Values: - `id`: matched exactly. - `name`: matched as a substring, case-insensitive.' schema: type: string SmsProviderFilterQuery: name: filter_query in: query description: Search term matched across the fields named in filter_or. schema: type: string SmsProviderOrderBy: name: order_by in: query description: 'Sort field. Accepted: created_at (default created_at).' schema: type: string SmsProviderOrder: name: order in: query description: 'Sort direction: asc | desc (default desc).' schema: type: string SmsProviderIdPath: name: id in: path required: true 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.' 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 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 Slug: name: slug in: path required: true schema: $ref: '#/components/schemas/Slug' Version: name: version in: path required: true schema: type: integer minimum: 1 AthenaAccountSidHeader: description: Target account for principals broader than one account (tenant / account API key); account-scoped principals use their own. in: header name: X-Account-Sid required: false schema: type: string 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 LanguageQuery: name: language in: query required: false description: Filter models by language code (e.g. en, de, pl). schema: type: string 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 StreamIdPath: name: id in: path required: true description: Chat stream id. schema: type: string PartsBehaviorQuery: name: parts_behavior in: query required: false schema: type: string enum: - on_finish_get_all - on_finish_get_sentence ActionPath: name: action in: path required: true description: Stream lifecycle action. schema: type: string enum: - commit - cancel Engine: name: engine in: path required: true description: TTS engine selector. schema: type: string enum: - polly - azure - gc - ya_v3 - techmo - elevenlabs - alfanum - voxtream - kugel Voice: name: voice in: query required: false description: Voice id. Short alias `v`. schema: type: string Language: name: language in: query required: false description: Language code. Short alias `l`. schema: type: string Text: name: text in: query required: false description: Plain text to synthesize. Required unless `text_b64` is set. schema: type: string TextB64: name: text_b64 in: query required: false description: Base64-encoded text. Required unless `text` is set. schema: type: string Speed: name: speed in: query required: false description: Speech speed. Short alias `s`. schema: type: string Format: name: format in: query required: false description: Audio format. Short alias `f`. Defaults to `mp3`. schema: type: string default: mp3 SampleRate: name: sampleRate in: query required: false description: Sample rate in Hz. Short alias `sr`. schema: type: integer Model: name: model in: query required: false description: Provider model. Short alias `m`. schema: type: string Fallback: name: fallback in: query required: false description: Allow voice fallback. Short alias `fb`. Defaults to `true`. schema: type: boolean default: true VoiceAlias: name: v in: query required: false description: Short alias for `voice`. schema: type: string LanguageAlias: name: l in: query required: false description: Short alias for `language`. schema: type: string SpeedAlias: name: s in: query required: false description: Short alias for `speed`. schema: type: string FormatAlias: name: f in: query required: false description: Short alias for `format`. schema: type: string SampleRateAlias: name: sr in: query required: false description: Short alias for `sampleRate`. schema: type: integer ModelAlias: name: m in: query required: false description: Short alias for `model`. schema: type: string FallbackAlias: name: fb in: query required: false description: Short alias for `fallback`. schema: type: boolean AdvancedSettings: name: advanced_settings in: query required: false description: 'Provider-specific free-form synthesis settings, supplied as dot-delimited nested query keys of the form `advanced_settings.
.=` (alias prefix `as`), e.g. `as.s.param1=100`. The keys are flattened into a nested object per section; the accepted sections and keys are provider-specific.' schema: type: object additionalProperties: true SkipUriLengthValidation: name: skip_uri_length_validation in: query required: false description: Skip the freeswitch URI length guard when `true`. schema: type: boolean schemas: ScenarioType: type: string enum: - constructor 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' Scenario: type: object required: - id - type - name - template - description - account_sid - constructor - fix_communication_ttl - is_shared_for_copy - created_at - updated_at - version - draft_exists - is_published properties: id: type: string type: $ref: '#/components/schemas/ScenarioType' name: type: string template: type: string description: type: string account_sid: type: string constructor: anyOf: - $ref: '#/components/schemas/Constructor' - type: 'null' fix_communication_ttl: type: integer is_shared_for_copy: type: boolean description: 'Shares the scenario for read and copy with other accounts of the owning tenant. Rules: - The permission of each operation still applies. - Outside the owning tenant, the scenario is absent. - Writes are unaffected. - `GET /v1/a/scenario` still lists the caller''s own account alone. - A shared scenario does resolve into another resource''s `included` map.' created_at: type: string format: date-time updated_at: type: string format: date-time version: type: integer draft_exists: type: boolean is_published: type: boolean description: Says whether a version has been published. false while the scenario exists as a draft only. ScenarioList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/Scenario' total: type: integer format: int64 description: Counts the scenarios 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' CreateScenarioRequest: type: object required: - type - name properties: type: $ref: '#/components/schemas/ScenarioType' name: type: string template: type: string fix_communication_ttl: type: integer is_shared_for_copy: type: boolean constructor: $ref: '#/components/schemas/Constructor' draft: type: boolean description: 'Creates the scenario unpublished when true. Rules: - The content is saved as its work-in-progress draft. - `version` stays 0 until the first publish.' validate: type: boolean default: true description: 'Gates two independent checks. The checks: - Constructor content validation is honoured only together with `draft: true`. When false, an incomplete work-in-progress draft is saved. - Classifier readiness is honoured on a publish. When false, the publish is not blocked by a referenced classifier version that is not trained. A publish always validates content, whatever the value.' DeleteScenarioResponse: type: object required: - code - reason properties: code: type: string reason: type: string PatchScenarioRequest: type: object description: 'Carries a partial update of the scenario. Rules: - An omitted field preserves the current value. - `type`, `name` and `constructor` cannot be unset. - With `draft: true`, the write is saved to the work-in-progress draft, and the published state stays unchanged. - Without `draft: true`, the write is a publish. Refused when: - `type` is empty. - `name` is empty. - `constructor` is an explicit `null`. - `constructor` carries none of `bricks`, `forest` or `properties`.' properties: type: $ref: '#/components/schemas/ScenarioType' name: type: string template: type: string fix_communication_ttl: type: integer is_shared_for_copy: type: boolean constructor: anyOf: - $ref: '#/components/schemas/Constructor' - type: 'null' x-go-type: nullable.Nullable[Constructor] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true draft: type: boolean validate: type: boolean default: true description: 'Gates two independent checks. The checks: - Constructor content validation is honoured only together with `draft: true`. When false, an incomplete work-in-progress draft is saved. - Classifier readiness is honoured on a publish. When false, the publish is not blocked by a referenced classifier version that is not trained. A publish always validates content, whatever the value.' PlaceholdersResponse: type: object required: - placeholders properties: placeholders: type: array items: type: string WebhookRunRequest: type: object required: - properties description: 'Carries the brick configuration to run, in the shape the brick stores it. Refused when: - The configuration has no `request.url`. - The configuration has no `request.method`. - The response mapping names a `source` other than `body` or `header`. - The response mapping names a `path` that does not parse for that source. On a refusal, nothing is sent.' properties: properties: $ref: '#/components/schemas/ConstructorWebhookV1Properties' storage: type: object description: Holds the test variable values placeholders are compiled against. A `{{contact.}}` placeholder is read from the `contact` value, which holds the contact's data as JSON text. additionalProperties: type: string WebhookRunRedirect: type: object required: - code - url - method properties: code: type: integer url: type: string method: type: string WebhookRunResponse: type: object required: - http_status_code - http_status_text - headers - body - duration properties: http_status_code: type: integer http_status_text: type: string headers: type: - object - 'null' additionalProperties: type: array items: type: string body: type: string duration: type: integer description: Reports the round-trip duration in milliseconds. WebhookRunResult: type: object required: - status - error - variables - curl - redirects - response properties: status: type: string description: Reports the outcome the scenario would branch on — `processed` or `fail`. error: type: string description: Carries the failure detail; empty when the outcome is `processed`. variables: type: - object - 'null' description: Variables the response mapping extracted. additionalProperties: type: string curl: type: string description: Reproduces the request as a curl command. redirects: type: - array - 'null' items: $ref: '#/components/schemas/WebhookRunRedirect' response: description: Carries the response received; `null` when the target never answered. anyOf: - $ref: '#/components/schemas/WebhookRunResponse' - type: 'null' ValidateScenarioRequest: type: object required: - type - name properties: type: $ref: '#/components/schemas/ScenarioType' name: type: string constructor: $ref: '#/components/schemas/Constructor' ScenarioValidation: type: object required: - valid properties: valid: type: boolean description: Reports that the body passes every check of a publish; always true, because a body that fails a check is refused. SystemVariable: type: object required: - name - writable properties: name: type: string description: Written without the `{{ }}` of a placeholder. writable: type: boolean description: Says whether a scenario may write to the variable. SystemVariablesResponse: type: object required: - system_variables properties: system_variables: type: array items: $ref: '#/components/schemas/SystemVariable' BrickValidationRequest: type: object required: - type - version - brick properties: type: type: string description: Names the brick type, a key of `constructor.bricks`. version: type: string description: Names the brick version, a key under that type. brick: type: object additionalProperties: true description: Carries the brick in the shape a scenario stores it under `constructor.bricks..`. ScenarioVersionSnapshot: type: object required: - name properties: name: type: string constructor: anyOf: - $ref: '#/components/schemas/Constructor' - type: 'null' ScenarioVersion: type: object required: - id - scenario_sid - content_hash - snapshot - created_at description: 'Holds either a published version or a draft record. Rules: - Exactly one of `version` and `draft_version` is set. - `version` is set on a published version. - `draft_version` 0 is the mutable work-in-progress draft. - A `draft_version` above 0 is a frozen draft record.' properties: id: type: string scenario_sid: type: string version: type: - integer - 'null' draft_version: type: - integer - 'null' content_hash: type: string description: Identifies the content of the record. Node positions and the order of brick outputs are not content. snapshot: $ref: '#/components/schemas/ScenarioVersionSnapshot' created_at: type: string format: date-time ScenarioVersionList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/ScenarioVersion' total: type: integer format: int64 description: Counts the versions 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. DeleteScenarioVersionResponse: type: object required: - code - reason properties: code: type: string reason: type: string NumberStatus: type: string enum: - active - inactive x-enum-varnames: - NumberStatusActive - NumberStatusInactive Number: type: object required: - id - account_sid - identifier - name - external_id - pool_sid - status - is_used - agent_sid - created_at - updated_at properties: id: type: string account_sid: type: string identifier: type: string name: type: string external_id: type: string description: Carries the key the client system provisioning this number assigned to it. Unique among the account's live numbers when set. pool_sid: type: - string - 'null' status: $ref: '#/components/schemas/NumberStatus' is_used: type: boolean description: 'Says whether an agent already holds this number. Rules: - Only an active or inactive agent counts as holding it. - Archiving that agent releases it. - An agent that reaches the number only through its pool does not hold it.' agent_sid: type: - string - 'null' description: Identifies the agent that holds this number; null while none does. created_at: type: string format: date-time updated_at: type: string format: date-time NumberPoolStatus: type: string enum: - active - inactive x-enum-varnames: - NumberPoolStatusActive - NumberPoolStatusInactive NumberPool: type: object required: - id - account_sid - name - external_id - status - created_at - updated_at properties: id: type: string account_sid: type: string name: type: string external_id: type: string description: Carries the key the client system provisioning this pool assigned to it. Unique among the account's live pools when set. status: $ref: '#/components/schemas/NumberPoolStatus' created_at: type: string format: date-time updated_at: type: string format: date-time AgentGatewayType: type: string enum: - number - number_pool x-enum-varnames: - AgentGatewayTypeNumber - AgentGatewayTypeNumberPool description: 'Declares the gateway kind. Rules: - The matching sid (`number_sid` / `number_pool_sid`) carries the gateway. - The other sid stays empty. Any other combination of the sids is refused.' CallingScheduleStrategy: type: string enum: - default x-enum-varnames: - CallingScheduleStrategyDefault description: How `args` is read. `default` reads `args.schedules` as cron expressions. CallingScheduleArgs: type: object required: - schedules properties: schedules: type: array minItems: 1 items: type: string description: 'Lists five-field cron expressions (minute, hour, day of month, month, day of week). Rules: - A call may be placed in any minute at least one of them matches: for example `* 8-19 * * 1-5` is 08:00–19:59, Monday to Friday. - At least one is required.' CallingSchedule: type: object required: - strategy - args description: 'Restricts when the agent''s calls are placed: only inside the minutes its schedules name, read in the agent''s `timezone`. Rules: - A call that comes due outside them is held and placed when they next open. - Absent, the platform default applies: 08:00–19:59 every day. - Test calls are not held by it. Refused when: - The `strategy` is unknown. - The value holds no schedule. - A schedule does not parse.' properties: strategy: $ref: '#/components/schemas/CallingScheduleStrategy' args: $ref: '#/components/schemas/CallingScheduleArgs' CommunicationResultTarget: type: object properties: url: type: string CommunicationResultConfig: type: object properties: targets: type: array items: $ref: '#/components/schemas/CommunicationResultTarget' AgentSms: type: object required: - provider_sid description: 'Sets the SMS routing: the provider to send through and the sender. The sender: - With `use_alpha`, it is one of the provider''s alphas. - Otherwise, it is one of the provider''s numbers. - It is always an explicitly registered value.' properties: provider_sid: type: string use_alpha: type: boolean alpha: type: string description: Sets the sender alpha. Required when use_alpha is true; one of the provider's alphas. number: type: string description: Sets the sender number. Required when use_alpha is false; one of the provider's numbers. AgentStatus: type: string enum: - active - inactive - archived x-enum-varnames: - AgentStatusActive - AgentStatusInactive - AgentStatusArchived description: 'Declares the agent''s status. Values: - `inactive`: pauses the agent; it keeps its number or pool, its name and its `lines`. - `archived`: is final and is reached only through archive; written in a create or a patch, it is refused.' AgentStatusChange: type: object required: - from - to - at properties: from: $ref: '#/components/schemas/AgentStatus' to: $ref: '#/components/schemas/AgentStatus' at: type: string format: date-time Agent: type: object required: - id - account_sid - name - gateway_type - number_sid - number_pool_sid - scenario_sid - voicemail_enabled - call_recording - calling_schedule - timezone - lines - is_test - communication_result - sms - status - status_changed_at - status_history - old_number - old_number_pool - created_at - updated_at properties: id: type: string account_sid: type: string name: type: string description: Unique among the agents of the account that are not archived; archiving or deleting an agent frees its name. gateway_type: $ref: '#/components/schemas/AgentGatewayType' number_sid: type: - string - 'null' number_pool_sid: type: - string - 'null' scenario_sid: type: string voicemail_enabled: type: boolean deprecated: true description: Turns on answering machine detection for the agent's outbound calls on a scenario whose start call brick is v1. call_recording: type: boolean calling_schedule: description: Null when the agent has no window of its own; the platform default (08:00–19:59 every day) then applies. anyOf: - $ref: '#/components/schemas/CallingSchedule' - type: 'null' timezone: type: string description: Names the IANA zone the calling window is read in, such as `Europe/Warsaw`. When empty, the account's zone applies. lines: type: integer description: Simultaneous calls this agent holds, answered and placed together. is_test: type: boolean communication_result: anyOf: - $ref: '#/components/schemas/CommunicationResultConfig' - type: 'null' sms: anyOf: - $ref: '#/components/schemas/AgentSms' - type: 'null' status: $ref: '#/components/schemas/AgentStatus' status_changed_at: type: string format: date-time description: Records when `status` last changed. status_history: type: array description: Records every change of `status`, oldest first. items: $ref: '#/components/schemas/AgentStatusChange' old_number: type: - string - 'null' description: 'Records the `identifier` of the number the agent held when it was archived. Null when: - The agent is not archived yet. - The agent is on a pool.' old_number_pool: type: - string - 'null' description: 'Records the name of the pool the agent used when it was archived. Null when: - The agent is not archived yet. - The agent is on a number.' created_at: type: string format: date-time updated_at: type: string format: date-time NumberIncluded: type: object description: 'Carries the related resources resolved for this response, one map per relation under the relation''s name, keyed by the related resource''s own id (`included.number_pool[id]`, `included.agent[agent_sid]`). Rules: - A relation''s map is present whenever it was requested. - A requested relation''s map is empty when nothing resolved. - A reference the caller may not read is absent from the map, and the number keeps its sid.' properties: number_pool: type: object additionalProperties: $ref: '#/components/schemas/NumberPool' agent: type: object additionalProperties: $ref: '#/components/schemas/Agent' NumberList: type: object required: - items - total - limit - offset - has_more - included properties: items: type: array items: $ref: '#/components/schemas/Number' total: type: integer format: int64 description: Counts the numbers 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. included: $ref: '#/components/schemas/NumberIncluded' CreateNumberRequest: type: object required: - identifier properties: identifier: type: string pattern: ^[a-zA-Z0-9] description: Starts with a letter or digit. name: type: string external_id: type: string pool_sid: type: - string - 'null' status: $ref: '#/components/schemas/NumberStatus' NumberRead: description: The full number plus `included`, the pool `include=number_pool` and the holding agent `include=agent` resolved for it; `{}` when none was asked for. allOf: - $ref: '#/components/schemas/Number' - type: object required: - included properties: included: $ref: '#/components/schemas/NumberIncluded' PatchNumberRequest: type: object description: 'Carries a partial update of the number. Rules: - An omitted field preserves the current value. - `pool_sid`: an explicit `null` detaches the number from its pool. - `external_id`: an explicit empty value clears it.' properties: identifier: type: string pattern: ^[a-zA-Z0-9] description: Starts with a letter or digit. name: type: string external_id: type: string pool_sid: type: - string - 'null' x-go-type: nullable.Nullable[string] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true status: $ref: '#/components/schemas/NumberStatus' NumberPoolIncluded: type: object description: 'Carries the related resources resolved for this response, one map per relation under the relation''s name, keyed by the related resource''s own id (`included.number[id]`). Rules: - A to-many relation is keyed the same way, and each number carries its `pool_sid`. - A relation''s map is present whenever it was requested. - A requested relation''s map is empty when nothing resolved. - A reference the caller may not read is absent from the map, and the pool keeps its sid.' properties: number: type: object additionalProperties: $ref: '#/components/schemas/Number' NumberPoolList: type: object required: - items - total - limit - offset - has_more - included properties: items: type: array items: $ref: '#/components/schemas/NumberPool' total: type: integer format: int64 description: Counts the pools 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. included: $ref: '#/components/schemas/NumberPoolIncluded' CreateNumberPoolRequest: type: object required: - name properties: name: type: string external_id: type: string status: $ref: '#/components/schemas/NumberPoolStatus' NumberPoolRead: description: The full pool plus `included`, the members `include=number` resolved for it; `{}` when none were asked for. allOf: - $ref: '#/components/schemas/NumberPool' - type: object required: - included properties: included: $ref: '#/components/schemas/NumberPoolIncluded' PatchNumberPoolRequest: type: object description: 'Carries a partial update of the number pool. Rules: - An omitted field preserves the current value. - An explicit empty `external_id` clears it.' properties: name: type: string external_id: type: string status: $ref: '#/components/schemas/NumberPoolStatus' CommunicationDirection: type: string enum: - inbound - outbound x-enum-varnames: - CommunicationDirectionInbound - CommunicationDirectionOutbound CommunicationStatus: type: string description: 'Where the call stands. `stopped` is the one that is not an outcome: the call was asked for and never placed, because the work that asked for it was switched off first, so the person is still to reach. `in_progress_offline` is a call that has ended while its scenario still runs the bricks that need no call; the line is free, and the outcome follows when the scenario ends.' enum: - new - ready - dialing - in_progress - in_progress_offline - bounced - done - failed - drifted - stopped x-enum-varnames: - CommunicationStatusNew - CommunicationStatusReady - CommunicationStatusDialing - CommunicationStatusInProgress - CommunicationStatusInProgressOffline - CommunicationStatusBounced - CommunicationStatusDone - CommunicationStatusFailed - CommunicationStatusDrifted - CommunicationStatusStopped CallStatus: type: string description: 'Reports the telephony state of the call. Values: - `trying`, `ringing` and `answered` are transient: the call is still running. - Every other value is final. - `abandoned`: is an inbound call the caller ended before it was answered.' enum: - trying - ringing - answered - busy - rejected - no_answer - voicemail - incomplete - completed - failed - tech_canceled - abandoned x-enum-varnames: - CallStatusTrying - CallStatusRinging - CallStatusAnswered - CallStatusBusy - CallStatusRejected - CallStatusNoAnswer - CallStatusVoicemail - CallStatusIncomplete - CallStatusCompleted - CallStatusFailed - CallStatusTechCanceled - CallStatusAbandoned CommunicationStatusChange: type: object required: - from - to - at properties: from: $ref: '#/components/schemas/CommunicationStatus' to: $ref: '#/components/schemas/CommunicationStatus' reason: type: string call_sid: type: string at: type: string format: date-time CallStatusChange: type: object description: One change of `call_status`. required: - from - to - at properties: from: description: Null on the first change, when the call had no telephony state yet. anyOf: - $ref: '#/components/schemas/CallStatus' - type: 'null' to: $ref: '#/components/schemas/CallStatus' reason: type: string description: Explains why the call moved to this state; absent when the change had no reason. at: type: string format: date-time CommunicationNumber: type: object description: A copy of the number as it stood at call time. A later edit or delete of the number or the pool does not change it. required: - sid - identifier - pool_sid - pool_name properties: sid: type: string description: Identifies the number the call used. Kept after the number is deleted. identifier: type: string description: Records the number's identifier at call time. pool_sid: type: - string - 'null' description: Identifies the agent's pool the number belongs to; null when the call did not go through a pool. pool_name: type: - string - 'null' description: Records the pool's name at call time. CommunicationResultPayload: type: object description: The call as it stood when it finished. A later change to the call does not change it. The body each target receives also carries download links for the recording and the call history, made fresh at every send. required: - communication_sid - account_sid - call_sid - recipient - direction - scenario_sid - version - draft_version - communication_status - call_status - reason - duration - variables - occurred_at properties: communication_sid: type: string account_sid: type: string call_sid: type: - string - 'null' recipient: type: string direction: $ref: '#/components/schemas/CommunicationDirection' scenario_sid: type: - string - 'null' description: Names the scenario the call ran. version: type: - integer - 'null' description: Names the published scenario version the call ran; null when it ran a draft. draft_version: type: - integer - 'null' description: Names the draft scenario version the call ran; null when it ran a published version. communication_status: $ref: '#/components/schemas/CommunicationStatus' call_status: anyOf: - $ref: '#/components/schemas/CallStatus' - type: 'null' reason: type: string duration: type: integer description: Reports the call duration between answer and hangup, in seconds. variables: type: object additionalProperties: true description: Carries the call's `variables`. occurred_at: type: string format: date-time description: Records when the call reached its final status. CommunicationRoutingPlanRoute: type: object required: - position - routing_id - name - expression - passed properties: position: type: integer description: Records the place of the routing in the agent's list at that moment. routing_id: type: string name: type: string description: Records the name of the routing at that moment. expression: type: - string - 'null' description: Records the condition at that moment. Null on the default routing. passed: type: boolean description: Records whether the routing took the call. skipped: type: string enum: - draft description: 'Records why a routing whose condition matched did not take the call. `draft`: the call is not a test and the routing''s scenario has no published version.' CommunicationRoutingPlan: type: object required: - variables - routes properties: variables: type: object additionalProperties: true description: Records the value of every field the checked conditions read, as it was compared, nested by the parts of the field name. The moment `now` is at `now.datetime`. routes: type: array description: Lists the routings checked, in order, up to the one that took the call, which is always last. items: $ref: '#/components/schemas/CommunicationRoutingPlanRoute' Communication: type: object required: - id - account_sid - agent_sid - scenario_sid - automation_sid - contact_sid - version - draft_version - automation_attempt_sid - recipient - direction - communication_status - call_status - reason - data - variables - communication_status_history - call_status_history - scheduled_at - timezone - next_call_at - call_attempt_number - executor_id - call_sid - duration - is_test - prefer_draft - consent_granted - has_recording - has_call_history - number - result_payload - routing_sid - routing_plan - created_at - updated_at properties: id: type: string account_sid: type: string agent_sid: type: string scenario_sid: type: string description: 'Names the scenario the communication runs. Empty on a call of an agent that is not dialled or answered yet: the agent''s routings choose its scenario then.' automation_sid: type: - string - 'null' description: Names the automation that produced this call. Empty for a call no automation placed. contact_sid: type: - string - 'null' description: Names the person this call is for. Empty where the other party could not be identified as a contact. version: type: - integer - 'null' description: Names the published scenario version; null when the run used a draft, and on a call of an agent that is not dialled or answered yet. draft_version: type: - integer - 'null' description: Names the draft scenario version; null when the run used a published version. At most one of version / draft_version is set. automation_attempt_sid: type: - string - 'null' description: Names the run within that automation. Empty for a call no run produced. recipient: type: string direction: $ref: '#/components/schemas/CommunicationDirection' communication_status: $ref: '#/components/schemas/CommunicationStatus' call_status: anyOf: - $ref: '#/components/schemas/CallStatus' - type: 'null' reason: type: string description: 'Explains why the communication reached its current status. Values: - `agent_at_capacity`: is a stable token for a call refused because the agent was at capacity. - `no_published_routing`: is a stable token for an outbound call through an agent that is not a test and found no routing with a published scenario. The call is `failed` and is not retried. - `no_number_to_dial_from`: is a stable token for a call with no number to dial from. The call is `failed` and is not retried. - Every other value is free text. Rules: - It is taken from the last status change that gave a reason. - A move to `ready` clears it.' data: type: - object - 'null' additionalProperties: true variables: type: - object - 'null' additionalProperties: true description: 'Records the variables the call ended with; null until the call reaches a final status. `call.dialog-TEXT`, `call.dialog-BASE64` and the system variables of the last and the current brick (`last_question.*`, `last_webhook.*` and the other `last_.*` families, `current_brick.*`) are not kept. `contact` holds the contact''s data as JSON text, the fields the call wrote included: `{{contact.first_name}}` in a brick is `first_name` inside it.' communication_status_history: type: array description: Records every change of `communication_status`, oldest first. items: $ref: '#/components/schemas/CommunicationStatusChange' call_status_history: type: array description: Records every change of `call_status`, oldest first; `[]` while the call has no telephony state. items: $ref: '#/components/schemas/CallStatusChange' scheduled_at: type: - string - 'null' format: date-time timezone: type: string description: 'Names the IANA zone the calling window is read in: the agent''s, else the account''s. Rules: - The field is empty on an inbound call. - The field is empty when neither the agent nor the account names one. - When the field is empty, the window is read in UTC.' next_call_at: type: string format: date-time description: 'Records the earliest moment the dispatcher may place the call; the moment is a floor, not a schedule. Rules: - The moment is `scheduled_at` or the creation time. - After a bounce, the retry backoff sets the moment. - The call is never placed before this moment. - A call that is due outside the agent''s calling window is moved to the window''s next opening when it is claimed.' call_attempt_number: type: integer executor_id: type: - string - 'null' call_sid: type: - string - 'null' duration: type: integer description: Reports the call duration between answer and hangup, in seconds; 0 until the call completes. is_test: type: boolean description: Says whether this is a test communication. prefer_draft: type: boolean description: Says whether the test call asked for the draft of its scenario first. `draft_version` says whether it played one. consent_granted: type: boolean description: Says whether personal-data recording consent was granted for the call. has_recording: type: boolean description: Says whether a stored call recording exists for this communication. has_call_history: type: boolean description: 'Says whether a saved call history exists for this communication: the document `GET /v1/a/communication/{id}/history` serves.' number: description: 'Records the account''s number the call went out from or came in on. A communication created before this field existed carries its agent''s number from that time as a best guess. Null when: - The call is not placed or answered yet. - A communication created before this field existed has no agent.' anyOf: - $ref: '#/components/schemas/CommunicationNumber' - type: 'null' result_payload: description: 'Records the call''s result, set once when the call reaches `done`, `failed` or `drifted`. Null when: - The call has not reached one of these statuses yet. - The call is `stopped`. - The call finished before this field existed.' anyOf: - $ref: '#/components/schemas/CommunicationResultPayload' - type: 'null' routing_sid: type: - string - 'null' description: 'Names the routing of the agent that chose the scenario of the call, the default routing included. Null when: - The call has no agent. - The call is a scenario test call. - The call of an agent is not dialled yet. - The call was placed before routing existed.' routing_plan: description: Records how the agent's routings chose the scenario of the call. Null whenever `routing_sid` is null. anyOf: - $ref: '#/components/schemas/CommunicationRoutingPlan' - type: 'null' created_at: type: string format: date-time updated_at: type: string format: date-time ScenarioEmbed: type: object description: 'A scenario as embedded in another resource''s `included` map: every Scenario field except `constructor`. Read `GET /v1/a/scenario/{id}` for the constructor.' required: - id - type - name - template - description - account_sid - fix_communication_ttl - is_shared_for_copy - created_at - updated_at - version - draft_exists - is_published properties: id: type: string type: $ref: '#/components/schemas/ScenarioType' name: type: string template: type: string description: type: string account_sid: type: string fix_communication_ttl: type: integer is_shared_for_copy: type: boolean created_at: type: string format: date-time updated_at: type: string format: date-time version: type: integer draft_exists: type: boolean is_published: type: boolean description: Says whether a version has been published. false while the scenario exists as a draft only. CommunicationResultStatus: type: string enum: - new - in_progress - delivered - undelivered - failed x-enum-varnames: - CommunicationResultStatusNew - CommunicationResultStatusInProgress - CommunicationResultStatusDelivered - CommunicationResultStatusUndelivered - CommunicationResultStatusFailed DeliveryAttempt: type: object required: - at properties: at: type: string format: date-time http_status: type: integer error: type: string CommunicationResult: type: object required: - id - communication_sid - account_sid - target_url - status - attempts - next_attempt_at - status_changed_at - last_error - last_response_status - history - delivered_at - created_at - updated_at properties: id: type: string communication_sid: type: string account_sid: type: string target_url: type: string status: $ref: '#/components/schemas/CommunicationResultStatus' attempts: type: integer next_attempt_at: type: string format: date-time status_changed_at: type: string format: date-time last_error: type: string last_response_status: type: - integer - 'null' history: type: - array - 'null' items: $ref: '#/components/schemas/DeliveryAttempt' delivered_at: type: - string - 'null' format: date-time created_at: type: string format: date-time updated_at: type: string format: date-time StoredNumber: type: string description: 'Identifies the contact within the account, in the stored form. By type: - A phone number is stored as its country calling code followed by the national number, digits only (`37123112233`). - A SIP identifier is stored as it was sent.' IdentifierType: type: string enum: - number - alphanumeric x-enum-varnames: - IdentifierTypeNumber - IdentifierTypeAlphanumeric description: 'Declares what an identifier is. Values: - `number`: is a phone number, brought to the stored form before it is kept or compared. - `alphanumeric`: is a SIP identifier, kept as sent and checked only to start with a letter or a digit. A request that omits it means `number`, and a value outside the two is refused.' RecordedIdentifierType: anyOf: - $ref: '#/components/schemas/IdentifierType' - type: 'null' description: The identifier type the stored value was read as; `null` where the platform holds none. RecordedCountryCode: type: - string - 'null' description: 'Records the country the stored number belongs to, ISO 3166-1 alpha-2, lowercase. Null when: - The identifier is alphanumeric. - The number is outside any country''s range. - The platform holds no country for the number.' ContactRevision: type: string description: Hash of the contact's current `number`, `type`, `country_code` and `data`. An edit sends it back to prevent a lost update under concurrent writes. ContactListItem: type: object description: A contact as it appears in a list, without the `communication_history` array. Read `GET /v1/a/contact/{id}` for a contact's full record. required: - id - account_sid - number - type - country_code - data - revision - segment_sids - created_at - updated_at properties: id: type: string account_sid: type: string description: Names the account that owns the contact. number: $ref: '#/components/schemas/StoredNumber' type: $ref: '#/components/schemas/RecordedIdentifierType' country_code: $ref: '#/components/schemas/RecordedCountryCode' data: type: object additionalProperties: true description: Holds everything the account has on the person; `{}` when nothing is held. revision: $ref: '#/components/schemas/ContactRevision' segment_sids: type: array items: type: string description: Lists the account's segments this contact is currently in, its default segment included. created_at: type: string format: date-time updated_at: type: string format: date-time AutomationMode: type: string enum: - manual - scheduled x-enum-varnames: - AutomationModeManual - AutomationModeScheduled description: 'Declares how the automation decides when to run. Values: - `manual`: places its calls when a person starts it. - `scheduled`: opens each of its attempts at the moment that attempt names.' AutomationStatus: type: string enum: - new - idle - in_progress - done - stopped - archived x-enum-varnames: - AutomationStatusNew - AutomationStatusIdle - AutomationStatusInProgress - AutomationStatusDone - AutomationStatusStopped - AutomationStatusArchived description: 'Records where the automation stands. Values: - `new`: has never run. - `idle`: is switched on with nothing due. - `in_progress`: is placing calls. - `done`: has nothing left to call. - `stopped`: was switched off by a person. - `archived`: never runs again. The status is the system''s to write: a person moves it through stop, start and archive.' AutomationStatusChange: type: object required: - from - to - at properties: from: $ref: '#/components/schemas/AutomationStatus' to: $ref: '#/components/schemas/AutomationStatus' at: type: string format: date-time Automation: type: object required: - id - account_sid - agent_sid - segment_sid - limit_policy_sid - name - mode - status - status_changed_at - status_history - created_at - updated_at properties: id: type: string account_sid: type: string agent_sid: type: string segment_sid: type: string limit_policy_sid: type: - string - 'null' description: Names the slice of the agent's capacity this automation competes inside. Empty means it competes for whatever the agent's policies did not reserve. name: type: string description: Unique among the live automations of the same agent; archiving frees it. mode: $ref: '#/components/schemas/AutomationMode' status: $ref: '#/components/schemas/AutomationStatus' status_changed_at: type: string format: date-time description: Records when `status` last changed. status_history: type: array description: Records every change of `status`, oldest first. items: $ref: '#/components/schemas/AutomationStatusChange' created_at: type: string format: date-time updated_at: type: string format: date-time AutomationAttemptStatus: type: string enum: - new - in_progress - done - stopped - skipped x-enum-varnames: - AutomationAttemptStatusNew - AutomationAttemptStatusInProgress - AutomationAttemptStatusDone - AutomationAttemptStatusStopped - AutomationAttemptStatusSkipped description: 'Records where one run stands. Values: - `new`: has not opened yet. - `in_progress`: is placing calls. - `done`: finished its calls. - `stopped`: was cut short by its window or by a person. - `skipped`: never opened.' AutomationAttemptStatusReason: type: string enum: - window_ended - stopped_by_user - overtaken - window_missed - ended_by_user x-enum-varnames: - AutomationAttemptStatusReasonWindowEnded - AutomationAttemptStatusReasonStoppedByUser - AutomationAttemptStatusReasonOvertaken - AutomationAttemptStatusReasonWindowMissed - AutomationAttemptStatusReasonEndedByUser description: 'Records why the run moved to `stopped` or `skipped`. On a move to `stopped`: - `window_ended`: the run''s window ran out. - `stopped_by_user`: a user stopped or deleted the automation, or archived its agent. On a move to `skipped`: - `overtaken`: a later run of the automation opened while this run''s window was still open. - `window_missed`: the window ended before the run could open. - `ended_by_user`: a user archived or deleted the automation, or archived its agent.' AutomationAttemptStatusChange: type: object required: - from - to - reason - at properties: from: $ref: '#/components/schemas/AutomationAttemptStatus' to: $ref: '#/components/schemas/AutomationAttemptStatus' reason: description: 'Records why the run stopped or was skipped. Null when: - The change is to any other status. - The change was recorded before the reason was kept.' anyOf: - $ref: '#/components/schemas/AutomationAttemptStatusReason' - type: 'null' at: type: string format: date-time AutomationAttempt: type: object required: - id - account_sid - automation_sid - status - status_changed_at - status_history - starts_at - ends_at - created_at - updated_at description: One run of an automation, over the contacts it had not reached when the run opened. properties: id: type: string account_sid: type: string automation_sid: type: string status: $ref: '#/components/schemas/AutomationAttemptStatus' status_changed_at: type: string format: date-time description: Records when `status` last changed. status_history: type: array description: Records every change of `status`, oldest first, so it carries the moment the run opened and the moment it ended. items: $ref: '#/components/schemas/AutomationAttemptStatusChange' starts_at: type: - string - 'null' format: date-time ends_at: type: - string - 'null' format: date-time description: Records when calling stops. Empty on an attempt that runs until its calls are all over. created_at: type: string format: date-time updated_at: type: string format: date-time CommunicationIncluded: type: object description: 'Carries the related resources resolved for this response, one map per relation under the relation''s name. Rules: - Each map is keyed by the related resource''s own id (`included.agent[id]`). - A to-many relation is keyed the same way. - Each result delivery carries its `communication_sid`. - A relation''s map is present whenever it was requested. - A map is empty if nothing resolved. - A reference the caller may not read is absent from the map, and the communication keeps its sid.' properties: agent: type: object additionalProperties: $ref: '#/components/schemas/Agent' scenario: type: object additionalProperties: $ref: '#/components/schemas/ScenarioEmbed' communication_result: type: object additionalProperties: $ref: '#/components/schemas/CommunicationResult' contact: type: object description: Resolves the contact each `contact_sid` names, in the list row shape. additionalProperties: $ref: '#/components/schemas/ContactListItem' automation: type: object description: Resolves the automation each `automation_sid` names; a call placed by hand resolves nothing here. additionalProperties: $ref: '#/components/schemas/Automation' automation_attempt: type: object description: Resolves the run each `automation_attempt_sid` names; a call placed by hand resolves nothing here. additionalProperties: $ref: '#/components/schemas/AutomationAttempt' CommunicationList: type: object required: - items - total - limit - offset - has_more - included properties: items: type: array items: $ref: '#/components/schemas/Communication' total: type: integer format: int64 description: Counts the communications 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. included: $ref: '#/components/schemas/CommunicationIncluded' DispatchCommunicationRequest: type: object required: - recipient description: 'Describes the call to dispatch. The fields: - `agent_sid` and `scenario_sid`: exactly one of the two is set. - `agent_sid`: dials through a configured agent; its routings choose the scenario when the call is dialled, and dispatch timing is the server''s decision. - `scenario_sid`: is a test call of that scenario. - `is_test` and `prefer_draft`: say which scenarios the call may play. - `scheduled_at`: either variant may set it to defer the dispatch. - `timezone`: is never accepted here; it is always derived on the server, from the bound agent or from the account. A call through an agent is placed only inside that agent''s calling window. The from-number: - For a published run through an agent, it is the bound agent''s number. - When that agent''s gateway is a pool, it is a random active number of the agent''s pool. - Otherwise it is a free account number. - When a draft test call finds no free account number, it is the number of its own agent; with no agent, the number of the scenario''s oldest agent that is not archived, or a random active number of that agent''s pool. A request that sends neither or both of `agent_sid` and `scenario_sid` is refused.' properties: recipient: type: string pattern: ^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$ description: 'Names the person to call. Rules: - A value with a letter is an alphanumeric identifier, kept as sent. - Any other value is a phone number in the international form, with or without a leading `00`, recorded and dialled in the stored form of a contact''s `number` (`37123112233`).' agent_sid: type: string description: An agent of another account, or an archived one, is refused. automation_sid: type: string description: A dispatch that sends it is refused. scheduled_at: type: string format: date-time data: type: object description: 'Sets the variables of the call from a flat map of scalar values (string/number/boolean). Rules: - The map is not written onto the contact. - The keys `contact` and `contact.{path}` are accepted with any value and set nothing.' additionalProperties: true contact: type: - object - 'null' description: Carries what the caller knows about the person the call is for. properties: data: type: - object - 'null' additionalProperties: true description: 'Merges into the contact''s data. Rules: - A key given here replaces the same key. - A nested object given here changes only the keys it names inside that object, at any depth. - Every other key stays. - A key set to `null` removes it. - Null, absent or `{}` leaves the data as it is. The call starts with the contact''s data in the `contact` variable.' scenario_sid: type: string description: Names the scenario to dial directly, for a test call. is_test: type: boolean description: 'Marks the call as a test call. Rules: - A test call through an agent takes every routing of the agent, a routing whose scenario has no published version included. - A call through an agent that is not a test passes over such a routing. When no routing with a published scenario holds, it fails with the reason `no_published_routing`. - A call through a test agent, a call with `prefer_draft`, and a call through `scenario_sid` are test calls.' prefer_draft: type: boolean description: 'Makes a test call play the draft of its scenario first. Values: - `true`: plays the current draft, frozen on first use; the published version when the scenario has no draft. - Omitted: plays the published version; a test call through an agent plays the draft when the scenario has no published version.' draft: type: boolean deprecated: true description: Means the same as `prefer_draft`. CommunicationRead: description: The full communication plus `included`, the relations `include` resolved for it; `{}` when none were asked for. allOf: - $ref: '#/components/schemas/Communication' - type: object required: - included properties: included: $ref: '#/components/schemas/CommunicationIncluded' 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 CallHistoryEventBase: type: object required: - seq - call_sid - timestamp - type properties: seq: type: integer description: Orders the event within the call. It starts at 0 and grows by one per event. call_sid: type: string description: Identifies the call. timestamp: type: string format: date-time description: Records the moment the event happened. type: type: string description: Names what happened. brick_type: type: string description: Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. brick_id: type: string description: Identifies the brick the event belongs to. Absent on an event that belongs to no brick. CallHistoryEventPayloadBrickStart: type: object required: - brick_type - brick_description properties: brick_type: type: string description: Names the type of the brick. brick_description: type: string description: Carries the description the brick has in the scenario. CallHistoryEventBrickStart: description: A brick of the scenario started. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - brick_start payload: $ref: '#/components/schemas/CallHistoryEventPayloadBrickStart' CallHistoryEventPayloadBrickEnd: type: object required: - brick_type - output_id properties: brick_type: type: string description: Names the type of the brick. output_id: type: string description: Names the output the brick left through. CallHistoryEventBrickEnd: description: A brick of the scenario ended. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - brick_end payload: $ref: '#/components/schemas/CallHistoryEventPayloadBrickEnd' CallHistoryEventPayloadWebhookStart: type: object required: - url - method properties: url: type: string description: Address the request goes to. method: type: string description: Names the HTTP method of the request. CallHistoryEventWebhookStart: description: A webhook brick sent its request. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - webhook_start payload: $ref: '#/components/schemas/CallHistoryEventPayloadWebhookStart' CallHistoryEventPayloadWebhookComplete: type: object required: - status_code - duration_ms properties: status_code: type: integer description: Records the HTTP status of the response. duration_ms: type: integer description: Records the time the request took, in milliseconds. response: type: string description: Carries the body of the response. CallHistoryEventWebhookComplete: description: A webhook request got its response. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - webhook_complete payload: $ref: '#/components/schemas/CallHistoryEventPayloadWebhookComplete' CallHistoryEventPayloadWebhookError: type: object required: - error - duration_ms properties: error: type: string description: Says what went wrong. status_code: type: integer description: Records the HTTP status of the response, when one arrived. duration_ms: type: integer description: Records the time the request took, in milliseconds. CallHistoryEventWebhookError: description: A webhook request failed. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - webhook_error payload: $ref: '#/components/schemas/CallHistoryEventPayloadWebhookError' CallHistoryEventSpeechStart: description: The person started to speak. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - speech_start payload: type: object description: Empty object. CallHistoryEventSpeechEnd: description: The person stopped speaking. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - speech_end payload: type: object description: Empty object. CallHistoryEventPayloadRecognitionSetup: type: object required: - engine - languages - speech_timeout_ms - no_input_timeout_ms - enable_vad properties: engine: type: string description: Names the recognition engine the brick uses. languages: type: array items: type: string description: Languages recognition listens for. speech_timeout_ms: type: integer description: Records the longest time the person may speak, in milliseconds. no_input_timeout_ms: type: integer description: Records the longest wait for the person to start speaking, in milliseconds. enable_vad: type: boolean description: Says whether voice activity detection is on. recognition_shift_direction: type: string description: 'Names the direction the start of recognition is moved in: `forward` or `backward`.' recognition_shift_duration_ms: type: integer description: Records the time the start of recognition is moved by, in milliseconds. recognition_mode: type: string description: 'Names the recognition mode: `constant` or `interim`.' CallHistoryEventRecognitionSetup: description: A brick that listens started; the payload carries its recognition settings. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - recognition_setup payload: $ref: '#/components/schemas/CallHistoryEventPayloadRecognitionSetup' CallHistoryEventPayloadRecognitionSession: type: object required: - id properties: id: type: string description: Identifies the recognition session. CallHistoryEventRecognitionStarted: description: Recognition started to listen. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - recognition_started payload: $ref: '#/components/schemas/CallHistoryEventPayloadRecognitionSession' CallHistoryEventPayloadRecognitionStopped: type: object required: - id - reason properties: id: type: string description: Identifies the recognition session. reason: type: string description: 'Says why recognition stopped: `complete`, `no_input_timeout`, `speech_timeout` or `cancelled`.' CallHistoryEventRecognitionStopped: description: Recognition stopped listening. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - recognition_stopped payload: $ref: '#/components/schemas/CallHistoryEventPayloadRecognitionStopped' CallHistoryEventPayloadRecognitionInterim: type: object required: - id - transcript - stability properties: id: type: string description: Identifies the recognition session. transcript: type: string description: Carries the text recognized so far. stability: type: number description: Reports the stability the engine gives the text. CallHistoryEventRecognitionInterim: description: Recognition returned a partial transcript of what the person is saying. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - recognition_interim payload: $ref: '#/components/schemas/CallHistoryEventPayloadRecognitionInterim' CallHistoryEventPayloadRecognitionFinal: type: object required: - id - transcript properties: id: type: string description: Identifies the recognition session. transcript: type: string description: Carries the text the person said. confidence: type: number description: Reports the confidence the engine gives the text. CallHistoryEventRecognitionFinal: description: Recognition returned the final transcript of what the person said. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - recognition_final payload: $ref: '#/components/schemas/CallHistoryEventPayloadRecognitionFinal' CallHistoryEventPayloadTtsStart: type: object required: - stream properties: stream: type: boolean description: Says whether the phrase is synthesized as a stream. A streamed phrase with no `text` sends its text in `tts_delta` events. text: type: string description: Carries the text of the phrase, when it is known at the start. CallHistoryEventTtsStart: description: The agent started to speak. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - tts_start payload: $ref: '#/components/schemas/CallHistoryEventPayloadTtsStart' CallHistoryEventPayloadTtsDelta: type: object required: - text properties: id: type: string description: Identifies the phrase the part belongs to. text: type: string description: Carries the text of the part. CallHistoryEventTtsDelta: description: The next part of a streamed phrase of the agent. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - tts_delta payload: $ref: '#/components/schemas/CallHistoryEventPayloadTtsDelta' CallHistoryEventTtsInterrupted: description: The person interrupted the phrase of the agent. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object properties: type: type: string enum: - tts_interrupted CallHistoryEventTtsFinished: description: The agent finished the phrase. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object properties: type: type: string enum: - tts_finished payload: type: object description: Empty object. CallHistoryEventPayloadAudioFilePlay: type: object required: - url properties: url: type: string description: Address of the audio file. CallHistoryEventAudioFilePlay: description: An audio file started to play. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - audio_file_play payload: $ref: '#/components/schemas/CallHistoryEventPayloadAudioFilePlay' CallHistoryEventPayloadAssignmentComplete: type: object required: - variables properties: variables: type: object additionalProperties: type: string description: Variables the brick set, by name. CallHistoryEventAssignmentComplete: description: An assignment brick set its variables. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - assignment_complete payload: $ref: '#/components/schemas/CallHistoryEventPayloadAssignmentComplete' CallHistoryEventPayloadFunctionCall: type: object required: - name properties: name: type: string description: Names the function. arguments: type: string description: Arguments of the call, as a JSON text. CallHistoryEventFunctionCall: description: The AI agent called a function. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - function_call payload: $ref: '#/components/schemas/CallHistoryEventPayloadFunctionCall' CallHistoryEventPayloadAnswerSelectedCandidate: type: object required: - answer_id - transcript - method properties: answer_id: type: string description: Identifies the matched answer. description: type: string description: Carries the description of the answer. tag: type: string description: Carries the tag of the answer. transcript: type: string description: Carries the text the match was made on. method: type: string description: 'Records how the answer was matched: `keyword`, `intent` or `llm`.' intent_id: type: string description: Identifies the matched intent. confidence: type: number description: Reports the confidence of the match. threshold: type: number description: Reports the lowest confidence the brick accepts. keyword: type: string description: Carries the keyword that matched. llm_tag: type: string description: Carries the tag the language model returned. llm_model: type: string description: Names the language model that made the match. CallHistoryEventAnswerSelectedCandidate: description: A question brick matched an answer during recognition, before the entities are extracted. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - answer_selected_candidate payload: $ref: '#/components/schemas/CallHistoryEventPayloadAnswerSelectedCandidate' CallHistoryEventPayloadAnswerSelected: type: object required: - answer_id - transcript properties: answer_id: type: string description: 'Identifies the chosen answer, or names the outcome of the question. By outcome: - On a closed question, the value identifies the chosen answer. - On any other outcome, the value is the name of the outcome: `valid`, `invalid`, `empty` or `change_language`.' description: type: string description: Carries the description of the chosen answer, or of the output the brick leaves through. tag: type: string description: Carries the tag of the answer. transcript: type: string description: Carries the text the choice was made on. method: type: string description: 'Records how the answer was matched: `keyword`, `intent` or `llm`.' entities: type: object additionalProperties: type: string description: Entities taken from the text, by name. detected_language: type: string description: Names the language detected in the text. CallHistoryEventAnswerSelected: description: A question brick settled the outcome of its question. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - answer_selected payload: $ref: '#/components/schemas/CallHistoryEventPayloadAnswerSelected' CallHistoryEventPayloadGptFallback: type: object required: - text properties: text: type: string description: Carries the text the brick says. CallHistoryEventGptFallback: description: A question brick asks again with a text the language model wrote. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - gpt_fallback payload: $ref: '#/components/schemas/CallHistoryEventPayloadGptFallback' CallHistoryEventPayloadTimerStarted: type: object required: - timeout_ms properties: timeout_ms: type: integer description: Records the length of the timer, in milliseconds. CallHistoryEventNoInputTimerStarted: description: The wait for the person to start speaking began. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - no_input_timer_started payload: $ref: '#/components/schemas/CallHistoryEventPayloadTimerStarted' CallHistoryEventSpeechTimerStarted: description: The limit on how long the person may speak began. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - speech_timer_started payload: $ref: '#/components/schemas/CallHistoryEventPayloadTimerStarted' CallHistoryEventNoInputTimeoutFired: description: The person did not start speaking in time. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - no_input_timeout_fired payload: type: object description: Empty object. CallHistoryEventSpeechTimeoutFired: description: The person spoke longer than the limit. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - speech_timeout_fired payload: type: object description: Empty object. CallHistoryEventPayloadCallStateChanged: type: object required: - state properties: state: type: string description: Names the state the call moved to. sip_code: type: integer description: Carries the SIP code that came with the change. reason: type: string description: Carries the reason that came with the change. CallHistoryEventCallStateChanged: description: The outbound call moved to another state while it was being connected. allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object required: - payload properties: type: type: string enum: - call_state_changed payload: $ref: '#/components/schemas/CallHistoryEventPayloadCallStateChanged' CallHistoryEventCallEnd: description: 'The scenario reached its end brick. Rules: - It is the last event of the scenario. - One `call_state_changed` can follow it. - A call that ends before its scenario starts sends none. - A call that is stopped by force sends none.' allOf: - $ref: '#/components/schemas/CallHistoryEventBase' - type: object properties: type: type: string enum: - call_end CallHistoryEvent: description: 'One call history event: one thing that happened on a call. `type` fixes the shape of `payload`.' oneOf: - $ref: '#/components/schemas/CallHistoryEventBrickStart' - $ref: '#/components/schemas/CallHistoryEventBrickEnd' - $ref: '#/components/schemas/CallHistoryEventWebhookStart' - $ref: '#/components/schemas/CallHistoryEventWebhookComplete' - $ref: '#/components/schemas/CallHistoryEventWebhookError' - $ref: '#/components/schemas/CallHistoryEventSpeechStart' - $ref: '#/components/schemas/CallHistoryEventSpeechEnd' - $ref: '#/components/schemas/CallHistoryEventRecognitionSetup' - $ref: '#/components/schemas/CallHistoryEventRecognitionStarted' - $ref: '#/components/schemas/CallHistoryEventRecognitionStopped' - $ref: '#/components/schemas/CallHistoryEventRecognitionInterim' - $ref: '#/components/schemas/CallHistoryEventRecognitionFinal' - $ref: '#/components/schemas/CallHistoryEventTtsStart' - $ref: '#/components/schemas/CallHistoryEventTtsDelta' - $ref: '#/components/schemas/CallHistoryEventTtsInterrupted' - $ref: '#/components/schemas/CallHistoryEventTtsFinished' - $ref: '#/components/schemas/CallHistoryEventAudioFilePlay' - $ref: '#/components/schemas/CallHistoryEventAssignmentComplete' - $ref: '#/components/schemas/CallHistoryEventFunctionCall' - $ref: '#/components/schemas/CallHistoryEventAnswerSelectedCandidate' - $ref: '#/components/schemas/CallHistoryEventAnswerSelected' - $ref: '#/components/schemas/CallHistoryEventGptFallback' - $ref: '#/components/schemas/CallHistoryEventNoInputTimerStarted' - $ref: '#/components/schemas/CallHistoryEventSpeechTimerStarted' - $ref: '#/components/schemas/CallHistoryEventNoInputTimeoutFired' - $ref: '#/components/schemas/CallHistoryEventSpeechTimeoutFired' - $ref: '#/components/schemas/CallHistoryEventCallStateChanged' - $ref: '#/components/schemas/CallHistoryEventCallEnd' discriminator: propertyName: type mapping: brick_start: '#/components/schemas/CallHistoryEventBrickStart' brick_end: '#/components/schemas/CallHistoryEventBrickEnd' webhook_start: '#/components/schemas/CallHistoryEventWebhookStart' webhook_complete: '#/components/schemas/CallHistoryEventWebhookComplete' webhook_error: '#/components/schemas/CallHistoryEventWebhookError' speech_start: '#/components/schemas/CallHistoryEventSpeechStart' speech_end: '#/components/schemas/CallHistoryEventSpeechEnd' recognition_setup: '#/components/schemas/CallHistoryEventRecognitionSetup' recognition_started: '#/components/schemas/CallHistoryEventRecognitionStarted' recognition_stopped: '#/components/schemas/CallHistoryEventRecognitionStopped' recognition_interim: '#/components/schemas/CallHistoryEventRecognitionInterim' recognition_final: '#/components/schemas/CallHistoryEventRecognitionFinal' tts_start: '#/components/schemas/CallHistoryEventTtsStart' tts_delta: '#/components/schemas/CallHistoryEventTtsDelta' tts_interrupted: '#/components/schemas/CallHistoryEventTtsInterrupted' tts_finished: '#/components/schemas/CallHistoryEventTtsFinished' audio_file_play: '#/components/schemas/CallHistoryEventAudioFilePlay' assignment_complete: '#/components/schemas/CallHistoryEventAssignmentComplete' function_call: '#/components/schemas/CallHistoryEventFunctionCall' answer_selected_candidate: '#/components/schemas/CallHistoryEventAnswerSelectedCandidate' answer_selected: '#/components/schemas/CallHistoryEventAnswerSelected' gpt_fallback: '#/components/schemas/CallHistoryEventGptFallback' no_input_timer_started: '#/components/schemas/CallHistoryEventNoInputTimerStarted' speech_timer_started: '#/components/schemas/CallHistoryEventSpeechTimerStarted' no_input_timeout_fired: '#/components/schemas/CallHistoryEventNoInputTimeoutFired' speech_timeout_fired: '#/components/schemas/CallHistoryEventSpeechTimeoutFired' call_state_changed: '#/components/schemas/CallHistoryEventCallStateChanged' call_end: '#/components/schemas/CallHistoryEventCallEnd' CallAnalyticsPeriod: type: string enum: - today - 30d - 12m x-enum-varnames: - CallAnalyticsPeriodToday - CallAnalyticsPeriod30d - CallAnalyticsPeriod12m CallAnalyticsGroupBy: type: string enum: - agent - routing x-enum-varnames: - CallAnalyticsGroupByAgent - CallAnalyticsGroupByRouting CallAnalyticsInterval: type: string enum: - hour - day - month x-enum-varnames: - CallAnalyticsIntervalHour - CallAnalyticsIntervalDay - CallAnalyticsIntervalMonth CallAnalyticsWindow: type: object required: - from - to - timezone - interval properties: from: type: string format: date-time description: Marks the start of the first bucket. to: type: string format: date-time description: Marks the end of the bucket that holds the current time. timezone: type: string description: 'Names the IANA zone the buckets are cut in: the account''s, or Europe/Warsaw when it has none.' interval: $ref: '#/components/schemas/CallAnalyticsInterval' CallCounts: type: object required: - total - outbound - inbound - call_duration - call_duration_excluding_transfer properties: total: type: integer format: int64 outbound: type: integer format: int64 inbound: type: integer format: int64 call_duration: type: integer format: int64 description: Seconds, summed over the calls. call_duration_excluding_transfer: type: integer format: int64 description: Seconds, summed over the calls, without the time spent on a transferred leg. CallBucket: allOf: - $ref: '#/components/schemas/CallCounts' - type: object required: - start - by_agent - by_routing properties: start: type: string format: date-time by_agent: type: - object - 'null' description: Counts per agent id; null unless group_by=agent. A call with no agent is absent here. additionalProperties: $ref: '#/components/schemas/CallCounts' by_routing: type: - object - 'null' description: Counts per routing id; null unless group_by=routing. A call no routing chose is absent here. additionalProperties: $ref: '#/components/schemas/CallCounts' Routing: type: object required: - id - account_sid - agent_sid - name - condition - scenario_sid - is_published - position - default - created_at - updated_at properties: id: type: string account_sid: type: string agent_sid: type: string name: type: string description: Names the routing. The default routing is named `default`. condition: type: - string - 'null' description: 'Holds the expression a call is checked against. Rules: - A segment is written by its name. - A segment that the account no longer holds is written by its id. Null on the default routing.' scenario_sid: type: string description: Names the scenario a call plays when the condition matches. On the default routing it is the agent's scenario. is_published: type: boolean description: Reports whether the scenario has a published version. position: type: integer description: Places the routing in the order the agent checks them, from 1. The default routing is always last. default: type: boolean description: Marks the routing that ends the list. created_at: type: string format: date-time updated_at: type: string format: date-time CallAnalyticsIncluded: type: object required: - agents properties: agents: type: object description: Resolves the agents of by_agent that still exist, keyed by id. A deleted agent is absent. `{}` with group_by=routing. additionalProperties: $ref: '#/components/schemas/Agent' routings: type: object description: Resolves the routings of by_routing that still exist, keyed by id, the default routings included. A deleted routing is absent. Present only with group_by=routing. additionalProperties: $ref: '#/components/schemas/Routing' CallAnalytics: type: object required: - period - totals - buckets - included properties: period: $ref: '#/components/schemas/CallAnalyticsWindow' totals: $ref: '#/components/schemas/CallCounts' buckets: type: array items: $ref: '#/components/schemas/CallBucket' included: description: null unless group_by is set. anyOf: - $ref: '#/components/schemas/CallAnalyticsIncluded' - type: 'null' AgentLineAnalytics: type: object required: - agent_sid - lines - lines_in_use properties: agent_sid: type: string lines: type: integer description: Calls this agent may hold at once. lines_in_use: type: integer description: Calls this agent holds now, answered and placed together. LineAnalytics: type: object required: - account_lines - lines_assigned - lines_in_use - agents properties: account_lines: type: integer description: Calls the account may hold at once across its agents. lines_assigned: type: integer description: Sums the lines over agents. lines_in_use: type: integer description: Counts the calls the account holds now, a call with no agent included. agents: type: array description: Lists every agent of the account that is not archived, newest first. items: $ref: '#/components/schemas/AgentLineAnalytics' ContactFieldAnalytics: type: object required: - name - type - contacts properties: name: type: string description: Names the field by its dotted path. type: type: string enum: - string - number - boolean - array x-enum-varnames: - ContactFieldTypeString - ContactFieldTypeNumber - ContactFieldTypeBoolean - ContactFieldTypeArray description: Names the one type every contact of the account holds at the field. contacts: type: integer description: Counts the contacts that hold the field. ContactAnalytics: type: object required: - contacts - fields - data_bytes properties: contacts: type: object required: - current - limit properties: current: type: integer description: Counts the account's contacts. limit: type: integer description: Reports the account's contact limit. fields: type: array description: Lists every data field the account's contacts hold, by name. items: $ref: '#/components/schemas/ContactFieldAnalytics' data_bytes: type: object required: - total - computed_at properties: total: type: integer format: int64 description: Sums the bytes of every value of the contacts' data, each array item on its own. computed_at: type: - string - 'null' format: date-time description: Records when the total was summed, at most 15 minutes before; null until the first sum, while total is 0. CommunicationResultIncluded: type: object description: 'Carries the related resources resolved for this response, one map per relation under the relation''s name. Rules: - Each map is keyed by the related resource''s own id (`included.communication[id]`). - A relation''s map is present whenever it was requested. - A map is empty if nothing resolved. - A reference the caller may not read is absent from the map, and the delivery keeps its sid.' properties: communication: type: object additionalProperties: $ref: '#/components/schemas/Communication' CommunicationResultList: type: object required: - items - total - limit - offset - has_more - included properties: items: type: array items: $ref: '#/components/schemas/CommunicationResult' total: type: integer format: int64 description: Counts the result deliveries 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. included: $ref: '#/components/schemas/CommunicationResultIncluded' CommunicationResultRead: description: The full delivery plus `included`, the communication `include=communication` resolved for it; `{}` when none was asked for. allOf: - $ref: '#/components/schemas/CommunicationResult' - type: object required: - included properties: included: $ref: '#/components/schemas/CommunicationResultIncluded' PatchCommunicationResultRequest: type: object description: An omitted `target_url` keeps the current one. properties: target_url: type: string Segment: type: object description: A group of the account's contacts, addressed as one. required: - id - account_sid - name - is_default - is_used - automation_sid - contact_count - created_at - updated_at - deleted_at properties: id: type: string account_sid: type: string description: Names the account that owns the segment. name: type: string is_default: type: boolean description: 'Marks the account''s default segment: every live contact, computed rather than recorded. Refused when: - The default segment is edited. - The default segment is deleted.' is_used: type: boolean description: Says whether a live automation already holds this segment. Archiving that automation releases it. automation_sid: type: - string - 'null' description: Identifies the live automation that holds this segment; null while none does. contact_count: type: integer format: int64 description: Counts the current members. For the default segment this is the account's live contact count. created_at: type: string format: date-time updated_at: type: string format: date-time deleted_at: type: - string - 'null' format: date-time description: 'Records when the segment was deleted; `null` while it is live. Rules: - The segment list returns a deleted segment with `show_deleted=true`. - The contact list returns a deleted segment with `include=segment`. - No other read returns a deleted segment.' SegmentMembership: type: object description: 'Records one contact''s place in one segment: when it joined, which source put it there, and when it left. The account''s default segment records no membership, so it never appears here.' required: - contact_sid - segment_sid - source_sid - joined_at - left_at properties: contact_sid: type: string segment_sid: type: string source_sid: type: - string - 'null' description: Names the source that supplied the contact; `null` once that source has been purged. joined_at: type: string format: date-time left_at: type: - string - 'null' format: date-time description: Records when the contact left the segment; `null` while it is a member. SourceCounts: type: object description: Counts the rows a source holds. required: - total - success - rejected properties: total: type: integer format: int64 description: Counts the rows the source holds. success: type: integer format: int64 description: Counts the rows that are published, each a contact. rejected: type: integer format: int64 description: Counts the rows that could not be used. Retrievable as a file. Source: type: object description: An origin a segment's membership comes from. It belongs to the segment it was uploaded into and cannot exist without one. required: - id - account_sid - segment_sid - kind - status - auto_update - reset_reach - counts - total_count - success_count - error_count - created_at - updated_at properties: id: type: string account_sid: type: string description: Names the account that owns the source. segment_sid: type: string description: Names the segment this source belongs to. A source never exists without one. kind: type: string enum: - file - manual description: 'Says where this source''s contacts come from. Values: - `file`: the contacts come from a supplied file. - `manual`: the contacts are named one at a time.' status: type: string enum: - draft - published - removed description: 'Records the state of the source. Values: - `draft`: its content is editable. - `published`: is set after publish. - `removed`: is set after a delete. A published or removed source is frozen and stays in the list.' auto_update: type: boolean description: Says whether the segment follows later changes to this source. Always false for the kinds served today, whose content cannot change once supplied. reset_reach: type: boolean description: Puts the contacts this source supplies back on the list of the automation that holds the segment when the source is published. Changeable while the source is a draft. filename: type: - string - 'null' description: Names the uploaded file, as supplied. counts: $ref: '#/components/schemas/SourceCounts' total_count: type: integer format: int64 deprecated: true description: Rows the source holds. Replaced by `counts.total`. success_count: type: integer format: int64 deprecated: true description: Rows that are published, each a contact. Replaced by `counts.success`. error_count: type: integer format: int64 deprecated: true description: Rows that could not be used. Replaced by `counts.rejected`. created_at: type: string format: date-time updated_at: type: string format: date-time ContactIncluded: type: object description: 'Carries the related resources resolved for this response, one map per relation under the relation''s name. The relations: - `segment`: is keyed by the segment''s own id (`included.segment[id]`), one entry for every id in a contact''s `segment_sids`. - `segment_membership`: has no id of its own and is keyed by the contact''s id (`included.segment_membership[contact_id]`), holding every membership the contact has had, newest first. - `source`: is keyed by the source''s own id, one entry for each `source_sid` those memberships name; a membership with no `source_sid` resolves nothing. A relation''s map is present whenever it was requested, empty if nothing resolved.' properties: segment: type: object additionalProperties: $ref: '#/components/schemas/Segment' segment_membership: type: object additionalProperties: type: array items: $ref: '#/components/schemas/SegmentMembership' source: type: object additionalProperties: $ref: '#/components/schemas/Source' ContactList: type: object required: - items - total - limit - offset - has_more - included properties: items: type: array items: $ref: '#/components/schemas/ContactListItem' total: type: integer format: int64 description: Counts the contacts 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. included: $ref: '#/components/schemas/ContactIncluded' CountryCode: type: string x-go-type: string description: 'Supplies the country for a phone number that arrives without an international mark (`+` or `00`): `0501111222` with `pl` stores as `48501111222`. Rules: - It is an ISO 3166-1 alpha-2 code, in upper or lower case, from `GET /v1/a/info/countries`. - A number already in the international form ignores it. Refused when: - The code is unknown. - The code is sent with type `alphanumeric`.' CreateContactRequest: type: object required: - number properties: number: type: string description: 'Identifies the contact, read by `type` and `country_code`. A phone number arrives with or without an international mark (`+` or `00`), loses its spaces and punctuation, and is stored as `37123112233`. Refused when: - The number cannot be brought to that form. - The account already holds the number.' type: $ref: '#/components/schemas/IdentifierType' country_code: $ref: '#/components/schemas/CountryCode' data: type: object additionalProperties: true description: 'Sets what the account holds on the person. Rules: - A field set to `null` is not stored. - Omitted means `{}`.' ContactValueUsage: type: object required: - field - bytes properties: field: type: string description: Names the field by its dotted path. bytes: type: integer description: Counts the bytes of the value's text; for an array, those of its longest item. items: type: integer description: Counts the items of an array; absent for any other value. ContactDataUsage: type: object description: Reports how much of the account's limits the contact's data takes, counted the way the limits count it. required: - fields - value_bytes - array_items - values properties: fields: type: object required: - current - limit properties: current: type: integer description: Counts the fields of the data, at any depth, an array as one field. limit: type: integer description: Reports the account's field limit. value_bytes: type: integer description: Reports the account's byte limit for one value and for each item of an array. array_items: type: integer description: Reports the account's limit for the items of one array. values: type: array description: Lists every field of the data by its dotted path, in path order. items: $ref: '#/components/schemas/ContactValueUsage' ContactCall: type: object description: One finished call with a contact, as the contact's call log carries it. A call is finished when its status is `done`, `failed`, `drifted` or `stopped`. required: - communication_sid - direction - communication_status - call_status - reason - duration - scenario_sid - agent_sid - automation_sid - occurred_at properties: communication_sid: type: string description: Names the communication that holds the full record of the call. direction: $ref: '#/components/schemas/CommunicationDirection' communication_status: $ref: '#/components/schemas/CommunicationStatus' call_status: anyOf: - $ref: '#/components/schemas/CallStatus' - type: 'null' description: '`null` for a call that recorded no telephony state.' reason: type: string description: Explains why the call ended in its status; empty when no reason was recorded. duration: type: integer description: Reports the call duration between answer and hangup, in seconds; 0 for a call that was not answered or never placed. scenario_sid: type: string description: Names the scenario the call ran; empty for a call that records no scenario. agent_sid: type: string description: Names the agent the call ran through; empty for a call with no agent. automation_sid: type: - string - 'null' description: Names the automation that placed the call; `null` for a call no automation placed. occurred_at: type: string format: date-time description: Records when the call reached its final status. Contact: type: object description: The full contact, including its call log in `communication_history`. required: - id - account_sid - number - type - country_code - data - data_usage - revision - communication_history - segment_sids - created_at - updated_at properties: id: type: string account_sid: type: string description: Names the account that owns the contact. number: $ref: '#/components/schemas/StoredNumber' type: $ref: '#/components/schemas/RecordedIdentifierType' country_code: $ref: '#/components/schemas/RecordedCountryCode' data: type: object additionalProperties: true description: Holds everything the account has on the person; `{}` when nothing is held. data_usage: $ref: '#/components/schemas/ContactDataUsage' revision: $ref: '#/components/schemas/ContactRevision' communication_history: type: array items: $ref: '#/components/schemas/ContactCall' description: 'Lists the last 50 finished calls with the person. Rules: - The newest call comes first. - A deleted communication is not listed. - The list is `[]` when there is none. A call receives the same list at its start as the read-only `communication_history` system variable.' segment_sids: type: array items: type: string description: Lists the account's segments this contact is currently in, its default segment included. created_at: type: string format: date-time updated_at: type: string format: date-time ContactDataOp: type: string enum: - rename - delete x-enum-varnames: - ContactDataOpRename - ContactDataOpDelete ContactDataFieldChange: type: object description: 'Carries the paths of a data field change, each a path such as `address.street`. By operation: - A rename carries `from` and `to`. - A delete carries `field`.' required: [] properties: from: type: string description: Names the field to move. to: type: string description: Names where the field moves. field: type: string description: Names the field to remove. ContactDataFieldChangeResult: type: object required: - updated properties: updated: type: integer description: Counts the contacts that held the field and changed. ContactFieldConflict: type: object description: Names what stops a data field rename. required: - field properties: topic: type: string field: type: string description: Names the field that stops the rename by its path. contact: type: string description: Names the first contact whose data stops the rename; absent when the two paths alone conflict. ContactQueryField: type: object required: - name - type properties: name: type: string description: Names the field as a query writes it, `number` or `data.address.street`. type: type: string enum: - string - number - boolean - array - datetime x-enum-varnames: - ContactQueryTypeString - ContactQueryTypeNumber - ContactQueryTypeBoolean - ContactQueryTypeArray - ContactQueryTypeDatetime description: Names the one type every contact of the account holds at the field. ContactQueryLanguage: type: object required: - fields - operators properties: fields: type: array description: Lists the contact's own fields first, then the data fields by name. items: $ref: '#/components/schemas/ContactQueryField' operators: type: array description: Lists the comparison operators. items: type: string enum: - '=' - '!=' - < - <= - '>' - '>=' - IN - NOT IN x-enum-varnames: - ContactQueryOperatorEq - ContactQueryOperatorNe - ContactQueryOperatorLt - ContactQueryOperatorLe - ContactQueryOperatorGt - ContactQueryOperatorGe - ContactQueryOperatorIn - ContactQueryOperatorNotIn ContactExport: type: object description: An export job; `status` moves through `queued` and `running` to `completed` or `failed`. required: - id - status - created_at - finished_at - url - expires_at - error properties: id: type: string status: type: string enum: - queued - running - completed - failed x-enum-varnames: - ContactExportStatusQueued - ContactExportStatusRunning - ContactExportStatusCompleted - ContactExportStatusFailed description: 'Records the state of the job. Values: - `queued`: waits to run. - `running`: writes the file. - `completed`: carries `url`. - `failed`: carries `error`.' created_at: type: string format: date-time finished_at: type: - string - 'null' format: date-time description: Records when the job completed or failed; `null` before that. url: type: string description: Points at the csv file with a signed download link, valid for 7 days; empty until the job completes. expires_at: type: - string - 'null' format: date-time description: Records when `url` stops working; `null` until the job completes. error: type: string description: Says why the job failed; empty otherwise. ContactRead: description: The full contact plus `included`, the relations `include` resolved for it; `{}` when none were asked for. allOf: - $ref: '#/components/schemas/Contact' - type: object required: - included properties: included: $ref: '#/components/schemas/ContactIncluded' PatchContactRequest: type: object description: 'Carries a partial update of the contact: an omitted `number`, `type`, `country_code` or `data` preserves the current value. The fields: - `number`: a submitted one reaches the stored form through `type` and `country_code`, as on create. - `data`: a submitted object replaces the stored one wholesale; its parts are never merged, and `{}` clears it. - A field of `data` set to `null` is not stored. - `communication_history`: is absent here because it is not writable through the API. Refused when: - `type` or `country_code` is sent without a `number`. - `data` is set to `null`.' required: - revision properties: number: type: string description: As on create; the `type` and `country_code` of this request apply to it. type: $ref: '#/components/schemas/IdentifierType' country_code: $ref: '#/components/schemas/CountryCode' data: type: object additionalProperties: true x-go-type: nullable.Nullable[map[string]interface{}] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true revision: type: string description: Carries the `revision` the caller read, exactly as it was returned. SegmentIncluded: type: object description: 'Carries the related resources resolved for this response, one map per relation under the relation''s name. Rules: - Each map is keyed by the related resource''s own id. - A to-many relation is keyed the same way. - A relation''s map is present whenever it was requested, and empty if nothing resolved. The maps: - `source`: keyed as `included.source[id]`. Each source carries its `segment_sid` and its row counts, newest first, capped the way every to-many include is. - `automation`: keyed as `included.automation[automation_sid]`.' properties: source: type: object additionalProperties: $ref: '#/components/schemas/Source' automation: type: object additionalProperties: $ref: '#/components/schemas/Automation' SegmentList: type: object required: - items - total - limit - offset - has_more - included properties: items: type: array items: $ref: '#/components/schemas/Segment' total: type: integer format: int64 description: Counts the segments 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. included: $ref: '#/components/schemas/SegmentIncluded' CreateSegmentRequest: type: object required: - name description: A new segment, usable at once. Sources are created inside it afterwards — a source belongs to its segment and cannot exist before one. properties: name: type: string description: Names the segment; unique among the live segments of the account, the default one aside. SegmentRead: description: 'Carries the full segment plus `included`, the related resources resolved for it. The relations: - `include=source`: resolves the sources. - `include=automation`: resolves the holding automation. `included` is `{}` when none were asked for.' allOf: - $ref: '#/components/schemas/Segment' - type: object required: - included properties: included: $ref: '#/components/schemas/SegmentIncluded' PatchSegmentRequest: type: object description: 'Partial update: an omitted field preserves the current value. The default segment refuses this call.' properties: name: type: string description: Names the segment; unique among the live segments of the account, the default one aside. SourceList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/Source' total: type: integer format: int64 limit: type: integer offset: type: integer has_more: type: boolean CreateSourceRequest: type: object required: - kind description: An empty source of the given kind. Its content is supplied afterwards, and each supply states the `type` and `country_code` that apply to its rows. properties: kind: type: string enum: - file - manual description: 'Says where this source''s contacts come from. Values: - `file`: the contacts come from a supplied file. - `manual`: the contacts are named one at a time.' reset_reach: type: boolean description: Puts the contacts this source supplies back on the automation's list when the source is published. Default false. SourcePublishCounts: type: object description: Counts the contacts a publish call wrote. required: - created - updated properties: created: type: integer format: int64 description: Counts the contacts the call created. updated: type: integer format: int64 description: Counts the contacts the account already held that the call wrote data to. SourcePublishResult: type: object description: 'Reports what the publish call did. The fields: - `sources`: lists the sources the call published, each with its counts. - `counts`: counts the contacts the call wrote; a retried publish counts only the contacts it wrote itself. - `reset_reach_processed`: counts the contacts the sources with `reset_reach` put back.' required: - sources - counts - reset_reach_processed properties: sources: type: array items: $ref: '#/components/schemas/Source' counts: $ref: '#/components/schemas/SourcePublishCounts' reset_reach_processed: type: integer format: int64 description: 'Counts the contacts put back to waiting on the automation that holds the segment. Rules: - It is 0 when no published source carries `reset_reach`. - It is 0 when no live automation holds the segment. - It is 0 when none of the supplied contacts had been called.' ValidationCounts: type: object description: Rows or merged contacts by what publish would do with them. required: - create - update - rejected - conflicts - over_limit properties: create: type: integer format: int64 description: Counts the contacts that would be new. update: type: integer format: int64 description: Counts the contacts the account already holds that would change. rejected: type: integer format: int64 description: Counts the rows that cannot be used; publish skips them. conflicts: type: integer format: int64 description: Counts the contacts another draft source supplies with different data, type or country; publish refuses while any remain. over_limit: type: integer format: int64 description: Counts the contacts whose data, merged into what the contact holds, would break a data limit of the account; publish refuses while any remain. SourceValidationCounts: type: object required: - source_sid - counts properties: source_sid: type: string counts: $ref: '#/components/schemas/ValidationCounts' ContactDataLimitBreach: type: object description: Names the first limit of the account the contact data breaks. required: - trigger - field - params properties: trigger: $ref: '#/components/schemas/ContactDataTrigger' field: type: string description: Names the field that breaks the limit by its path; for too many fields, the first new field past the limit. params: $ref: '#/components/schemas/ContactDataLimitParams' ValidatedContactRow: type: object description: One row that supplied the merged contact, with the three values the rows are compared on. required: - id - source_sid - type - country_code - data properties: id: type: string source_sid: type: string type: $ref: '#/components/schemas/RecordedIdentifierType' country_code: $ref: '#/components/schemas/RecordedCountryCode' data: type: - object - 'null' additionalProperties: true ValidatedContact: type: object description: One number across the segment's draft sources, with the rows that supplied it. required: - number - action - contact_sid - is_conflicting - over_limit - rows properties: number: type: string action: type: string enum: - create - update description: 'Says what publish would do with this number. Values: - `create`: the account holds no contact with this number. - `update`: the account already holds a contact with this number.' contact_sid: type: - string - 'null' description: Names the contact an update would write into; null on a create. is_conflicting: type: boolean description: Says whether two of the rows disagree on data, type or country. Publish refuses the batch while any merged contact is conflicting. over_limit: description: Names the first data limit the merged contact breaks, counted together with the data the contact already holds; null when it breaks none. anyOf: - $ref: '#/components/schemas/ContactDataLimitBreach' - type: 'null' rows: type: array items: $ref: '#/components/schemas/ValidatedContactRow' SourceValidation: type: object description: What publish would do with the segment's draft sources; the call changes nothing. required: - batch - contacts - sources - items - total - limit - offset - has_more properties: batch: $ref: '#/components/schemas/ValidationCounts' contacts: type: object description: Reports the account's contacts against its contact limit; publish refuses while `batch.create` is above `limit` less `current`. required: - current - limit properties: current: type: integer format: int64 description: Counts the account's contacts. limit: type: integer format: int64 description: Reports the account's contact limit. sources: type: array items: $ref: '#/components/schemas/SourceValidationCounts' description: Lists one entry per draft source, newest first. items: type: array items: $ref: '#/components/schemas/ValidatedContact' description: Lists the merged contacts, one per number, in number order. total: type: integer format: int64 description: Counts the merged contacts in the batch, 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 merged contacts beyond this page exist. PatchSourceRequest: type: object description: 'The source''s own configuration, as opposed to its content: a file''s rows are supplied on its `file` sub-resource, not here.' properties: auto_update: type: - boolean - 'null' description: Keeps the segment in step with this source. Refused for a kind whose content cannot change. reset_reach: type: - boolean - 'null' description: Puts the contacts this source supplies back on the automation's list when the source is published. Changeable while the source is a draft; refused afterwards. UploadCounts: type: object description: Counts the rows of one upload. required: - total - success - rejected - duplicate properties: total: type: integer format: int64 description: Counts the rows the upload carried. success: type: integer format: int64 description: Counts the usable rows stored. rejected: type: integer format: int64 description: Counts the rows that could not be used. Retrievable as a file. duplicate: type: integer format: int64 description: Counts the rows merged into another row of the same number; the last of them is kept. ResultError: type: object description: One kind of thing that went wrong, with its parameters carried separately so the message stays translatable. required: - code - message - parameters properties: code: type: string description: Carries the stable snake_case code the client switches on. message: type: string description: Carries English text. It never interpolates a variable value — those travel in parameters. parameters: type: object additionalProperties: true description: 'Carries everything variable about this error: counts, an example row, the offending value.' SourceFile: type: object description: 'Reports what an upload of a file did. The fields: - `counts`: counts the rows of the file. - `errors`: lists the reasons any of its rows were rejected.' required: - counts - total_count - success_count - error_count properties: filename: type: - string - 'null' description: Names the file as supplied. counts: $ref: '#/components/schemas/UploadCounts' total_count: type: integer format: int64 deprecated: true description: Rows the upload carried. Replaced by `counts.total`. success_count: type: integer format: int64 deprecated: true description: Counts the usable rows of the upload. Replaced by `counts.success`. error_count: type: integer format: int64 deprecated: true description: Rows that could not be used. Replaced by `counts.rejected`. errors: type: array items: $ref: '#/components/schemas/ResultError' description: Empty when nothing was rejected. SourceColumnChange: type: object description: 'Carries one change to the columns of the source''s rows. By kind: - A rename carries `from` and `to`. - A delete carries `field`. Each names a column of the source''s rows.' properties: from: type: string description: Names the column to rename. to: type: string description: 'Names the column it becomes. Rules: - It holds at most 64 characters. - It holds no dot.' field: type: string description: Names the column to remove. SourceColumnChangeResult: type: object required: - updated properties: updated: type: integer description: Counts the rows that held the column and changed. SupplySourceContactRow: type: object required: - number properties: number: type: string description: Carries the row's number, brought to the stored form by the request's `type` and `country_code`. data: type: - object - 'null' additionalProperties: true description: Carries the row's contact data; a nested object sets nested fields. SupplySourceContactsRequest: type: object description: Carries a list of rows to upload to a source. required: - rows properties: type: $ref: '#/components/schemas/IdentifierType' country_code: $ref: '#/components/schemas/CountryCode' rows: type: array description: Holds up to 100 000 rows. items: $ref: '#/components/schemas/SupplySourceContactRow' SourceRowsResult: type: object description: 'Reports what an upload of a list of rows did. The fields: - `counts`: counts the rows of the list. - `errors`: lists the reasons any of its rows were rejected.' required: - counts - errors properties: counts: $ref: '#/components/schemas/UploadCounts' errors: type: array items: $ref: '#/components/schemas/ResultError' description: Empty when nothing was rejected. SourceContactRejection: type: object description: 'Names why a row cannot be used. By reason: - For `value_too_long`, it carries `field` and `limit`. - For `type_mismatch`, it carries `field` and `type`. - For a reason about the number, it carries `reason` only.' required: - reason properties: reason: $ref: '#/components/schemas/RowRejectionReason' field: type: string description: Names the key of `data` whose value is refused. limit: type: integer description: Reports the account's value limit in bytes. type: type: string description: Names the type the field holds across the account's contacts. SourceContact: type: object description: 'Describes one row a source holds; the row is editable and removable while its source is a draft. Refused when: - The row is edited or removed while its source is published. - The row is edited or removed while its source is removed.' required: - id - number - status - type - country_code - data - line - row_index - processed_at - error - rejection - created_at properties: id: type: string status: type: string enum: - draft - published - rejected description: 'Says where the row stands. Values: - `draft`: the row stays a draft until its source is published. - `published`: the row has become a contact. - `rejected`: the row cannot be used; the reason is in `error`.' number: type: string description: 'Carries the number this row resolves to a contact by. By row: - A row rejected for its number holds the value as supplied. - Every other row holds the stored form that the `type` and `country_code` of the supplying request produced.' type: $ref: '#/components/schemas/RecordedIdentifierType' country_code: $ref: '#/components/schemas/RecordedCountryCode' data: type: - object - 'null' additionalProperties: true description: Holds everything else the row carried, keyed by its normalised column headings. line: type: - integer - 'null' description: 'Records, on a row a supplied file rejected, the line of that file the row starts on. Rules: - The heading row is counted, so the first row under a heading on line 1 is line 2. - For an xlsx file, the line is the row of the sheet. Null when: - The row is usable. - The row was rejected when it was added or corrected on its own. - The row was supplied in a list of rows. - The row was stored before lines were recorded. A correction that makes the row usable clears it.' row_index: type: - integer - 'null' description: 'Records the place of a rejected row in `rows` of the supplied list, counted from 0. Null when: - The row is usable. - The row was supplied in a file, or added or corrected on its own. A correction that makes the row usable clears it.' processed_at: type: - string - 'null' format: date-time description: 'Records when the row became a contact. Null when: - The row is a draft. - The row is rejected.' error: type: - string - 'null' description: 'Says why the row cannot be used, null when it can. It holds `the number is missing`, `the number is not valid: the number holds no digits`, `… is not a valid international number`, `… is not valid for the country_code`, `… is not a valid international number, so a country_code is needed`, or one of the values below. Values: - `… the identifier must start with a letter or a digit`: given for an `alphanumeric` row. - `the value of is longer than bytes`: names the key of `data` and the account''s value limit. - `the value of is not of type `: names the type the field holds across the account''s contacts.' rejection: anyOf: - $ref: '#/components/schemas/SourceContactRejection' - type: 'null' description: 'Names why the row cannot be used, as a code. Null when: - The row can be used. - The reason has no code; `error` still says why.' created_at: type: string format: date-time SourceContactList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/SourceContact' total: type: integer format: int64 limit: type: integer offset: type: integer has_more: type: boolean CreateSourceContactRequest: type: object required: - number properties: number: type: string type: $ref: '#/components/schemas/IdentifierType' country_code: $ref: '#/components/schemas/CountryCode' data: type: - object - 'null' additionalProperties: true PatchSourceContactRequest: type: object description: 'Carries a partial update of the source row. Rules: - An omitted field preserves the current value. - `type` and `country_code` apply to a submitted `number`. - `country_code: null` states no country, as an omitted one does. Refused when: - The source is published. - The source is removed. - The number is one the source already holds. - `type` or `country_code` is sent without a `number`.' properties: number: type: string type: $ref: '#/components/schemas/IdentifierType' country_code: anyOf: - $ref: '#/components/schemas/CountryCode' - type: 'null' data: type: - object - 'null' additionalProperties: true x-go-type: nullable.Nullable[map[string]interface{}] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true LimitPolicy: type: object required: - id - account_sid - agent_sid - name - lines - created_at - updated_at properties: id: type: string account_sid: type: string agent_sid: type: string name: type: string description: Unique among the live policies of the same agent. lines: type: integer description: Calls held for the automations that name this policy. created_at: type: string format: date-time updated_at: type: string format: date-time AutomationIncluded: type: object description: 'Carries the related resources resolved for this response. Rules: - Related resources are deduplicated and keyed by the related resource''s own id, so an automation resolves one as `included.agent[agent_sid]`. - A relation''s map is present whenever it was requested. - A relation''s map is empty if nothing resolved. - A reference the caller may not read is absent from the map, and the automation keeps its sid.' properties: agent: type: object additionalProperties: $ref: '#/components/schemas/Agent' segment: type: object additionalProperties: $ref: '#/components/schemas/Segment' limit_policy: type: object description: Resolves the policy each `limit_policy_sid` names; an automation without one resolves nothing here. additionalProperties: $ref: '#/components/schemas/LimitPolicy' AutomationList: type: object required: - items - total - limit - offset - has_more - included properties: items: type: array items: $ref: '#/components/schemas/Automation' total: type: integer format: int64 description: Counts the automations 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. included: $ref: '#/components/schemas/AutomationIncluded' CreateAutomationRequest: type: object required: - agent_sid - segment_sid - name properties: agent_sid: type: string description: 'Names the agent the calls go out through. Refused when: - The agent belongs to another account. - The agent is archived.' segment_sid: type: string description: Names the contacts to reach. A segment another live automation already holds is refused. limit_policy_sid: type: string description: Names a policy of the same agent. One belonging to another agent is refused. name: type: string description: Unique among the live automations of the same agent. mode: $ref: '#/components/schemas/AutomationMode' AutomationRead: description: The full automation plus `included`, the relations `include` resolved for it; `{}` when none were asked for. allOf: - $ref: '#/components/schemas/Automation' - type: object required: - included properties: included: $ref: '#/components/schemas/AutomationIncluded' PatchAutomationRequest: type: object description: 'Carries a partial update of the automation. Rules: - An omitted field preserves the current value. - The status moves through stop, start and archive rather than by being written.' properties: agent_sid: type: string description: 'Names the agent the calls go out through, fixed once an attempt of the automation opens. Refused when: - The agent belongs to another account. - The agent is archived.' segment_sid: type: string description: 'Names the contacts to reach, fixed once an attempt of the automation opens. Refused when: - The segment belongs to another account. - Another live automation already holds the segment.' mode: $ref: '#/components/schemas/AutomationMode' name: type: string description: Refused when another live automation holds it under the agent the automation has after this update. limit_policy_sid: type: - string - 'null' description: Names a policy of the agent the automation has after this update, or null to compete for what no policy of that agent reserved. x-go-type: nullable.Nullable[string] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true AutomationAttemptIncluded: type: object description: 'Carries the related resources resolved for this response. Rules: - Related resources are deduplicated and keyed by the related resource''s own id, so a run resolves its automation as `included.automation[automation_sid]`. - A relation''s map is present whenever it was requested. - A relation''s map is empty if nothing resolved.' properties: automation: type: object additionalProperties: $ref: '#/components/schemas/Automation' AutomationAttemptList: type: object required: - items - total - limit - offset - has_more - included properties: items: type: array items: $ref: '#/components/schemas/AutomationAttempt' total: type: integer format: int64 description: Counts the runs 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. included: $ref: '#/components/schemas/AutomationAttemptIncluded' CreateAutomationAttemptRequest: type: object required: - starts_at description: One pass over the contacts the automation has not reached, from `starts_at` to `ends_at`. Calls go out only inside the agent's calling schedule. properties: starts_at: type: string format: date-time description: 'Sets when calling starts. Refused when: - The moment is in the past. - The window overlaps another attempt of this automation.' ends_at: type: - string - 'null' format: date-time description: Sets when calling stops, finished or not — whoever is left waits for the next attempt. Omitted, the attempt runs until its calls are over or the next attempt starts; a moment at or before `starts_at` is refused. AutomationAttemptRead: description: The full run plus `included`, the automation `include=automation` resolved for it; `{}` when none was asked for. allOf: - $ref: '#/components/schemas/AutomationAttempt' - type: object required: - included properties: included: $ref: '#/components/schemas/AutomationAttemptIncluded' UpdateAutomationAttemptRequest: type: object description: Moves the window of an attempt that has not opened. A field left out stays as it is. properties: starts_at: type: string format: date-time description: 'Sets when calling starts. Refused when: - The moment is in the past. - The window overlaps another attempt of this automation.' ends_at: type: - string - 'null' format: date-time description: Sets when calling stops. `null` leaves the attempt without an end, so it runs until its calls are over; on any attempt but the one that runs last that is refused. A moment at or before `starts_at` is refused. x-go-type: nullable.Nullable[time.Time] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true AutomationProgress: type: object required: - total - reached - in_progress - attempted - waiting - stopped description: Where the outreach stands, counted in contacts. The five figures under `total` do not overlap and add up to it. properties: total: type: integer format: int64 description: Contacts the automation has taken across its runs, or contacts the run took. Before the first run takes anyone, the live members of the segment. reached: type: integer format: int64 description: Contacts who picked up. in_progress: type: integer format: int64 description: Contacts whose call is being placed or under way right now. attempted: type: integer format: int64 description: Contacts whose latest call ended without them picking up. waiting: type: integer format: int64 description: Contacts with no call placed yet, or whose call is created and not yet dialled. Before the first run takes anyone, every live member of the segment. stopped: type: integer format: int64 description: Contacts whose call was stopped before dialling, or deleted. The next run takes them. AutomationReachReset: type: object required: - reset description: How many contacts were put back on the list. properties: reset: type: integer format: int64 description: Contacts moved back to waiting. LimitPolicyIncluded: type: object description: 'Carries the related resources resolved for this response, deduplicated and keyed by the related resource''s own id, so a policy resolves its agent as `included.agent[agent_sid]`. Rules: - A relation''s map is present whenever it was requested. - A requested relation''s map is empty when nothing resolved. - A reference the caller may not read is absent from the map, and the policy keeps its sid.' properties: agent: type: object additionalProperties: $ref: '#/components/schemas/Agent' LimitPolicyList: type: object required: - items - total - limit - offset - has_more - included properties: items: type: array items: $ref: '#/components/schemas/LimitPolicy' total: type: integer format: int64 description: Counts the policies 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. included: $ref: '#/components/schemas/LimitPolicyIncluded' CreateLimitPolicyRequest: type: object required: - agent_sid - name - lines properties: agent_sid: type: string description: 'Names the agent whose capacity is sliced. Refused when: - The agent belongs to another account. - The agent is archived.' name: type: string description: Unique among the live policies of the same agent. lines: type: integer description: A figure that no longer fits inside the agent's capacity is refused. LimitPolicyRead: description: The full policy plus `included`, the agent `include=agent` resolved for it; `{}` when none was asked for. allOf: - $ref: '#/components/schemas/LimitPolicy' - type: object required: - included properties: included: $ref: '#/components/schemas/LimitPolicyIncluded' PatchLimitPolicyRequest: type: object description: 'Carries a partial update of the policy. Rules: - An omitted field preserves the current value. - The agent a policy slices is fixed at creation.' properties: name: type: string description: Unique among the live policies of the same agent. lines: type: integer description: A figure that no longer fits inside the agent's capacity is refused. SmsProviderType: type: string enum: - http x-enum-varnames: - SmsProviderTypeHTTP description: Provider kind; `http` is a generic single-HTTP-call gateway. SmsProviderHeader: type: object required: - name - value properties: name: type: string value: type: string description: Template variables ({{from}}, {{to}}, {{text}}) allowed. SmsProviderStatus: type: string enum: - active - inactive x-enum-varnames: - SmsProviderStatusActive - SmsProviderStatusInactive description: 'Says whether the provider is active. While the provider is `inactive`: - The provider is never called. - A send is recorded and answered with status failed. - Its config stays editable.' SmsProviderAccessType: type: string enum: - account - tenant x-enum-varnames: - SmsProviderAccessTypeAccount - SmsProviderAccessTypeTenant description: Field declares an owner of created model. account or tenant SmsProvider: type: object required: - id - account_sid - name - type - url - method - headers - body_template - alphas - numbers - status - access_type - created_at - updated_at properties: id: type: string account_sid: type: string name: type: string type: $ref: '#/components/schemas/SmsProviderType' url: type: string method: type: string headers: type: array items: $ref: '#/components/schemas/SmsProviderHeader' body_template: type: string alphas: type: array items: type: string numbers: type: array items: type: string status: $ref: '#/components/schemas/SmsProviderStatus' access_type: $ref: '#/components/schemas/SmsProviderAccessType' created_at: type: string format: date-time updated_at: type: string format: date-time AgentIncluded: type: object description: 'Carries the related resources resolved for this response, one map per relation under the relation''s name, keyed by the related resource''s own id (`included.scenario[id]`). Rules: - A relation''s map is present whenever it was requested, empty if nothing resolved. - A reference the caller may not read is absent from the map, and the agent keeps its sid.' properties: scenario: type: object additionalProperties: $ref: '#/components/schemas/ScenarioEmbed' number: type: object additionalProperties: $ref: '#/components/schemas/Number' number_pool: type: object additionalProperties: $ref: '#/components/schemas/NumberPool' automation: type: object description: Resolves the automations of the agents of this response; a to-many relation, each automation carrying its `agent_sid`, capped the way every to-many include is. additionalProperties: $ref: '#/components/schemas/Automation' sms_provider: type: object description: Resolves the provider each `sms.provider_sid` names; an agent without SMS routing resolves nothing here. additionalProperties: $ref: '#/components/schemas/SmsProvider' AgentList: type: object required: - items - total - limit - offset - has_more - included properties: items: type: array items: $ref: '#/components/schemas/Agent' total: type: integer format: int64 description: Counts the agents 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. included: $ref: '#/components/schemas/AgentIncluded' CreateAgentRequest: type: object required: - name - gateway_type - scenario_sid properties: name: type: string description: A name another agent of the account already holds is refused; archived and deleted agents do not count. gateway_type: $ref: '#/components/schemas/AgentGatewayType' number_sid: type: - string - 'null' number_pool_sid: type: - string - 'null' scenario_sid: type: string voicemail_enabled: type: boolean deprecated: true description: Turns on answering machine detection for the agent's outbound calls on a scenario whose start call brick is v1. call_recording: type: boolean calling_schedule: $ref: '#/components/schemas/CallingSchedule' timezone: type: string description: 'Sets the IANA zone the calling window is read in. Refused when: - The zone is unknown. - A `calling_schedule` is set on an agent with no timezone.' lines: type: integer description: 'Sets how many simultaneous calls this agent holds. Omitted, the agent is created holding one. Refused when: - The account''s agents no longer fit its allocation. - This agent''s limit policies no longer fit inside it.' is_test: type: boolean communication_result: $ref: '#/components/schemas/CommunicationResultConfig' sms: $ref: '#/components/schemas/AgentSms' status: $ref: '#/components/schemas/AgentStatus' AgentRead: description: The full agent plus `included`, the relations `include` resolved for it; `{}` when none were asked for. allOf: - $ref: '#/components/schemas/Agent' - type: object required: - included properties: included: $ref: '#/components/schemas/AgentIncluded' PatchAgentRequest: type: object description: 'Carries a partial update of the agent. Rules: - An omitted field preserves the current value. - A nullable object field accepts an explicit `null` to clear the value.' properties: name: type: string description: A name another agent of the account already holds is refused; archived and deleted agents do not count. gateway_type: $ref: '#/components/schemas/AgentGatewayType' number_sid: type: - string - 'null' number_pool_sid: type: - string - 'null' scenario_sid: type: string voicemail_enabled: type: boolean deprecated: true description: Turns on answering machine detection for the agent's outbound calls on a scenario whose start call brick is v1. call_recording: type: boolean calling_schedule: description: A change reaches the agent's calls that are not yet placed; `null` removes the window and the platform default then applies to them. anyOf: - $ref: '#/components/schemas/CallingSchedule' - type: 'null' x-go-type: nullable.Nullable[CallingSchedule] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true timezone: type: string description: 'Sets the IANA zone the calling window is read in. Refused when: - The zone is unknown. - A `calling_schedule` is set on an agent with no timezone.' lines: type: integer description: 'Sets how many simultaneous calls this agent holds. Refused when: - The account''s agents no longer fit its allocation. - This agent''s limit policies no longer fit inside it.' is_test: type: boolean communication_result: anyOf: - $ref: '#/components/schemas/CommunicationResultConfig' - type: 'null' x-go-type: nullable.Nullable[CommunicationResultConfig] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true sms: anyOf: - $ref: '#/components/schemas/AgentSms' - type: 'null' x-go-type: nullable.Nullable[AgentSms] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true status: $ref: '#/components/schemas/AgentStatus' RoutingList: type: object required: - items - total - limit - offset - has_more - included description: Carries every routing of the agent in one page. properties: items: type: array items: $ref: '#/components/schemas/Routing' total: type: integer format: int64 description: Counts the routings, the default routing included. limit: type: integer description: Reports the number of routings returned. offset: type: integer description: Reports 0. has_more: type: boolean description: Reports false. included: type: object description: Reports `{}`. CreateRoutingRequest: type: object required: - name - condition - scenario_sid properties: name: type: string description: Names the routing. condition: type: string description: Holds the expression a call is checked against, as `GET /v1/a/agent/-/routing/-/query-language` describes it. scenario_sid: type: string description: Names the scenario a call plays when the condition matches; it may have no published version. position: type: integer description: 'Places the routing in the order, from 1. Rules: - Omitted, the routing goes last, before the default routing. - The routings from that position on move one place down.' PatchRoutingRequest: type: object description: 'Carries a partial update of the routing. Rules: - An omitted field preserves the current value. - A new position moves the routings between the old and the new place one place toward the old one.' properties: name: type: string description: Names the routing. condition: type: string description: Holds the expression a call is checked against, as `GET /v1/a/agent/-/routing/-/query-language` describes it. scenario_sid: type: string description: Names the scenario a call plays when the condition matches; it may have no published version. position: type: integer description: From 1 to the number of the agent's routings, the default routing not counted. RoutingQueryField: type: object required: - name - type properties: name: type: string description: Names the field as a condition writes it, `call.direction` or `contact.address.city`. type: type: string enum: - string - number - boolean - array - date - time - datetime - segment x-enum-varnames: - RoutingQueryTypeString - RoutingQueryTypeNumber - RoutingQueryTypeBoolean - RoutingQueryTypeArray - RoutingQueryTypeDate - RoutingQueryTypeTime - RoutingQueryTypeDatetime - RoutingQueryTypeSegment description: 'Names the type of the field. Values: - `segment`: compares with `=`, `!=`, `IN` and `NOT IN` only, by segment name or id. - `array`: compares with nothing.' values: type: array items: type: string description: Lists every value the field can hold. Absent when the set is open. RoutingQueryLanguage: type: object required: - fields - operators - durations properties: fields: type: array description: Lists the call fields, the time fields and `segment` first, then the contact data fields sorted by name. items: $ref: '#/components/schemas/RoutingQueryField' operators: type: array description: Lists the operators. items: type: string enum: - '=' - '!=' - < - <= - '>' - '>=' - IN - NOT IN x-enum-varnames: - RoutingQueryOperatorEq - RoutingQueryOperatorNe - RoutingQueryOperatorLt - RoutingQueryOperatorLe - RoutingQueryOperatorGt - RoutingQueryOperatorGe - RoutingQueryOperatorIn - RoutingQueryOperatorNotIn durations: type: array description: Lists the units of a duration that shifts `now`, as in `now - 2h`. items: type: string enum: - ms - s - m - h - d x-enum-varnames: - RoutingQueryDurationMs - RoutingQueryDurationS - RoutingQueryDurationM - RoutingQueryDurationH - RoutingQueryDurationD SmsProviderList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/SmsProvider' total: type: integer format: int64 description: Counts the providers 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. CreateSmsProviderRequest: type: object required: - name - url - body_template properties: name: type: string type: $ref: '#/components/schemas/SmsProviderType' url: type: string description: Sets the send endpoint. Template variables ({{from}}, {{to}}, {{text}}) allowed. method: type: string description: Sets the HTTP method, default POST. headers: type: array items: $ref: '#/components/schemas/SmsProviderHeader' body_template: type: string description: Sets the request-body template. Template variables ({{from}}, {{to}}, {{text}}) allowed. alphas: type: array items: type: string numbers: type: array items: type: string status: $ref: '#/components/schemas/SmsProviderStatus' access_type: $ref: '#/components/schemas/SmsProviderAccessType' PatchSmsProviderRequest: type: object description: 'Carries a partial update of the SMS provider. Rules: - An omitted field preserves the current value. - A nullable array field accepts explicit `null` to clear the value.' properties: name: type: string type: $ref: '#/components/schemas/SmsProviderType' url: type: string method: type: string headers: type: - array - 'null' items: $ref: '#/components/schemas/SmsProviderHeader' x-go-type: nullable.Nullable[[]SmsProviderHeader] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true body_template: type: string alphas: type: - array - 'null' items: type: string x-go-type: nullable.Nullable[[]string] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true numbers: type: - array - 'null' items: type: string x-go-type: nullable.Nullable[[]string] x-go-type-import: path: github.com/oapi-codegen/nullable x-go-type-skip-optional-pointer: true status: $ref: '#/components/schemas/SmsProviderStatus' access_type: $ref: '#/components/schemas/SmsProviderAccessType' SmsSendRequest: type: object required: - to - text description: 'Carries exactly one of `communication_sid` or `provider_sid`. By mode: - `communication_sid`: resolves the agent''s provider and sender from that communication; the sender comes from the agent''s SMS settings. - `provider_sid`: sends directly, with at least one of `from_alpha` and `from_number`, the registered senders of that provider. Rules: - `from_alpha` is preferred when both senders are set. - `to` is always explicit: the caller states the recipient. Refused when neither or both of `communication_sid` and `provider_sid` are set.' properties: communication_sid: type: string provider_sid: type: string from_alpha: type: string description: 'Sets the sender alpha on a direct send: one of the provider''s registered alphas. Rules: - At least one of `from_alpha` and `from_number` accompanies `provider_sid`. - `from_alpha` wins when both are set. Refused when `from_alpha` or `from_number` is sent alongside `communication_sid`.' from_number: type: string description: 'Sets the sender number on a direct send: one of the provider''s registered numbers. Rules: - It is used when `from_alpha` is absent. - It accompanies `provider_sid` only. Refused when it is sent alongside `communication_sid`.' to: type: string text: type: string variables: type: object additionalProperties: type: string description: 'Carries values for additional `{{name}}` template variables. Rules: - They are substituted into the provider config, where the reserved `from`, `to` and `text` variables always win over a same-named entry. - They are also substituted into `text` itself, where the reserved names carry no such protection.' SmsResultStatus: type: string enum: - sent - failed x-enum-varnames: - SmsResultStatusSent - SmsResultStatusFailed SmsResult: type: object required: - id - status - from - to - http_status - error properties: id: type: string description: Identifies the recorded sms row (sms_…). status: $ref: '#/components/schemas/SmsResultStatus' from: type: string description: Records the resolved sender identity the message was sent as. to: type: string description: Records the resolved recipient. http_status: type: - integer - 'null' description: Records the provider response status; null when no response was received. error: type: - string - 'null' 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. RegularLoginRequest: type: object required: - email - password properties: email: type: string password: type: string SessionResponse: type: object required: - session_token - user_sid - account_sid - tenant_sid - email properties: session_token: type: string user_sid: type: string account_sid: type: - string - 'null' description: Names the account the session is scoped to; null for a tenant-level user, whose session carries tenant scope. tenant_sid: type: string email: type: string MagicConsumeRequest: type: object required: - token properties: token: type: string PasswordChangeRequest: type: object required: - current_password - new_password properties: current_password: type: string new_password: type: string minLength: 8 PasswordResetConsumeRequest: type: object required: - token - new_password properties: token: type: string new_password: type: string minLength: 8 EntityStatus: type: string enum: - active - inactive x-enum-varnames: - EntityStatusActive - EntityStatusInactive 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. CreateUserRequest: type: object required: - email properties: email: type: string format: email x-go-type: string name: type: string external_id: type: string password: type: string description: Sets the password the user signs in with. roles: type: array items: type: string description: Names of roles listed by `GET /v1/a/role`; omitted means no roles until a patch assigns them. PatchUserRequest: type: object description: 'Carries a partial update of the user. Rules: - An omitted field preserves the current value. - An explicit empty `password` clears the stored password, after which `has_password` reads false. - 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/a/role`. status: $ref: '#/components/schemas/EntityStatus' password: type: string description: Replaces the password the user signs in with; an empty string removes it. 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. HandoffResponse: type: object required: - token - expires_at - consume_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. 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 RoleLevel: type: string enum: - account - tenant x-enum-varnames: - RoleLevelAccount - RoleLevelTenant 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 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. 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. 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 ProfileUser: type: object required: - sid - account_sid - tenant_sid - level - email - name - external_id - roles - status - has_password - last_login_at properties: sid: type: string account_sid: type: - string - 'null' description: Names the owning account; null for a tenant-level caller. tenant_sid: type: - string - 'null' description: Names the owning tenant; null for an account-level caller. level: type: string enum: - account - tenant x-enum-varnames: - ProfileUserLevelAccount - ProfileUserLevelTenant description: 'Declares the owner of the caller: 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; empty when unset. roles: type: array items: type: string 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 ProfileContactLimits: type: object description: Reports the contact limits the account runs on, its own where the tenant set one and the platform's otherwise. required: - data_fields - value_bytes - array_items - contacts properties: data_fields: type: integer description: Bounds the fields of a contact's data, counted at any depth, an array as one field. value_bytes: type: integer description: Bounds the bytes of one value of a contact's data, and of each item of an array. array_items: type: integer description: Bounds the items of an array in a contact's data. contacts: type: integer description: Bounds the contacts the account holds. ProfileAccount: type: object required: - sid - tenant_sid - tenant_name - name - email - external_id - country - timezone - phone - status - lines - contact_limits properties: sid: type: string tenant_sid: type: string tenant_name: type: string name: type: string email: type: string external_id: type: string country: type: string timezone: type: string phone: type: string status: $ref: '#/components/schemas/EntityStatus' lines: type: integer description: Simultaneous calls the account may hold across its agents. Set by the tenant on the tenant plane. contact_limits: $ref: '#/components/schemas/ProfileContactLimits' FeatureFlagSet: type: object description: Every declared feature flag evaluated for the caller's account. The set is closed, so each flag is present whatever its value. required: - global_llm - global_stt - global_tts - sentry_enabled additionalProperties: false properties: global_llm: type: boolean global_stt: type: boolean global_tts: type: boolean sentry_enabled: type: boolean description: Declares whether the client may send its errors, traces and session replays to an error tracker. example: global_llm: true global_stt: false global_tts: true sentry_enabled: false ManagedResources: type: object description: 'Declares the resource types a tenant''s integrating system provisions and owns. Rules: - Every declarable type carries its own boolean, present whether or not it is declared. - It is editable by the platform operator only, never by the tenant it constrains. For a declared type: - Every resource of that type requires an external identifier. - Only a caller with the role `tenant_admin` creates, changes or deletes a resource of that type.' required: - account - user - number - number_pool properties: account: type: boolean description: 'Declares that the tenant provisions its own accounts. Refused when: - An account is created without an `external_id`. - The account edits its own contact fields through `/v1/a/profile`. The account and profile operations name the codes.' user: type: boolean description: 'Declares that the tenant provisions its accounts'' users. For a caller without the role `tenant_admin`: - Creating, changing or deleting a user is refused. - Resetting a user''s password is refused. - Switching users on and off stays allowed. - The magic link stays open. The user operations name the code.' number: type: boolean description: 'Declares that the tenant provisions its accounts'' numbers: a caller without the role `tenant_admin` that creates, changes or deletes one is refused, but still switches them on and off; the number operations name the code.' number_pool: type: boolean description: Declares that the tenant provisions its accounts' number pools, on the same terms as `number`. ProfileLink: type: object required: - title - url - group properties: title: type: string description: Carries the text a client shows for the link; it carries no `<` or `>`. url: type: string description: Carries the `https` address the link opens. example: https://account.apifonica.com/numbers/buy group: type: string description: Carries the label a client groups the link under; empty for none. It carries no `<` or `>`. Profile: type: object required: - user - account - feature_flags - managed_resources - permissions - links properties: user: $ref: '#/components/schemas/ProfileUser' account: anyOf: - $ref: '#/components/schemas/ProfileAccount' - type: 'null' description: Carries the account-shaped half of the profile; null for a tenant-level caller, who has none. feature_flags: $ref: '#/components/schemas/FeatureFlagSet' managed_resources: allOf: - $ref: '#/components/schemas/ManagedResources' description: Declares what the caller's own tenant provisions, as it applies to this account. permissions: type: array items: $ref: '#/components/schemas/PermissionName' description: Lists every permission the caller holds, sorted by name. A route that requires one admits the caller only when it is in this list. example: - agent:read - contact:read - segment:read links: type: array items: $ref: '#/components/schemas/ProfileLink' description: Lists the links the caller's tenant places in the interface, in the order a client shows them; the same for every caller of the tenant. PatchProfileRequest: type: object additionalProperties: false properties: user: type: object additionalProperties: false properties: name: type: string email: type: string format: email x-go-type: string description: Replaces the address the person signs in with; unique among live account-level users. account: type: object additionalProperties: false properties: name: type: string country: type: string timezone: type: string phone: type: string pattern: ^[0-9]*$ description: Digits only, no separators. Country: type: object required: - code - name properties: code: type: string description: 'Carries the country code: ISO 3166-1 alpha-2, lowercase.' example: rs name: type: string example: Serbia CountryList: type: object required: - items properties: items: type: array items: $ref: '#/components/schemas/Country' Region: type: object required: - code - name properties: code: type: string description: Carries the region code, lowercase — the value stored in feature-flag rules. example: eea name: type: string example: European Economic Area RegionList: type: object required: - items properties: items: type: array items: $ref: '#/components/schemas/Region' 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' LanguageEntityTypes: type: object properties: language: type: string types: type: array items: type: string required: - language - types EntityTypeList: type: array items: $ref: '#/components/schemas/LanguageEntityTypes' Model: type: object properties: id: type: string title: type: string description: type: string language: type: string is_default_for_language: type: boolean required: - id - title - description - language ModelList: type: array items: $ref: '#/components/schemas/Model' ClassifyRequest: type: object properties: phrase: type: string required: - phrase ClassifiedIntents: type: object properties: intents: type: object additionalProperties: type: number format: float required: - intents EntityExtractionRequest: type: object properties: types: type: array items: type: string language: type: string time_zone: type: string timestamp: type: integer format: int64 phrase: type: string required: - types - language - phrase ExtractedEntity: type: object properties: type: type: string value: description: Shape depends on the entity type (e.g. date, time, address, phone-number). type: object additionalProperties: true required: - type - value ExtractedEntityList: type: array items: $ref: '#/components/schemas/ExtractedEntity' 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 FunctionCall: type: object description: A model-emitted function call (deprecated single-function form). properties: name: type: string arguments: type: string description: JSON-encoded argument string. FunctionCallDetail: type: object description: The function name and JSON-encoded arguments carried by a tool call. properties: name: type: string arguments: type: string ToolCall: type: object required: - id - type - function properties: id: type: string type: type: string function: $ref: '#/components/schemas/FunctionCallDetail' Message: type: object description: A chat message. Content is a string; multimodal content is not supported. required: - role - content properties: role: type: string content: type: string name: type: string function_call: $ref: '#/components/schemas/FunctionCall' tool_calls: type: array items: $ref: '#/components/schemas/ToolCall' tool_call_id: type: string Function: type: object required: - name - parameters properties: name: type: string description: type: string parameters: type: object description: JSON-Schema parameter definition, kept deliberately loose. additionalProperties: true Tool: type: object required: - type properties: type: type: string function: $ref: '#/components/schemas/Function' OpenAIChatFields: type: object description: OpenAI-shaped chat request fields shared by chat completion and chat stream. required: - model - messages properties: model: type: string messages: type: array items: $ref: '#/components/schemas/Message' max_tokens: type: integer temperature: type: number format: float top_p: type: number format: float reasoning_effort: type: string enum: - none - minimal - low - medium - high description: 'Reasoning budget for reasoning-capable models (GPT-5 and newer). Omit to keep the model default (medium). Lower values cut latency; ''none'' disables reasoning entirely. Forwarded to OpenAI and Azure OpenAI backends only; ignored by the other providers. ' n: type: integer stream: type: boolean stop: type: array items: type: string presence_penalty: type: number format: float frequency_penalty: type: number format: float logit_bias: type: object additionalProperties: type: integer logprobs: type: boolean top_logprobs: type: integer user: type: string seed: type: integer response_format: type: object additionalProperties: true tools: type: array items: $ref: '#/components/schemas/Tool' tool_choice: description: 'Tool-selection control: "none"/"auto"/"required" or an object.' functions: type: array items: $ref: '#/components/schemas/Function' function_call: description: 'Function-selection control (deprecated): "none"/"auto" or an object.' parallel_tool_calls: description: Whether tool calls may run in parallel. stream_options: type: object additionalProperties: true RequestMetadata: type: object properties: call_sid: type: string agent_sid: type: string description: The agent the call runs under. automation_sid: type: string description: The automation that placed the call. Empty when no automation placed it. scenario_sid: type: string node_id: type: string account_sid: type: string target: type: string description: entity|intent|fallback|streaming source: type: string description: hermes|bff|ss|ids is_test: type: boolean RequestRAGDocument: type: object properties: ids: type: array items: type: string number: type: integer threshold: type: number format: float RequestRAG: type: object properties: document: $ref: '#/components/schemas/RequestRAGDocument' is_limit_with_documents: type: boolean ChatCompletionRequest: allOf: - $ref: '#/components/schemas/OpenAIChatFields' - type: object properties: engine: type: string enum: - open_ai - azure provider: type: string backend: type: string gdpr_required: type: boolean metadata: $ref: '#/components/schemas/RequestMetadata' fallback_model: type: string rag: $ref: '#/components/schemas/RequestRAG' Usage: type: object required: - prompt_tokens - completion_tokens - total_tokens properties: prompt_tokens: type: integer completion_tokens: type: integer total_tokens: type: integer ChatStreamInfoResponseUsage: type: object required: - name - tiktokens properties: name: type: string usage: $ref: '#/components/schemas/Usage' tiktokens: type: integer ChatStreamInfoResponseTimeline: type: object required: - name - seconds properties: name: type: string seconds: type: number format: float ChatStreamInfoResponseDetail: type: object required: - name - detail properties: name: type: string detail: description: Arbitrary detail payload. ChatStreamInfoResponse: type: object required: - id - status - created - engine - request properties: id: type: string status: type: string error: type: string finish_reason: type: string text: type: string created: type: string engine: type: string commit: type: string request: $ref: '#/components/schemas/ChatCompletionRequest' function_call: allOf: - $ref: '#/components/schemas/FunctionCall' deprecated: true description: 'Deprecated: use tool_calls instead.' tool_calls: type: array items: $ref: '#/components/schemas/ToolCall' usage: type: array items: $ref: '#/components/schemas/ChatStreamInfoResponseUsage' timeline: type: array items: $ref: '#/components/schemas/ChatStreamInfoResponseTimeline' details: type: array items: $ref: '#/components/schemas/ChatStreamInfoResponseDetail' rag: $ref: '#/components/schemas/RequestRAG' ErrorResponse-3: type: object description: 'Canonical structured error emitted by the chat completion, chat stream and embeddings handlers (the shared `errorResponse` helper). `code` is an application error code (0 when unset); `status` mirrors the HTTP status.' required: - name - message - code - status properties: name: type: string message: type: string code: type: integer status: type: integer ChatStreamResultResponseContent: type: object properties: part: type: string total: type: string ChatStreamResultResponse: type: object required: - status properties: type: type: string status: type: string enum: - in_progress - error - finished - completed error: type: string content: $ref: '#/components/schemas/ChatStreamResultResponseContent' function_call: allOf: - $ref: '#/components/schemas/FunctionCall' deprecated: true description: 'Deprecated: use tool_calls instead.' tool_calls: type: array items: $ref: '#/components/schemas/ToolCall' PublicModelOptions: type: object properties: deployment: type: string max_tokens: type: integer default_temperature: type: number format: float default_reasoning_effort: type: string PublicModel: type: object required: - model - display_name - provider - provider_display_name - backend - backend_display_name - type - enabled properties: model: type: string display_name: type: string provider: type: string provider_display_name: type: string backend: type: string backend_display_name: type: string type: type: string enabled: type: boolean options: $ref: '#/components/schemas/PublicModelOptions' compliance: type: object additionalProperties: type: boolean description: Carries the compliance marks of the model's backend, keyed by mark name, for example `gdpr`. PublicModelList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/PublicModel' total: type: integer limit: type: integer description: The page size applied. offset: type: integer description: The offset applied. has_more: type: boolean description: True when more items exist after this page. PublicGroupedModel: type: object required: - model - display_name - provider - provider_display_name - type - enabled - gdpr properties: model: type: string display_name: type: string provider: type: string provider_display_name: type: string type: type: string enabled: type: boolean gdpr: type: boolean default_temperature: type: number format: float PublicGroupedModelList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/PublicGroupedModel' total: type: integer limit: type: integer description: The page size applied. offset: type: integer description: The offset applied. has_more: type: boolean description: True when more items exist after this page. 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 Choice: type: object required: - index - message - finish_reason properties: index: type: integer message: $ref: '#/components/schemas/Message' finish_reason: type: string logprobs: description: Per-token log-probability detail. ChatCompletionResponse: type: object required: - id - object - created - model - choices - usage - system_fingerprint properties: id: type: string object: type: string created: type: integer format: int64 model: type: string choices: type: array items: $ref: '#/components/schemas/Choice' usage: $ref: '#/components/schemas/Usage' system_fingerprint: type: string ChatStreamRunRequest: allOf: - $ref: '#/components/schemas/OpenAIChatFields' - type: object properties: engine: type: string enum: - open_ai - azure provider: type: string backend: type: string gdpr_required: type: boolean rag: $ref: '#/components/schemas/RequestRAG' metadata: $ref: '#/components/schemas/RequestMetadata' fallback_model: type: string rephrase_question: type: boolean ChatStreamRunResponse: type: object required: - stream_id properties: stream_id: type: string EmbeddingRequest: type: object required: - model - input properties: engine: type: string enum: - open_ai - azure provider: type: string model: type: string input: type: array items: type: string metadata: $ref: '#/components/schemas/RequestMetadata' EmbeddingResponse: type: object required: - embeddings properties: embeddings: type: array items: type: array items: type: number format: float ErrorApi: type: object properties: code: type: string reason: type: string message: type: string required: - code - reason - message SpeechRequest: type: object description: JSON synthesis request body (POST/DELETE). properties: model: type: string voice: type: string language: type: string speed: type: string format: type: string default: mp3 text: type: string sample_rate: type: integer advanced_settings: type: object additionalProperties: true fallback: type: - boolean - 'null' description: Defaults to true when omitted. Lang: type: object properties: language_code: type: string engine: type: string required: - language_code - engine NormalizedQuery: type: object properties: query: type: object description: The normalized query parameters, by name. additionalProperties: type: string required: - query VoiceResponse: type: object properties: name: type: string human_name: type: string languages_codes: type: array items: type: string gender: type: string engine: type: string status: type: string enum: - active - deprecated - unavailable models: type: array items: type: string required: - name - human_name - languages_codes - gender - engine - status ResolveVoiceRequest: type: object properties: engine: type: string name: type: string language_code: type: string model: type: string gender: type: string format: type: string required: - engine - name - language_code ResolveVoiceResponse: type: object properties: engine: type: string name: type: string model: type: string language_code: type: string gender: type: string fallback: type: boolean required: - engine - name - model - language_code - gender - fallback STTEngineRunRequestItemParams: type: object properties: is_realtime_processing: type: boolean description: Stream the source in real time and collect interim results. language: type: string model: type: string STTEngineRunRequestSourceDetails: type: object properties: url: type: string description: Signed URL or gs:// path of the audio to recognize. STTEngineRunRequestItem: type: object properties: type: type: string description: Item kind; only `source` is supported. params: $ref: '#/components/schemas/STTEngineRunRequestItemParams' source: $ref: '#/components/schemas/STTEngineRunRequestSourceDetails' STTEngineRunRequest: type: object required: - requests properties: requests: type: array items: $ref: '#/components/schemas/STTEngineRunRequestItem' is_test: type: boolean description: Benchmark flag; passed through to the engine run. InterimResult: type: object required: - timestamp - transcript - end_offset - sent_traffic_offset - latency - is_final properties: timestamp: type: string transcript: type: string end_offset: type: string description: int64 as decimal string (protojson emission parity). sent_traffic_offset: type: string description: int64 as decimal string (protojson emission parity). latency: type: string description: int64 as decimal string (protojson emission parity). is_final: type: boolean STTEngineRunResponseItemSource: type: object required: - id - error - transcript - model - interim_results properties: id: type: string error: type: string description: Per-item engine failure; empty on success. transcript: type: string model: type: string interim_results: type: array items: $ref: '#/components/schemas/InterimResult' STTEngineRunResponseItem: type: object required: - type - source properties: type: type: string source: anyOf: - $ref: '#/components/schemas/STTEngineRunResponseItemSource' - type: 'null' STTEngineRunResponse: type: object required: - responses properties: responses: type: array items: $ref: '#/components/schemas/STTEngineRunResponseItem' Error-2: type: object required: - code - message description: Mirrors the grpc-gateway error envelope (code = grpc status code). properties: code: type: integer message: type: string details: type: array items: type: object TranscriptionRequest: type: object required: - url properties: url: type: string description: A gs:// link to a call recording of the account, or an http or https link to a PCM WAV file on a public host. model: type: string description: A model of the engine; the engine's default model when absent. language: type: string description: Comma-separated language codes, or `auto`. `gsr@v2` takes one code or `auto` and uses `auto` when `language` is absent; the other engines use `de-DE,en-US` when it is absent. start_ms: type: integer format: int64 description: Start of the cut. Times in the result count from it. end_ms: type: integer format: int64 description: End of the cut. speaker_labels: type: array description: One label per channel, 1 to 32 letters, digits, '_' or '-'. items: type: string StartTranscriptionRequest: allOf: - $ref: '#/components/schemas/TranscriptionRequest' - type: object required: - engine properties: engine: type: string description: The engine that transcribes the file, e.g. "gsr@v2". TranscriptionUpload: type: object properties: file: type: string format: binary description: The PCM WAV file. url: type: string description: Used when no file is sent; never with a file. model: type: string description: A model of the engine; the engine's default model when absent. language: type: string description: Comma-separated language codes, or `auto`. `gsr@v2` takes one code or `auto` and uses `auto` when `language` is absent; the other engines use `de-DE,en-US` when it is absent. start_ms: type: string description: Integer, milliseconds. end_ms: type: string description: Integer, milliseconds. speaker_labels: type: string description: Comma-separated, one label per channel. StartTranscriptionUpload: allOf: - $ref: '#/components/schemas/TranscriptionUpload' - type: object required: - engine properties: engine: type: string description: The engine that transcribes the file, e.g. "gsr@v2". TranscriptionWord: type: object required: - start_ms - end_ms - text properties: start_ms: type: integer format: int64 end_ms: type: integer format: int64 text: type: string confidence: type: number format: double description: The engine's confidence in the word, from 0 to 1. Absent when the engine gives none. TranscriptionUtterance: type: object required: - start_ms - end_ms - text - words properties: start_ms: type: integer format: int64 end_ms: type: integer format: int64 language: type: string text: type: string words: type: array items: $ref: '#/components/schemas/TranscriptionWord' TranscriptionChannel: type: object required: - channel - language - text - utterances properties: channel: type: integer role: type: string description: The speaker label of the channel. Without `speaker_labels`, a stereo call recording has `client` on channel 0 and `bot` on channel 1, and a mono file has no role. language: type: string text: type: string utterances: type: array items: $ref: '#/components/schemas/TranscriptionUtterance' TranscriptionTurn: type: object required: - speaker - start_ms - end_ms - text properties: speaker: type: string description: The role of the channel, or `speaker` when the channel has no role. start_ms: type: integer format: int64 end_ms: type: integer format: int64 language: type: string description: The language of the turn. Absent when the engine gives none. text: type: string TranscriptionResult: type: object required: - engine - model - endpoint - sample_rate - start_ms - duration_ms - chunk_ms - channels - dialog - issues properties: engine: type: string description: The engine that transcribed the audio. model: type: string description: The model of the engine. endpoint: type: string description: The URL of the engine that received the audio. sample_rate: type: integer description: The sample rate of the file, in Hz. start_ms: type: integer format: int64 description: The start of the cut in the file, in milliseconds. duration_ms: type: integer format: int64 description: The length of the transcribed audio, in milliseconds. chunk_ms: type: integer format: int64 description: Chunk length sent to the engine; 0 when each channel went whole. channels: type: array description: One entry per channel of the file. items: $ref: '#/components/schemas/TranscriptionChannel' dialog: type: array description: The turns of all channels, in time order. items: $ref: '#/components/schemas/TranscriptionTurn' issues: type: array description: 'Warnings about the result, one text per warning: a channel with no recognized speech, a channel too short for reliable language detection, or a word time moved to the end of the audio.' items: type: string TranscriptionJob: type: object required: - id - status - created_at - expires_at properties: id: type: string description: The job id. status: type: string enum: - queued - running - completed - failed description: The state of the job. `result` is set when it is `completed`. error: type: string description: Set when the job failed. created_at: type: string format: date-time description: When the job was created. expires_at: type: string format: date-time description: When the job is deleted, 1 hour after it was created. result: $ref: '#/components/schemas/TranscriptionResult' TranscriptionError: type: object required: - error properties: error: type: string TranscriptionModel: type: object required: - engine - model - is_default_model properties: engine: type: string description: Names the engine, e.g. "gsr@v2". model: type: string description: Identifies the model, e.g. "chirp_3". is_default_model: type: boolean description: Says whether a transcription with no `model` uses this model of the engine. TranscriptionModelList: type: object required: - models properties: models: type: array items: $ref: '#/components/schemas/TranscriptionModel' RecognitionLanguage: type: object required: - code - name properties: code: type: string description: Carries the language code, e.g. "en-US". name: type: string description: Gives the human-readable language name, e.g. "English (United States)". RecognitionLanguageList: type: object required: - languages properties: languages: type: array items: $ref: '#/components/schemas/RecognitionLanguage' RecognitionModelMetadata: type: object description: What this engine / language / model combination is capable of. Every flag is always present; `false` means the combination does not offer the capability. required: - auto_punctuation - diarization - model_adaptation - word_level_confidence - profanity_filter - spoken_punctuation - spoken_emojis - launch_readiness properties: auto_punctuation: type: boolean description: Says whether the combination can punctuate the transcript automatically. diarization: type: boolean description: Says whether the combination can attribute speech to distinct speakers. model_adaptation: type: boolean description: Says whether the combination accepts adaptation hints such as class tokens. word_level_confidence: type: boolean description: Says whether the combination reports a confidence score per word. profanity_filter: type: boolean description: Says whether the combination can mask profanities in the transcript. spoken_punctuation: type: boolean description: Says whether the combination can transcribe spoken punctuation as marks. spoken_emojis: type: boolean description: Says whether the combination can transcribe spoken emoji names as emoji. launch_readiness: type: string description: Reports the maturity the engine publishes for this combination — `GA` or `Preview`; empty when the engine publishes none. RecognitionModelOption: type: object required: - engine - language - language_name - language_local_name - model - model_name - metadata - is_default_model properties: engine: type: string description: Names the engine, e.g. "gsr@v2". language: type: string description: Carries the language code, e.g. "en-US". language_name: type: string description: Gives the English language name. language_local_name: type: string description: Gives the language name in its own script. model: type: string description: Identifies the model. model_name: type: string description: Gives the human-readable model name; empty when the engine has none. is_default_model: type: boolean description: Says whether this model is the default for its engine and language. metadata: allOf: - $ref: '#/components/schemas/RecognitionModelMetadata' description: Lists the capability flags of this engine / language / model combination. RecognitionModelOptionList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/RecognitionModelOption' total: type: integer format: int64 description: Counts the options 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. GrammarParameter: type: object required: - name - description - regex properties: name: type: string description: Names the parameter key, e.g. "auto_punctuation". description: type: string regex: type: string description: Restricts the value by a validation pattern; empty when unconstrained. RecognitionSpecEntry: type: object required: - key - value properties: key: type: string description: Names the kind of tuning option this entry lists. enum: - grammar_parameters - class_tokens - filters value: type: array description: 'Carries the options. By `key`: - `grammar_parameters`: carries objects. - `class_tokens` and `filters`: carry plain strings.' items: oneOf: - type: string - $ref: '#/components/schemas/GrammarParameter' RecognitionSpec: type: object required: - engine - language - specs - endpoint_detection properties: engine: type: string language: type: string description: Carries the language code as the engine lists it, e.g. "en" for `languages=en-US`. endpoint_detection: type: boolean description: Says whether endpoint detection is available for the engine. A scenario switches it on in a brick's speech recognition settings only where this is true. specs: type: array items: $ref: '#/components/schemas/RecognitionSpecEntry' RecognitionSpecList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/RecognitionSpec' total: type: integer format: int64 description: Counts the engine / language pairs matching the filters. 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. STTDictionary: type: object required: - id - account_sid - name - language - engines - public - tokens - description - created_at - updated_at properties: id: type: string account_sid: type: - string - 'null' description: Names the owning account; `null` for a global preset. name: type: string language: type: string description: Names the locale the vocabulary belongs to, e.g. "en-US". public: type: boolean description: Says whether this is a global preset (no owning account). description: type: string tokens: type: array description: Carries the vocabulary, the words and phrases fed to recognition. items: type: string engines: type: array description: 'Lists the engines serving this dictionary''s language, drawn from the recognition catalog. By plane: - Under `/v1/a/adapters/stt/data/*`, the list holds only the engines the caller''s feature flags offer. - The operator plane returns all of them.' items: type: string created_at: type: string format: date-time updated_at: type: string format: date-time STTDictionaryList: type: object required: - items - total - limit - offset - has_more properties: items: type: array items: $ref: '#/components/schemas/STTDictionary' total: type: integer format: int64 description: Counts the dictionaries 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. CreateSTTDictionaryRequest: type: object required: - name - language - tokens properties: name: type: string language: type: string tokens: type: array items: type: string description: type: string PatchSTTDictionaryRequest: type: object description: 'Partial update: an omitted field preserves the current value.' properties: name: type: string language: type: string tokens: type: array items: type: string description: type: string TTSTextRule: type: object required: [] properties: max_bytes: type: integer description: Carries the most bytes of the text in UTF-8. Absent when the engine counts characters. example: 5000 max_chars: type: integer description: Carries the most characters of the text. Absent when the engine counts bytes. example: 1300 max_chars_non_latin: type: integer description: Carries the most characters of a text that holds a character other than an ASCII letter, an ASCII digit, a space or a common punctuation mark. Absent when the engine has one limit for every text. example: 700 TTSEngineTextRule: allOf: - type: object required: - engine properties: engine: type: string description: Carries the engine name, as a brick's `engine` property takes it. example: gc - $ref: '#/components/schemas/TTSTextRule' TTSValidationRules: type: object required: - default - items properties: default: description: Carries the rule of an engine that has no item. allOf: - $ref: '#/components/schemas/TTSTextRule' items: type: array description: Carries the rule of each offered engine. items: $ref: '#/components/schemas/TTSEngineTextRule' 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.' ErrorCodeAgentActiveCalls: type: string enum: - agent_active_calls description: A call of the agent is being dialled or is in progress. ErrorCodeAgentArchived: type: string enum: - agent_archived description: The agent is archived and accepts no change. ErrorCodeAgentCallingScheduleInvalid: type: string enum: - agent_calling_schedule_invalid description: 'Refuses the calling schedule in the request. Returned when: - The calling schedule names an unknown strategy. - The calling schedule carries no schedules. - The calling schedule carries a schedule that never opens.' ErrorCodeAgentConcurrentUpdate: type: string enum: - agent_concurrent_update description: Another write to the same agent landed first; read the agent again and retry. ErrorCodeAgentGatewayInactive: type: string enum: - agent_gateway_inactive description: The agent is active and its gateway has no active number. ErrorCodeAgentInvalid: type: string enum: - agent_invalid description: 'Refuses the agent in the request. Returned when: - The gateway is neither a number nor a pool. - `scenario_sid` is empty. - The body sets `status` to `archived`. - A referenced scenario, number or pool is missing or deleted.' ErrorCodeAgentLinesExceeded: type: string enum: - agent_lines_exceeded description: The `lines` figure takes the account's agents past its allocation. ErrorCodeAgentLinesUnderPolicies: type: string enum: - agent_lines_under_policies description: The `lines` figure is below what the agent's limit policies reserve. ErrorCodeAgentNameInUse: type: string enum: - agent_name_in_use description: Another agent of the account holds the name; archived and deleted agents do not count. ErrorCodeAgentNotArchived: type: string enum: - agent_not_archived description: The agent is not archived, and only an archived agent can be deleted. ErrorCodeAgentNotFound: type: string enum: - agent_not_found description: No live agent with this id. ErrorCodeAgentNumberInPool: type: string enum: - agent_number_in_pool description: The number belongs to a pool. ErrorCodeAgentNumberInUse: type: string enum: - agent_number_in_use description: Another agent holds the number. ErrorCodeAgentTimezoneInvalid: type: string enum: - agent_timezone_invalid description: '`timezone` is not an IANA zone name.' ErrorCodeAgentTimezoneRequired: type: string enum: - agent_timezone_required description: The calling schedule needs a `timezone`, and the agent has none. 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.' ErrorCodeAutomationArchived: type: string enum: - automation_archived description: The automation is archived and accepts no change. ErrorCodeAutomationAttemptEndMissing: type: string enum: - automation_attempt_end_missing description: The move leaves an attempt without an end anywhere but last in the schedule. ErrorCodeAutomationAttemptEndsBeforeStart: type: string enum: - automation_attempt_ends_before_start description: '`ends_at` is not after `starts_at`.' ErrorCodeAutomationAttemptNotFound: type: string enum: - automation_attempt_not_found description: No attempt of this automation with this id. ErrorCodeAutomationAttemptOpened: type: string enum: - automation_attempt_opened description: An attempt of the automation has opened, so its agent, segment and mode no longer change. ErrorCodeAutomationAttemptOverlaps: type: string enum: - automation_attempt_overlaps description: The window overlaps another attempt of the automation. ErrorCodeAutomationAttemptPast: type: string enum: - automation_attempt_past description: 'Refuses a moment or an attempt that is not in the future. Returned when: - The moment is in the past. - The attempt is already running or past.' ErrorCodeAutomationAttemptsWaiting: type: string enum: - automation_attempts_waiting description: The automation holds attempts waiting to open, so its mode does not change. ErrorCodeAutomationContactNotFound: type: string enum: - automation_contact_not_found description: The automation has not taken this contact. ErrorCodeAutomationModeManual: type: string enum: - automation_mode_manual description: The automation is in the manual mode, which takes no scheduled attempts. ErrorCodeAutomationNameInUse: type: string enum: - automation_name_in_use description: Another live automation of the target agent holds the name. ErrorCodeAutomationNotFound: type: string enum: - automation_not_found description: No live automation with this id. ErrorCodeAutomationRequiresPublishedScenario: type: string enum: - automation_requires_published_scenario description: Refuses an agent change that activates the agent or gives an active agent a new scenario, while that scenario has no published version and the agent has automations that are not archived. `data.automations` names up to twenty of them. ErrorCodeAutomationRunUnderWay: type: string enum: - automation_run_under_way description: A run is idle or in progress; the action waits for it to stop. ErrorCodeAutomationScenarioUnpublished: type: string enum: - automation_scenario_unpublished description: The agent's scenario has never been published. ErrorCodeAutomationSegmentClaimed: type: string enum: - automation_segment_claimed description: Another live automation holds the segment. 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.' ErrorCodeCommunicationActive: type: string enum: - communication_active description: The call is being dialled or is in progress; delete it once it ends, or with `hard=true`. ErrorCodeCommunicationInvalid: type: string enum: - communication_invalid description: 'Refuses the dispatch body. Returned when: - The body names an agent, scenario, version, draft, recipient or variable that is missing, out of scope or malformed. - A recipient is a phone number with no country calling code. - A recipient is a placeholder for a withheld number. - The body names an `automation_sid`. - The body names an agent that is archived. - A `data` key is a system variable. - A `data` key holds null, an object or an array. - A test call finds no account number to dial from. - The body sends `is_test: false` with `scenario_sid`, `prefer_draft: true` or `draft: true`, or sends `prefer_draft` and `draft` with different values. `message` says which. The `data` keys `contact` and `contact.{path}` are never refused.' ErrorCodeCommunicationNotFound: type: string enum: - communication_not_found description: 'Refuses the communication id in the request. Returned when: - No communication has this id. - The communication with this id was deleted.' ErrorCodeCommunicationResultNotFound: type: string enum: - communication_result_not_found description: No result delivery with this id. ErrorCodeCommunicationResultTargetConflict: type: string enum: - communication_result_target_conflict description: Another delivery of the same communication already holds the target URL. ErrorCodeConflict: type: string enum: - conflict description: The write collides with the current state of the resource; `message` says what collided. ErrorCodeConnectedAgentSmsSettingsNotSet: type: string enum: - connected_agent_sms_settings_not_set description: The version being published has an SMS brick, and agents that are not archived and have no SMS settings reference the scenario; `data.agents` names them, the first twenty of them. ErrorCodeContactChanged: type: string enum: - contact_changed description: The contact does not have the `revision` the request carries. ErrorCodeContactDataLimit: type: string enum: - contact_data_limit description: 'Refuses contact data the account cannot hold. Returned when: - The contact data would break a limit of its account. - The contact data is already past a limit, and the write leaves it past. - A value has another type than its field holds across the account''s contacts. - An item of an array is an object, an array or `null`. `data` names the limit, the field and the numbers or the types.' ErrorCodeContactExportNotFound: type: string enum: - contact_export_not_found description: 'Refuses the export job id in the request. Returned when: - No export job has this id. - The job was removed 7 days after it finished.' ErrorCodeContactFieldConflict: type: string enum: - contact_field_conflict description: 'Refuses the rename of a field in the contact data. Returned when: - The new path lies inside the old one or holds it. - A contact of the account holds a value at the new path or on the way to it. - A contact holds a value that is not an object on the way to the new path. `data.field` names the field in the way, and `data.contact` the first such contact when one is named.' ErrorCodeContactFieldInUse: type: string enum: - contact_field_in_use description: The condition of a live routing of an agent that is not archived reads the data field or a field under it; `data.routings` names them, the first twenty of them. ErrorCodeContactInUse: type: string enum: - contact_in_use description: Live automations hold a segment the contact is in; `data.automations` names them. ErrorCodeContactInvalid: type: string enum: - contact_invalid description: 'Refuses the contact number in the request. Returned when: - The number is missing. - The number cannot be brought to the stored form. `data.reason` names why, as a code.' ErrorCodeContactLimitReached: type: string enum: - contact_limit_reached description: The account holds as many contacts as its limit allows, and the request would add one more. ErrorCodeContactNotFound: type: string enum: - contact_not_found description: No live contact with this id. ErrorCodeContactNumberTaken: type: string enum: - contact_number_taken description: The account already holds a contact with this number. ErrorCodeCountryCodeInvalid: type: string enum: - country_code_invalid description: 'Refuses the `country_code` of the request. Returned when: - `country_code` is not a known country. - `country_code` is not accepted with the `type` given.' ErrorCodeEmailConflict: type: string enum: - email_conflict description: Another live user, at either level, already holds the email address. 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. ErrorCodeFileColumnNameTooLong: type: string enum: - file_column_name_too_long description: A heading of the file normalises to a key longer than 64 characters, or a path of the data of a list of rows is longer. ErrorCodeFileColumnsClash: type: string enum: - file_columns_clash description: 'Refuses the columns of the file. Returned when: - Two headings of the file normalise to the same key. - A heading of the file normalises to a key that another heading nests under, such as `address` beside `address.city`. - A column rename names the column itself or a column a row of the source already holds. `message` names the key.' ErrorCodeFileEmpty: type: string enum: - file_empty description: The file holds no row after its headings, or the list of rows is empty. ErrorCodeFileEncodingUnsupported: type: string enum: - file_encoding_unsupported description: 'Refuses the encoding of the csv file. Returned when: - The csv file is not UTF-8 text. - The csv file holds a NUL character.' ErrorCodeFileMalformed: type: string enum: - file_malformed description: The file does not read as the type its `Content-Type` declares. ErrorCodeFileNoUsableRows: type: string enum: - file_no_usable_rows description: 'Refuses the upload: it reads, and every row of it is rejected. The data: - `data.rows`: counts the rows of the upload. - `data.reasons`: counts the rows by reason.' ErrorCodeFileNumberColumnMissing: type: string enum: - file_number_column_missing description: No heading of the file normalises to `number`. ErrorCodeFileTooManyColumns: type: string enum: - file_too_many_columns description: The file holds more than 30 named columns, or the data of a list of rows more than 29 paths, the number counted as the 30th. ErrorCodeFileTooManyRows: type: string enum: - file_too_many_rows description: The file or the list of rows holds more than 100 000 rows. ErrorCodeFileTypeUnsupported: type: string enum: - file_type_unsupported description: The `Content-Type` of the `file` part is neither csv nor xlsx; the file is not read. ErrorCodeIdentifierTypeInvalid: type: string enum: - identifier_type_invalid description: '`type` names an unknown way of reading a number.' 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.' ErrorCodeLimitPolicyInUse: type: string enum: - limit_policy_in_use description: Live automations name the policy; `data.automations` names them. ErrorCodeLimitPolicyNameInUse: type: string enum: - limit_policy_name_in_use description: Another live policy of the same agent holds the name. ErrorCodeLimitPolicyNotFound: type: string enum: - limit_policy_not_found description: No live limit policy with this id. ErrorCodeLimitPolicyOverAgent: type: string enum: - limit_policy_over_agent description: The policies of the agent, this one included, reserve more lines than the agent has. ErrorCodeMagicInvalid: type: string enum: - magic_invalid description: 'Refuses the sign-in token. Returned when: - The token is unknown, already spent or expired. - The user of the token is no longer active.' 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`). ErrorCodeNoUserPrincipal: type: string enum: - no_user_principal description: The credential has no person behind it, so a self endpoint cannot answer for it. 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.' ErrorCodeNumberExternalIdConflict: type: string enum: - number_external_id_conflict description: Another live number of the account holds the `external_id`. ErrorCodeNumberIdentifierConflict: type: string enum: - number_identifier_conflict description: The identifier is registered platform-wide already, possibly by an account the caller cannot see. ErrorCodeNumberIdentifierInvalid: type: string enum: - number_identifier_invalid description: The identifier is not a SIP identity the platform accepts. ErrorCodeNumberInUse: type: string enum: - number_in_use description: Agents that are not archived use the number, bound to it or to its pool; `data.agents` names them, the first twenty of them. ErrorCodeNumberNotFound: type: string enum: - number_not_found description: No live number of the account with this id or external identifier. ErrorCodeNumberPoolExternalIdConflict: type: string enum: - number_pool_external_id_conflict description: Another live pool of the account holds the `external_id`. ErrorCodeNumberPoolInUse: type: string enum: - number_pool_in_use description: Agents use the pool; `data.agents` names them, the first twenty of them. ErrorCodeNumberPoolInvalid: type: string enum: - number_pool_invalid description: '`name` is blank.' ErrorCodeNumberPoolNotFound: type: string enum: - number_pool_not_found description: No live number pool of the account with this id or external identifier. ErrorCodePasswordInvalid: type: string enum: - password_invalid description: 'Refuses a sign-in with an address and a password. Returned when: - The address is unknown. - The password is wrong. - The user is inactive. - The user has no password set.' 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. ErrorCodeQueryInvalid: type: string enum: - query_invalid description: 'Refuses the `query` expression of a contact filter, or the `condition` of a routing, in the request. Returned when: - The expression cannot be read. - A `data.` or a `contact.` names a field no contact of the account holds. - A `data.` or a `contact.` names a field that holds fields of its own. - A routing condition compares a field with a value or an operator the field does not take, or a `contact.` with a value of a type the field cannot hold. - The expression holds too many comparisons or characters. `message` names what is wrong and where.' ErrorCodeRateLimited: type: string enum: - rate_limited description: More requests than the operation allows in its window; wait and retry. ErrorCodeRoutingDefaultLocked: type: string enum: - routing_default_locked description: The request changes, moves or deletes the default routing. ErrorCodeRoutingInvalid: type: string enum: - routing_invalid description: 'Refuses the routing in the request. Returned when: - The name is empty. - The position is outside the agent''s list. - The scenario does not exist on the account. - The condition names a segment that the account does not hold.' ErrorCodeRoutingNameInUse: type: string enum: - routing_name_in_use description: Another live routing of the same agent holds the name, or the name is `default` in any letter case. ErrorCodeRoutingNotFound: type: string enum: - routing_not_found description: No live routing with this id on the agent. ErrorCodeScenarioCopyFailed: type: string enum: - scenario_copy_failed description: A resource the scenario or template names cannot be copied, so nothing is created and no resource is left behind. ErrorCodeScenarioInUse: type: string enum: - scenario_in_use description: Agents that are not archived reference the scenario, or live routings of agents that are not archived play it; `data.agents` and `data.routings` name them, the first twenty of each. ErrorCodeScenarioInvalid: type: string enum: - scenario_invalid description: The patch unsets `type`, `name` or `constructor`. ErrorCodeScenarioNotFound: type: string enum: - scenario_not_found description: 'Refuses a scenario id the caller cannot see. Returned when: - No scenario with this id exists. - The scenario belongs to an account outside the caller''s tenant. - The scenario belongs to another account of the tenant and is not shared for copy.' ErrorCodeScenarioSmsSenderRequired: type: string enum: - scenario_sms_sender_required description: The published version of the agent's scenario has an SMS brick, and the agent has no SMS settings. 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. ErrorCodeScenarioVersionImmutable: type: string enum: - scenario_version_immutable description: The record is a published version or a frozen draft; only the current work-in-progress draft is deletable. ErrorCodeScenarioVersionNotFound: type: string enum: - scenario_version_not_found description: No version record of the scenario with this axis number and draft flag. 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.' ErrorCodeSegmentDefaultReadOnly: type: string enum: - segment_default_read_only description: The account's default segment takes no edit, no source and no delete. ErrorCodeSegmentInUse: type: string enum: - segment_in_use description: Live automations hold the segment, or the condition of a live routing of an agent that is not archived names it; `data.automations` or `data.routings` names them. ErrorCodeSegmentInvalid: type: string enum: - segment_invalid description: 'Refuses the segment or source in the request. Returned when: - `name` is empty. - The source kind is not one the platform offers. - `auto_update` is set on a source kind that cannot be followed.' ErrorCodeSegmentNameInUse: type: string enum: - segment_name_in_use description: Another live segment of the account already holds the name; a deleted segment releases its name. ErrorCodeSegmentNotFound: type: string enum: - segment_not_found description: No live segment of the account with this id. ErrorCodeSegmentPublishRunning: type: string enum: - segment_publish_running description: A publish of the segment's sources is running; until it ends the sources take no write and no second publish. A publish that stopped without finishing counts as running for five minutes after it last worked. 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`. ErrorCodeSmsProviderInUse: type: string enum: - sms_provider_in_use description: Agents that are not archived reference the provider; `data.agents` names them, the first twenty of them. ErrorCodeSmsProviderInvalid: type: string enum: - sms_provider_invalid description: 'Refuses the SMS configuration. Returned when: - The sender is missing. - The alpha or number named is not the provider''s. - The provider config is incomplete.' ErrorCodeSmsProviderNameTaken: type: string enum: - sms_provider_name_taken description: Another live provider of the account holds the name. ErrorCodeSmsProviderNotFound: type: string enum: - sms_provider_not_found description: No live SMS provider of the account with this id. ErrorCodeSmsSendInvalid: type: string enum: - sms_send_invalid description: 'Refuses a send that names no usable target. Returned when: - `to` is missing. - Neither an agent nor a provider with a sender is given.' ErrorCodeSmsSettingsMissing: type: string enum: - sms_settings_missing description: The agent named has no SMS settings. ErrorCodeSourceConflict: type: string enum: - source_conflict description: Two draft sources supply the same number with different data. ErrorCodeSourceContactLimit: type: string enum: - source_contact_limit description: The batch would add more contacts than the account can take; `GET …/source/-/validate` shows how many it can. ErrorCodeSourceDataLimit: type: string enum: - source_data_limit description: A merged contact of the batch would break a data limit of the account; `GET …/source/-/validate` names it. ErrorCodeSourceNotFound: type: string enum: - source_not_found description: No source with this id in the segment addressed. ErrorCodeSourceNothingToPublish: type: string enum: - source_nothing_to_publish description: The segment has no draft source. ErrorCodeSourcePublished: type: string enum: - source_published description: The source is published; its rows and its `reset_reach` no longer change. ErrorCodeSourceRemoved: type: string enum: - source_removed description: The source is removed and takes no write. ErrorCodeSourceRowDuplicate: type: string enum: - source_row_duplicate description: The source already holds a row with this number. ErrorCodeSourceRowNotFound: type: string enum: - source_row_not_found description: No row with this id in the source addressed. ErrorCodeTenantManaged: type: string enum: - tenant_managed description: 'Refuses a write that belongs to the tenant, made by a caller without the role `tenant_admin`. Returned when: - The tenant declares this resource type in `managed_resources`. - The tenant administers this SMS provider.' 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' BadRequest-2: description: Invalid request body or parameters content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-3' NotFound-3: description: Resource does not exist content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-3' InternalError-4: description: Internal server error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-3' RequestTimeout: description: Upstream provider timed out content: application/json: schema: $ref: '#/components/schemas/ErrorResponse-3' Audio: description: Synthesized audio stream. headers: X-Cache: description: '`1` on cache hit, `0` otherwise.' schema: type: string Content-Disposition: schema: type: string content: audio/mpeg: schema: type: string format: binary audio/wav: schema: type: string format: binary Error: description: Error response. content: application/json: schema: $ref: '#/components/schemas/ErrorApi' Unauthorized: description: Missing or invalid credentials content: application/json: schema: $ref: '#/components/schemas/Error' Forbidden: description: Caller has no access content: application/json: schema: $ref: '#/components/schemas/Error' BadRequest-3: description: Invalid request body or parameters content: application/json: schema: $ref: '#/components/schemas/Error' Conflict: description: Request conflicts with current resource state content: application/json: schema: $ref: '#/components/schemas/Error' Unprocessable: description: Semantic validation failure content: application/json: schema: $ref: '#/components/schemas/Error' NotFound-4: description: Resource does not exist content: application/json: schema: $ref: '#/components/schemas/Error' requestBodies: InvokeBody: required: false content: application/json: schema: $ref: '#/components/schemas/InvokeBody' x-tagGroups: - name: Auth tags: - Auth - name: Account tags: - User - Profile - Role - Number - NumberPool - name: Voicebot tags: - Scenario - ScenarioVersion - ScenarioTemplate - Audio - Agent - Routing - Limit policy - Automation - Contact - Segment - SegmentSource - name: SegmentSource tags: - Source - Source file - Source manual - Source publishing - name: Communication tags: - Communication - CommunicationResult - name: Analytics tags: - Analytics - name: Integrations tags: - SMS - name: Adapters tags: - LLM Adapter - TTS Adapter - STT Adapter - IDS Adapter - Edge Function - name: IDS Adapter tags: - Classifier - Entity - Model - name: Reference tags: - Info - Contract