# Brazil Cep Address Lookup (`b2b_lead_generation/brazil-cep-address-lookup`) Actor

Instantly resolve Brazilian postal codes (CEP) to detailed street, neighborhood, city, and state data. Paste your list of 8-digit CEPs, run the lookup, and easily export clean address datasets as JSON, CSV, or Excel files.

- **URL**: https://apify.com/b2b_lead_generation/brazil-cep-address-lookup.md
- **Developed by:** [B2B Lead Generation](https://apify.com/b2b_lead_generation) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Brazil CEP Address Lookup

![Brazil CEP Address Lookup cover](https://images.bigibyte.com/cdn-cgi/image/width=1260,height=540,fit=cover,format=webp/apify-actors-covers/brazil-cep-address-lookup-cover.png)

Look up Brazilian postal codes (CEP) and retrieve their corresponding address details with Brazil CEP Address Lookup. Enter one or more 8-digit CEPs and collect structured address data, including state, city, neighborhood, street, and geographic information when available. Export your results as JSON, CSV, or Excel.

### What This Actor Does

This actor looks up Brazilian CEPs and returns their associated address information. Results can include state and city codes, timezone details, and geographic coordinates.

Each CEP is processed independently. Duplicate CEP results are avoided, and unsuccessful lookups are recorded as error rows so other lookups can continue.

### Lookup Mode

**CEP Lookup:** Submit one or more 8-digit Brazilian postal codes to retrieve their corresponding address information.

### Input Example

```json
{
  "mode": "cep",
  "ceps": ["01001000"],
  "requestDelaySecs": 1
}
```

### Input Parameters

| Parameter | Description |
|---|---|
| `mode` | Lookup mode. Use `cep`. |
| `ceps` | Array of 8-digit Brazilian postal codes to look up. |
| `requestDelaySecs` | Delay between requests, in seconds. |

### Output Example

```json
{
  "cep": "01001000",
  "state": "SP",
  "city": "São Paulo",
  "neighborhood": "Sé",
  "street": "Praça da Sé",
  "service": "open-cep",
  "ibge": {
    "city": "3550308",
    "state": "35"
  },
  "timezoneName": "America/Sao_Paulo",
  "location": {
    "type": "Point",
    "coordinates": {
      "longitude": "-46.63611",
      "latitude": "-23.5475"
    }
  },
  "scraped_at": "2026-10-26T00:00:00+00:00"
}
```

### Output Fields

| Field | Description |
|---|---|
| `cep` | Brazilian postal code. |
| `state` | State abbreviation. |
| `city` | City name. |
| `neighborhood` | Neighborhood name. |
| `street` | Street or address name. |
| `service` | Service identifier returned with the result. |
| `ibge` | Nested object containing city and state IBGE codes. |
| `timezoneName` | Timezone associated with the location. |
| `location` | Geographic location object with coordinates when available. |
| `scraped_at` | Timestamp when the result was collected. |

### Use Cases

- **Address Enrichment:** Add city, state, street, and neighborhood information to Brazilian postal code datasets.
- **Shipping and Logistics:** Validate postal code location details when preparing delivery records.
- **Market Research:** Organize geographic data for Brazilian cities and regions.
- **Data Cleaning:** Identify unsuccessful CEP lookups while retaining valid results for further processing.
- **CRM Management:** Enrich customer location records with structured address information.

### FAQ

**What is a CEP?**

CEP stands for Código de Endereçamento Postal, Brazil's postal code system. Brazilian CEPs contain eight digits.

**What information does the lookup return?**

Results can include the CEP, state, city, neighborhood, street, IBGE codes, timezone, and geographic coordinates when available.

**Can I look up multiple CEPs in one run?**

Yes. Provide multiple 8-digit postal codes in the `ceps` array.

**What happens when a CEP cannot be found?**

The actor records an error row containing the input and available error details, then continues processing other CEPs.

**Can I export the results?**

Yes. Apify supports exporting collected dataset records in JSON, CSV, Excel, and other available formats.

**Can I schedule recurring lookups?**

Yes. You can configure Apify schedules to run the actor automatically at your preferred intervals.

### Trademark Notice

BrasilAPI and its related names and trademarks belong to their respective owners. This actor is an independent tool and does not imply affiliation, sponsorship, or endorsement.

### Is Web Scraping Legal?

This actor collects publicly accessible Brazilian postal code and address information without bypassing login screens, paywalls, or technical security measures. How collected information can be used depends on applicable laws and the source website's policies.

- **Personal Data:** Address information may relate to identifiable individuals in some contexts. Follow applicable privacy laws, including GDPR and CCPA where relevant, and collect only information you are authorized to use.
- **Copyright and Licensing:** Check the applicable terms and licences for the underlying data before redistributing or reusing it.
- **Platform Terms and Rate Limits:** Respect BrasilAPI's policies, usage conditions, attribution requirements, and reasonable request practices.
- **Disclaimer:** This information is general guidance, not legal advice. Consult a qualified professional if you have questions about your intended use.

For more information, read Apify's guide: [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/)

# Actor input Schema

## `mode` (type: `string`):

What to scrape. CEP lookup resolves each postal code against BrasilAPI.

## `ceps` (type: `array`):

8-digit CEPs, one per line.

## `requestDelaySecs` (type: `number`):

Seconds to wait between requests.

## `userAgent` (type: `string`):

User-Agent header sent with each request.

## `timeoutSecs` (type: `integer`):

Overall run budget in seconds.

## `requestTimeoutSecs` (type: `integer`):

Per-request timeout in seconds.

## `proxyConfiguration` (type: `object`):

Optional proxy. Leave off unless you need it.

## Actor input object example

```json
{
  "mode": "cep",
  "ceps": [
    "01001000"
  ],
  "requestDelaySecs": 1,
  "userAgent": "ActorResearch/1.0",
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

Dataset rows in the overview table.

## `dataset` (type: `string`):

Full dataset for this run.

## `items` (type: `string`):

Dataset items as JSON.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "ceps": [
        "01001000"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("b2b_lead_generation/brazil-cep-address-lookup").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "ceps": ["01001000"] }

# Run the Actor and wait for it to finish
run = client.actor("b2b_lead_generation/brazil-cep-address-lookup").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "ceps": [
    "01001000"
  ]
}' |
apify call b2b_lead_generation/brazil-cep-address-lookup --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,b2b_lead_generation/brazil-cep-address-lookup"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/kAke4f1xVy1v82FmF/builds/utM8GP5rKzNa3O1gd/openapi.json
