{
  "openapi": "3.0.3",
  "info": {
    "title": "Nume CNPJ API",
    "version": "1.0.0",
    "description": "Consulta de CNPJ sobre a base da Receita Federal do Brasil, com sócios, Simples/MEI, inscrições estaduais, dívida ativa, sanções e histórico. Créditos por chamada: só respostas 200 consomem. Planos: Dev (100 créditos/mês, 3 req/min); Starter (10000 créditos/mês, 30 req/min); Pro (50000 créditos/mês, 120 req/min); Business (250000 créditos/mês, 300 req/min). Documentação: https://nume.solutions/cnpj/api",
    "contact": {
      "name": "Nume",
      "url": "https://nume.solutions/contato"
    },
    "termsOfService": "https://nume.solutions/termos",
    "license": {
      "name": "Uso conforme os termos da Nume",
      "url": "https://nume.solutions/termos"
    }
  },
  "servers": [
    {
      "url": "https://api.nume.solutions"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Chave nume_live_… criada em https://nume.solutions/conta/api"
      }
    },
    "schemas": {
      "Empresa": {
        "type": "object",
        "properties": {
          "cnpj": {
            "type": "string"
          },
          "cnpj_basico": {
            "type": "string"
          },
          "razao_social": {
            "type": "string",
            "nullable": true
          },
          "natureza_juridica": {
            "type": "object",
            "nullable": true,
            "properties": {
              "codigo": {
                "type": "string",
                "nullable": true
              },
              "descricao": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "porte": {
            "type": "string",
            "nullable": true
          },
          "capital_social": {
            "type": "number",
            "nullable": true
          },
          "ente_federativo": {
            "type": "string",
            "nullable": true
          },
          "qualificacao_responsavel": {
            "type": "object",
            "nullable": true,
            "properties": {
              "codigo": {
                "type": "string",
                "nullable": true
              },
              "descricao": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "simples": {
            "type": "object",
            "properties": {
              "optante": {
                "type": "boolean",
                "nullable": true
              },
              "desde": {
                "type": "string",
                "nullable": true,
                "description": "Data ISO 8601 (AAAA-MM-DD)"
              },
              "excluido_em": {
                "type": "string",
                "nullable": true,
                "description": "Data ISO 8601 (AAAA-MM-DD)"
              }
            }
          },
          "mei": {
            "type": "object",
            "properties": {
              "optante": {
                "type": "boolean",
                "nullable": true
              },
              "desde": {
                "type": "string",
                "nullable": true,
                "description": "Data ISO 8601 (AAAA-MM-DD)"
              },
              "excluido_em": {
                "type": "string",
                "nullable": true,
                "description": "Data ISO 8601 (AAAA-MM-DD)"
              }
            }
          },
          "estabelecimento": {
            "type": "object",
            "properties": {
              "cnpj": {
                "type": "string",
                "example": "00000000000191"
              },
              "matriz": {
                "type": "boolean",
                "nullable": true
              },
              "nome_fantasia": {
                "type": "string",
                "nullable": true
              },
              "situacao_cadastral": {
                "type": "string",
                "nullable": true,
                "example": "ATIVA"
              },
              "motivo_situacao": {
                "type": "object",
                "nullable": true,
                "properties": {
                  "codigo": {
                    "type": "string",
                    "nullable": true
                  },
                  "descricao": {
                    "type": "string",
                    "nullable": true
                  }
                }
              },
              "data_situacao": {
                "type": "string",
                "nullable": true,
                "description": "Data ISO 8601 (AAAA-MM-DD)"
              },
              "data_abertura": {
                "type": "string",
                "nullable": true,
                "description": "Data ISO 8601 (AAAA-MM-DD)"
              },
              "cnae_principal": {
                "type": "object",
                "nullable": true,
                "properties": {
                  "codigo": {
                    "type": "string",
                    "nullable": true
                  },
                  "descricao": {
                    "type": "string",
                    "nullable": true
                  }
                }
              },
              "cnaes_secundarios": {
                "type": "array",
                "items": {
                  "type": "object",
                  "nullable": true,
                  "properties": {
                    "codigo": {
                      "type": "string",
                      "nullable": true
                    },
                    "descricao": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              },
              "endereco": {
                "type": "object",
                "nullable": true,
                "properties": {
                  "tipo_logradouro": {
                    "type": "string",
                    "nullable": true
                  },
                  "logradouro": {
                    "type": "string",
                    "nullable": true
                  },
                  "numero": {
                    "type": "string",
                    "nullable": true
                  },
                  "complemento": {
                    "type": "string",
                    "nullable": true
                  },
                  "bairro": {
                    "type": "string",
                    "nullable": true
                  },
                  "cep": {
                    "type": "string",
                    "nullable": true
                  },
                  "municipio": {
                    "type": "object",
                    "nullable": true,
                    "properties": {
                      "codigo": {
                        "type": "string",
                        "nullable": true
                      },
                      "descricao": {
                        "type": "string",
                        "nullable": true
                      }
                    }
                  },
                  "uf": {
                    "type": "string",
                    "nullable": true
                  }
                }
              },
              "telefones": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "fax": {
                "type": "string",
                "nullable": true
              },
              "email": {
                "type": "string",
                "nullable": true
              },
              "inscricoes_estaduais": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "uf": {
                      "type": "string",
                      "nullable": true
                    },
                    "inscricao": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              },
              "atualizado_em": {
                "type": "string",
                "nullable": true
              }
            },
            "nullable": true
          },
          "total_estabelecimentos": {
            "type": "integer"
          },
          "atualizado_em": {
            "type": "string",
            "nullable": true
          },
          "fonte": {
            "type": "string"
          },
          "estabelecimentos": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Estabelecimento"
            },
            "description": "Só com completo=1"
          },
          "socios": {
            "type": "array",
            "description": "Só com completo=1",
            "items": {
              "type": "object",
              "properties": {
                "nome": {
                  "type": "string",
                  "nullable": true
                },
                "identificador": {
                  "type": "string",
                  "nullable": true
                },
                "cpf_cnpj": {
                  "type": "string",
                  "nullable": true,
                  "description": "CPF mascarado como na fonte"
                },
                "qualificacao": {
                  "type": "object",
                  "nullable": true,
                  "properties": {
                    "codigo": {
                      "type": "string",
                      "nullable": true
                    },
                    "descricao": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                },
                "faixa_etaria": {
                  "type": "string",
                  "nullable": true
                },
                "data_entrada": {
                  "type": "string",
                  "nullable": true,
                  "description": "Data ISO 8601 (AAAA-MM-DD)"
                },
                "pais": {
                  "type": "object",
                  "nullable": true,
                  "properties": {
                    "codigo": {
                      "type": "string",
                      "nullable": true
                    },
                    "descricao": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                },
                "representante_legal": {
                  "type": "string",
                  "nullable": true
                },
                "representante_qualificacao": {
                  "type": "object",
                  "nullable": true,
                  "properties": {
                    "codigo": {
                      "type": "string",
                      "nullable": true
                    },
                    "descricao": {
                      "type": "string",
                      "nullable": true
                    }
                  }
                }
              }
            }
          },
          "divida_ativa": {
            "type": "object",
            "nullable": true,
            "description": "Só com completo=1. null = base não carregada; lista vazia = nada consta",
            "additionalProperties": true
          },
          "sancoes": {
            "type": "object",
            "nullable": true,
            "description": "Só com completo=1. null = base não carregada; lista vazia = nada consta",
            "additionalProperties": true
          },
          "historico": {
            "type": "array",
            "description": "Só com completo=1",
            "items": {
              "type": "object",
              "properties": {
                "entidade": {
                  "type": "string",
                  "nullable": true
                },
                "campo": {
                  "type": "string"
                },
                "de": {
                  "type": "string",
                  "nullable": true
                },
                "para": {
                  "type": "string",
                  "nullable": true
                },
                "observado_em": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Estabelecimento": {
        "type": "object",
        "properties": {
          "cnpj": {
            "type": "string",
            "example": "00000000000191"
          },
          "matriz": {
            "type": "boolean",
            "nullable": true
          },
          "nome_fantasia": {
            "type": "string",
            "nullable": true
          },
          "situacao_cadastral": {
            "type": "string",
            "nullable": true,
            "example": "ATIVA"
          },
          "motivo_situacao": {
            "type": "object",
            "nullable": true,
            "properties": {
              "codigo": {
                "type": "string",
                "nullable": true
              },
              "descricao": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "data_situacao": {
            "type": "string",
            "nullable": true,
            "description": "Data ISO 8601 (AAAA-MM-DD)"
          },
          "data_abertura": {
            "type": "string",
            "nullable": true,
            "description": "Data ISO 8601 (AAAA-MM-DD)"
          },
          "cnae_principal": {
            "type": "object",
            "nullable": true,
            "properties": {
              "codigo": {
                "type": "string",
                "nullable": true
              },
              "descricao": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "cnaes_secundarios": {
            "type": "array",
            "items": {
              "type": "object",
              "nullable": true,
              "properties": {
                "codigo": {
                  "type": "string",
                  "nullable": true
                },
                "descricao": {
                  "type": "string",
                  "nullable": true
                }
              }
            }
          },
          "endereco": {
            "type": "object",
            "nullable": true,
            "properties": {
              "tipo_logradouro": {
                "type": "string",
                "nullable": true
              },
              "logradouro": {
                "type": "string",
                "nullable": true
              },
              "numero": {
                "type": "string",
                "nullable": true
              },
              "complemento": {
                "type": "string",
                "nullable": true
              },
              "bairro": {
                "type": "string",
                "nullable": true
              },
              "cep": {
                "type": "string",
                "nullable": true
              },
              "municipio": {
                "type": "object",
                "nullable": true,
                "properties": {
                  "codigo": {
                    "type": "string",
                    "nullable": true
                  },
                  "descricao": {
                    "type": "string",
                    "nullable": true
                  }
                }
              },
              "uf": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "telefones": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "fax": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "inscricoes_estaduais": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "uf": {
                  "type": "string",
                  "nullable": true
                },
                "inscricao": {
                  "type": "string",
                  "nullable": true
                }
              }
            }
          },
          "atualizado_em": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "EmpresaDeSocio": {
        "type": "object",
        "properties": {
          "cnpj_basico": {
            "type": "string"
          },
          "razao_social": {
            "type": "string",
            "nullable": true
          },
          "socio": {
            "type": "string",
            "nullable": true
          },
          "municipio": {
            "type": "string",
            "nullable": true
          },
          "uf": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "Erro": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "nullable": true
          },
          "secret": {
            "type": "string",
            "description": "A chave da assinatura; guarde no servidor"
          },
          "ativo": {
            "type": "boolean"
          },
          "criado_em": {
            "type": "string"
          },
          "ultima_entrega_em": {
            "type": "string",
            "nullable": true
          },
          "ultimo_status_http": {
            "type": "integer",
            "nullable": true
          },
          "entregas_recentes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Entrega"
            },
            "description": "As últimas 20, payload incluído: uma entrega failed pode ser recuperada daqui"
          }
        }
      },
      "Entrega": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "evento": {
            "type": "string"
          },
          "cnpj": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "ok",
              "failed"
            ]
          },
          "tentativas": {
            "type": "integer"
          },
          "status_http": {
            "type": "integer",
            "nullable": true
          },
          "proxima_tentativa_em": {
            "type": "string",
            "nullable": true
          },
          "criada_em": {
            "type": "string"
          },
          "entregue_em": {
            "type": "string",
            "nullable": true
          },
          "payload": {
            "type": "object",
            "description": "O corpo do POST que a Nume faz na URL registrada quando um CNPJ monitorado muda. Assinado em X-Nume-Signature (sha256= + HMAC-SHA256 hex do corpo exato com o secret do webhook); X-Nume-Delivery repete o id; X-Nume-Event, o evento.",
            "properties": {
              "id": {
                "type": "string",
                "description": "Id da entrega, o mesmo em toda tentativa: use para deduplicar"
              },
              "evento": {
                "type": "string",
                "enum": [
                  "empresa.alterada",
                  "teste"
                ]
              },
              "enviado_em": {
                "type": "string"
              },
              "cnpj": {
                "type": "string"
              },
              "razao_social": {
                "type": "string",
                "nullable": true
              },
              "observado_em": {
                "type": "string",
                "description": "A alteração mais recente"
              },
              "alteracoes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "entidade": {
                      "type": "string",
                      "nullable": true
                    },
                    "campo": {
                      "type": "string"
                    },
                    "de": {
                      "type": "string",
                      "nullable": true
                    },
                    "para": {
                      "type": "string",
                      "nullable": true
                    },
                    "observado_em": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "EventoEmpresaAlterada": {
        "type": "object",
        "description": "O corpo do POST que a Nume faz na URL registrada quando um CNPJ monitorado muda. Assinado em X-Nume-Signature (sha256= + HMAC-SHA256 hex do corpo exato com o secret do webhook); X-Nume-Delivery repete o id; X-Nume-Event, o evento.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Id da entrega, o mesmo em toda tentativa: use para deduplicar"
          },
          "evento": {
            "type": "string",
            "enum": [
              "empresa.alterada",
              "teste"
            ]
          },
          "enviado_em": {
            "type": "string"
          },
          "cnpj": {
            "type": "string"
          },
          "razao_social": {
            "type": "string",
            "nullable": true
          },
          "observado_em": {
            "type": "string",
            "description": "A alteração mais recente"
          },
          "alteracoes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "entidade": {
                  "type": "string",
                  "nullable": true
                },
                "campo": {
                  "type": "string"
                },
                "de": {
                  "type": "string",
                  "nullable": true
                },
                "para": {
                  "type": "string",
                  "nullable": true
                },
                "observado_em": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Monitoramento": {
        "type": "object",
        "properties": {
          "cnpj": {
            "type": "string"
          },
          "razao_social": {
            "type": "string",
            "nullable": true
          },
          "desde": {
            "type": "string"
          },
          "verificado_em": {
            "type": "string",
            "nullable": true
          },
          "ultima_alteracao_vista": {
            "type": "string",
            "nullable": true
          }
        }
      }
    }
  },
  "paths": {
    "/v1": {
      "get": {
        "operationId": "indice",
        "summary": "Índice: endpoints, planos e créditos",
        "security": [],
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "Qualquer outro caminho fora de /v1 (not_found)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        }
      }
    },
    "/v1/empresas/{cnpj}": {
      "get": {
        "operationId": "consultarEmpresa",
        "summary": "Uma empresa pelo CNPJ (1 crédito; 2 com completo=1)",
        "parameters": [
          {
            "name": "cnpj",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "14 dígitos, com ou sem pontuação"
          },
          {
            "name": "completo",
            "in": "query",
            "required": false,
            "description": "completo=1 inclui todos os estabelecimentos, sócios, dívida ativa, sanções e histórico",
            "schema": {
              "type": "string",
              "enum": [
                "0",
                "1"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A empresa",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requisições por minuto do plano"
              },
              "X-Credits-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos do plano que restam no mês"
              },
              "X-Credits-Overage": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos extras comprados do saldo e ainda não usados"
              },
              "X-Credits-Charged": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos desta chamada"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Empresa"
                }
              }
            }
          },
          "400": {
            "description": "Pedido inválido (invalid_cnpj, missing_filter, invalid_nome, bad_request, too_many)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "402": {
            "description": "Créditos do mês e saldo esgotados (credits_exhausted). Nada é cobrado depois.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "403": {
            "description": "Plano sem o endpoint (plan_required) ou IP fora da lista da chave (ip_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "404": {
            "description": "CNPJ fora da base (not_found). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "429": {
            "description": "Acima das requisições por minuto (rate_limited) ou do dia no plano Dev (daily_cap). Veja Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "451": {
            "description": "A empresa existe, mas os dados dela foram removidos a pedido do titular, com base na LGPD (removed_by_holder). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "503": {
            "description": "Base indisponível (backend_unavailable, service_unavailable). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        }
      }
    },
    "/v1/empresas": {
      "get": {
        "operationId": "buscarEmpresas",
        "summary": "Busca por filtros ou por nome (5 créditos por página; planos pagos)",
        "parameters": [
          {
            "name": "nome",
            "in": "query",
            "required": false,
            "description": "Prefixo da razão social ou nome fantasia (3 letras ou mais). Com nome=, os outros filtros são ignorados",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "uf",
            "in": "query",
            "required": false,
            "description": "UF, duas letras",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "municipio",
            "in": "query",
            "required": false,
            "description": "Código IBGE/Receita do município",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cnae",
            "in": "query",
            "required": false,
            "description": "CNAE principal, 7 dígitos",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "situacao",
            "in": "query",
            "required": false,
            "description": "ATIVA, BAIXADA, INAPTA, SUSPENSA, NULA",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "porte",
            "in": "query",
            "required": false,
            "description": "ME, EPP, DEMAIS",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "simples",
            "in": "query",
            "required": false,
            "description": "true/false",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mei",
            "in": "query",
            "required": false,
            "description": "true/false",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "com_email",
            "in": "query",
            "required": false,
            "description": "true/false",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "com_telefone",
            "in": "query",
            "required": false,
            "description": "true/false",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "matriz",
            "in": "query",
            "required": false,
            "description": "true/false",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bairro",
            "in": "query",
            "required": false,
            "description": "",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cep",
            "in": "query",
            "required": false,
            "description": "8 dígitos",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "razao",
            "in": "query",
            "required": false,
            "description": "Prefixo da razão social",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cnpj_basico",
            "in": "query",
            "required": false,
            "description": "Raiz do CNPJ, 8 dígitos",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "capital_min",
            "in": "query",
            "required": false,
            "description": "Capital social mínimo, em reais",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "capital_max",
            "in": "query",
            "required": false,
            "description": "Capital social máximo, em reais",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "abertura_min",
            "in": "query",
            "required": false,
            "description": "Data de abertura a partir de (AAAA-MM-DD)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "abertura_max",
            "in": "query",
            "required": false,
            "description": "Data de abertura até (AAAA-MM-DD)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "natureza_juridica",
            "in": "query",
            "required": false,
            "description": "Código da natureza jurídica",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ente_federativo",
            "in": "query",
            "required": false,
            "description": "",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pagina",
            "in": "query",
            "required": false,
            "description": "Página, a partir de 0",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "por_pagina",
            "in": "query",
            "required": false,
            "description": "Até 50",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Uma página de empresas",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requisições por minuto do plano"
              },
              "X-Credits-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos do plano que restam no mês"
              },
              "X-Credits-Overage": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos extras comprados do saldo e ainda não usados"
              },
              "X-Credits-Charged": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos desta chamada"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "filtros": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "pagina": {
                      "type": "integer"
                    },
                    "por_pagina": {
                      "type": "integer"
                    },
                    "tem_proxima": {
                      "type": "boolean"
                    },
                    "total_na_pagina": {
                      "type": "integer"
                    },
                    "resultados": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Empresa"
                      }
                    },
                    "fonte": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Pedido inválido (missing_filter, invalid_nome, ou invalid_filter: a base diz qual valor não pôde aplicar). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "402": {
            "description": "Créditos do mês e saldo esgotados (credits_exhausted). Nada é cobrado depois.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "403": {
            "description": "Plano sem o endpoint (plan_required) ou IP fora da lista da chave (ip_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "404": {
            "description": "CNPJ fora da base (not_found). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "429": {
            "description": "Acima das requisições por minuto (rate_limited) ou do dia no plano Dev (daily_cap). Veja Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "503": {
            "description": "Base indisponível (backend_unavailable, service_unavailable). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "504": {
            "description": "A busca demorou demais (search_timeout): inclua atividade, estado ou cidade. Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        }
      }
    },
    "/v1/empresas/lote": {
      "post": {
        "operationId": "consultarLote",
        "summary": "Até 100 CNPJs por chamada (1 crédito por CNPJ encontrado, 2 com completo; planos pagos)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "cnpjs"
                ],
                "properties": {
                  "cnpjs": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 100
                  },
                  "completo": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Um resultado por CNPJ enviado, na ordem",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requisições por minuto do plano"
              },
              "X-Credits-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos do plano que restam no mês"
              },
              "X-Credits-Overage": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos extras comprados do saldo e ainda não usados"
              },
              "X-Credits-Charged": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos desta chamada"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer"
                    },
                    "encontrados": {
                      "type": "integer"
                    },
                    "nao_encontrados": {
                      "type": "integer"
                    },
                    "removidos": {
                      "type": "integer"
                    },
                    "invalidos": {
                      "type": "integer"
                    },
                    "creditos_cobrados": {
                      "type": "integer"
                    },
                    "resultados": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "cnpj": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "ok",
                              "nao_encontrado",
                              "removido",
                              "invalido",
                              "erro"
                            ],
                            "description": "removido: a empresa existe, mas os dados dela foram removidos a pedido do titular (LGPD); não é cobrado"
                          },
                          "mensagem": {
                            "type": "string"
                          },
                          "empresa": {
                            "$ref": "#/components/schemas/Empresa"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Pedido inválido (invalid_cnpj, missing_filter, invalid_nome, bad_request, too_many)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "402": {
            "description": "Créditos do mês e saldo esgotados (credits_exhausted). Nada é cobrado depois.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "403": {
            "description": "Plano sem o endpoint (plan_required) ou IP fora da lista da chave (ip_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "404": {
            "description": "CNPJ fora da base (not_found). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "429": {
            "description": "Acima das requisições por minuto (rate_limited) ou do dia no plano Dev (daily_cap). Veja Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "503": {
            "description": "Base indisponível (backend_unavailable, service_unavailable). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        }
      }
    },
    "/v1/empresas/{cnpj}/grupo": {
      "get": {
        "operationId": "grupoEconomico",
        "summary": "Grupo econômico: empresas com sócio em comum (5 créditos por página; planos pagos)",
        "parameters": [
          {
            "name": "cnpj",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "CNPJ de 14 dígitos ou a raiz de 8"
          },
          {
            "name": "pagina",
            "in": "query",
            "required": false,
            "description": "Página, a partir de 0",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Uma página de empresas",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requisições por minuto do plano"
              },
              "X-Credits-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos do plano que restam no mês"
              },
              "X-Credits-Overage": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos extras comprados do saldo e ainda não usados"
              },
              "X-Credits-Charged": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos desta chamada"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cnpj_basico": {
                      "type": "string"
                    },
                    "pagina": {
                      "type": "integer"
                    },
                    "por_pagina": {
                      "type": "integer"
                    },
                    "tem_proxima": {
                      "type": "boolean"
                    },
                    "total_na_pagina": {
                      "type": "integer"
                    },
                    "resultados": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/EmpresaDeSocio"
                      }
                    },
                    "fonte": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Pedido inválido (invalid_cnpj, missing_filter, invalid_nome, bad_request, too_many)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "402": {
            "description": "Créditos do mês e saldo esgotados (credits_exhausted). Nada é cobrado depois.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "403": {
            "description": "Plano sem o endpoint (plan_required) ou IP fora da lista da chave (ip_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "404": {
            "description": "CNPJ fora da base (not_found). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "429": {
            "description": "Acima das requisições por minuto (rate_limited) ou do dia no plano Dev (daily_cap). Veja Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "451": {
            "description": "A empresa existe, mas os dados dela foram removidos a pedido do titular, com base na LGPD (removed_by_holder). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "503": {
            "description": "Base indisponível (backend_unavailable, service_unavailable). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        }
      }
    },
    "/v1/socios": {
      "get": {
        "operationId": "buscarSocios",
        "summary": "Empresas de um sócio, por prefixo do nome (2 créditos por página; planos pagos)",
        "parameters": [
          {
            "name": "nome",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 3
            }
          },
          {
            "name": "cnae",
            "in": "query",
            "required": false,
            "description": "CNAE principal, 7 dígitos",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "municipio",
            "in": "query",
            "required": false,
            "description": "Código do município",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pagina",
            "in": "query",
            "required": false,
            "description": "Página, a partir de 0",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Uma página de empresas",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requisições por minuto do plano"
              },
              "X-Credits-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos do plano que restam no mês"
              },
              "X-Credits-Overage": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos extras comprados do saldo e ainda não usados"
              },
              "X-Credits-Charged": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos desta chamada"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "busca": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "pagina": {
                      "type": "integer"
                    },
                    "por_pagina": {
                      "type": "integer"
                    },
                    "tem_proxima": {
                      "type": "boolean"
                    },
                    "total_na_pagina": {
                      "type": "integer"
                    },
                    "resultados": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/EmpresaDeSocio"
                      }
                    },
                    "fonte": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Pedido inválido (invalid_cnpj, missing_filter, invalid_nome, bad_request, too_many)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "402": {
            "description": "Créditos do mês e saldo esgotados (credits_exhausted). Nada é cobrado depois.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "403": {
            "description": "Plano sem o endpoint (plan_required) ou IP fora da lista da chave (ip_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "404": {
            "description": "CNPJ fora da base (not_found). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "429": {
            "description": "Acima das requisições por minuto (rate_limited) ou do dia no plano Dev (daily_cap). Veja Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "503": {
            "description": "Base indisponível (backend_unavailable, service_unavailable). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhook": {
      "get": {
        "operationId": "lerWebhook",
        "summary": "O webhook da conta: URL, secret e as últimas 20 entregas (0 créditos; Pro e Business)",
        "responses": {
          "200": {
            "description": "O webhook, ou { url: null, ativo: false } se nenhum foi registrado",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requisições por minuto do plano"
              },
              "X-Credits-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos do plano que restam no mês"
              },
              "X-Credits-Overage": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos extras comprados do saldo e ainda não usados"
              },
              "X-Credits-Charged": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos desta chamada"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "403": {
            "description": "Plano sem webhooks (plan_required: Pro ou Business) ou IP fora da lista da chave (ip_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "429": {
            "description": "Acima das requisições por minuto (rate_limited) ou do dia no plano Dev (daily_cap). Veja Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "503": {
            "description": "Base indisponível (backend_unavailable, service_unavailable). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "registrarWebhook",
        "summary": "Registra ou troca a URL https que recebe os avisos; o secret é mantido (0 créditos; Pro e Business)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "example": "https://seu.sistema/nume"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "O webhook, com o secret",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requisições por minuto do plano"
              },
              "X-Credits-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos do plano que restam no mês"
              },
              "X-Credits-Overage": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos extras comprados do saldo e ainda não usados"
              },
              "X-Credits-Charged": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos desta chamada"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "400": {
            "description": "URL recusada (invalid_url: só https, host público, sem usuário e senha) ou JSON inválido (bad_request)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "403": {
            "description": "Plano sem webhooks (plan_required: Pro ou Business) ou IP fora da lista da chave (ip_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "429": {
            "description": "Acima das requisições por minuto (rate_limited) ou do dia no plano Dev (daily_cap). Veja Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "503": {
            "description": "Base indisponível (backend_unavailable, service_unavailable). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        },
        "callbacks": {
          "empresaAlterada": {
            "{$request.body#/url}": {
              "post": {
                "summary": "Um CNPJ monitorado mudou (1 crédito por aviso entregue). Até 3 tentativas, uma por passagem diária",
                "requestBody": {
                  "required": true,
                  "content": {
                    "application/json": {
                      "schema": {
                        "$ref": "#/components/schemas/EventoEmpresaAlterada"
                      }
                    }
                  }
                },
                "responses": {
                  "2XX": {
                    "description": "Recebido"
                  },
                  "4XX": {
                    "description": "Qualquer resposta fora de 2xx, ou mais de 8 segundos sem resposta, conta como falha e entra na fila de novas tentativas"
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "desativarWebhook",
        "summary": "Desativa o webhook; URL, secret e monitoramentos ficam (0 créditos; Pro e Business)",
        "responses": {
          "200": {
            "description": "{ ativo: false, desativado: true|false }",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requisições por minuto do plano"
              },
              "X-Credits-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos do plano que restam no mês"
              },
              "X-Credits-Overage": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos extras comprados do saldo e ainda não usados"
              },
              "X-Credits-Charged": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos desta chamada"
              }
            }
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "403": {
            "description": "Plano sem webhooks (plan_required: Pro ou Business) ou IP fora da lista da chave (ip_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "429": {
            "description": "Acima das requisições por minuto (rate_limited) ou do dia no plano Dev (daily_cap). Veja Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "503": {
            "description": "Base indisponível (backend_unavailable, service_unavailable). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhook/teste": {
      "post": {
        "operationId": "testarWebhook",
        "summary": "Envia um evento teste à URL registrada agora, assinado como os reais (0 créditos; Pro e Business)",
        "responses": {
          "200": {
            "description": "{ id, entregue: true|false, status_http }",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requisições por minuto do plano"
              },
              "X-Credits-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos do plano que restam no mês"
              },
              "X-Credits-Overage": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos extras comprados do saldo e ainda não usados"
              },
              "X-Credits-Charged": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos desta chamada"
              }
            }
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "403": {
            "description": "Plano sem webhooks (plan_required: Pro ou Business) ou IP fora da lista da chave (ip_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "404": {
            "description": "Nenhum webhook ativo (no_webhook)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "429": {
            "description": "Acima das requisições por minuto (rate_limited) ou do dia no plano Dev (daily_cap). Veja Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "503": {
            "description": "Base indisponível (backend_unavailable, service_unavailable). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        }
      }
    },
    "/v1/assinaturas": {
      "post": {
        "operationId": "criarAssinatura",
        "summary": "Cria um documento para assinar a partir de um PDF e, por padrão, já envia os convites por e-mail (0 créditos)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "pdf_base64",
                  "signatarios",
                  "campos"
                ],
                "properties": {
                  "titulo": {
                    "type": "string"
                  },
                  "nome_arquivo": {
                    "type": "string"
                  },
                  "mensagem": {
                    "type": "string",
                    "description": "Vai no e-mail do convite"
                  },
                  "pdf_base64": {
                    "type": "string",
                    "description": "O PDF em base64, até 3 MB"
                  },
                  "signatarios": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "required": [
                        "nome",
                        "email"
                      ],
                      "properties": {
                        "nome": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "campos": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "signatario",
                        "tipo",
                        "pagina",
                        "x",
                        "y",
                        "largura",
                        "altura"
                      ],
                      "properties": {
                        "signatario": {
                          "type": "integer",
                          "description": "Posição em signatarios, a partir de 0"
                        },
                        "tipo": {
                          "type": "string",
                          "enum": [
                            "assinatura",
                            "rubrica",
                            "nome",
                            "cpf",
                            "data",
                            "texto"
                          ]
                        },
                        "pagina": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "x": {
                          "type": "number",
                          "description": "Frações da página como ela aparece, a partir do canto de cima à esquerda"
                        },
                        "y": {
                          "type": "number"
                        },
                        "largura": {
                          "type": "number"
                        },
                        "altura": {
                          "type": "number"
                        },
                        "rotulo": {
                          "type": "string",
                          "description": "Pergunta de um campo de texto"
                        },
                        "obrigatorio": {
                          "type": "boolean",
                          "default": true
                        }
                      }
                    }
                  },
                  "enviar": {
                    "type": "boolean",
                    "default": true,
                    "description": "false cria um rascunho, para conferir em nume.solutions/empresa/assinaturas"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "{ id, status: enviado|rascunho, painel, signatarios[], emails_enviados }"
          },
          "400": {
            "description": "Pedido inválido (invalid_cnpj, missing_filter, invalid_nome, bad_request, too_many)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "413": {
            "description": "PDF acima de 4 MB"
          },
          "429": {
            "description": "Acima das requisições por minuto (rate_limited) ou do dia no plano Dev (daily_cap). Veja Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        }
      }
    },
    "/v1/assinaturas/{id}": {
      "get": {
        "operationId": "consultarAssinatura",
        "summary": "Onde o documento está, pessoa por pessoa (0 créditos)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "{ id, titulo, status, criado_em, enviado_em, concluido_em, prazo, sha256_original, sha256_final, verificacao, signatarios[] }"
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "404": {
            "description": "Documento não encontrado"
          }
        }
      }
    },
    "/v1/monitoramentos": {
      "get": {
        "operationId": "listarMonitoramentos",
        "summary": "Os CNPJs que a conta acompanha, 100 por página, e o limite do plano (0 créditos; Pro e Business)",
        "parameters": [
          {
            "name": "pagina",
            "in": "query",
            "required": false,
            "description": "Página, a partir de 0",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Uma página de monitoramentos",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requisições por minuto do plano"
              },
              "X-Credits-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos do plano que restam no mês"
              },
              "X-Credits-Overage": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos extras comprados do saldo e ainda não usados"
              },
              "X-Credits-Charged": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos desta chamada"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer"
                    },
                    "limite": {
                      "type": "integer"
                    },
                    "pagina": {
                      "type": "integer"
                    },
                    "por_pagina": {
                      "type": "integer"
                    },
                    "tem_proxima": {
                      "type": "boolean"
                    },
                    "resultados": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Monitoramento"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "403": {
            "description": "Plano sem webhooks (plan_required: Pro ou Business) ou IP fora da lista da chave (ip_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "429": {
            "description": "Acima das requisições por minuto (rate_limited) ou do dia no plano Dev (daily_cap). Veja Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "503": {
            "description": "Base indisponível (backend_unavailable, service_unavailable). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "monitorarCnpjs",
        "summary": "Acompanha até 100 CNPJs a mais por chamada, dentro do limite do plano (1000 no Pro, 10000 no Business) (0 créditos)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "cnpjs"
                ],
                "properties": {
                  "cnpjs": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 100
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Quantos entraram, já estavam, foram recusados pelo limite ou eram inválidos",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requisições por minuto do plano"
              },
              "X-Credits-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos do plano que restam no mês"
              },
              "X-Credits-Overage": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos extras comprados do saldo e ainda não usados"
              },
              "X-Credits-Charged": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos desta chamada"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "adicionados": {
                      "type": "integer"
                    },
                    "existentes": {
                      "type": "integer"
                    },
                    "recusados_pelo_limite": {
                      "type": "integer"
                    },
                    "invalidos": {
                      "type": "integer"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "limite": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Pedido inválido (invalid_cnpj, missing_filter, invalid_nome, bad_request, too_many)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "403": {
            "description": "Plano sem webhooks (plan_required: Pro ou Business) ou IP fora da lista da chave (ip_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "429": {
            "description": "Acima das requisições por minuto (rate_limited) ou do dia no plano Dev (daily_cap). Veja Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "503": {
            "description": "Base indisponível (backend_unavailable, service_unavailable). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        }
      }
    },
    "/v1/monitoramentos/{cnpj}": {
      "delete": {
        "operationId": "pararMonitoramento",
        "summary": "Deixa de acompanhar um CNPJ (0 créditos; Pro e Business)",
        "parameters": [
          {
            "name": "cnpj",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "14 dígitos, com ou sem pontuação"
          }
        ],
        "responses": {
          "200": {
            "description": "{ cnpj, removido: true }",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requisições por minuto do plano"
              },
              "X-Credits-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos do plano que restam no mês"
              },
              "X-Credits-Overage": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos extras comprados do saldo e ainda não usados"
              },
              "X-Credits-Charged": {
                "schema": {
                  "type": "integer"
                },
                "description": "Créditos desta chamada"
              }
            }
          },
          "400": {
            "description": "Pedido inválido (invalid_cnpj, missing_filter, invalid_nome, bad_request, too_many)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "401": {
            "description": "Chave ausente, mal formada ou revogada (invalid_key)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "403": {
            "description": "Plano sem webhooks (plan_required: Pro ou Business) ou IP fora da lista da chave (ip_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "404": {
            "description": "Este CNPJ não estava monitorado (not_found)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "429": {
            "description": "Acima das requisições por minuto (rate_limited) ou do dia no plano Dev (daily_cap). Veja Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          },
          "503": {
            "description": "Base indisponível (backend_unavailable, service_unavailable). Não é cobrado.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Erro"
                }
              }
            }
          }
        }
      }
    }
  }
}