
sldx
br.com.sldx/sldx
Brazilian market data (B3) for AI: stock quotes, dividends, fundamentals, CVM funds, FX, Selic/IPCA.
Documentation
SLDX API — API de cotações da B3 · Brazilian stock market API
Português
SLDX API é uma API REST de dados do mercado brasileiro: cotações de ações e FIIs da B3, dividendos, indicadores fundamentalistas, fundos da CVM, câmbio e indicadores macroeconômicos (Selic, IPCA). Este repositório traz exemplos prontos em curl, Python e Node.js.
O que a API resolve
Quem precisa de dados da bolsa brasileira geralmente acaba fazendo scraping de sites (que quebra sem aviso), juntando várias fontes diferentes, ou pagando por feeds caros. A SLDX entrega esses dados por uma única API REST, com respostas em JSON:
| Dado | Endpoint de exemplo |
|---|---|
| Cotação de ações e FIIs | GET /stock-price/PETR4 |
| Dividendos e proventos | GET /stock-dividends/ITUB4 |
| Fundamentos (P/L, P/VP, ROE…) | GET /stock-fundamentals/BBAS3 |
| Selic, IPCA e outros indicadores | GET /indicators/selic |
| Moedas e cripto | GET /currencies/{codigo} |
Referência completa: https://api.sldx.com.br/docs
1. Pegue sua chave grátis
- Crie sua conta em https://api.sldx.com.br/dev
- No Portal do Desenvolvedor, gere um token no modo Token Simples. Ele tem o formato
KID.SECRET. - Guarde o token numa variável de ambiente:
export SLDX_TOKEN="seu_kid.seu_secret"
Toda requisição envia o token no cabeçalho Authorization: Bearer <token>. Base URL: https://api.sldx.com.br.
2. Exemplos
curl
# Cotação
curl -H "Authorization: Bearer $SLDX_TOKEN" https://api.sldx.com.br/stock-price/PETR4
# Dividendos
curl -H "Authorization: Bearer $SLDX_TOKEN" https://api.sldx.com.br/stock-dividends/ITUB4
# Fundamentos
curl -H "Authorization: Bearer $SLDX_TOKEN" https://api.sldx.com.br/stock-fundamentals/BBAS3
# Selic
curl -H "Authorization: Bearer $SLDX_TOKEN" https://api.sldx.com.br/indicators/selic
Python
# pip install requests
import os
import requests
BASE_URL = "https://api.sldx.com.br"
HEADERS = {"Authorization": f"Bearer {os.environ['SLDX_TOKEN']}"}
def sldx(path: str) -> dict:
resp = requests.get(f"{BASE_URL}{path}", headers=HEADERS, timeout=10)
resp.raise_for_status()
return resp.json()
print(sldx("/stock-price/PETR4")) # cotação
print(sldx("/stock-dividends/ITUB4")) # dividendos
print(sldx("/stock-fundamentals/BBAS3")) # fundamentos
print(sldx("/indicators/selic")) # Selic
Node.js (18+)
// Node 18+ já tem fetch nativo
const BASE_URL = "https://api.sldx.com.br";
const headers = { Authorization: `Bearer ${process.env.SLDX_TOKEN}` };
async function sldx(path) {
const res = await fetch(`${BASE_URL}${path}`, { headers });
if (!res.ok) throw new Error(`HTTP ${res.status} em ${path}`);
return res.json();
}
console.log(await sldx("/stock-price/PETR4")); // cotação
console.log(await sldx("/stock-dividends/ITUB4")); // dividendos
console.log(await sldx("/stock-fundamentals/BBAS3")); // fundamentos
console.log(await sldx("/indicators/selic")); // Selic
Salve como exemplo.mjs e rode com node exemplo.mjs.
Créditos e erros
- Cada chamada consome créditos do seu plano. O cabeçalho
X-SLDXAPI-RemainingCreditsmostra quantos créditos você ainda tem. 401: token ausente ou inválido ·403: o endpoint não faz parte do seu plano ·429: seus créditos acabaram.- Respostas
401e403não consomem créditos. - O plano grátis cobre cotações de ações e FIIs, fundamentos, índices/câmbio, indicadores (Selic/IPCA/CDI/IGP-M) e cripto. Dividendos, histórico e fundos exigem plano pago.
Usar com IA (MCP)
A SLDX também tem um servidor MCP remoto. Com ele, Claude, Cursor, VS Code e outros clientes MCP conseguem consultar os dados direto na conversa:
{
"mcpServers": {
"sldx": {
"url": "https://mcp.sldx.com.br/mcp",
"headers": { "Authorization": "Bearer SEU_TOKEN" }
}
}
}
Mais detalhes em https://api.sldx.com.br/homepage/mcp
English
SLDX API is a REST API for Brazilian market data: B3 stock and REIT (FII) quotes, dividends, fundamentals, CVM-registered funds, FX rates, and macro indicators (Selic, IPCA). This repository has ready-to-run examples in curl, Python, and Node.js.
What it solves
Getting Brazilian stock market data usually means scraping websites (which break without warning), stitching several sources together, or paying for expensive feeds. SLDX serves this data through a single REST API that returns JSON:
| Data | Example endpoint |
|---|---|
| Stock and FII quotes | GET /stock-price/PETR4 |
| Dividends | GET /stock-dividends/ITUB4 |
| Fundamentals (P/E, P/B, ROE…) | GET /stock-fundamentals/BBAS3 |
| Selic, IPCA and other indicators | GET /indicators/selic |
| Currencies and crypto | GET /currencies/{code} |
Full reference: https://api.sldx.com.br/docs
1. Get a free API key
- Sign up at https://api.sldx.com.br/dev
- In the Developer Portal, generate a Simple Token. It looks like
KID.SECRET. - Store it in an environment variable:
export SLDX_TOKEN="your_kid.your_secret"
Every request sends the token in the Authorization: Bearer <token> header. Base URL: https://api.sldx.com.br.
2. Examples
The curl, Python, and Node.js snippets in the Portuguese section above work as-is. Only the comments are in Portuguese (cotação = quote, dividendos = dividends, fundamentos = fundamentals).
Credits and errors
- Each call uses credits from your plan. The
X-SLDXAPI-RemainingCreditsheader shows how many you have left. 401: missing or invalid token ·403: the endpoint isn't in your plan ·429: you're out of credits.401and403responses don't use any credits.- The free plan covers stock and FII quotes, fundamentals, indices/FX, indicators (Selic/IPCA/CDI/IGP-M) and crypto. Dividends, price history and funds require a paid plan.
Use it with AI (MCP)
SLDX also runs a remote MCP server at https://mcp.sldx.com.br/mcp (Bearer token auth). Add the JSON config from the Portuguese section above to Claude, Cursor, VS Code, or any MCP client. Details: https://api.sldx.com.br/homepage/mcp
sldx-mcpnpm install sldx-mcpsldx-mcppip install sldx-mcp