{
  "openapi": "3.0.0",
  "info": {
    "title": "Zarv ID API",
    "version": "2.0.1",
    "description": "Documentação da API do Zarv ID"
  },
  "servers": [
    {
      "url": "https://services.zarv.com",
      "description": "Produção"
    }
  ],
  "tags": [
    {
      "name": "Autenticação",
      "description": "API de Autenticação"
    },
    {
      "name": "Verificação",
      "description": "API de Verificações"
    },
    {
      "name": "Lista Restritiva",
      "description": "API de Lista Restritiva"
    }
  ],
  "paths": {
    "/api/v1/authentication": {
      "post": {
        "summary": "Login",
        "description": "Autenticação para obter um token de acesso",
        "tags": ["Autenticação"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthenticationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Autenticação realizada com sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthenticationResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/verifications": {
      "post": {
        "summary": "Criar uma verificação",
        "description": "Cria uma nova verificação para um CPF ou CNPJ",
        "tags": ["Verificação"],
        "security": [
          {
            "Authentication v2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerificationRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Verificação criada com sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "Consultar verificações",
        "description": "Obtém todas as verificações com filtros opcionais",
        "tags": ["Verificação"],
        "security": [
          {
            "Authentication v2": []
          }
        ],
        "parameters": [
          {
            "name": "nationalId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 11,
              "maxLength": 14,
              "example": "012345678900"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Filtra pelo status da verificação.",
            "schema": {
              "type": "string",
              "enum": [
                "CREATED",
                "PROCESSING",
                "ANALYZING",
                "COMPLETED",
                "FAILED",
                "CNH_EXTRACT"
              ],
              "example": "COMPLETED"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Busca parcial e case-insensitive por CPF/CNPJ ou nome. Combina com os demais filtros.",
            "schema": {
              "type": "string",
              "example": "maria"
            }
          },
          {
            "name": "types",
            "in": "query",
            "required": false,
            "description": "Filtra por um ou mais tipos de verificação. Repita o parâmetro para múltiplos valores (ex.: ?types=full&types=light).",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["full", "light"]
              },
              "example": ["full", "light"]
            }
          },
          {
            "name": "feedbackStatus",
            "in": "query",
            "required": false,
            "description": "Filtra pelo status do feedback (decisão de aprovação) mais recente da verificação. NOTSTARTED retorna verificações que ainda não receberam feedback.",
            "schema": {
              "type": "string",
              "enum": [
                "NOTSTARTED",
                "APPROVED",
                "REPROVED",
                "STANDBY",
                "WAIVED"
              ],
              "example": "APPROVED"
            }
          },
          {
            "name": "incomplete",
            "in": "query",
            "required": false,
            "description": "Quando true, retorna apenas verificações potencialmente travadas: em CREATED ou PROCESSING e criadas entre 15 minutos e 12 horas atrás.",
            "schema": {
              "type": "boolean",
              "example": true
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "example": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 25,
              "example": 10
            }
          },
          {
            "name": "scoreGte",
            "in": "query",
            "required": false,
            "description": "Filtra verificações com Zarv Score maior ou igual a este valor (inclusive, faixa 0–1000). Combine com scoreLte para um intervalo fechado.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000,
              "example": 500
            }
          },
          {
            "name": "scoreLte",
            "in": "query",
            "required": false,
            "description": "Filtra verificações com Zarv Score menor ou igual a este valor (inclusive, faixa 0–1000).",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000,
              "example": 800
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Lista de verificações",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationResponseList"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/verifications/batch": {
      "post": {
        "summary": "Criar verificações em lote",
        "description": "Cria uma verificação para cada `nationalId` da lista, aplicando a mesma configuração de `verifications` a todos os itens. Cada item é validado e cobrado individualmente; o resultado de cada um vem em `items`, um mapa indexado pelo `nationalId`. Itens aceitos retornam `id` (verification ID) para polling posterior; itens rejeitados retornam `error`. Face recognition e CNH não são suportados em lote — se presentes no corpo, são ignorados.",
        "tags": ["Verificação"],
        "security": [
          {
            "Authentication v2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRequest"
              },
              "example": {
                "nationalId": ["012345678900", "98765432100"],
                "verifications": {
                  "type": "full",
                  "finance": {
                    "restrictions": true
                  }
                },
                "callback": {
                  "url": "https://example.com/webhooks/verifications",
                  "method": "POST",
                  "headers": {
                    "Authorization": "Bearer <token>"
                  }
                },
                "metadata": {
                  "campaignId": "summer-2026",
                  "source": "partner-xyz"
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Lote aceito para processamento. A resposta contém o resumo do lote e, em `items`, o status de cada `nationalId` enviado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchResponse"
                },
                "example": {
                  "total": 4,
                  "success": 2,
                  "errors": 2,
                  "items": {
                    "012345678900": {
                      "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab"
                    },
                    "98765432100": {
                      "id": "e5f6g7h8-1234-5678-90ab-cdef12345678"
                    },
                    "11111111111": {
                      "error": "invalid national id"
                    },
                    "22222222222": {
                      "error": "There is not enough balance: insufficient balance"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Corpo da requisição inválido ou `nationalId` vazio"
          }
        }
      }
    },
    "/api/v2/verifications/{id}": {
      "get": {
        "summary": "Consultar verificação por ID",
        "description": "Obtém uma verificação específica pelo ID",
        "tags": ["Verificação"],
        "security": [
          {
            "Authentication v2": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "example": "805181ca-2956-49e1-81bb-93d1792d269d"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Detalhes da verificação",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/verifications/{id}/pdf": {
      "get": {
        "summary": "Obter PDF da verificação",
        "description": "Retorna os bytes do arquivo PDF de uma verificação específica pelo ID. A resposta contém o conteúdo binário do arquivo e nao uma URL para download.",
        "tags": ["Verificação"],
        "security": [
          {
            "Authentication v2": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "example": "805181ca-2956-49e1-81bb-93d1792d269d"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bytes do arquivo PDF da verificação",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Parâmetros inválidos",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "No verificationID provided"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Erro ao gerar ou obter o PDF",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "internal server error"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/verifications/{id}/feedbacks": {
      "post": {
        "summary": "Criar feedback para uma verificação",
        "description": "Criar feedback para uma verificação",
        "tags": ["Verificação"],
        "security": [
          {
            "Authentication v2": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerificationFeebbackRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Feedback criado com sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationFeedbackResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/blacklist": {
      "get": {
        "summary": "Consultar lista restritiva",
        "description": "Obtém os registros da lista restritiva com paginação por workspace",
        "tags": ["Lista Restritiva"],
        "security": [
          {
            "Authentication v2": []
          }
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "example": "fc31805a-9ac5-423b-b3cb-b626c769b27c"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "example": 10
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "example": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Lista restritiva consultada com sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlacklistResponseList"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Adicionar item na lista restritiva",
        "description": "Cria um novo registro na lista restritiva para um workspace",
        "tags": ["Lista Restritiva"],
        "security": [
          {
            "Authentication v2": []
          }
        ],
        "parameters": [
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "example": "fc31805a-9ac5-423b-b3cb-b626c769b27c"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BlacklistRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Item adicionado na lista restritiva com sucesso",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlacklistResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/blacklist/{nationalId}": {
      "delete": {
        "summary": "Remover item da lista restritiva",
        "description": "Remove um registro da lista restritiva por nationalId e workspace",
        "tags": ["Lista Restritiva"],
        "security": [
          {
            "Authentication v2": []
          }
        ],
        "parameters": [
          {
            "name": "nationalId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 11,
              "maxLength": 14,
              "example": "91439362025"
            }
          },
          {
            "name": "workspaceId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "example": "fc31805a-9ac5-423b-b3cb-b626c769b27c"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Item removido da lista restritiva com sucesso"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "Authentication v2": {
        "description": "For more details, see [Authentication v2](https://developers.zarv.com/api/zarv-id/authentication)",
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "AuthenticationRequest": {
        "type": "object",
        "required": ["username", "password"],
        "properties": {
          "username": {
            "type": "string",
            "format": "email",
            "description": "Nome de usuário do usuário",
            "example": "foo@example.com"
          },
          "password": {
            "type": "string",
            "description": "Senha do usuário",
            "minLength": 4,
            "example": "1234"
          }
        }
      },
      "AuthenticationResponse": {
        "type": "object",
        "properties": {
          "accessToken": {
            "type": "string",
            "description": "Token de acesso",
            "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
          },
          "refreshToken": {
            "type": "string",
            "description": "Token de acesso",
            "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
          },
          "expiresIn": {
            "type": "number",
            "description": "Tempo de expiração do token de acesso",
            "example": 300
          },
          "refreshExpiresIn": {
            "type": "number",
            "description": "Tempo de expiração do token de atualização",
            "example": 3600
          },
          "tokenType": {
            "type": "string",
            "description": "Tipo de token",
            "example": "Bearer"
          }
        }
      },
      "VerificationRequest": {
        "type": "object",
        "properties": {
          "nationalId": {
            "type": "string",
            "description": "CPF ou CNPJ",
            "minLength": 11,
            "maxLength": 14,
            "example": "012345678900"
          },
          "verifications": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["full", "light"],
                "example": "full"
              },
              "finance": {
                "type": "object",
                "properties": {
                  "restrictions": {
                    "type": "boolean",
                    "example": true
                  }
                }
              }
            }
          }
        },
        "required": ["nationalId", "verification"]
      },
      "VerificationResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "example": "805181ca-2956-49e1-81bb-93d1792d269d"
          },
          "workspaceId": {
            "type": "string",
            "format": "uuid",
            "example": "bc5a5b9e-3bb2-4998-b301-a6a39314d330"
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "example": "767b88ea-6f5e-4256-b6bb-726cb402cd7b"
          },
          "nationalId": {
            "type": "string",
            "example": "012345678900"
          },
          "name": {
            "type": "string",
            "example": "FOO BAR"
          },
          "status": {
            "type": "string",
            "enum": ["CREATED", "PROCESSING", "COMPLETED", "FAILED"],
            "example": "COMPLETED"
          },
          "verification": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["full", "light"],
                "example": "full"
              },
              "finance": {
                "type": "object",
                "properties": {
                  "restrictions": {
                    "type": "boolean",
                    "example": true
                  }
                }
              },
              "result": {
                "type": "object",
                "properties": {
                  "score": {
                    "type": "number",
                    "example": 1000
                  },
                  "scoreFactor": {
                    "type": "number",
                    "example": 3
                  },
                  "rules": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "example": [
                      "PROFILE_SUSPECTED_PERSON_BLACKLIST",
                      "FINANCE_SOCIAL_ASSISTANCES",
                      "FINANCE_ASSET",
                      "RELATED_GHOST_PERSONAL_RELATIONSHIPS",
                      "LAWSUIT_PROCESS_REDFLAG_L1",
                      "LAWSUIT_SUSPECT_PROCESS_L2"
                    ]
                  },
                  "execution": {
                    "type": "object",
                    "properties": {
                      "startedAt": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2025-05-12T14:05:53Z"
                      },
                      "endedAt": {
                        "type": "string",
                        "format": "date-time",
                        "example": "2025-05-12T14:05:53Z"
                      },
                      "durationMs": {
                        "type": "number",
                        "example": 799
                      }
                    }
                  }
                }
              },
              "person": {
                "type": "object",
                "properties": {
                  "profile": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "example": "FOO BAR"
                      },
                      "nationalId": {
                        "type": "string",
                        "example": "012345678900"
                      },
                      "fiscalStatus": {
                        "type": "string",
                        "enum": ["REGULAR", "SUSPECTED", "BLACKLISTED"],
                        "example": "REGULAR"
                      },
                      "obitFlag": {
                        "type": "boolean",
                        "example": false
                      },
                      "birthDate": {
                        "type": "string",
                        "format": "date",
                        "example": "1990-01-01"
                      },
                      "age": {
                        "type": "number",
                        "example": 30
                      },
                      "gender": {
                        "type": "string",
                        "enum": ["M", "F"],
                        "example": "F"
                      },
                      "contacts": {
                        "type": "object",
                        "properties": {
                          "addresses": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "example": "WORK"
                                },
                                "street": {
                                  "type": "string",
                                  "example": "Rua das Flores"
                                },
                                "number": {
                                  "type": "string",
                                  "example": "123"
                                },
                                "neighborhood": {
                                  "type": "string",
                                  "example": "Bairro das Flores"
                                },
                                "city": {
                                  "type": "string",
                                  "example": "São Paulo"
                                },
                                "state": {
                                  "type": "string",
                                  "example": "SP"
                                },
                                "postalCode": {
                                  "type": "string",
                                  "example": "1234567890"
                                },
                                "createdAt": {
                                  "type": "string",
                                  "format": "date-time",
                                  "example": "2025-05-12T14:05:53Z"
                                },
                                "updatedAt": {
                                  "type": "string",
                                  "format": "date-time",
                                  "example": "2025-05-12T14:05:53Z"
                                }
                              }
                            }
                          },
                          "emails": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "example": "foo@bar.com"
                            }
                          },
                          "phones": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": ["CELULAR", "MOBILE", "FIXO", "WORK"],
                                  "example": "MOBILE"
                                },
                                "number": {
                                  "type": "string",
                                  "example": "999999999"
                                },
                                "area": {
                                  "type": "string",
                                  "example": "13"
                                },
                                "country": {
                                  "type": "string",
                                  "example": "55"
                                },
                                "createdAt": {
                                  "type": "string",
                                  "format": "date",
                                  "example": "2025-05-12"
                                },
                                "updatedAt": {
                                  "type": "string",
                                  "format": "date",
                                  "example": "2025-05-12"
                                }
                              }
                            }
                          }
                        }
                      },
                      "indicators": {
                        "type": "object",
                        "properties": {
                          "blacklisted": {
                            "type": "object",
                            "properties": {
                              "risky": {
                                "type": "boolean",
                                "example": true
                              },
                              "value": {
                                "type": "number",
                                "example": 1
                              }
                            }
                          },
                          "blacklistedCompanies": {
                            "type": "object",
                            "properties": {
                              "risky": {
                                "type": "boolean",
                                "example": false
                              },
                              "value": {
                                "type": "number",
                                "example": 0
                              }
                            }
                          },
                          "blacklistedRelated": {
                            "type": "object",
                            "properties": {
                              "risky": {
                                "type": "boolean",
                                "example": false
                              },
                              "value": {
                                "type": "number",
                                "example": 0
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "finance": {
                    "type": "object",
                    "properties": {
                      "salary": {
                        "type": "number",
                        "example": 1000
                      },
                      "income": {
                        "type": "string",
                        "example": "5 A 7 SM"
                      },
                      "totalAssets": {
                        "type": "string",
                        "example": "ABAIXO DE 100K"
                      },
                      "taxReturns": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "year": {
                              "type": "string",
                              "example": "2024"
                            },
                            "status": {
                              "type": "string",
                              "example": "SALDO INEXISTENTE DE IMPOSTO A PAGAR OU A RESTITUIR"
                            },
                            "bank": {
                              "type": "string",
                              "example": "BANCO DO BRASIL"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date",
                              "example": "2025-05-12"
                            }
                          }
                        }
                      },
                      "collections": {
                        "type": "object",
                        "properties": {
                          "total": {
                            "type": "number",
                            "example": 17
                          },
                          "totalOrigins": {
                            "type": "number",
                            "example": 2
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date",
                            "example": "2025-05-12"
                          }
                        }
                      },
                      "assistancePrograms": {
                        "type": "object",
                        "properties": {
                          "programs": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "example": "BOLSA FAMÍLIA"
                                },
                                "city": {
                                  "type": "string",
                                  "example": "São Paulo"
                                },
                                "state": {
                                  "type": "string",
                                  "example": "SP"
                                },
                                "active": {
                                  "type": "boolean",
                                  "example": true
                                },
                                "amount": {
                                  "type": "number",
                                  "example": 1000
                                },
                                "totalAmount": {
                                  "type": "number",
                                  "example": 1000
                                },
                                "startedAt": {
                                  "type": "string",
                                  "format": "date",
                                  "example": "2025-05-12"
                                },
                                "endedAt": {
                                  "type": "string",
                                  "format": "date",
                                  "example": "2025-05-12"
                                }
                              }
                            }
                          },
                          "total": {
                            "type": "number",
                            "example": 1
                          },
                          "totalActive": {
                            "type": "number",
                            "example": 0
                          }
                        }
                      },
                      "indicators": {
                        "type": "object",
                        "properties": {
                          "monthlyIncome": {
                            "type": "object",
                            "properties": {
                              "risky": {
                                "type": "boolean",
                                "example": false
                              },
                              "value": {
                                "type": "number",
                                "example": 1000
                              }
                            }
                          },
                          "assistancePrograms": {
                            "type": "object",
                            "properties": {
                              "risky": {
                                "type": "boolean",
                                "example": false
                              },
                              "value": {
                                "type": "number",
                                "example": 0
                              }
                            }
                          },
                          "ltyTaxDeclarations": {
                            "type": "object",
                            "properties": {
                              "risky": {
                                "type": "boolean",
                                "example": true
                              },
                              "value": {
                                "type": "number",
                                "example": 1
                              }
                            }
                          },
                          "collections": {
                            "type": "object",
                            "properties": {
                              "risky": {
                                "type": "boolean",
                                "example": true
                              },
                              "value": {
                                "type": "number",
                                "example": 17
                              }
                            }
                          }
                        }
                      },
                      "restrictions": {
                        "type": "object",
                        "properties": {
                          "registerLogs": {
                            "type": "string",
                            "example": "Cliente notificado, período de resposta encerrado, dados prontos para serem usados"
                          },
                          "isNegative": {
                            "type": "boolean",
                            "example": true
                          },
                          "hasData": {
                            "type": "boolean",
                            "example": true
                          },
                          "segment": {
                            "type": "string",
                            "example": "Atraso severo (Negativo ativo ou CCF ou ação ou atraso maior que 90 dias no CP.)"
                          },
                          "reportedBy": {
                            "type": "string",
                            "example": "BANCO SANTANDER BRASIL S.A."
                          },
                          "reportedAt": {
                            "type": "string",
                            "format": "date",
                            "example": "2025-05-12"
                          },
                          "status": {
                            "type": "string",
                            "example": "Ativo"
                          },
                          "city": {
                            "type": "string",
                            "example": "São Paulo"
                          },
                          "amount": {
                            "type": "string",
                            "example": "R$869,73"
                          },
                          "type": {
                            "type": "string",
                            "example": "Créditos e Financiamentos"
                          },
                          "totalAmount": {
                            "type": "number",
                            "example": 869.73
                          },
                          "consultationLogs": {
                            "type": "object",
                            "properties": {
                              "60": {
                                "type": "number",
                                "example": 0
                              },
                              "90": {
                                "type": "number",
                                "example": 1
                              },
                              "+90": {
                                "type": "number",
                                "example": 2
                              },
                              "+30": {
                                "type": "number",
                                "example": 0
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "lawsuits": {
                    "type": "object"
                  },
                  "related": {
                    "type": "object"
                  }
                }
              },
              "version": {
                "type": "string",
                "example": "v4"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-05-12T14:05:53Z"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-05-12T14:05:53Z"
              }
            }
          }
        }
      },
      "VerificationResponseList": {
        "type": "object",
        "properties": {
          "verifications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VerificationResponse"
            }
          },
          "page": {
            "type": "integer",
            "example": 1
          },
          "limit": {
            "type": "integer",
            "example": 10
          },
          "total": {
            "type": "integer",
            "example": 100
          }
        }
      },
      "BatchRequest": {
        "type": "object",
        "required": ["nationalId", "verifications"],
        "description": "Configuração compartilhada + lista de CPFs/CNPJs. Todos os itens são processados com a mesma configuração de `verifications`.",
        "properties": {
          "nationalId": {
            "type": "array",
            "description": "Lista de CPFs ou CNPJs. Duplicados no input não causam erro, mas no `items` de resposta apenas a última tentativa permanece.",
            "minItems": 1,
            "items": {
              "type": "string",
              "example": "012345678900"
            }
          },
          "verifications": {
            "type": "object",
            "description": "Configuração aplicada a todos os itens. Campos `faceRecognition` e `cnh`, se presentes, são ignorados.",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["full", "light"],
                "example": "full"
              },
              "finance": {
                "type": "object",
                "properties": {
                  "restrictions": {
                    "type": "boolean",
                    "example": true
                  }
                }
              }
            }
          },
          "callback": {
            "type": "object",
            "description": "Callback HTTP disparado quando cada verificação do lote muda pra `COMPLETED` ou `FAILED`. Aplicado a todas as verificações do lote.",
            "required": ["url", "method"],
            "properties": {
              "url": {
                "type": "string",
                "description": "URL para onde o webhook será enviado.",
                "example": "https://example.com/webhooks/verifications"
              },
              "method": {
                "type": "string",
                "description": "Método HTTP usado na chamada do webhook.",
                "enum": ["POST", "PUT"],
                "example": "POST"
              },
              "headers": {
                "type": "object",
                "description": "Headers HTTP adicionais enviados junto do webhook. Útil para autenticação no seu endpoint (ex: `Authorization: Bearer ...`).",
                "additionalProperties": {
                  "type": "string"
                },
                "example": {
                  "Authorization": "Bearer <token>",
                  "X-Tenant-Id": "my-tenant"
                }
              }
            }
          },
          "metadata": {
            "type": "object",
            "description": "Metadata livre aplicada a todas as verificações criadas no lote.",
            "additionalProperties": true,
            "example": {
              "campaignId": "summer-2026",
              "source": "partner-xyz"
            }
          }
        }
      },
      "BatchResponse": {
        "type": "object",
        "description": "Resumo do lote e status por `nationalId`. A invariante `success + errors == total` é mantida mesmo com `nationalId` duplicados — nesse caso `len(items) <= total`.",
        "properties": {
          "total": {
            "type": "integer",
            "description": "Quantidade de tentativas (= tamanho da lista `nationalId` enviada)."
          },
          "success": {
            "type": "integer",
            "description": "Quantidade de itens aceitos para processamento."
          },
          "errors": {
            "type": "integer",
            "description": "Quantidade de itens que falharam na criação."
          },
          "items": {
            "type": "object",
            "description": "Status por item, indexado pelo `nationalId`. Sucessos têm `id` (verification ID para polling); falhas têm `error`.",
            "additionalProperties": {
              "$ref": "#/components/schemas/BatchStatus"
            },
            "example": {
              "012345678900": {
                "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab"
              },
              "98765432100": {
                "id": "e5f6g7h8-1234-5678-90ab-cdef12345678"
              },
              "11111111111": {
                "error": "invalid national id"
              },
              "22222222222": {
                "error": "There is not enough balance: insufficient balance"
              }
            }
          }
        },
        "example": {
          "total": 4,
          "success": 2,
          "errors": 2,
          "items": {
            "012345678900": {
              "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab"
            },
            "98765432100": {
              "id": "e5f6g7h8-1234-5678-90ab-cdef12345678"
            },
            "11111111111": {
              "error": "invalid national id"
            },
            "22222222222": {
              "error": "There is not enough balance: insufficient balance"
            }
          }
        }
      },
      "BatchStatus": {
        "type": "object",
        "description": "Outcome de um item do lote. Exatamente um dos campos (`id` ou `error`) é populado.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Verification ID quando o item foi aceito e enfileirado para processamento. Use em `GET /v2/verifications/{id}` para polling.",
            "example": "a1b2c3d4-5678-90ab-cdef-1234567890ab"
          },
          "error": {
            "type": "string",
            "description": "Motivo da falha (validação, saldo insuficiente, erro interno, etc.) quando o item foi rejeitado antes do enfileiramento.",
            "example": "There is not enough balance: insufficient balance"
          }
        }
      },
      "VerificationFeebbackRequest": {
        "type": "object",
        "required": ["verificationId", "status"],
        "properties": {
          "verificationId": {
            "type": "string",
            "description": "ID da verificação",
            "example": "805181ca-2956-49e1-81bb-93d1792d269d"
          },
          "status": {
            "type": "string",
            "enum": ["STANDBY", "REPROVED", "APPROVED"],
            "example": "APPROVED"
          },
          "comment": {
            "type": "string",
            "description": "Comentário opcional do feedback",
            "example": "Documentacao validada com sucesso"
          }
        }
      },
      "VerificationFeedbackResponse": {
        "type": "object",
        "required": ["status", "verificationId"],
        "properties": {
          "status": {
            "type": "string",
            "enum": ["STANDBY", "REPROVED", "APPROVED"],
            "example": "APPROVED"
          },
          "verificationId": {
            "type": "string",
            "description": "ID da verificação",
            "example": "805181ca-2956-49e1-81bb-93d1792d269d"
          }
        }
      },
      "BlacklistRequest": {
        "type": "object",
        "required": ["nationalId", "type", "description"],
        "properties": {
          "nationalId": {
            "type": "string",
            "description": "CPF ou CNPJ a ser incluído na lista restritiva",
            "minLength": 11,
            "maxLength": 14,
            "example": "91439362025"
          },
          "type": {
            "type": "string",
            "description": "Tipo da restrição",
            "enum": ["credit", "fraud", "other"],
            "example": "fraud"
          },
          "description": {
            "type": "string",
            "description": "Descrição da restrição",
            "example": "Fraude"
          }
        }
      },
      "BlacklistResponse": {
        "type": "object",
        "required": [
          "id",
          "workspaceId",
          "userId",
          "nationalId",
          "type",
          "description",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "example": "53190a88-7866-4fc4-9986-5e24f7d8da97"
          },
          "workspaceId": {
            "type": "string",
            "format": "uuid",
            "example": "fc31805a-9ac5-423b-b3cb-b626c769b27c"
          },
          "userId": {
            "type": "string",
            "format": "uuid",
            "example": "a7e3545c-b7e1-4156-8363-7d3ecca8c8d9"
          },
          "nationalId": {
            "type": "string",
            "example": "91439362025"
          },
          "type": {
            "type": "string",
            "enum": ["CREDIT", "FRAUD", "OTHER"],
            "example": "FRAUD"
          },
          "description": {
            "type": "string",
            "example": "Fraude"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "example": "2026-03-30T17:53:52Z"
          }
        }
      },
      "BlacklistResponseList": {
        "type": "object",
        "properties": {
          "blacklist": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BlacklistResponse"
            }
          },
          "page": {
            "type": "integer",
            "example": 1
          },
          "limit": {
            "type": "integer",
            "example": 10
          },
          "total": {
            "type": "integer",
            "example": 1
          }
        }
      }
    }
  }
}
