{
  "openapi": "3.0.1",
  "info": {
    "title": "Brazil CNPJ Company Lookup & Search (Receita Federal)",
    "description": "Look up Brazilian companies by CNPJ or search by CNAE, UF, city and status. Receita Federal open data: razão social, CNAEs, address, phone, Simples/MEI, capital, partners (QSA).",
    "version": "0.1",
    "x-build-id": "EJRF8n3WSsKoC4hhE"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/bigdavidson~brazil-cnpj-companies/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-bigdavidson-brazil-cnpj-companies",
        "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/bigdavidson~brazil-cnpj-companies/runs": {
      "post": {
        "operationId": "runs-sync-bigdavidson-brazil-cnpj-companies",
        "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/bigdavidson~brazil-cnpj-companies/run-sync": {
      "post": {
        "operationId": "run-sync-bigdavidson-brazil-cnpj-companies",
        "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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "auto",
              "lookup",
              "search"
            ],
            "type": "string",
            "description": "auto = lookup when CNPJs are given, search when cnae/uf/city/naturezaJuridica are given (search wins if both). lookup = enrich the CNPJ list. search = find companies by CNAE + UF + city + legal nature + situação. Cost: $0.005 per run + $0.003 per company returned; error/notice rows are free.",
            "default": "auto"
          },
          "cnpjs": {
            "title": "CNPJs to look up / CNPJs para consultar",
            "type": "array",
            "description": "Lookup mode. Array of strings. CNPJs with or without punctuation (33.000.167/0001-01 or 33000167000101), numeric or the new alphanumeric format (12.ABC.345/01DE-35). An item may hold several CNPJs separated by commas or spaces; spaces inside one CNPJ (33 000 167 0001 01) are joined back. Leading zeros lost by spreadsheets are restored; an 8-digit root is read as its headquarters (0001). Check digits are validated before any request — invalid ones get a free error row. Max 10,000 per run (extra CNPJs each get a free 'not processed' row).",
            "items": {
              "type": "string"
            }
          },
          "cnae": {
            "title": "Activity / CNAE (search)",
            "type": "array",
            "description": "Search mode. Array of strings. CNAE subclass codes (5611-2/01 or 5611201), a class/group prefix (8630-5, 8630, 56) that expands to its subclasses, or words. Common business words in Portuguese or English map to the right codes (software, dentista, hotel, farmácia, advogado, academia, salão de beleza, pet shop, oficina, construtora, escola, restaurante, lawyer, gym...); other Portuguese words are matched whole-word (singular/plural) against the official CNAE names. Words too generic for one industry (comércio, loja, serviços, distribuidora) or matching over 30 codes (transporte) are refused with a free row instead of being searched. A free 'aviso' row lists exactly which codes each word became. Max 50 codes.",
            "items": {
              "type": "string"
            }
          },
          "cnaeScope": {
            "title": "CNAE match",
            "enum": [
              "main",
              "any"
            ],
            "type": "string",
            "description": "main = the company's main activity (CNAE fiscal) must match. any = main OR any secondary activity matches (more results, less precise).",
            "default": "main"
          },
          "uf": {
            "title": "State / UF (search)",
            "type": "array",
            "description": "Search mode. Array of strings. Two-letter state codes (SP, RJ, MG...) or state names (São Paulo, Minas Gerais). Several allowed.",
            "items": {
              "type": "string"
            }
          },
          "city": {
            "title": "City / Município (search)",
            "type": "array",
            "description": "Search mode. Array of strings. City names, accents optional, optionally with the state: Campinas, Campinas/SP, 'Bom Jesus - PI'. Old or Receita spellings are recognised (Moji Mirim, Parati). A state capital's name means the capital (Campo Grande = Campo Grande/MS); any other name that exists in several states matches all of them unless a UF is given. 7-digit IBGE codes also work.",
            "items": {
              "type": "string"
            }
          },
          "naturezaJuridica": {
            "title": "Legal nature / Natureza jurídica (search)",
            "type": "array",
            "description": "Search mode, filtered at the source. Array of strings: 4-digit codes (2062 = Sociedade Empresária Limitada, 2135 = Empresário Individual, 2046/2054 = S.A.) or words: ltda, sa, eireli, cooperativa, associacao, or 'companies' (Ltda, S.A., EIRELI, sociedades simples, cooperatives — leaves out Empresário Individual/MEI, whose address and phone the source hides). Can be the only search filter.",
            "items": {
              "type": "string"
            }
          },
          "situacao": {
            "title": "Registration status / Situação cadastral (search)",
            "type": "array",
            "description": "Search mode. Array of strings: ATIVA (default), BAIXADA, INAPTA, SUSPENSA, NULA, or 'all'. English also accepted (active, closed, suspended). Lookups always return the company whatever its status.",
            "items": {
              "type": "string"
            }
          },
          "porte": {
            "title": "Company size / Porte (search)",
            "type": "array",
            "description": "Search mode. Array of strings: ME (micro), EPP (small) or DEMAIS (everything larger — the Receita does not split medium from large). Checked by the actor while it scans; skipped companies are not charged.",
            "items": {
              "type": "string"
            }
          },
          "openedFrom": {
            "title": "Opened on or after (search)",
            "type": "string",
            "description": "Search mode. Earliest opening date (data_inicio_atividade): YYYY-MM-DD, DD/MM/YYYY, YYYY-MM or YYYY. Checked by the actor while it scans — the source returns companies in its own order, so a narrow date range over a large area scans many pages (up to 300,000 results per run)."
          },
          "openedTo": {
            "title": "Opened on or before (search)",
            "type": "string",
            "description": "Search mode. Latest opening date: YYYY-MM-DD, DD/MM/YYYY, YYYY-MM (end of that month) or YYYY (end of that year)."
          },
          "openedInLastDays": {
            "title": "Opened in the last N days (search)",
            "minimum": 1,
            "maximum": 36500,
            "type": "integer",
            "description": "Search mode. Shortcut for openedFrom = today minus N days. New companies only appear after the Receita's monthly release (see atualizacao_base)."
          },
          "requirePhone": {
            "title": "Only companies with a phone number (search)",
            "type": "boolean",
            "description": "Search mode. Skip companies with no usable phone on file (telefones gives pre-2016 8-digit mobiles in today's 9-digit form). Individual entrepreneurs (MEI/EI) have their phone and street hidden by the source for privacy, so this mostly keeps legal entities (naturezaJuridica 'companies' does that at the source, faster).",
            "default": false
          },
          "excludeMei": {
            "title": "Exclude MEI (search)",
            "type": "boolean",
            "description": "Search mode. Skip companies registered as MEI (microempreendedor individual).",
            "default": false
          },
          "includePartners": {
            "title": "Include partners (QSA)",
            "type": "boolean",
            "description": "Include the partner list (quadro societário) with names, roles, entry dates and age bands. Individual partners' CPFs come masked by the Receita (***456789**); partner companies show their CNPJ as the source provides it. Turn off for data minimisation (LGPD).",
            "default": true
          },
          "maxRecords": {
            "title": "Max companies",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Maximum companies returned (and charged at $0.003 each). Search default: 100. Lookup default: every CNPJ given."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}