{
  "openapi": "3.0.1",
  "info": {
    "title": "Consulta CNPJ — Receita Federal Scraper",
    "description": "Consulta CNPJ em massa na Receita Federal: empresas por estado, CNAE, cidade (nome ou código IBGE) ou natureza jurídica — 55M+ CNPJs com sócios (QSA), flags fiscais, capital e telefone quando o cadastro tem. Filtro só ATIVA, vários estados numa run, lookup KYC de um CNPJ.",
    "version": "0.1",
    "x-build-id": "nPXIZhlrpLWlYB5hc"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/memo23~cnpj-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-memo23-cnpj-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/memo23~cnpj-scraper/runs": {
      "post": {
        "operationId": "runs-sync-memo23-cnpj-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/memo23~cnpj-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-memo23-cnpj-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "cnpj": {
            "title": "CNPJs para consultar",
            "type": "array",
            "description": "Um ou mais CNPJs de 14 dígitos (pontos, barras e hífens são ignorados, ex.: `00.000.000/0001-91`). Anula todos os filtros de busca abaixo.",
            "items": {
              "type": "string"
            }
          },
          "uf": {
            "title": "Estado (UF)",
            "type": "string",
            "description": "Sigla(s) de estado, vírgula para várias: `SP` ou `SP,RJ,MG`. Também desambigua cidade homônima. Válidas: AC, AL, AP, AM, BA, CE, DF, ES, GO, MA, MT, MS, MG, PA, PB, PR, PE, PI, RJ, RN, RS, RO, RR, SC, SP, SE, TO."
          },
          "cnae": {
            "title": "Código(s) CNAE",
            "type": "string",
            "description": "Código(s) CNAE, vírgula para vários. Casa a atividade principal e as secundárias. Exemplo: `6209100` (suporte de TI) ou `6209100,6201501`."
          },
          "municipio": {
            "title": "Município — nome da cidade ou código IBGE/SIAFI",
            "type": "string",
            "description": "Nome(s) de cidade ou código(s) IBGE/SIAFI, vírgula para vários. Nomes resolvem pela tabela oficial do IBGE (acento opcional): `São Paulo`, `Tatuí`, `Brasilia`. Código IBGE de 7 dígitos (`3550308`) e SIAFI de 4 dígitos também valem. Se o nome existe em mais de um estado (ex.: Bom Jesus), informe `uf` ou o código IBGE."
          },
          "naturezaJuridica": {
            "title": "Código(s) de natureza jurídica",
            "type": "string",
            "description": "Código(s) de natureza jurídica, vírgula para vários. Exemplo: `2135` (Empresário Individual), `2062` (Sociedade Empresária Limitada / LTDA)."
          },
          "partnerCpf": {
            "title": "CPF/CNPJ do sócio (QSA)",
            "type": "string",
            "description": "CPF ou CNPJ de pessoa/empresa no quadro de sócios (QSA), vírgula para vários. Para CPF use o formato mascarado da Receita `***123456**` (asteriscos nos três primeiros e nos dois últimos dígitos, sem pontos nem hífen). Dica: busca só por sócio pode estourar timeout; junte um `uf`."
          },
          "situacaoCadastral": {
            "title": "Filtro de situação cadastral",
            "enum": [
              "ALL",
              "",
              "ATIVA",
              "BAIXADA",
              "INAPTA",
              "SUSPENSA",
              "NULA"
            ],
            "type": "string",
            "description": "Grava só empresas com esta situação — ex.: `ATIVA` para pular CNPJs mortos em prospecção. Registros filtrados não são cobrados. Aplicado no Actor; `ALL` mantém tudo. String vazia ainda vale como sinônimo de `ALL`, para tarefas antigas.",
            "default": "ALL"
          },
          "includeGraph": {
            "title": "Incluir grafo de sócios (só na consulta direta)",
            "type": "boolean",
            "description": "Na consulta direta de CNPJ, adiciona o campo `grafo` com as ligações do quadro de sócios (API aberta grafo.minhareceita.org). Uma chamada HTTP extra por CNPJ; ignorado na busca em massa.",
            "default": false
          },
          "unmaskSoleProprietorCpf": {
            "title": "Devolver CPF completo de empresário individual (dado pessoal)",
            "type": "boolean",
            "description": "Desligado por padrão. A Receita grava o nome do EI como `NOME 02898774073` — o CPF completo de 11 dígitos. Por padrão este Actor mascara para `NOME ***.987.740-**` e marca `cpf_masked: true`. Ligue só se tiver base legal na LGPD para tratar o CPF cru — o número é dado pessoal de pessoa física, e a responsabilidade passa a ser sua.",
            "default": false
          },
          "maxItems": {
            "title": "Máximo de registros a gravar",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Teto de registros de empresa gravados na run. O cadastro tem 55M+ CNPJs — deixe baixo nas primeiras runs para validar a saída.",
            "default": 100
          },
          "pageSize": {
            "title": "Registros por página da API",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Registros pedidos por página da API (1–1000). O padrão 1000 é o máximo do upstream e o mais rápido; baixe só se estourar timeout em filtros muito pesados.",
            "default": 1000
          },
          "maxConcurrency": {
            "title": "Concorrência máxima (consulta direta)",
            "minimum": 1,
            "maximum": 25,
            "type": "integer",
            "description": "Requisições em paralelo ao consultar vários CNPJs. Mantida baixa por padrão — minhareceita.org é um espelho comunitário.",
            "default": 5
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}