# OLX Brasil Scraper (`gio21/olx-scraper`) Actor

Scrape classified ads from OLX Brasil (olx.com.br) by keyword, category, and state. Extract title, price, location, images, seller info, and ad properties. Pay per result.

- **URL**: https://apify.com/gio21/olx-scraper.md
- **Developed by:** [Gio](https://apify.com/gio21) (community)
- **Categories:** E-commerce
- **Features:** Limited permissions
- **Stats:** 92 total users, 14 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$5.00 / 1,000 item scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## OLX Brasil Scraper

Scrape classified ads from OLX Brasil (olx.com.br) by keyword, category, and state. Get structured data for every listing including title, price, location, seller type, images, and ad properties.

### What you can do with it

- **Price research:** track asking prices for a product or category across regions to benchmark the market.
- **Lead generation:** collect listings from professional sellers (autos, real estate, services) with city and DDD area code.
- **Market monitoring:** watch how supply and pricing for a keyword change over time by re-running on a schedule.
- **Competitor and inventory tracking:** monitor what specific categories or sellers are listing and at what price points.
- **Real estate and vehicle analysis:** pull sale or rent listings (or cars and vehicles) filtered by state to study local inventory.

### Input

| Field | Type | Description |
|---|---|---|
| `keyword` | string | Search term for OLX ads (e.g. iphone, apartamento, carro, notebook). Required. |
| `category` | string | Filter by OLX category. One of: autos, imoveis, imoveis-venda, imoveis-aluguel, eletronicos, moveis, empregos, servicos, esportes, moda, agro, musica, bebes, animais. Empty for all categories. |
| `state` | string | Filter by Brazilian state UF (e.g. sp, rj, mg, ba). Leave empty for all states. |
| `maxItems` | integer | Maximum number of ads to scrape (default: 50). |
| `maxPages` | integer | Maximum number of search result pages to scrape (default: 5, each page has ~50 ads). |
| `sort` | string | Sort order: relevance, newest, price_asc, or price_desc. |

#### Example input

```json
{
  "keyword": "iphone 13",
  "category": "eletronicos",
  "state": "sp",
  "maxItems": 50,
  "maxPages": 3,
  "sort": "price_asc"
}
```

### Output

One dataset item per listing:

```json
{
  "listId": 1234567890,
  "title": "iPhone 13 128GB Meia-noite",
  "price": 2890.0,
  "priceDisplay": "R$ 2.890",
  "currency": "BRL",
  "oldPrice": 3200.0,
  "category": "Celulares e telefones",
  "location": "Sao Paulo, SP",
  "city": "São Paulo",
  "state": "SP",
  "neighbourhood": "Vila Mariana",
  "ddd": "11",
  "professionalAd": false,
  "images": [
    "https://img.olx.com.br/images/00/001234567890.jpg"
  ],
  "imageCount": 4,
  "videoCount": 0,
  "url": "https://sp.olx.com.br/sao-paulo-e-regiao/celulares/iphone-13-128gb-1234567890",
  "properties": {
    "Marca": "Apple",
    "Modelo": "iPhone 13",
    "Memória interna": "128GB"
  },
  "installments": "12x de R$ 240,83",
  "olxPay": true,
  "olxDelivery": false,
  "isFeatured": false,
  "publishedAt": "2026-06-20T14:32:00.000Z",
  "keyword": "iphone 13",
  "scrapedAt": "2026-06-26T10:15:42.000Z"
}
```

### Pricing

**$0.005 per item scraped** (pay per event). You are not charged for failed pages or duplicates.

### Notes and limits

- This scraper targets OLX Brasil only (olx.com.br) and returns prices in BRL.
- Data comes from the search results pages, so fields reflect the listing card (price, location, images, key properties). It does not open each ad's detail page.
- Each search page holds roughly 50 ads. To collect more listings, increase both `maxItems` and `maxPages`.
- Results depend on OLX serving its standard page data. If a page is temporarily blocked or its layout changes, that page is skipped and logged rather than failing the whole run.

# Actor input Schema

## `keyword` (type: `string`):

Search term for OLX ads (e.g. iphone, apartamento, carro, notebook)

## `category` (type: `string`):

Filter by OLX category

## `state` (type: `string`):

Filter by Brazilian state (e.g. sp, rj, mg, ba). Leave empty for all states.

## `maxItems` (type: `integer`):

Maximum number of ads to scrape (default: 50)

## `maxPages` (type: `integer`):

Maximum number of search result pages to scrape (default: 5, each page has ~50 ads)

## `sort` (type: `string`):

How to sort search results

## Actor input object example

```json
{
  "keyword": "iphone",
  "category": "",
  "state": "",
  "maxItems": 20,
  "maxPages": 3,
  "sort": "relevance"
}
```

# Actor output Schema

## `results` (type: `string`):

All scraped OLX ads with title, price, location, images, properties, and URL.

# 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 = {
    "keyword": "iphone",
    "category": "",
    "state": "",
    "maxItems": 20,
    "maxPages": 3,
    "sort": "relevance"
};

// Run the Actor and wait for it to finish
const run = await client.actor("gio21/olx-scraper").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 = {
    "keyword": "iphone",
    "category": "",
    "state": "",
    "maxItems": 20,
    "maxPages": 3,
    "sort": "relevance",
}

# Run the Actor and wait for it to finish
run = client.actor("gio21/olx-scraper").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 '{
  "keyword": "iphone",
  "category": "",
  "state": "",
  "maxItems": 20,
  "maxPages": 3,
  "sort": "relevance"
}' |
apify call gio21/olx-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gio21/olx-scraper"
        }
    }
}
```

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/5GLrR5biTyeAccVJJ/builds/uqqA7gQjbi635Dcvk/openapi.json
