# Ibovespa Brazil Stocks Market API - B3 Fundamentals Scraper (`brasildados/ibovespa-brazil-stocks-api`) Actor

Every traded Brazilian stock on B3, including all Ibovespa stocks: price in BRL and USD, 20 fundamental indicators (P/E, P/B, dividend yield, ROE, ROIC, margins, EV/EBITDA) plus market cap, net income, EPS and net debt. Filter by ticker or export the full table as JSON, CSV or Excel.

- **URL**: https://apify.com/brasildados/ibovespa-brazil-stocks-api.md
- **Developed by:** [brasildados.org - API de Dados Abertos](https://apify.com/brasildados) (community)
- **Categories:** Lead generation, Other, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $50.00 / 1,000 per cnpj (tax id)s

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

### 📈 What is the Ibovespa & Brazil Stocks API?

This **Brazil stocks API and scraper** returns **every traded stock on B3**, the Brazilian stock exchange (including all **Ibovespa** stocks), with the latest price in BRL and USD and **20 fundamental indicators**: P/E, P/B, dividend yield, ROE, ROIC, margins, EV/EBITDA, debt and growth. It also calculates market cap, net income, revenue, EBIT, enterprise value, net debt, EPS, book value and dividend per share. Get the full market table in one run, or only the tickers you need.

- ✅ **Whole market in one call:** around 960 traded stocks per run, ready for screening and ranking.
- ✅ **Filter by ticker:** send `PETR4`, `VALE3`, `ITUB4`... and get only those.
- ✅ **Clean numbers:** values come as real numbers (no "1.083,50" or "8,5%" strings), with English field names.
- ✅ **Valuation, profitability, debt and growth** in the same record.
- ✅ **No login, no captcha, no API key from any broker.**
- ✅ **You only pay for what is delivered:** invalid or not found tickers are not charged.

### 💼 Use cases

- 📊 **Stock screening:** rank the Brazilian market by P/E, dividend yield, ROE or EV/EBITDA.
- 💰 **Dividend investing:** find B3 stocks with the highest dividend yield and healthy debt.
- 🧮 **Quant and backtesting:** take a daily snapshot of the whole market's fundamentals.
- 🧾 **Portfolio monitoring:** follow the indicators of the stocks you hold, every day.
- 🤖 **AI agents and dashboards:** feed spreadsheets, BI tools and LLM agents with Brazilian market data.
- 📰 **Research and content:** build tables and rankings for reports and articles.

### 🚀 How to use the API

```bash
curl -X POST "https://api.apify.com/v2/acts/brasildados~ibovespa-brazil-stocks-api/run-sync-get-dataset-items" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"tickers":["PETR4","VALE3"]}'
```

Real response (shortened to one of the two stocks):

```json
[
  {
    "ticker": "PETR4",
    "companyName": "PETROBRAS",
    "priceBrl": 59.68,
    "priceUsd": 11.74,
    "priceToEarnings": 5.77,
    "priceToBookValue": 1.6,
    "priceToSalesRatio": 1.402,
    "dividendYieldPercent": 6.11,
    "priceToAssets": 0.601,
    "priceToWorkingCapital": -29.14,
    "priceToEbit": 3.28,
    "priceToNetCurrentAssets": -1.2,
    "evToEbit": 4.61,
    "evToEbitda": 3.36,
    "grossMarginPercent": 50.6,
    "ebitMarginPercent": 42.76,
    "netMarginPercent": 24.39,
    "currentRatio": 0.85,
    "roicPercent": 19.69,
    "roePercent": 27.73,
    "avgDailyVolume2MonthsBrl": 2315290000,
    "shareholdersEquityBrl": 480950000000,
    "netDebtToEquity": 0.65,
    "revenueGrowth5yPercent": -2.33,
    "marketCapBrl": 769520000000,
    "netIncomeBrl": 133365684575,
    "netRevenueBrl": 548873038516,
    "ebitBrl": 234609756098,
    "totalAssetsBrl": 1280399334443,
    "enterpriseValueBrl": 1081550975610,
    "netDebtBrl": 312617500000,
    "earningsPerShareBrl": 10.34,
    "bookValuePerShareBrl": 37.3,
    "dividendPerShareBrl": 3.65,
    "retrievedAt": "2026-10-19T14:34:15.370Z"
  }
]
```

To get **the full market**, send an empty body: `-d '{}'`.

Your API token is in **Settings → API & Integrations** in the Apify Console. Always send it in the `Authorization: Bearer` header, never in the URL.

#### 🖱️ From the Console

1. Click **Try for free** (or **Start**) at the top of this page.
2. Add tickers, one per line, or leave the field empty to get every stock.
3. Click **Start**. Results appear in the **Output** tab, ready to export as JSON, CSV or Excel.

### ⬇️ Input

| Field | Description |
|---|---|
| `tickers` | Optional. List of B3 tickers (e.g. `PETR4`, `VALE3`, `ITUB4`). **Leave empty to get every traded stock.** |

```json
{
  "tickers": ["PETR4", "VALE3"]
}
```

⚠️ **Invalid, repeated or not found tickers:**

| You send | What happens |
|---|---|
| `PETR4` or `petr4` | ✅ Returned (tickers are case-insensitive). |
| The same ticker twice | ✅ Returned and charged once. |
| `abc` (not a B3 ticker format) | ⏭️ Ignored and listed in the log, not charged. The run continues. |
| A valid format that is not traded (e.g. `XXXX9`) | ⏭️ Listed in the log as not found, not charged. |

### ⬆️ Output

One record per stock. Downloads (JSON, CSV, Excel) and the API always include every field; the views in the Console **Output** tab only change which columns are shown on screen.

| Field | Description |
|---|---|
| `ticker` | B3 ticker (e.g. `PETR4`) |
| `companyName` | Short name of the listed company (e.g. `PETROBRAS`) |
| `priceBrl` | Last price, in Brazilian reais (BRL) |
| `priceUsd` | Last price in US dollars, converted with the latest official PTAX selling rate (Central Bank of Brazil) |
| `priceToEarnings` | P/E: price divided by earnings per share |
| `priceToBookValue` | P/B: price divided by book value per share |
| `priceToSalesRatio` | P/S (PSR): market value divided by net revenue |
| `dividendYieldPercent` | Dividend yield in the last 12 months, in percent (6.11 = 6.11%) |
| `priceToAssets` | Market value divided by total assets |
| `priceToWorkingCapital` | Market value divided by working capital |
| `priceToEbit` | Market value divided by EBIT |
| `priceToNetCurrentAssets` | Market value divided by net current assets |
| `evToEbit` | Enterprise value divided by EBIT |
| `evToEbitda` | Enterprise value divided by EBITDA |
| `grossMarginPercent` | Gross margin, in percent |
| `ebitMarginPercent` | EBIT margin, in percent |
| `netMarginPercent` | Net margin, in percent |
| `currentRatio` | Current assets divided by current liabilities |
| `roicPercent` | Return on invested capital, in percent |
| `roePercent` | Return on equity, in percent |
| `avgDailyVolume2MonthsBrl` | Average daily traded volume in the last 2 months, in BRL |
| `shareholdersEquityBrl` | Shareholders' equity, in BRL |
| `netDebtToEquity` | Net debt divided by equity (negative = more cash than debt) |
| `revenueGrowth5yPercent` | Net revenue compound annual growth over 5 years, in percent |
| `marketCapBrl` | **Calculated.** Market cap in BRL: P/B × shareholders' equity |
| `netIncomeBrl` | **Calculated.** Net income (last 12 months) in BRL: market cap ÷ P/E; negative = loss |
| `netRevenueBrl` | **Calculated.** Net revenue (last 12 months) in BRL: market cap ÷ P/S |
| `ebitBrl` | **Calculated.** EBIT (last 12 months) in BRL: market cap ÷ P/EBIT |
| `totalAssetsBrl` | **Calculated.** Total assets in BRL: market cap ÷ P/Assets |
| `enterpriseValueBrl` | **Calculated.** Enterprise value in BRL: EV/EBIT × EBIT |
| `netDebtBrl` | **Calculated.** Net debt in BRL: net debt/equity × equity; negative = more cash than debt |
| `earningsPerShareBrl` | **Calculated.** Earnings per share in BRL: price ÷ P/E |
| `bookValuePerShareBrl` | **Calculated.** Book value per share in BRL: price ÷ P/B |
| `dividendPerShareBrl` | **Calculated.** Dividends per share in the last 12 months, in BRL: price × dividend yield |
| `retrievedAt` | Date and time the data was retrieved (ISO 8601) |

**Data notes:**

- Only stocks with a price above zero are returned; listed securities with no trading are left out.
- A ratio of `0` may mean the indicator is not available for that company (for example, P/E when there is no profit to compare).
- Percent fields are already in percent: `6.11` means 6.11%.
- **Calculated fields** (market cap, net income, revenue, EBIT, assets, EV, net debt and per-share values) are derived from the published ratios at run time. They are approximations, because the ratios are rounded to 2 or 3 decimals, and come as `null` when the ratio they depend on is not available.
- `priceUsd` uses the latest PTAX rate published by the Central Bank of Brazil (business days, around 1 p.m. Brasília time). If the rate cannot be loaded, `priceUsd` comes as `null` and the rest of the run is not affected.

### 💰 How much does it cost?

You pay **per stock returned**. A run with two tickers bills two records; the full market bills one record per traded stock. Current prices are in the **Pricing** tab.

🆓 **Not charged:** invalid tickers and tickers that are not found or not traded.

### 🔗 Integrations

- **REST API** and official Apify clients for **JavaScript** and **Python**.
- **Google Sheets**, **n8n, Make and Zapier** to keep a market table always updated.
- **Webhooks** and **Slack** after each run.
- **Scheduling** on Apify to take a daily snapshot of the market (e.g. cron `0 22 * * 1-5`, after the B3 close).
- **MCP** to use the Actor inside AI agents.

### ❓ FAQ

#### How do I get Brazilian stock fundamentals via API?

Call `run-sync-get-dataset-items` with `{"tickers":["PETR4"]}` (see [How to use the API](#-how-to-use-the-api)), or with `{}` for every traded stock. Each record has the price and 20 indicators.

#### Does it include every Ibovespa stock?

Yes. It returns every traded stock on B3: in our last test, all 76 stocks of the official Ibovespa portfolio were in the table, together with small caps and units (tickers ending in 11). BDRs are not included.

#### How many stocks come in the full table?

Around 960 traded stocks (961 in our last test). The number changes as companies list, delist or stop trading.

#### How are market cap, net income and the per-share values calculated?

From the published ratios, at run time: market cap = P/B × equity; net income = market cap ÷ P/E; revenue = market cap ÷ P/S; EBIT = market cap ÷ P/EBIT; EV = EV/EBIT × EBIT; EPS = price ÷ P/E; book value per share = price ÷ P/B; dividend per share = price × dividend yield. They are close approximations of the company figures, not numbers reported by the company.

#### Is the price available in US dollars?

Yes. `priceUsd` converts the price with the latest official PTAX selling rate from the Central Bank of Brazil.

#### Can I get historical prices?

No. Each run returns the current snapshot. To build a history, schedule a daily run and store the results.

#### Why do some indicators come as 0?

A `0` may mean the indicator is not available for that company, such as P/E without a profit or margins for companies without revenue data.

#### Do I need a broker account, API key or captcha?

No. Only your Apify token to call the API.

#### What happens if I send a wrong ticker?

It is ignored, listed in the log and not charged. The run continues with the valid tickers.

#### How often is the data updated?

Each run fetches the data again at that moment. The `retrievedAt` field records the exact time.

### 🧩 Other brasildados Actors

- 🏢 [Brazil CNPJ Enrichment](https://apify.com/brasildados/brazil-enrich-data-lead-by-cnpj?fpr=t5lwzq): company registration data by CNPJ.
- ™️ [INPI Trademarks by CNPJ](https://apify.com/brasildados/inpi-marcas-api-cnpj?fpr=t5lwzq): trademarks of Brazilian companies.
- 🔬 [INPI Patents by CNPJ](https://apify.com/brasildados/inpi-patentes-api-cnpj?fpr=t5lwzq): patents of Brazilian companies.
- 📰 [Brazil Official Gazette (DOU) Scraper](https://apify.com/brasildados/dou-monitor?fpr=t5lwzq): monitor federal acts that mention listed companies.

🌐 <https://brasildados.org/> · 🛒 [All brasildados Actors](https://apify.com/brasildados?fpr=t5lwzq)

### 🇧🇷 Resumo em português

**API de ações brasileiras (B3 e Ibovespa) com indicadores fundamentalistas.** Retorna todas as ações negociadas na B3, incluindo todas as do Ibovespa, com cotação e 20 indicadores: P/L, P/VP, dividend yield, ROE, ROIC, margens, EV/EBITDA, endividamento e crescimento.

- **Entrada:** `tickers` (opcional). Vazio = todas as ações negociadas (~960).
- **Saída:** um registro por ação, com números já convertidos (6.11 = 6,11%) e nomes de campo em inglês. Inclui a cotação em dólar (PTAX do Banco Central) e valores calculados a partir dos múltiplos: valor de mercado, lucro, receita, EBIT, ativo total, valor da firma, dívida líquida, LPA, VPA e dividendo por ação. Os títulos e descrições dos campos estão em inglês e português.
- **Usos:** filtro de ações, carteira de dividendos, análise quantitativa, acompanhamento de carteira e agentes de IA.
- **Preço:** por ação retornada; ticker inválido ou não encontrado não é cobrado. Veja a aba Pricing.
- **API:** `POST https://api.apify.com/v2/acts/brasildados~ibovespa-brazil-stocks-api/run-sync-get-dataset-items` com `{"tickers":["PETR4","VALE3"]}` e `Authorization: Bearer <token>`.

# Actor input Schema

## `tickers` (type: `array`):

**Optional.** Leave this field **empty to get ALL traded Brazilian stocks** (around 960). Fill it only to get specific B3 tickers (e.g. PETR4, VALE3, ITUB4). Invalid or not found tickers are ignored, not charged, and the run continues with the others. | **Opcional.** Deixe este campo **vazio para receber TODAS as ações brasileiras negociadas** (cerca de 960). Preencha só para receber tickers específicos da B3 (ex.: PETR4, VALE3, ITUB4). Tickers inválidos ou não encontrados são ignorados, sem cobrança, e a execução segue com os demais.

## Actor input object example

```json
{
  "tickers": [
    "PETR4",
    "VALE3"
  ]
}
```

# Actor output Schema

## `stocks` (type: `string`):

Dataset with one record per stock. | Dataset com um registro por ação.

# 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 = {
    "tickers": [
        "PETR4",
        "VALE3"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("brasildados/ibovespa-brazil-stocks-api").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 = { "tickers": [
        "PETR4",
        "VALE3",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("brasildados/ibovespa-brazil-stocks-api").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 '{
  "tickers": [
    "PETR4",
    "VALE3"
  ]
}' |
apify call brasildados/ibovespa-brazil-stocks-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,brasildados/ibovespa-brazil-stocks-api"
        }
    }
}
```

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/3yRGOYVgAB8taNTeZ/builds/kyvzRJ3waAXxUJ50z/openapi.json
