{
  "openapi": "3.0.1",
  "info": {
    "title": "Brazil CNPJ Companies Scraper: Receita Federal Register Data",
    "description": "Company records from the Brazilian CNPJ register for a list of CNPJ numbers or a search by state, city and CNAE activity: legal name, trade name, status, legal nature, capital, address, opening date and size. Public data, no partner or personal fields, no API key.",
    "version": "1.0",
    "x-build-id": "fiUZRQA9gRdm9Keop"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/rowcraft~brazil-cnpj-companies-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-rowcraft-brazil-cnpj-companies-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/rowcraft~brazil-cnpj-companies-scraper/runs": {
      "post": {
        "operationId": "runs-sync-rowcraft-brazil-cnpj-companies-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/rowcraft~brazil-cnpj-companies-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-rowcraft-brazil-cnpj-companies-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": {
          "cnpjs": {
            "title": "CNPJ numbers",
            "type": "array",
            "description": "CNPJ numbers to look up, one per line: 33000167000101 or 33.000.167/0001-01 (up to 10,000). A number with wrong check digits is reported without a request; a number that does not exist is not charged. Leave empty to use the search below.",
            "items": {
              "type": "string"
            }
          },
          "states": {
            "title": "States (UF)",
            "type": "array",
            "description": "Search the register: companies registered in these states. Combine with an activity code or a city; a search needs at least one of states, activity codes or cities.",
            "items": {
              "type": "string",
              "enum": [
                "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",
                "EX"
              ],
              "enumTitles": [
                "AC – Acre",
                "AL – Alagoas",
                "AP – Amapá",
                "AM – Amazonas",
                "BA – Bahia",
                "CE – Ceará",
                "DF – Distrito Federal",
                "ES – Espírito Santo",
                "GO – Goiás",
                "MA – Maranhão",
                "MT – Mato Grosso",
                "MS – Mato Grosso do Sul",
                "MG – Minas Gerais",
                "PA – Pará",
                "PB – Paraíba",
                "PR – Paraná",
                "PE – Pernambuco",
                "PI – Piauí",
                "RJ – Rio de Janeiro",
                "RN – Rio Grande do Norte",
                "RS – Rio Grande do Sul",
                "RO – Rondônia",
                "RR – Roraima",
                "SC – Santa Catarina",
                "SP – São Paulo",
                "SE – Sergipe",
                "TO – Tocantins",
                "EX – Registered abroad"
              ]
            }
          },
          "activityCodes": {
            "title": "Activity codes (CNAE)",
            "type": "array",
            "description": "7-digit CNAE codes, one per line: 6201501 (software development), 5611201 (restaurants), 4120400 (building construction). Several codes are searched together.",
            "items": {
              "type": "string"
            }
          },
          "activityScope": {
            "title": "Activity match",
            "enum": [
              "main",
              "any"
            ],
            "type": "string",
            "description": "Main activity: the company's registered main CNAE (the most precise). Any activity: the code may also be one of its secondary activities, which returns many more companies.",
            "default": "main"
          },
          "cityCodes": {
            "title": "Cities (IBGE codes)",
            "type": "array",
            "description": "7-digit IBGE municipality codes, one per line: 3550308 (São Paulo), 3304557 (Rio de Janeiro), 3106200 (Belo Horizonte), 4106902 (Curitiba).",
            "items": {
              "type": "string"
            }
          },
          "onlyActive": {
            "title": "Only active companies",
            "type": "boolean",
            "description": "Skip companies whose registration is closed, suspended or unfit (about 4 in 10 records of a search). Applies to the search; companies you look up by CNPJ are delivered with their status.",
            "default": true
          },
          "headOfficesOnly": {
            "title": "Head offices only",
            "type": "boolean",
            "description": "Skip branches (filiais). The register lists every establishment with its own CNPJ.",
            "default": false
          },
          "openedAfter": {
            "title": "Opened after",
            "type": "string",
            "description": "Only companies that started activity on or after this date (YYYY-MM-DD), for example 2025-01-01 for companies opened in the last months. Applies to the search."
          },
          "legalNatureCodes": {
            "title": "Legal nature codes",
            "type": "array",
            "description": "4-digit legal nature codes, one per line: 2062 (limited company), 2054 (corporation, closed), 2046 (corporation, open). Empty = all forms except sole traders; naming 2062 makes a search of a common activity much faster. Sole traders, EIRELI and other forms named after a person (2135, 2305, 2313, 4014, 4090, 4120) are ignored.",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "Maximum companies",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many companies. 0 = no limit (a search can then read for a long time).",
            "default": 500
          },
          "concurrency": {
            "title": "Parallel lookups",
            "minimum": 1,
            "maximum": 8,
            "type": "integer",
            "description": "How many CNPJ lookups run at the same time (the delay between requests still applies). Default 4; the register answers a lookup in about 0.15 s.",
            "default": 4
          },
          "countOnly": {
            "title": "Count only (free check)",
            "type": "boolean",
            "description": "Only count how many rows match your filters and estimate the cost at your price tier. Nothing is delivered and nothing is charged apart from the start event. Turn it off to get the data.",
            "default": false
          },
          "onlyNew": {
            "title": "Only new rows since the last run",
            "type": "boolean",
            "description": "Remember the rows already delivered to you (in a key-value store in your Apify account) and deliver only rows that appeared since the last run with the same state key. The first run delivers everything that matches; later runs cost only the new rows. Ideal for schedules.",
            "default": false
          },
          "stateName": {
            "title": "State name",
            "type": "string",
            "description": "Name of the memory used by \"Only new rows\". Use a different name for each schedule or search (for example `stockholm-python`) so they do not share one memory.",
            "default": "default"
          },
          "notifyUrl": {
            "title": "Notify this URL when the run ends",
            "type": "string",
            "description": "A webhook address that receives one JSON POST with the number of new rows and links to the dataset: a Slack or Discord incoming webhook, a Make, n8n or Zapier catch hook, or your own endpoint. The message is also in the `text` (Slack) and `content` (Discord) fields."
          },
          "notifyWhenEmpty": {
            "title": "Notify also when there are no new rows",
            "type": "boolean",
            "description": "By default the notification is sent only when at least one row was delivered.",
            "default": false
          },
          "requestIntervalMs": {
            "title": "Delay between requests to the same host (ms)",
            "minimum": 150,
            "maximum": 10000,
            "type": "integer",
            "description": "Default 150 ms, minimum 150. The register is a free community service: do not lower it, and raise it if you see HTTP 429 answers in the run summary.",
            "default": 150
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}