{
  "openapi": "3.0.1",
  "info": {
    "title": "Brazil CNPJ Receita Federal Scraper",
    "description": "Turn Receita Federal's registry into lead lists: every Brazilian company by state, CNAE industry, city, or legal form — 55M+ CNPJs with partners (QSA), tax-regime flags, capital, and phone where the registry has it. Active-only filtering, multi-state sweeps, single-CNPJ KYC lookups",
    "version": "0.0",
    "x-build-id": "2ICZMjLUWVRKYHfSL"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/memo23~brazil-cnpj-receita-federal-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-memo23-brazil-cnpj-receita-federal-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~brazil-cnpj-receita-federal-scraper/runs": {
      "post": {
        "operationId": "runs-sync-memo23-brazil-cnpj-receita-federal-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~brazil-cnpj-receita-federal-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-memo23-brazil-cnpj-receita-federal-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 to look up",
            "type": "array",
            "description": "One or more 14-digit CNPJs (dots, slashes, and dashes are ignored, e.g. `00.000.000/0001-91`). Overrides every search filter below.",
            "items": {
              "type": "string"
            }
          },
          "uf": {
            "title": "State (UF)",
            "type": "string",
            "description": "Two-letter Brazilian state code(s), comma-separated for multiple: `SP` or `SP,RJ,MG`. Valid codes: 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": "CNAE industry code(s)",
            "type": "string",
            "description": "CNAE code(s), comma-separated for multiple. Matches both the primary and secondary activities of a company. Example: `6209100` (IT support services) or `6209100,6201501`."
          },
          "municipio": {
            "title": "Municipality code(s) — digits only, not a city name",
            "type": "string",
            "description": "IBGE or SIAFI municipal code(s), digits only, comma-separated for multiple. NOT a city name — `TATUÍ` will be rejected. Find codes at https://www.ibge.gov.br/explica/codigos-dos-municipios.html — e.g. `5300108` (Brasília), `3550308` (São Paulo)."
          },
          "naturezaJuridica": {
            "title": "Legal form code(s) (natureza jurídica)",
            "type": "string",
            "description": "Legal-form code(s), comma-separated for multiple. Example: `2135` (Empresário Individual / sole proprietor), `2062` (Sociedade Empresária Limitada / LTDA)."
          },
          "partnerCpf": {
            "title": "Partner CPF/CNPJ (QSA)",
            "type": "string",
            "description": "CPF or CNPJ of a person/entity in the company's partner list (QSA), comma-separated for multiple. For CPFs use the masked Receita format `***123456**` (asterisks for the first three and last two digits, no dots or dashes) — that is how Receita Federal publishes them. Tip: partner-only searches can time out upstream; combining with a `uf` filter helps."
          },
          "situacaoCadastral": {
            "title": "Registration status filter",
            "enum": [
              "ALL",
              "",
              "ATIVA",
              "BAIXADA",
              "INAPTA",
              "SUSPENSA",
              "NULA"
            ],
            "type": "string",
            "description": "Only save companies with this registration status — e.g. `ATIVA` to skip dead CNPJs in lead-gen runs. Filtered-out records are never charged. Applied client-side; `ALL` keeps everything. (An empty string is still accepted as a synonym for `ALL`, so older saved inputs keep working.)",
            "default": "ALL"
          },
          "includeGraph": {
            "title": "Include ownership graph (direct lookups only)",
            "type": "boolean",
            "description": "For direct CNPJ lookups, adds a `grafo` field with the company's ownership-graph entries (people and entities connected via partner boards) from the open grafo.minhareceita.org API. One extra HTTP call per CNPJ; ignored in bulk-search mode.",
            "default": false
          },
          "unmaskSoleProprietorCpf": {
            "title": "Return unmasked sole-proprietor CPFs (personal data)",
            "type": "boolean",
            "description": "OFF by default. Receita Federal stores a sole proprietor's legal name as `NAME 02898774073` — the person's full 11-digit CPF. By default this Actor masks it to `NAME ***.987.740-**` and sets `cpf_masked: true`. Turn this ON only if you have a lawful basis under the LGPD to process the complete CPF — the raw number is personal data of a private individual, and you become responsible for handling it.",
            "default": false
          },
          "maxItems": {
            "title": "Maximum records to save",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Hard cap on the number of company records saved across the whole run. The registry holds 55M+ CNPJs — keep this low on first runs to validate the output.",
            "default": 100
          },
          "pageSize": {
            "title": "Records per API page",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Records requested per upstream API page (1–1000). The default of 1000 is the upstream maximum and the fastest option; lower it only if you hit upstream timeouts on very heavy filter combinations.",
            "default": 1000
          },
          "maxConcurrency": {
            "title": "Max concurrency (direct lookups)",
            "minimum": 1,
            "maximum": 25,
            "type": "integer",
            "description": "Parallel requests when looking up multiple CNPJs directly. Kept modest by default — minhareceita.org is a donation-funded community mirror.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}