{
  "openapi": "3.1.0",
  "info": {
    "title": "Moraviq Voice: API pública v2",
    "summary": "Chamadas de voz para parceiros (spec 03, contrato em docs/04b-contrato-v2.md)",
    "version": "2.0.0"
  },
  "paths": {
    "/v2/sites/{site}": {
      "put": {
        "tags": [
          "v2"
        ],
        "summary": "Put Site",
        "operationId": "put_site_v2_sites__site__put",
        "parameters": [
          {
            "name": "site",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9._:-]{1,64}$",
              "title": "Site"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SiteIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Put Site V2 Sites  Site  Put"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "v2"
        ],
        "summary": "Delete Site",
        "operationId": "delete_site_v2_sites__site__delete",
        "parameters": [
          {
            "name": "site",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9._:-]{1,64}$",
              "title": "Site"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Delete Site V2 Sites  Site  Delete"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/sites/{site}/stations/{station}": {
      "put": {
        "tags": [
          "v2"
        ],
        "summary": "Put Station",
        "operationId": "put_station_v2_sites__site__stations__station__put",
        "parameters": [
          {
            "name": "site",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9._:-]{1,64}$",
              "title": "Site"
            }
          },
          {
            "name": "station",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9._:-]{1,64}$",
              "title": "Station"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StationIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Put Station V2 Sites  Site  Stations  Station  Put"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/calls": {
      "post": {
        "tags": [
          "v2"
        ],
        "summary": "Create Call",
        "operationId": "create_call_v2_calls_post",
        "parameters": [
          {
            "name": "idempotency-key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CallIn"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "v2"
        ],
        "summary": "List Calls",
        "operationId": "list_calls_v2_calls_get",
        "parameters": [
          {
            "name": "site",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,64}$"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Site"
            }
          },
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Since"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cursor"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "title": "Limit"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response List Calls V2 Calls Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/calls/{call_id}": {
      "get": {
        "tags": [
          "v2"
        ],
        "summary": "Get Call",
        "operationId": "get_call_v2_calls__call_id__get",
        "parameters": [
          {
            "name": "call_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Call Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Get Call V2 Calls  Call Id  Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/calls/{call_id}/ring-ack": {
      "post": {
        "tags": [
          "v2"
        ],
        "summary": "Ring Ack",
        "operationId": "ring_ack_v2_calls__call_id__ring_ack_post",
        "parameters": [
          {
            "name": "call_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Call Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RingAckIn"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/calls/{call_id}/accept": {
      "post": {
        "tags": [
          "v2"
        ],
        "summary": "Accept",
        "operationId": "accept_v2_calls__call_id__accept_post",
        "parameters": [
          {
            "name": "call_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Call Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeviceRef"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Accept V2 Calls  Call Id  Accept Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/calls/{call_id}/reject": {
      "post": {
        "tags": [
          "v2"
        ],
        "summary": "Reject",
        "operationId": "reject_v2_calls__call_id__reject_post",
        "parameters": [
          {
            "name": "call_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Call Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeviceRef"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Reject V2 Calls  Call Id  Reject Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/calls/{call_id}/cancel": {
      "post": {
        "tags": [
          "v2"
        ],
        "summary": "Cancel",
        "operationId": "cancel_v2_calls__call_id__cancel_post",
        "parameters": [
          {
            "name": "call_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Call Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Cancel V2 Calls  Call Id  Cancel Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/calls/{call_id}/hangup": {
      "post": {
        "tags": [
          "v2"
        ],
        "summary": "Hangup",
        "operationId": "hangup_v2_calls__call_id__hangup_post",
        "parameters": [
          {
            "name": "call_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Call Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Hangup V2 Calls  Call Id  Hangup Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/calls/{call_id}/disposition": {
      "post": {
        "tags": [
          "v2"
        ],
        "summary": "Disposition",
        "operationId": "disposition_v2_calls__call_id__disposition_post",
        "parameters": [
          {
            "name": "call_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Call Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DispositionIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Disposition V2 Calls  Call Id  Disposition Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/calls/{call_id}/device-token": {
      "post": {
        "tags": [
          "v2"
        ],
        "summary": "Device Token",
        "description": "Sem `Authorization`: a prova HMAC com o `device_secret` é a credencial.",
        "operationId": "device_token_v2_calls__call_id__device_token_post",
        "parameters": [
          {
            "name": "call_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Call Id"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeviceTokenIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/devices": {
      "post": {
        "tags": [
          "v2"
        ],
        "summary": "Register Device",
        "operationId": "register_device_v2_devices_post",
        "parameters": [
          {
            "name": "idempotency-key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeviceIn"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/devices/{device_id}": {
      "delete": {
        "tags": [
          "v2"
        ],
        "summary": "Delete Device",
        "operationId": "delete_device_v2_devices__device_id__delete",
        "parameters": [
          {
            "name": "device_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Device Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/users/{user}/devices": {
      "delete": {
        "tags": [
          "v2"
        ],
        "summary": "Revoke User Devices",
        "operationId": "revoke_user_devices_v2_users__user__devices_delete",
        "parameters": [
          {
            "name": "user",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9._:-]{1,64}$",
              "title": "User"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Revoke User Devices V2 Users  User  Devices Delete"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/ice-credentials": {
      "post": {
        "tags": [
          "v2"
        ],
        "summary": "Ice",
        "operationId": "ice_v2_ice_credentials_post",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IceIn"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Ice V2 Ice Credentials Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v2/ws-ticket": {
      "post": {
        "tags": [
          "v2"
        ],
        "summary": "Ws Ticket",
        "operationId": "ws_ticket_v2_ws_ticket_post",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "call.ringing": {
      "post": {
        "summary": "A chamada passou a tocar (traz devices_ringing).",
        "description": "Cabeçalhos do Standard Webhooks: `webhook-id` (estável entre tentativas), `webhook-timestamp` (unix, desta tentativa; recuse fora de 5 min) e `webhook-signature` (`v1,<base64 HMAC-SHA256(segredo, id.timestamp.corpo)>`; na rotação, duas assinaturas separadas por espaço). Responda 2xx em até 5 s; 8 tentativas em cerca de 23 h (5 s, 30 s, 2 min, 15 min, 1 h, 6 h, 16 h), depois fila morta. Ordem não garantida: use `timestamp` e o estado.",
        "operationId": "call_ringingcall_ringing_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Event"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "call.unconfirmed": {
      "post": {
        "summary": "Tocando há 10 s sem nenhum convite confirmado; uma vez por chamada.",
        "description": "Cabeçalhos do Standard Webhooks: `webhook-id` (estável entre tentativas), `webhook-timestamp` (unix, desta tentativa; recuse fora de 5 min) e `webhook-signature` (`v1,<base64 HMAC-SHA256(segredo, id.timestamp.corpo)>`; na rotação, duas assinaturas separadas por espaço). Responda 2xx em até 5 s; 8 tentativas em cerca de 23 h (5 s, 30 s, 2 min, 15 min, 1 h, 6 h, 16 h), depois fila morta. Ordem não garantida: use `timestamp` e o estado.",
        "operationId": "call_unconfirmedcall_unconfirmed_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Event"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "call.answered": {
      "post": {
        "summary": "O aceite venceu.",
        "description": "Cabeçalhos do Standard Webhooks: `webhook-id` (estável entre tentativas), `webhook-timestamp` (unix, desta tentativa; recuse fora de 5 min) e `webhook-signature` (`v1,<base64 HMAC-SHA256(segredo, id.timestamp.corpo)>`; na rotação, duas assinaturas separadas por espaço). Responda 2xx em até 5 s; 8 tentativas em cerca de 23 h (5 s, 30 s, 2 min, 15 min, 1 h, 6 h, 16 h), depois fila morta. Ordem não garantida: use `timestamp` e o estado.",
        "operationId": "call_answeredcall_answered_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Event"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "call.finished": {
      "post": {
        "summary": "Estado terminal; sempre vem, inclusive na chamada que nasce encerrada.",
        "description": "Cabeçalhos do Standard Webhooks: `webhook-id` (estável entre tentativas), `webhook-timestamp` (unix, desta tentativa; recuse fora de 5 min) e `webhook-signature` (`v1,<base64 HMAC-SHA256(segredo, id.timestamp.corpo)>`; na rotação, duas assinaturas separadas por espaço). Responda 2xx em até 5 s; 8 tentativas em cerca de 23 h (5 s, 30 s, 2 min, 15 min, 1 h, 6 h, 16 h), depois fila morta. Ordem não garantida: use `timestamp` e o estado.",
        "operationId": "call_finishedcall_finished_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Event"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CallData": {
        "properties": {
          "call_id": {
            "type": "string",
            "title": "Call Id"
          },
          "site": {
            "type": "string",
            "title": "Site"
          },
          "target": {
            "$ref": "#/components/schemas/Target"
          },
          "caller": {
            "$ref": "#/components/schemas/Caller"
          },
          "answered_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Answered By"
          },
          "status": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "created",
                  "ringing",
                  "connecting",
                  "active"
                ]
              },
              {
                "type": "string"
              }
            ],
            "title": "Status"
          },
          "end_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "enum": [
              "normal",
              "no_answer",
              "origin_cancelled",
              "origin_gone",
              "all_rejected",
              "no_devices",
              "quiet_hours",
              "site_limit",
              "partner_limit",
              "target_busy",
              "attendants_busy",
              "authorize_denied",
              "ice_timeout",
              "media_lost",
              "signaling_lost",
              "max_duration",
              "revoked",
              null
            ],
            "title": "End Reason"
          },
          "disposition": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Disposition"
          },
          "network": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "direct",
                  "relay"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Network"
          },
          "started_at": {
            "type": "string",
            "title": "Started At"
          },
          "answered_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Answered At"
          },
          "ended_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ended At"
          },
          "duration_s": {
            "type": "integer",
            "title": "Duration S"
          },
          "idempotency_key": {
            "type": "string",
            "title": "Idempotency Key"
          },
          "metadata": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object",
            "title": "Metadata"
          },
          "devices_ringing": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Devices Ringing",
            "description": "só em call.ringing"
          }
        },
        "type": "object",
        "required": [
          "call_id",
          "site",
          "target",
          "caller",
          "status",
          "started_at",
          "duration_s",
          "idempotency_key",
          "metadata"
        ],
        "title": "CallData",
        "description": "O `data` de todo evento de chamada. Só ids opacos do parceiro: sem nome, IP ou token."
      },
      "CallIn": {
        "properties": {
          "site": {
            "type": "string",
            "maxLength": 64,
            "minLength": 1,
            "pattern": "^[A-Za-z0-9._:-]{1,64}$",
            "title": "Site"
          },
          "target": {
            "$ref": "#/components/schemas/TargetIn"
          },
          "callees": {
            "anyOf": [
              {
                "items": {
                  "type": "string",
                  "maxLength": 64,
                  "minLength": 1,
                  "pattern": "^[A-Za-z0-9._:-]{1,64}$"
                },
                "type": "array",
                "maxItems": 20
              },
              {
                "type": "null"
              }
            ],
            "title": "Callees"
          },
          "caller": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CallerIn"
              },
              {
                "type": "null"
              }
            ]
          },
          "context": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ContextIn"
              },
              {
                "type": "null"
              }
            ]
          },
          "labels": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LabelsIn"
              },
              {
                "type": "null"
              }
            ]
          },
          "metadata": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Metadata"
          },
          "ring_timeout_s": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ring Timeout S"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "site",
          "target"
        ],
        "title": "CallIn"
      },
      "Caller": {
        "properties": {
          "user": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User"
          },
          "station": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Station"
          }
        },
        "type": "object",
        "title": "Caller"
      },
      "CallerIn": {
        "properties": {
          "user": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64,
                "minLength": 1,
                "pattern": "^[A-Za-z0-9._:-]{1,64}$"
              },
              {
                "type": "null"
              }
            ],
            "title": "User"
          },
          "station": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64,
                "minLength": 1,
                "pattern": "^[A-Za-z0-9._:-]{1,64}$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Station"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "CallerIn"
      },
      "ContextIn": {
        "properties": {
          "reason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "delivery",
                  "visitor",
                  "service",
                  "other"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "reason_label": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 24
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason Label"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "ContextIn"
      },
      "DeviceIn": {
        "properties": {
          "installation_id": {
            "type": "string",
            "maxLength": 128,
            "minLength": 16,
            "title": "Installation Id"
          },
          "app_id": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 128,
                "pattern": "^[A-Za-z0-9._:-]+$"
              },
              {
                "type": "null"
              }
            ],
            "title": "App Id"
          },
          "platform": {
            "type": "string",
            "enum": [
              "android",
              "ios",
              "web"
            ],
            "title": "Platform"
          },
          "push_type": {
            "type": "string",
            "enum": [
              "fcm",
              "apns_voip",
              "none"
            ],
            "title": "Push Type",
            "default": "none"
          },
          "push_token": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 512
              },
              {
                "type": "null"
              }
            ],
            "title": "Push Token"
          },
          "environment": {
            "type": "string",
            "enum": [
              "production",
              "sandboxed"
            ],
            "title": "Environment",
            "default": "production"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "installation_id",
          "platform"
        ],
        "title": "DeviceIn"
      },
      "DeviceRef": {
        "properties": {
          "device_id": {
            "type": "string",
            "format": "uuid",
            "title": "Device Id"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "device_id"
        ],
        "title": "DeviceRef"
      },
      "DeviceTokenIn": {
        "properties": {
          "device_id": {
            "type": "string",
            "format": "uuid",
            "title": "Device Id"
          },
          "ts": {
            "type": "integer",
            "title": "Ts"
          },
          "nonce": {
            "type": "string",
            "pattern": "^[0-9a-f]{16,64}$",
            "title": "Nonce"
          },
          "proof": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "title": "Proof"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "device_id",
          "ts",
          "nonce",
          "proof"
        ],
        "title": "DeviceTokenIn"
      },
      "DispositionIn": {
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^[a-z_]{1,32}$",
            "title": "Code"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "code"
        ],
        "title": "DispositionIn"
      },
      "Event": {
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "call.ringing",
              "call.unconfirmed",
              "call.answered",
              "call.finished"
            ],
            "title": "Type"
          },
          "timestamp": {
            "type": "string",
            "title": "Timestamp"
          },
          "data": {
            "$ref": "#/components/schemas/CallData"
          }
        },
        "type": "object",
        "required": [
          "type",
          "timestamp",
          "data"
        ],
        "title": "Event"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "IceIn": {
        "properties": {
          "call_id": {
            "type": "string",
            "format": "uuid",
            "title": "Call Id"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "call_id"
        ],
        "title": "IceIn"
      },
      "LabelsIn": {
        "properties": {
          "target": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ],
            "title": "Target"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "LabelsIn"
      },
      "RingAckIn": {
        "properties": {
          "device_id": {
            "type": "string",
            "format": "uuid",
            "title": "Device Id"
          },
          "result": {
            "type": "string",
            "enum": [
              "reported",
              "stale",
              "report_failed"
            ],
            "title": "Result"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "device_id",
          "result"
        ],
        "title": "RingAckIn"
      },
      "SiteIn": {
        "properties": {
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled"
          },
          "max_concurrent": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 500.0,
                "minimum": 1.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Concurrent"
          },
          "ring_timeout_s": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 60.0,
                "minimum": 15.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Ring Timeout S"
          },
          "retention_days": {
            "anyOf": [
              {
                "type": "integer",
                "maximum": 365.0,
                "minimum": 30.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Retention Days"
          },
          "busy_policy": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "one_per_target",
                  "allow_parallel"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Busy Policy"
          },
          "authorization": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "prior",
                  "callback"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Authorization"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "title": "SiteIn"
      },
      "StationIn": {
        "properties": {
          "label": {
            "type": "string",
            "maxLength": 32,
            "minLength": 1,
            "title": "Label"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "label"
        ],
        "title": "StationIn"
      },
      "Target": {
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "unit",
              "group",
              "users"
            ],
            "title": "Kind"
          },
          "ref": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ref"
          }
        },
        "type": "object",
        "required": [
          "kind"
        ],
        "title": "Target"
      },
      "TargetIn": {
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "unit",
              "group",
              "users"
            ],
            "title": "Kind"
          },
          "ref": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64,
                "minLength": 1,
                "pattern": "^[A-Za-z0-9._:-]{1,64}$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ref"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "kind"
        ],
        "title": "TargetIn"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "Error": {
        "type": "object",
        "required": [
          "error",
          "request_id"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "bad_request",
              "unauthorized",
              "forbidden",
              "not_allowed",
              "partner_disabled",
              "scope_missing",
              "call_not_found",
              "site_not_found",
              "device_not_found",
              "taken_elsewhere",
              "attendant_busy",
              "call_not_ringing",
              "idempotency_in_progress",
              "validation_failed",
              "idempotency_conflict",
              "ring_timeout_out_of_range",
              "metadata_too_large",
              "client_too_old",
              "rate_limited",
              "unavailable"
            ]
          },
          "detail": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          }
        }
      },
      "AppEvent": {
        "properties": {
          "type": {
            "const": "app.push_credential_failed",
            "title": "Type",
            "type": "string"
          },
          "timestamp": {
            "title": "Timestamp",
            "type": "string"
          },
          "data": {
            "$ref": "#/components/schemas/AppCredentialData"
          }
        },
        "required": [
          "type",
          "timestamp",
          "data"
        ],
        "title": "AppEvent",
        "type": "object",
        "description": "Webhook `app.push_credential_failed`: a Apple ou o Google recusaram a credencial de push de um app seu. Mesmos cabeçalhos do Standard Webhooks dos eventos de chamada. Sem push para o app até trocar a credencial no console."
      },
      "AppCredentialData": {
        "properties": {
          "app_id": {
            "title": "App Id",
            "type": "string"
          },
          "platform": {
            "enum": [
              "android",
              "ios"
            ],
            "title": "Platform",
            "type": "string"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "app_id",
          "platform",
          "reason"
        ],
        "title": "AppCredentialData",
        "type": "object"
      }
    },
    "securitySchemes": {
      "voice": {
        "type": "http",
        "scheme": "bearer",
        "description": "Asserção do servidor do parceiro (JWT `typ: voice+server`, EdDSA ou ES256, vida até 60 s, `jti` de uso único), token de aparelho (`typ: voice`, `ver: 2`) ou token curto da chamada (`vct1.`, emitido pelo núcleo)."
      }
    }
  },
  "security": [
    {
      "voice": []
    }
  ]
}
