{ "schemes": [ "http", "https" ], "swagger": "2.0", "info": { "description": "API para gerenciamento de dados de cidadãos do Rio de Janeiro, incluindo autodeclaração de informações e verificação de contato.", "title": "API RMI", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "Suporte RMI", "url": "http://www.rio.rj.gov.br", "email": "suporte@rio.rj.gov.br" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0" }, "host": "localhost:8080", "basePath": "/v1", "paths": { "/admin/phone/quarantine/stats": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Retorna estatísticas sobre números de telefone em quarentena (apenas administradores)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Estatísticas de quarentena", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.QuarantineStats" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/admin/phone/quarantined": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Retorna lista paginada de números de telefone em quarentena (apenas administradores)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Listar telefones em quarentena", "parameters": [ { "type": "integer", "description": "Página (padrão: 1)", "name": "page", "in": "query" }, { "type": "integer", "description": "Itens por página (padrão: 20, máximo: 100)", "name": "per_page", "in": "query" }, { "type": "boolean", "description": "Filtrar apenas quarentenas expiradas", "name": "expired", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.QuarantinedListResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/citizen/ethnicity/options": { "get": { "description": "Retorna a lista de opções válidas de etnia para autodeclaração. Esta lista é usada para validar as atualizações de etnia autodeclarada.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "citizen" ], "summary": "Listar opções de etnia", "responses": { "200": { "description": "Lista de opções de etnia válidas", "schema": { "type": "array", "items": { "type": "string" } } }, "500": { "description": "Erro interno do servidor", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/citizen/{cpf}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Recupera os dados do cidadão por CPF, combinando dados base com atualizações autodeclaradas. Dados autodeclarados têm precedência sobre dados base. Os resultados são armazenados em cache usando Redis com TTL configurável.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "citizen" ], "summary": "Obter dados do cidadão", "parameters": [ { "maxLength": 11, "minLength": 11, "type": "string", "description": "CPF do cidadão (11 dígitos)", "name": "cpf", "in": "path", "required": true } ], "responses": { "200": { "description": "Dados completos do cidadão", "schema": { "$ref": "#/definitions/models.Citizen" } }, "400": { "description": "Formato de CPF inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "401": { "description": "Token de autenticação não fornecido ou inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Acesso negado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "404": { "description": "Cidadão não encontrado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Erro interno do servidor", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/citizen/{cpf}/address": { "put": { "security": [ { "BearerAuth": [] } ], "description": "Atualiza ou cria o endereço autodeclarado de um cidadão por CPF. Apenas o campo de endereço é atualizado.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "citizen" ], "summary": "Atualizar endereço autodeclarado", "parameters": [ { "type": "string", "description": "Número do CPF", "name": "cpf", "in": "path", "required": true }, { "description": "Endereço autodeclarado", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.SelfDeclaredAddressInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handlers.SuccessResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "401": { "description": "Token de autenticação não fornecido ou inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Acesso negado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/citizen/{cpf}/email": { "put": { "security": [ { "BearerAuth": [] } ], "description": "Atualiza ou cria o email autodeclarado de um cidadão por CPF. Apenas o campo de email é atualizado.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "citizen" ], "summary": "Atualizar email autodeclarado", "parameters": [ { "type": "string", "description": "Número do CPF", "name": "cpf", "in": "path", "required": true }, { "description": "Email autodeclarado", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.SelfDeclaredEmailInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handlers.SuccessResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "401": { "description": "Token de autenticação não fornecido ou inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Acesso negado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/citizen/{cpf}/ethnicity": { "put": { "security": [ { "BearerAuth": [] } ], "description": "Atualiza ou cria a etnia autodeclarada de um cidadão por CPF. Apenas o campo de etnia é atualizado. O valor deve ser uma das opções válidas retornadas pelo endpoint /citizen/ethnicity/options.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "citizen" ], "summary": "Atualizar etnia autodeclarada", "parameters": [ { "type": "string", "description": "Número do CPF", "name": "cpf", "in": "path", "required": true }, { "description": "Etnia autodeclarada", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.SelfDeclaredRacaInput" } } ], "responses": { "200": { "description": "Etnia atualizada com sucesso", "schema": { "$ref": "#/definitions/handlers.SuccessResponse" } }, "400": { "description": "Formato de CPF inválido ou valor de etnia inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "401": { "description": "Token de autenticação não fornecido ou inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Acesso negado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "404": { "description": "Cidadão não encontrado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Erro interno do servidor", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/citizen/{cpf}/firstlogin": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Verifica se este é o primeiro login do usuário", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "citizen" ], "summary": "Obter status do primeiro login", "parameters": [ { "type": "string", "description": "Número do CPF", "name": "cpf", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.UserConfigResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "401": { "description": "Token de autenticação não fornecido ou inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Acesso negado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Define o status do primeiro login como falso para um usuário", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "citizen" ], "summary": "Atualizar status do primeiro login", "parameters": [ { "type": "string", "description": "Número do CPF", "name": "cpf", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.UserConfigResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "401": { "description": "Token de autenticação não fornecido ou inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Acesso negado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/citizen/{cpf}/maintenance-request": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Recupera os chamados do 1746 de um cidadão por CPF com paginação. Cada documento representa um chamado individual.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "citizen" ], "summary": "Obter chamados do 1746 do cidadão", "parameters": [ { "maxLength": 11, "minLength": 11, "type": "string", "description": "CPF do cidadão (11 dígitos)", "name": "cpf", "in": "path", "required": true }, { "minimum": 1, "type": "integer", "description": "Número da página (padrão: 1)", "name": "page", "in": "query" }, { "maximum": 100, "minimum": 1, "type": "integer", "description": "Itens por página (padrão: 10, máximo: 100)", "name": "per_page", "in": "query" } ], "responses": { "200": { "description": "Lista paginada de chamados do 1746", "schema": { "$ref": "#/definitions/models.PaginatedMaintenanceRequests" } }, "400": { "description": "Formato de CPF inválido ou parâmetros de paginação inválidos", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "401": { "description": "Token de autenticação não fornecido ou inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Acesso negado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Erro interno do servidor", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/citizen/{cpf}/optin": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Verifica se o usuário optou por receber notificações", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "citizen" ], "summary": "Obter status de opt-in", "parameters": [ { "type": "string", "description": "Número do CPF", "name": "cpf", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.UserConfigOptInResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "401": { "description": "Token de autenticação não fornecido ou inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Acesso negado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Atualiza o status de opt-in do usuário para notificações", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "citizen" ], "summary": "Atualizar status de opt-in", "parameters": [ { "type": "string", "description": "Número do CPF", "name": "cpf", "in": "path", "required": true }, { "description": "Status de opt-in", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.UserConfigOptInResponse" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.UserConfigOptInResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "401": { "description": "Token de autenticação não fornecido ou inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Acesso negado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/citizen/{cpf}/phone": { "put": { "security": [ { "BearerAuth": [] } ], "description": "Atualiza ou cria o telefone autodeclarado de um cidadão por CPF. Apenas o campo de telefone é atualizado (armazenado como pendente até verificado).", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "citizen" ], "summary": "Atualizar telefone autodeclarado", "parameters": [ { "type": "string", "description": "Número do CPF", "name": "cpf", "in": "path", "required": true }, { "description": "Telefone autodeclarado", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.SelfDeclaredPhoneInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handlers.SuccessResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "401": { "description": "Token de autenticação não fornecido ou inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Acesso negado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/citizen/{cpf}/phone/validate": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Valida o código de verificação enviado para o número de telefone", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "citizen" ], "summary": "Validar verificação de telefone", "parameters": [ { "type": "string", "description": "Número do CPF", "name": "cpf", "in": "path", "required": true }, { "description": "Código de verificação e telefone", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.PhoneVerificationValidateRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handlers.SuccessResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/citizen/{cpf}/wallet": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Recupera os dados da carteira do cidadão por CPF, incluindo informações de saúde e outros dados da carteira.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "citizen" ], "summary": "Obter dados da carteira do cidadão", "parameters": [ { "maxLength": 11, "minLength": 11, "type": "string", "description": "CPF do cidadão (11 dígitos)", "name": "cpf", "in": "path", "required": true } ], "responses": { "200": { "description": "Dados da carteira do cidadão", "schema": { "$ref": "#/definitions/models.CitizenWallet" } }, "400": { "description": "Formato de CPF inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "401": { "description": "Token de autenticação não fornecido ou inválido", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Acesso negado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "404": { "description": "Cidadão não encontrado", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Erro interno do servidor", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/config/channels": { "get": { "description": "Retorna lista de canais disponíveis para opt-in/opt-out", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "config" ], "summary": "Obter canais disponíveis", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "type": "string" } } } } } }, "/config/opt-out-reasons": { "get": { "description": "Retorna lista de motivos disponíveis para opt-out", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "config" ], "summary": "Obter motivos de opt-out", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/models.OptOutReason" } } } } } }, "/health": { "get": { "description": "Verifica a saúde da API e suas dependências (MongoDB e Redis). Retorna status detalhado para cada serviço.", "produces": [ "application/json" ], "tags": [ "health" ], "summary": "Verificação de saúde", "responses": { "200": { "description": "Todos os serviços estão saudáveis", "schema": { "$ref": "#/definitions/handlers.HealthResponse" } }, "503": { "description": "Um ou mais serviços estão indisponíveis", "schema": { "$ref": "#/definitions/handlers.HealthResponse" } } } } }, "/phone/{phone_number}/bind": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Vincula um número de telefone a um CPF sem definir opt-in", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "phone" ], "summary": "Vincular telefone a CPF", "parameters": [ { "type": "string", "description": "Número do telefone", "name": "phone_number", "in": "path", "required": true }, { "description": "Dados da vinculação", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.BindRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.BindResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/phone/{phone_number}/citizen": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Busca um cidadão por número de telefone e retorna dados mascarados", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "phone" ], "summary": "Obter cidadão por número de telefone", "parameters": [ { "type": "string", "description": "Número do telefone", "name": "phone_number", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.PhoneCitizenResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/phone/{phone_number}/opt-in": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Realiza opt-in para receber notificações", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "phone" ], "summary": "Realizar opt-in", "parameters": [ { "type": "string", "description": "Número do telefone", "name": "phone_number", "in": "path", "required": true }, { "description": "Dados do opt-in", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.OptInRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.OptInResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/phone/{phone_number}/opt-out": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Realiza opt-out para parar de receber notificações", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "phone" ], "summary": "Realizar opt-out", "parameters": [ { "type": "string", "description": "Número do telefone", "name": "phone_number", "in": "path", "required": true }, { "description": "Dados do opt-out", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.OptOutRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.OptOutResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/phone/{phone_number}/quarantine": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Coloca um número de telefone em quarentena (apenas administradores)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "phone" ], "summary": "Colocar telefone em quarentena", "parameters": [ { "type": "string", "description": "Número do telefone", "name": "phone_number", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.QuarantineResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Libera um número de telefone da quarentena (apenas administradores)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "phone" ], "summary": "Liberar telefone da quarentena", "parameters": [ { "type": "string", "description": "Número do telefone", "name": "phone_number", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.QuarantineResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/phone/{phone_number}/reject-registration": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Rejeita um registro e bloqueia o mapeamento telefone-CPF", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "phone" ], "summary": "Rejeitar registro", "parameters": [ { "type": "string", "description": "Número do telefone", "name": "phone_number", "in": "path", "required": true }, { "description": "Dados da rejeição", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.RejectRegistrationRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.RejectRegistrationResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/phone/{phone_number}/status": { "get": { "description": "Verifica o status de um número de telefone, incluindo se está em quarentena", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "phone" ], "summary": "Verificar status do número de telefone", "parameters": [ { "type": "string", "description": "Número do telefone", "name": "phone_number", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.PhoneStatusResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/phone/{phone_number}/validate-registration": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Valida dados de registro contra a base de dados oficial", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "phone" ], "summary": "Validar registro de cidadão", "parameters": [ { "type": "string", "description": "Número do telefone", "name": "phone_number", "in": "path", "required": true }, { "description": "Dados para validação", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.ValidateRegistrationRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.ValidateRegistrationResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } }, "/validate/phone": { "post": { "description": "Valida DDI, DDD e número para qualquer telefone internacional.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "validation" ], "summary": "Valida número de telefone", "parameters": [ { "description": "Telefone a ser validado", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handlers.PhoneValidationRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handlers.PhoneValidationResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/handlers.ErrorResponse" } } } } } }, "definitions": { "handlers.ErrorResponse": { "type": "object", "properties": { "error": { "type": "string" } } }, "handlers.HealthResponse": { "type": "object", "properties": { "services": { "type": "object", "additionalProperties": { "type": "string" } }, "status": { "type": "string" }, "timestamp": { "type": "string" } } }, "handlers.PhoneValidationRequest": { "description": "Estrutura de entrada contendo o número de telefone a ser validado.", "type": "object", "required": [ "phone" ], "properties": { "phone": { "description": "Número de telefone em formato internacional ou nacional.\nexample: \"+55 11 99988-7766\"", "type": "string" } } }, "handlers.PhoneValidationResponse": { "description": "Resultado da validação, contendo a decomposição (DDI, DDD, número) quando válida.", "type": "object", "properties": { "ddd": { "description": "DDD (código de área)", "type": "string" }, "ddi": { "description": "DDI (código do país)", "type": "string" }, "e164": { "description": "Representação E.164 do número", "type": "string" }, "message": { "description": "Mensagem de retorno.", "type": "string" }, "numero": { "description": "Número do assinante", "type": "string" }, "region": { "description": "Região ISO 3166-1 alpha-2", "type": "string" }, "valid": { "description": "Indica se o número é válido.", "type": "boolean" } } }, "handlers.SuccessResponse": { "type": "object", "properties": { "message": { "type": "string" } } }, "models.Aluno": { "type": "object", "properties": { "conceito": { "type": "string" }, "frequencia": { "type": "number" }, "indicador": { "type": "boolean" } } }, "models.AssistenciaSocial": { "type": "object", "properties": { "cadunico": { "$ref": "#/definitions/models.CadUnico" }, "cras": { "$ref": "#/definitions/models.CRAS" } } }, "models.BindRequest": { "type": "object", "required": [ "channel", "cpf" ], "properties": { "channel": { "type": "string" }, "cpf": { "type": "string" } } }, "models.BindResponse": { "type": "object", "properties": { "cpf": { "type": "string" }, "message": { "type": "string" }, "opt_in": { "type": "boolean" }, "phone_number": { "type": "string" }, "status": { "type": "string" } } }, "models.CRAS": { "type": "object", "properties": { "endereco": { "type": "string" }, "nome": { "type": "string" }, "telefone": { "type": "string" } } }, "models.CadUnico": { "type": "object", "properties": { "data_cadastro": { "type": "string" }, "data_limite_cadastro_atual": { "type": "string" }, "data_ultima_atualizacao": { "type": "string" }, "indicador": { "type": "boolean" }, "status_cadastral": { "type": "string" } } }, "models.Citizen": { "type": "object", "properties": { "_id": { "type": "string" }, "cpf": { "type": "string" }, "email": { "$ref": "#/definitions/models.Email" }, "endereco": { "$ref": "#/definitions/models.Endereco" }, "mae": { "$ref": "#/definitions/models.Mae" }, "menor_idade": { "type": "boolean" }, "nascimento": { "$ref": "#/definitions/models.Nascimento" }, "nome": { "type": "string" }, "nome_social": { "type": "string" }, "obito": { "$ref": "#/definitions/models.Obito" }, "raca": { "type": "string" }, "sexo": { "type": "string" }, "telefone": { "$ref": "#/definitions/models.Telefone" } } }, "models.CitizenWallet": { "type": "object", "properties": { "assistencia_social": { "$ref": "#/definitions/models.AssistenciaSocial" }, "cpf": { "type": "string" }, "documentos": { "$ref": "#/definitions/models.Documentos" }, "educacao": { "$ref": "#/definitions/models.Educacao" }, "saude": { "$ref": "#/definitions/models.Saude" } } }, "models.ClinicaFamilia": { "type": "object", "properties": { "email": { "type": "string" }, "endereco": { "type": "string" }, "horario_atendimento": { "type": "string" }, "id_cnes": { "type": "string" }, "indicador": { "type": "boolean" }, "nome": { "type": "string" }, "telefone": { "type": "string" } } }, "models.Documentos": { "type": "object", "properties": { "cns": { "type": "array", "items": { "type": "string" } } } }, "models.Educacao": { "type": "object", "properties": { "aluno": { "$ref": "#/definitions/models.Aluno" }, "escola": { "$ref": "#/definitions/models.Escola" } } }, "models.Email": { "type": "object", "properties": { "alternativo": { "type": "array", "items": { "type": "integer" } }, "indicador": { "type": "boolean" }, "principal": { "$ref": "#/definitions/models.EmailPrincipal" } } }, "models.EmailPrincipal": { "type": "object", "properties": { "origem": { "type": "string" }, "sistema": { "type": "string" }, "updated_at": { "type": "string" }, "valor": { "type": "string" } } }, "models.Endereco": { "type": "object", "properties": { "alternativo": { "type": "array", "items": { "type": "integer" } }, "indicador": { "type": "boolean" }, "principal": { "$ref": "#/definitions/models.EnderecoPrincipal" } } }, "models.EnderecoPrincipal": { "type": "object", "properties": { "bairro": { "type": "string" }, "cep": { "type": "string" }, "complemento": { "type": "string" }, "estado": { "type": "string" }, "logradouro": { "type": "string" }, "municipio": { "type": "string" }, "numero": { "type": "string" }, "origem": { "type": "string" }, "sistema": { "type": "string" }, "tipo_logradouro": { "type": "string" }, "updated_at": { "type": "string" } } }, "models.EquipeSaudeFamilia": { "type": "object", "properties": { "enfermeiros": { "type": "array", "items": { "$ref": "#/definitions/models.ProfissionalSaude" } }, "id_ine": { "type": "string" }, "indicador": { "type": "boolean" }, "medicos": { "type": "array", "items": { "$ref": "#/definitions/models.ProfissionalSaude" } }, "nome": { "type": "string" }, "telefone": { "type": "string" } } }, "models.Escola": { "type": "object", "properties": { "email": { "type": "string" }, "endereco": { "type": "string" }, "horario_funcionamento": { "type": "string" }, "nome": { "type": "string" }, "telefone": { "type": "string" }, "whatsapp": { "type": "string" } } }, "models.Mae": { "type": "object", "properties": { "cpf": { "type": "string" }, "nome": { "type": "string" } } }, "models.MaintenanceRequest": { "type": "object", "properties": { "categoria": { "type": "string" }, "cpf": { "type": "string" }, "data_alvo_diagnostico": { "type": "string" }, "data_alvo_finalizacao": { "type": "string" }, "data_fim": { "type": "string" }, "data_inicio": { "type": "string" }, "data_real_diagnostico": { "type": "string" }, "dentro_prazo": { "type": "string" }, "descricao": { "type": "string" }, "id": { "type": "string" }, "id_bairro": { "type": "string" }, "id_chamado": { "type": "string" }, "id_logradouro": { "type": "string" }, "id_origem_ocorrencia": { "type": "string" }, "id_subtipo": { "type": "string" }, "id_territorialidade": { "type": "string" }, "id_tipo": { "type": "string" }, "id_unidade_organizacional": { "type": "string" }, "id_unidade_organizacional_mae": { "type": "string" }, "indicador": { "type": "boolean" }, "justificativa_status": {}, "latitude": { "type": "number" }, "longitude": { "type": "number" }, "nome_unidade_organizacional": { "type": "string" }, "numero_logradouro": { "type": "integer" }, "origem_ocorrencia": { "type": "string" }, "prazo_tipo": { "type": "string" }, "prazo_unidade": { "type": "string" }, "reclamacoes": { "type": "integer" }, "situacao": { "type": "string" }, "status": { "type": "string" }, "subtipo": { "type": "string" }, "tempo_prazo": {}, "tipo": { "type": "string" }, "tipo_situacao": { "type": "string" }, "total_chamados": { "type": "integer" }, "total_fechados": { "type": "integer" }, "unidade_organizacional_ouvidoria": { "type": "string" } } }, "models.Nascimento": { "type": "object", "properties": { "data": { "type": "string" }, "municipio": { "type": "string" }, "municipio_id": { "type": "string" }, "pais": { "type": "string" }, "pais_id": { "type": "string" }, "uf": { "type": "string" } } }, "models.Obito": { "type": "object", "properties": { "ano": { "type": "integer" }, "indicador": { "type": "boolean" } } }, "models.OptInRequest": { "type": "object", "required": [ "channel", "cpf" ], "properties": { "channel": { "type": "string" }, "cpf": { "type": "string" }, "validation_result": { "$ref": "#/definitions/models.ValidationResult" } } }, "models.OptInResponse": { "type": "object", "properties": { "phone_mapping_id": { "type": "string" }, "status": { "type": "string" } } }, "models.OptOutReason": { "type": "object", "properties": { "code": { "type": "string" }, "subtitle": { "type": "string" }, "title": { "type": "string" } } }, "models.OptOutRequest": { "type": "object", "required": [ "channel", "reason" ], "properties": { "channel": { "type": "string" }, "reason": { "type": "string" } } }, "models.OptOutResponse": { "type": "object", "properties": { "status": { "type": "string" } } }, "models.PaginatedMaintenanceRequests": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/models.MaintenanceRequest" } }, "pagination": { "type": "object", "properties": { "page": { "type": "integer" }, "per_page": { "type": "integer" }, "total": { "type": "integer" }, "total_pages": { "type": "integer" } } } } }, "models.PaginationInfo": { "type": "object", "properties": { "page": { "type": "integer" }, "per_page": { "type": "integer" }, "total": { "type": "integer" }, "total_pages": { "type": "integer" } } }, "models.PhoneCitizenResponse": { "type": "object", "properties": { "cpf": { "type": "string" }, "first_name": { "type": "string" }, "found": { "type": "boolean" }, "name": { "type": "string" } } }, "models.PhoneStatusResponse": { "type": "object", "properties": { "cpf": { "type": "string" }, "found": { "type": "boolean" }, "name": { "type": "string" }, "phone_number": { "type": "string" }, "quarantine_until": { "type": "string" }, "quarantined": { "type": "boolean" } } }, "models.PhoneVerificationValidateRequest": { "type": "object", "required": [ "code", "ddd", "ddi", "valor" ], "properties": { "code": { "type": "string" }, "ddd": { "type": "string" }, "ddi": { "type": "string" }, "valor": { "type": "string" } } }, "models.ProfissionalSaude": { "type": "object", "properties": { "id_profissional_sus": { "type": "string" }, "nome": { "type": "string" } } }, "models.QuarantineResponse": { "type": "object", "properties": { "message": { "type": "string" }, "phone_number": { "type": "string" }, "quarantine_until": { "type": "string" }, "status": { "type": "string" } } }, "models.QuarantineStats": { "type": "object", "properties": { "active_quarantines": { "type": "integer" }, "expired_quarantines": { "type": "integer" }, "quarantine_history_total": { "type": "integer" }, "quarantines_with_cpf": { "type": "integer" }, "quarantines_without_cpf": { "type": "integer" }, "total_quarantined": { "type": "integer" } } }, "models.QuarantinedListResponse": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/definitions/models.QuarantinedPhone" } }, "pagination": { "$ref": "#/definitions/models.PaginationInfo" } } }, "models.QuarantinedPhone": { "type": "object", "properties": { "cpf": { "type": "string" }, "expired": { "type": "boolean" }, "phone_number": { "type": "string" }, "quarantine_until": { "type": "string" } } }, "models.RejectRegistrationRequest": { "type": "object", "required": [ "channel", "cpf", "reason" ], "properties": { "channel": { "type": "string" }, "cpf": { "type": "string" }, "reason": { "type": "string" } } }, "models.RejectRegistrationResponse": { "type": "object", "properties": { "status": { "type": "string" } } }, "models.Saude": { "type": "object", "properties": { "clinica_familia": { "$ref": "#/definitions/models.ClinicaFamilia" }, "equipe_saude_familia": { "$ref": "#/definitions/models.EquipeSaudeFamilia" } } }, "models.SelfDeclaredAddressInput": { "type": "object", "required": [ "bairro", "cep", "estado", "logradouro", "municipio", "numero" ], "properties": { "bairro": { "type": "string" }, "cep": { "type": "string" }, "complemento": { "type": "string" }, "estado": { "type": "string" }, "logradouro": { "type": "string" }, "municipio": { "type": "string" }, "numero": { "type": "string" }, "tipo_logradouro": { "type": "string" } } }, "models.SelfDeclaredEmailInput": { "type": "object", "required": [ "valor" ], "properties": { "valor": { "type": "string" } } }, "models.SelfDeclaredPhoneInput": { "type": "object", "required": [ "ddi", "valor" ], "properties": { "ddd": { "description": "DDD é obrigatório somente quando o DDI é 55 (Brasil)", "type": "string" }, "ddi": { "type": "string" }, "valor": { "type": "string" } } }, "models.SelfDeclaredRacaInput": { "type": "object", "required": [ "valor" ], "properties": { "valor": { "type": "string" } } }, "models.Telefone": { "type": "object", "properties": { "alternativo": { "type": "array", "items": { "type": "integer" } }, "indicador": { "type": "boolean" }, "principal": { "$ref": "#/definitions/models.TelefonePrincipal" } } }, "models.TelefonePrincipal": { "type": "object", "properties": { "ddd": { "type": "string" }, "ddi": { "type": "string" }, "origem": { "type": "string" }, "sistema": { "type": "string" }, "updated_at": { "type": "string" }, "valor": { "type": "string" } } }, "models.UserConfigOptInResponse": { "type": "object", "properties": { "opt_in": { "type": "boolean" } } }, "models.UserConfigResponse": { "type": "object", "properties": { "firstlogin": { "type": "boolean" } } }, "models.ValidateRegistrationRequest": { "type": "object", "required": [ "birth_date", "channel", "cpf", "name" ], "properties": { "birth_date": { "type": "string" }, "channel": { "type": "string" }, "cpf": { "type": "string" }, "name": { "type": "string" } } }, "models.ValidateRegistrationResponse": { "type": "object", "properties": { "matched_cpf": { "type": "string" }, "matched_name": { "type": "string" }, "valid": { "type": "boolean" } } }, "models.ValidationResult": { "type": "object", "properties": { "valid": { "type": "boolean" } } } }, "securityDefinitions": { "BearerAuth": { "description": "Tipo: Bearer token. Exemplo: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "type": "apiKey", "name": "Authorization", "in": "header" } }, "tags": [ { "description": "Operações relacionadas a cidadãos, incluindo consulta e atualização de dados autodeclarados", "name": "citizen" }, { "description": "Operações de verificação de saúde da API", "name": "health" } ] }