# Stream the call history events of a call (WebSocket) GET /v1/a/communication/{id}/events Select code sample ``` const url = 'https://example.com/v1/a/communication/example/events'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ``` curl --request GET \ --url https://example.com/v1/a/communication/example/events \ --header 'Authorization: Bearer ' ``` - /v1/a/communication/{id}/events 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. ## Permission This operation needs the permission [`communication:read`](https://docs.aiva.apifonica.com/concepts/roles-and-permissions/#communication-read). ## Authorizations - **[bearerAuth](https://docs.aiva.apifonica.com/api/account/#bearerauth)** ## Parameters ### Path Parameters **id** required string ### Header Parameters **X-Account-Sid** string 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. ## Responses ### 101 The connection is a WebSocket now; each text frame is one call history event. Media typeapplication/json One of: discriminator: type A brick of the scenario started. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: brick\_start **payload** required object **brick\_type** required Names the type of the brick. string **brick\_description** required Carries the description the brick has in the scenario. string A brick of the scenario ended. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: brick\_end **payload** required object **brick\_type** required Names the type of the brick. string **output\_id** required Names the output the brick left through. string A webhook brick sent its request. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: webhook\_start **payload** required object **url** required Address the request goes to. string **method** required Names the HTTP method of the request. string A webhook request got its response. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: webhook\_complete **payload** required object **status\_code** required Records the HTTP status of the response. integer **duration\_ms** required Records the time the request took, in milliseconds. integer **response** Carries the body of the response. string A webhook request failed. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: webhook\_error **payload** required object **error** required Says what went wrong. string **status\_code** Records the HTTP status of the response, when one arrived. integer **duration\_ms** required Records the time the request took, in milliseconds. integer The person started to speak. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: speech\_start **payload** required Empty object. object The person stopped speaking. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: speech\_end **payload** required Empty object. object A brick that listens started; the payload carries its recognition settings. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: recognition\_setup **payload** required object **engine** required Names the recognition engine the brick uses. string **languages** required Languages recognition listens for. Array\ **speech\_timeout\_ms** required Records the longest time the person may speak, in milliseconds. integer **no\_input\_timeout\_ms** required Records the longest wait for the person to start speaking, in milliseconds. integer **enable\_vad** required Says whether voice activity detection is on. boolean **recognition\_shift\_direction** Names the direction the start of recognition is moved in: `forward` or `backward`. string **recognition\_shift\_duration\_ms** Records the time the start of recognition is moved by, in milliseconds. integer **recognition\_mode** Names the recognition mode: `constant` or `interim`. string Recognition started to listen. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: recognition\_started **payload** required object **id** required Identifies the recognition session. string Recognition stopped listening. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: recognition\_stopped **payload** required object **id** required Identifies the recognition session. string **reason** required Says why recognition stopped: `complete`, `no_input_timeout`, `speech_timeout` or `cancelled`. string Recognition returned a partial transcript of what the person is saying. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: recognition\_interim **payload** required object **id** required Identifies the recognition session. string **transcript** required Carries the text recognized so far. string **stability** required Reports the stability the engine gives the text. number Recognition returned the final transcript of what the person said. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: recognition\_final **payload** required object **id** required Identifies the recognition session. string **transcript** required Carries the text the person said. string **confidence** Reports the confidence the engine gives the text. number The agent started to speak. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: tts\_start **payload** required object **stream** required Says whether the phrase is synthesized as a stream. A streamed phrase with no `text` sends its text in `tts_delta` events. boolean **text** Carries the text of the phrase, when it is known at the start. string The next part of a streamed phrase of the agent. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: tts\_delta **payload** required object **id** Identifies the phrase the part belongs to. string **text** required Carries the text of the part. string The person interrupted the phrase of the agent. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: tts\_interrupted The agent finished the phrase. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: tts\_finished **payload** Empty object. object An audio file started to play. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: audio\_file\_play **payload** required object **url** required Address of the audio file. string An assignment brick set its variables. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: assignment\_complete **payload** required object **variables** required Variables the brick set, by name. object ***key*** additional properties string The AI agent called a function. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: function\_call **payload** required object **name** required Names the function. string **arguments** Arguments of the call, as a JSON text. string A question brick matched an answer during recognition, before the entities are extracted. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: answer\_selected\_candidate **payload** required object **answer\_id** required Identifies the matched answer. string **description** Carries the description of the answer. string **tag** Carries the tag of the answer. string **transcript** required Carries the text the match was made on. string **method** required Records how the answer was matched: `keyword`, `intent` or `llm`. string **intent\_id** Identifies the matched intent. string **confidence** Reports the confidence of the match. number **threshold** Reports the lowest confidence the brick accepts. number **keyword** Carries the keyword that matched. string **llm\_tag** Carries the tag the language model returned. string **llm\_model** Names the language model that made the match. string A question brick settled the outcome of its question. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: answer\_selected **payload** required object **answer\_id** required 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`. string **description** Carries the description of the chosen answer, or of the output the brick leaves through. string **tag** Carries the tag of the answer. string **transcript** required Carries the text the choice was made on. string **method** Records how the answer was matched: `keyword`, `intent` or `llm`. string **entities** Entities taken from the text, by name. object ***key*** additional properties string **detected\_language** Names the language detected in the text. string A question brick asks again with a text the language model wrote. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: gpt\_fallback **payload** required object **text** required Carries the text the brick says. string The wait for the person to start speaking began. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: no\_input\_timer\_started **payload** required object **timeout\_ms** required Records the length of the timer, in milliseconds. integer The limit on how long the person may speak began. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: speech\_timer\_started **payload** required object **timeout\_ms** required Records the length of the timer, in milliseconds. integer The person did not start speaking in time. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: no\_input\_timeout\_fired **payload** required Empty object. object The person spoke longer than the limit. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: speech\_timeout\_fired **payload** required Empty object. object The outbound call moved to another state while it was being connected. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: call\_state\_changed **payload** required object **state** required Names the state the call moved to. string **sip\_code** Carries the SIP code that came with the change. integer **reason** Carries the reason that came with the change. string 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. object **seq** required Orders the event within the call. It starts at 0 and grows by one per event. integer **call\_sid** required Identifies the call. string **timestamp** required Records the moment the event happened. string format: date-time **type** required Names what happened. string **brick\_type** Names the type of the brick the event belongs to. Absent on an event that belongs to no brick. string **brick\_id** Identifies the brick the event belongs to. Absent on an event that belongs to no brick. string **type** required string Allowed values: call\_end ##### Example ``` { "type": "brick_start" } ``` ### 400 Bad request Media typeapplication/json object **error** required Carries the stable lower\_snake\_case usecase code, such as `scenario_not_found`. string **code** required 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. string **message** required string **data** 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`. object **topic** string **reason** 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. string Allowed values: number\_missing number\_no\_digits identifier\_invalid number\_not\_international number\_not\_for\_country country\_code\_required value\_too\_long type\_mismatch **errors** Groups the validation errors by entity. object **scenario** Array\ object **code** Carries the SCN1xx constructor validation code. string **message** string **summary** string **tree\_id** string **node\_id** string **output\_type** string **duplicate\_tree\_index** string **duplicate\_node\_index** string **property** string **invalid\_value** string **agents** Lists the agents a delete or a scenario publish was rejected for, capped at the first 20; `message` carries the total count. Array\ An agent a delete or a scenario publish was rejected for. object **id** required string **name** required string **automations** Lists the live automations referencing the resource a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live automation that holds the resource a delete was rejected for. object **id** required string **name** required string **routings** 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. Array\ A live routing of an agent that is not archived, which holds the resource a delete was rejected for. object **id** required string **name** required string **agent\_sid** required string **users** Lists the live users holding the role a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live user that holds the role a delete was rejected for. object **id** required string **email** required string **roles** Lists the live roles inheriting the role a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live role that inherits the role a delete was rejected for. object **id** required string **name** required string **rows** Lists the rows of the refused file, a row repeating an earlier row’s number as written counted once. integer format: int64 **reasons** How many rows of a refused file were rejected for each reason; a reason no row had is absent. object **number\_missing** The number cell is blank. integer format: int64 **number\_no\_digits** The number holds no digits. integer format: int64 **identifier\_invalid** An alphanumeric identifier does not start with a letter or a digit. integer format: int64 **number\_not\_international** The number is written as international and is not a valid one. integer format: int64 **number\_not\_for\_country** The number is not valid for the stated `country_code`. integer format: int64 **country\_code\_required** The number is not international, and no `country_code` was stated to read it by. integer format: int64 **value\_too\_long** A data cell holds a value longer than the account’s value limit in bytes. integer format: int64 **type\_mismatch** A data cell does not read as the type its field holds across the account’s contacts. integer format: int64 **trigger** 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. string Allowed values: too\_many\_fields value\_too\_long too\_many\_array\_items array\_item\_not\_scalar type\_mismatch **field** 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. string **contact** Names the first contact whose data stops a rename; absent when the two paths alone conflict. string **params** 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. object **limit** Reports the account’s limit. integer **current** Reports the value the data would have: the fields, the bytes or the items. integer **type** Names the type the field holds across the account’s contacts. string **got** Names the type of the new value. string **error** required One of: 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. string Allowed values: bad\_request 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`). string Allowed values: missing\_scope\_header 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. string Allowed values: scope\_conflict ##### Example ``` { "data": { "reason": "number_missing", "trigger": "too_many_fields" }, "error": "bad_request" } ``` ### 401 Unauthorized Media typeapplication/json object **error** required Carries the stable lower\_snake\_case usecase code, such as `scenario_not_found`. string **code** required 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. string **message** required string **data** 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`. object **topic** string **reason** 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. string Allowed values: number\_missing number\_no\_digits identifier\_invalid number\_not\_international number\_not\_for\_country country\_code\_required value\_too\_long type\_mismatch **errors** Groups the validation errors by entity. object **scenario** Array\ object **code** Carries the SCN1xx constructor validation code. string **message** string **summary** string **tree\_id** string **node\_id** string **output\_type** string **duplicate\_tree\_index** string **duplicate\_node\_index** string **property** string **invalid\_value** string **agents** Lists the agents a delete or a scenario publish was rejected for, capped at the first 20; `message` carries the total count. Array\ An agent a delete or a scenario publish was rejected for. object **id** required string **name** required string **automations** Lists the live automations referencing the resource a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live automation that holds the resource a delete was rejected for. object **id** required string **name** required string **routings** 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. Array\ A live routing of an agent that is not archived, which holds the resource a delete was rejected for. object **id** required string **name** required string **agent\_sid** required string **users** Lists the live users holding the role a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live user that holds the role a delete was rejected for. object **id** required string **email** required string **roles** Lists the live roles inheriting the role a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live role that inherits the role a delete was rejected for. object **id** required string **name** required string **rows** Lists the rows of the refused file, a row repeating an earlier row’s number as written counted once. integer format: int64 **reasons** How many rows of a refused file were rejected for each reason; a reason no row had is absent. object **number\_missing** The number cell is blank. integer format: int64 **number\_no\_digits** The number holds no digits. integer format: int64 **identifier\_invalid** An alphanumeric identifier does not start with a letter or a digit. integer format: int64 **number\_not\_international** The number is written as international and is not a valid one. integer format: int64 **number\_not\_for\_country** The number is not valid for the stated `country_code`. integer format: int64 **country\_code\_required** The number is not international, and no `country_code` was stated to read it by. integer format: int64 **value\_too\_long** A data cell holds a value longer than the account’s value limit in bytes. integer format: int64 **type\_mismatch** A data cell does not read as the type its field holds across the account’s contacts. integer format: int64 **trigger** 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. string Allowed values: too\_many\_fields value\_too\_long too\_many\_array\_items array\_item\_not\_scalar type\_mismatch **field** 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. string **contact** Names the first contact whose data stops a rename; absent when the two paths alone conflict. string **params** 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. object **limit** Reports the account’s limit. integer **current** Reports the value the data would have: the fields, the bytes or the items. integer **type** Names the type the field holds across the account’s contacts. string **got** Names the type of the new value. string **error** required One of: 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. string Allowed values: unauthenticated ##### Example ``` { "data": { "reason": "number_missing", "trigger": "too_many_fields" }, "error": "unauthenticated" } ``` ### 403 Forbidden Media typeapplication/json object **error** required Carries the stable lower\_snake\_case usecase code, such as `scenario_not_found`. string **code** required 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. string **message** required string **data** 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`. object **topic** string **reason** 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. string Allowed values: number\_missing number\_no\_digits identifier\_invalid number\_not\_international number\_not\_for\_country country\_code\_required value\_too\_long type\_mismatch **errors** Groups the validation errors by entity. object **scenario** Array\ object **code** Carries the SCN1xx constructor validation code. string **message** string **summary** string **tree\_id** string **node\_id** string **output\_type** string **duplicate\_tree\_index** string **duplicate\_node\_index** string **property** string **invalid\_value** string **agents** Lists the agents a delete or a scenario publish was rejected for, capped at the first 20; `message` carries the total count. Array\ An agent a delete or a scenario publish was rejected for. object **id** required string **name** required string **automations** Lists the live automations referencing the resource a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live automation that holds the resource a delete was rejected for. object **id** required string **name** required string **routings** 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. Array\ A live routing of an agent that is not archived, which holds the resource a delete was rejected for. object **id** required string **name** required string **agent\_sid** required string **users** Lists the live users holding the role a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live user that holds the role a delete was rejected for. object **id** required string **email** required string **roles** Lists the live roles inheriting the role a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live role that inherits the role a delete was rejected for. object **id** required string **name** required string **rows** Lists the rows of the refused file, a row repeating an earlier row’s number as written counted once. integer format: int64 **reasons** How many rows of a refused file were rejected for each reason; a reason no row had is absent. object **number\_missing** The number cell is blank. integer format: int64 **number\_no\_digits** The number holds no digits. integer format: int64 **identifier\_invalid** An alphanumeric identifier does not start with a letter or a digit. integer format: int64 **number\_not\_international** The number is written as international and is not a valid one. integer format: int64 **number\_not\_for\_country** The number is not valid for the stated `country_code`. integer format: int64 **country\_code\_required** The number is not international, and no `country_code` was stated to read it by. integer format: int64 **value\_too\_long** A data cell holds a value longer than the account’s value limit in bytes. integer format: int64 **type\_mismatch** A data cell does not read as the type its field holds across the account’s contacts. integer format: int64 **trigger** 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. string Allowed values: too\_many\_fields value\_too\_long too\_many\_array\_items array\_item\_not\_scalar type\_mismatch **field** 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. string **contact** Names the first contact whose data stops a rename; absent when the two paths alone conflict. string **params** 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. object **limit** Reports the account’s limit. integer **current** Reports the value the data would have: the fields, the bytes or the items. integer **type** Names the type the field holds across the account’s contacts. string **got** Names the type of the new value. string **error** required One of: The credential is valid and in scope, but the caller’s roles do not grant the permission the operation needs. string Allowed values: permission\_denied ##### Example ``` { "data": { "reason": "number_missing", "trigger": "too_many_fields" }, "error": "permission_denied" } ``` ### 404 Not found Media typeapplication/json object **error** required Carries the stable lower\_snake\_case usecase code, such as `scenario_not_found`. string **code** required 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. string **message** required string **data** 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`. object **topic** string **reason** 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. string Allowed values: number\_missing number\_no\_digits identifier\_invalid number\_not\_international number\_not\_for\_country country\_code\_required value\_too\_long type\_mismatch **errors** Groups the validation errors by entity. object **scenario** Array\ object **code** Carries the SCN1xx constructor validation code. string **message** string **summary** string **tree\_id** string **node\_id** string **output\_type** string **duplicate\_tree\_index** string **duplicate\_node\_index** string **property** string **invalid\_value** string **agents** Lists the agents a delete or a scenario publish was rejected for, capped at the first 20; `message` carries the total count. Array\ An agent a delete or a scenario publish was rejected for. object **id** required string **name** required string **automations** Lists the live automations referencing the resource a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live automation that holds the resource a delete was rejected for. object **id** required string **name** required string **routings** 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. Array\ A live routing of an agent that is not archived, which holds the resource a delete was rejected for. object **id** required string **name** required string **agent\_sid** required string **users** Lists the live users holding the role a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live user that holds the role a delete was rejected for. object **id** required string **email** required string **roles** Lists the live roles inheriting the role a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live role that inherits the role a delete was rejected for. object **id** required string **name** required string **rows** Lists the rows of the refused file, a row repeating an earlier row’s number as written counted once. integer format: int64 **reasons** How many rows of a refused file were rejected for each reason; a reason no row had is absent. object **number\_missing** The number cell is blank. integer format: int64 **number\_no\_digits** The number holds no digits. integer format: int64 **identifier\_invalid** An alphanumeric identifier does not start with a letter or a digit. integer format: int64 **number\_not\_international** The number is written as international and is not a valid one. integer format: int64 **number\_not\_for\_country** The number is not valid for the stated `country_code`. integer format: int64 **country\_code\_required** The number is not international, and no `country_code` was stated to read it by. integer format: int64 **value\_too\_long** A data cell holds a value longer than the account’s value limit in bytes. integer format: int64 **type\_mismatch** A data cell does not read as the type its field holds across the account’s contacts. integer format: int64 **trigger** 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. string Allowed values: too\_many\_fields value\_too\_long too\_many\_array\_items array\_item\_not\_scalar type\_mismatch **field** 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. string **contact** Names the first contact whose data stops a rename; absent when the two paths alone conflict. string **params** 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. object **limit** Reports the account’s limit. integer **current** Reports the value the data would have: the fields, the bytes or the items. integer **type** Names the type the field holds across the account’s contacts. string **got** Names the type of the new value. string **error** required One of: Refuses the communication id in the request. Returned when: - No communication has this id. - The communication with this id was deleted. string Allowed values: communication\_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. string Allowed values: not\_found ##### Example ``` { "data": { "reason": "number_missing", "trigger": "too_many_fields" }, "error": "communication_not_found" } ``` ### 500 Internal server error Media typeapplication/json object **error** required Carries the stable lower\_snake\_case usecase code, such as `scenario_not_found`. string **code** required 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. string **message** required string **data** 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`. object **topic** string **reason** 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. string Allowed values: number\_missing number\_no\_digits identifier\_invalid number\_not\_international number\_not\_for\_country country\_code\_required value\_too\_long type\_mismatch **errors** Groups the validation errors by entity. object **scenario** Array\ object **code** Carries the SCN1xx constructor validation code. string **message** string **summary** string **tree\_id** string **node\_id** string **output\_type** string **duplicate\_tree\_index** string **duplicate\_node\_index** string **property** string **invalid\_value** string **agents** Lists the agents a delete or a scenario publish was rejected for, capped at the first 20; `message` carries the total count. Array\ An agent a delete or a scenario publish was rejected for. object **id** required string **name** required string **automations** Lists the live automations referencing the resource a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live automation that holds the resource a delete was rejected for. object **id** required string **name** required string **routings** 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. Array\ A live routing of an agent that is not archived, which holds the resource a delete was rejected for. object **id** required string **name** required string **agent\_sid** required string **users** Lists the live users holding the role a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live user that holds the role a delete was rejected for. object **id** required string **email** required string **roles** Lists the live roles inheriting the role a delete was rejected for, capped at the first 20; `message` carries the total count. Array\ A live role that inherits the role a delete was rejected for. object **id** required string **name** required string **rows** Lists the rows of the refused file, a row repeating an earlier row’s number as written counted once. integer format: int64 **reasons** How many rows of a refused file were rejected for each reason; a reason no row had is absent. object **number\_missing** The number cell is blank. integer format: int64 **number\_no\_digits** The number holds no digits. integer format: int64 **identifier\_invalid** An alphanumeric identifier does not start with a letter or a digit. integer format: int64 **number\_not\_international** The number is written as international and is not a valid one. integer format: int64 **number\_not\_for\_country** The number is not valid for the stated `country_code`. integer format: int64 **country\_code\_required** The number is not international, and no `country_code` was stated to read it by. integer format: int64 **value\_too\_long** A data cell holds a value longer than the account’s value limit in bytes. integer format: int64 **type\_mismatch** A data cell does not read as the type its field holds across the account’s contacts. integer format: int64 **trigger** 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. string Allowed values: too\_many\_fields value\_too\_long too\_many\_array\_items array\_item\_not\_scalar type\_mismatch **field** 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. string **contact** Names the first contact whose data stops a rename; absent when the two paths alone conflict. string **params** 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. object **limit** Reports the account’s limit. integer **current** Reports the value the data would have: the fields, the bytes or the items. integer **type** Names the type the field holds across the account’s contacts. string **got** Names the type of the new value. string ##### Example ``` { "data": { "reason": "number_missing", "trigger": "too_many_fields" } } ``` ## Error codes | 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 | `missing_scope_header` | The credential acts for a tenant or for the platform, and the request names no account in `X-Account-Sid` (or no tenant in `X-Tenant-Sid`). | | 400 | `scope_conflict` | Refuses the value of the scope header. Returned when: - The scope header names an account or tenant the credential does not cover. - The scope header carries a value that is not an id of that kind. | | 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 | `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 | `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. |