{
  "openapi": "3.0.1",
  "info": {
    "title": "Brazil CNPJ Leads & Lookup: Companies by CNAE, City, Email",
    "description": "Build B2B lead lists of Brazilian companies by CNAE, state, municipality and legal form, or bulk-enrich CNPJs. Active companies only, MEIs left out, with registered email, phones, partners (QSA), address and Simples status. $2 per 1,000 companies.",
    "version": "1.0",
    "x-build-id": "EcpRBSadU7sKXjVpP"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/singgendarhan~brazil-cnpj-company-leads/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-singgendarhan-brazil-cnpj-company-leads",
        "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/singgendarhan~brazil-cnpj-company-leads/runs": {
      "post": {
        "operationId": "runs-sync-singgendarhan-brazil-cnpj-company-leads",
        "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/singgendarhan~brazil-cnpj-company-leads/run-sync": {
      "post": {
        "operationId": "run-sync-singgendarhan-brazil-cnpj-company-leads",
        "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 = find companies by the filters below (lead lists). lookup = return the companies whose CNPJs you list in \"CNPJs to look up\".",
            "default": "search"
          },
          "cnaes": {
            "title": "CNAE codes (activity)",
            "type": "array",
            "description": "7-digit CNAE subclasses, with or without punctuation, e.g. 5611201 (restaurants) or 6201-5/01 (custom software). Up to 50. By default only the company's primary (fiscal) CNAE is matched; turn on \"Also match secondary CNAEs\" to match any of its activities.",
            "items": {
              "type": "string"
            }
          },
          "includeSecondaryCnae": {
            "title": "Also match secondary CNAEs",
            "type": "boolean",
            "description": "Off = the CNAE must be the company's primary activity. On = primary or any secondary activity (more companies, broader list).",
            "default": false
          },
          "ufs": {
            "title": "States (UF)",
            "type": "array",
            "description": "Two-letter state codes, e.g. SP, RJ, MG. Ignored for the search itself when municipalities are given (a municipality already fixes its state). A state with no CNAE or municipality is a very broad search that the free source may refuse as too costly.",
            "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"
              ]
            }
          },
          "municipios": {
            "title": "Municipalities",
            "type": "array",
            "description": "Municipality names or codes, one per line: a name with its state (\"Campinas/SP\", \"Belo Horizonte - MG\"), a name alone when it is unique in Brazil or in the chosen states, a 7-digit IBGE code (3509502) or a Receita/SIAFI code (6291). Up to 100.",
            "items": {
              "type": "string"
            }
          },
          "naturezasJuridicas": {
            "title": "Legal forms (natureza jurídica)",
            "type": "array",
            "description": "4-digit legal-form codes, e.g. 2062 Sociedade Empresária Limitada (LTDA, incl. SLU), 2054 S.A. fechada, 2046 S.A. aberta, 2240 Sociedade Simples Limitada, 2232 Sociedade Simples Pura, 2143 Cooperativa, 3999 Associação Privada, 2135 Empresário Individual (needs excludeMei off). Leave empty for all legal forms.",
            "items": {
              "type": "string"
            }
          },
          "portes": {
            "title": "Company size (porte)",
            "type": "array",
            "description": "Only these Receita size classes. ME = microempresa, EPP = empresa de pequeno porte, DEMAIS = all larger companies. Leave empty for all sizes.",
            "items": {
              "type": "string",
              "enum": [
                "ME",
                "EPP",
                "DEMAIS"
              ],
              "enumTitles": [
                "ME (microempresa)",
                "EPP (pequeno porte)",
                "DEMAIS (medium and large)"
              ]
            }
          },
          "cepPrefixes": {
            "title": "CEP starts with",
            "type": "array",
            "description": "Only addresses whose CEP (postal code) starts with these digits, e.g. 13015 or 130. Applied to the scanned rows.",
            "items": {
              "type": "string"
            }
          },
          "openedAfter": {
            "title": "Opened on or after",
            "type": "string",
            "description": "Only companies whose activity start date (data de início de atividade) is on or after this date, YYYY-MM-DD. The source cannot sort by date, so this is applied to the scanned pages: for rare dates raise \"Max pages to scan\"."
          },
          "openedBefore": {
            "title": "Opened on or before",
            "type": "string",
            "description": "Only companies opened on or before this date, YYYY-MM-DD."
          },
          "openedWithinLastDays": {
            "title": "Opened in the last N days",
            "minimum": 1,
            "maximum": 36500,
            "type": "integer",
            "description": "Only companies opened in the last N days, counted back from the run date. Overrides \"Opened on or after\". Receita publishes monthly, so the newest companies are those of the latest snapshot."
          },
          "status": {
            "title": "Registration status",
            "enum": [
              "auto",
              "active",
              "any",
              "inactive"
            ],
            "type": "string",
            "description": "auto = active (ATIVA) companies only in search mode, every status in lookup mode. active = ATIVA only. any = every status (ATIVA, BAIXADA, INAPTA, SUSPENSA, NULA). inactive = everything except ATIVA.",
            "default": "auto"
          },
          "excludeMei": {
            "title": "Leave out MEIs and sole traders",
            "type": "boolean",
            "description": "On (default) = leave out MEIs and every Empresário Individual (legal form 2135): they are one person's business and their contacts are personal. Off = include them; their email and phones are still withheld (contactsWithheld = true).",
            "default": true
          },
          "onlyHeadOffice": {
            "title": "Head offices only",
            "type": "boolean",
            "description": "Only the head office (matriz) of each company, no branches (filiais).",
            "default": false
          },
          "onlyWithEmail": {
            "title": "Only with email",
            "type": "boolean",
            "description": "Only companies that registered an email with Receita Federal. Companies left out this way are not charged.",
            "default": false
          },
          "onlyWithPhone": {
            "title": "Only with phone",
            "type": "boolean",
            "description": "Only companies with at least one registered phone (placeholder numbers such as 1111-1111 do not count).",
            "default": false
          },
          "onlyNewSinceLastRun": {
            "title": "Only new since last run",
            "type": "boolean",
            "description": "For weekly or monthly schedules: skip companies that an earlier run with the same filters already returned. The memory lives in your own key-value store \"brazil-cnpj-leads-memory\" (one record per filter set), and the scan continues where the last run stopped.",
            "default": false
          },
          "memoryKey": {
            "title": "Memory name (optional)",
            "type": "string",
            "description": "Only with \"Only new since last run\": a name that keeps separate memories for two schedules that use the same filters, e.g. \"client-a\". Do not run two runs with the same filters and memory name at the same time: each reads the memory at its start and saves it at its end, so overlapping runs can return the same companies."
          },
          "includeSanctionsAndContracts": {
            "title": "Add federal sanctions and contracts",
            "type": "boolean",
            "description": "Adds CEIS, CNEP and CEPIM sanctions and a summary of federal contracts (Portal da Transparência, via OpenCNPJ) to each company. Charged as one extra event per company saved, whether or not anything is found.",
            "default": false
          },
          "cnpjs": {
            "title": "CNPJs to look up",
            "type": "array",
            "description": "Lookup mode only: CNPJs with or without punctuation (33.000.167/0001-01 or 33000167000101), one per line, up to 10,000. Leading zeros dropped by spreadsheets are restored, and the new alphanumeric CNPJs are accepted. Invalid CNPJs are listed in the run summary and not charged.",
            "items": {
              "type": "string"
            }
          },
          "maxResults": {
            "title": "Max companies",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Stop after saving this many companies. You pay only for companies saved. Default: 100 in search mode, all listed CNPJs in lookup mode."
          },
          "maxScanPages": {
            "title": "Max pages to scan",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Search mode: the scan budget in pages of 1,000 registry rows, so the Actor reads at most this many x 1,000 rows (closed companies included; small runs and busy periods use 500- or 250-row pages, each counted as a half or a quarter page; typically 15-50% of rows are active non-MEI companies). Raise it for big lists or rare filters. Scanning is free; only saved companies are charged.",
            "default": 20
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}