{
  "openapi": "3.0.1",
  "info": {
    "title": "Brazil Companies CNPJ: New Companies & B2B Leads",
    "description": "Brazilian companies from the Receita Federal registry (CNPJ): search by state, city, CNAE, size and status, or get companies opened in the last N days, with e-mail, phone, address, activities and partners (no CPF). Or enrich a list of CNPJs. No login or API key.",
    "version": "0.2",
    "x-build-id": "wyU2fQSf8OtLWVf4h"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/allanmxr~brazil-companies-cnpj/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-allanmxr-brazil-companies-cnpj",
        "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/allanmxr~brazil-companies-cnpj/runs": {
      "post": {
        "operationId": "runs-sync-allanmxr-brazil-companies-cnpj",
        "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/allanmxr~brazil-companies-cnpj/run-sync": {
      "post": {
        "operationId": "run-sync-allanmxr-brazil-companies-cnpj",
        "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": [
              "search",
              "lookup"
            ],
            "type": "string",
            "description": "Search finds companies by state, city, CNAE, size, status and opening date (new companies are the hottest leads). Lookup enriches a list of CNPJs you already have.",
            "default": "search"
          },
          "maxItems": {
            "title": "Max companies",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of companies in the output, in both modes (a longer CNPJ list is cut here). You only pay for companies delivered.",
            "default": 100
          },
          "cnpjs": {
            "title": "CNPJs (lookup mode)",
            "type": "array",
            "description": "CNPJs to look up, formatted or digits only (33.000.167/0001-01 or 33000167000101). Duplicates are removed. Used only in lookup mode.",
            "items": {
              "type": "string"
            }
          },
          "states": {
            "title": "States (UF)",
            "uniqueItems": true,
            "type": "array",
            "description": "States to search. With cities, choose exactly one state or write the state after each city. Empty with a recent opening window (openedWithinDays up to 180) searches the whole country.",
            "items": {
              "type": "string",
              "enum": [
                "AC",
                "AL",
                "AM",
                "AP",
                "BA",
                "CE",
                "DF",
                "ES",
                "GO",
                "MA",
                "MG",
                "MS",
                "MT",
                "PA",
                "PB",
                "PE",
                "PI",
                "PR",
                "RJ",
                "RN",
                "RO",
                "RR",
                "RS",
                "SC",
                "SE",
                "SP",
                "TO"
              ]
            }
          },
          "cities": {
            "title": "Cities",
            "type": "array",
            "description": "City names as in the Receita registry, accents optional: \"Barueri\", \"São Paulo/SP\", \"Rio de Janeiro/RJ\". Empty means every city of the chosen states.",
            "items": {
              "type": "string"
            }
          },
          "cnaes": {
            "title": "CNAE (activity codes)",
            "type": "array",
            "description": "Main activity of the company: a full 7 digit CNAE (6201501 or 6201-5/01) or a prefix of 2 to 6 digits (62 = IT services, 5611 = restaurants). Empty means every activity.",
            "items": {
              "type": "string"
            }
          },
          "openedWithinDays": {
            "title": "Opened in the last N days",
            "minimum": 1,
            "type": "integer",
            "description": "Only companies opened in the last N days, newest first. Up to 180 days it also works nationwide. Note: the Receita publishes its registry once a month, so the newest companies are a few days to about 5 weeks old."
          },
          "openedFrom": {
            "title": "Opened on or after",
            "type": "string",
            "description": "Opening date range start (use instead of openedWithinDays)."
          },
          "openedTo": {
            "title": "Opened on or before",
            "type": "string",
            "description": "Opening date range end."
          },
          "registrationStatus": {
            "title": "Registration status",
            "uniqueItems": true,
            "type": "array",
            "description": "Situação cadastral at the Receita. Active is what you want for leads.",
            "items": {
              "type": "string",
              "enum": [
                "active",
                "suspended",
                "unfit",
                "closed",
                "void"
              ],
              "enumTitles": [
                "Active (Ativa)",
                "Suspended (Suspensa)",
                "Unfit (Inapta)",
                "Closed (Baixada)",
                "Void (Nula)"
              ]
            },
            "default": [
              "active"
            ]
          },
          "companySizes": {
            "title": "Company size (porte)",
            "uniqueItems": true,
            "type": "array",
            "description": "Empty means every size.",
            "items": {
              "type": "string",
              "enum": [
                "micro",
                "small",
                "other"
              ],
              "enumTitles": [
                "Micro (ME)",
                "Small (EPP)",
                "Other (medium and large)"
              ]
            }
          },
          "mei": {
            "title": "MEI (individual micro-entrepreneurs)",
            "enum": [
              "include",
              "exclude",
              "only"
            ],
            "type": "string",
            "description": "MEIs are about half of the new CNPJs. Their e-mail, phone and street address belong to the owner and are left empty (LGPD). Exclude them to get companies with partners and bigger budgets.",
            "default": "include"
          },
          "establishmentType": {
            "title": "Head office or branch",
            "enum": [
              "all",
              "headOffice",
              "branch"
            ],
            "type": "string",
            "description": "Each branch has its own CNPJ and address.",
            "default": "all"
          },
          "onlyWithEmail": {
            "title": "Only with e-mail",
            "type": "boolean",
            "description": "Skip companies without an e-mail you can use. Applied on the index before fetching, so you only pay for contactable leads. MEIs and other one-person companies never count: their contact belongs to the owner (LGPD).",
            "default": false
          },
          "onlyWithPhone": {
            "title": "Only with phone",
            "type": "boolean",
            "description": "Skip companies without a phone you can use. MEIs and other one-person companies never count (LGPD).",
            "default": false
          },
          "includePartners": {
            "title": "Include partners (QSA)",
            "type": "boolean",
            "description": "Partner names and roles as published by the Receita. CPFs are never included, not even masked.",
            "default": true
          },
          "sources": {
            "title": "Data sources",
            "uniqueItems": true,
            "type": "array",
            "description": "Public APIs that serve the Receita Federal registry, tried in this order for every CNPJ. A source that blocks or does not know a CNPJ hands it to the next one. Keep all three for the best coverage.",
            "items": {
              "type": "string",
              "enum": [
                "opencnpj",
                "minhareceita",
                "brasilapi"
              ],
              "enumTitles": [
                "OpenCNPJ (with e-mail)",
                "Minha Receita (no e-mail)",
                "BrasilAPI (no e-mail, slow)"
              ]
            },
            "default": [
              "opencnpj",
              "minhareceita",
              "brasilapi"
            ]
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Leave empty: the Actor connects directly and only falls back to Apify datacenter proxy when a source blocks it."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}