# Brazil Central Bank Series - SGS, Focus & PTAX (`formative_cobia/brazil-central-bank-series`) Actor

Download official Banco Central do Brasil data in one clean numeric format: any SGS time series (Selic, CDI, IPCA, IGP-M, FX), Focus market expectations and PTAX exchange rates. Long daily series are split automatically. Monitoring mode returns only new data.

- **URL**: https://apify.com/formative_cobia/brazil-central-bank-series.md
- **Developed by:** [BR Open Data Tools](https://apify.com/formative_cobia) (community)
- **Categories:** Business, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.25 / 1,000 observations

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

## Brazil Central Bank Series – SGS, Focus & PTAX

Download official **Banco Central do Brasil** data in one clean, numeric format, ready for spreadsheets, BI tools and models:

- **SGS time series**: any series by code – Selic, CDI, IPCA, IGP-M, exchange rates, IBC-Br, GDP, credit, unemployment and thousands more.
- **Focus market expectations**: the weekly survey of market forecasts (annual, monthly, quarterly, Selic per Copom meeting, inflation for the next 12/24 months).
- **PTAX exchange rates**: official rates for USD, EUR, GBP, JPY, CHF, CAD, AUD, DKK, NOK and SEK.

### Why use it

The three Banco Central services have different formats and pitfalls: daily series accept at most 10 years per query, periods without data return an error, values come as text, dates come in three different formats, and an unsupported currency silently returns nothing. This Actor handles all of that:

- Long periods of daily series are **split automatically** (e.g. 20 years of the US dollar in one run).
- Every value is a **number**, every date is **YYYY-MM-DD**.
- One **unified schema** for the three sources.
- **Names and units** for popular SGS series.
- One invalid series code does **not** stop the other series; it is reported in the run summary.
- **Monitoring mode** returns only observations not delivered before – perfect for a daily schedule.

### Input

| Field | Description | Default |
|---|---|---|
| **SGS series codes** | Numeric SGS codes. | `432`, `433` |
| **Focus indicators** | Names as published in the Focus survey, e.g. `IPCA`, `Selic`, `Câmbio`, `PIB Total`, `IGP-M`. | – |
| **Focus expectation type** | annual, monthly, quarterly, Selic per Copom meeting, inflation next 12 or 24 months. | annual |
| **PTAX currencies** | USD, EUR, GBP, JPY, CHF, CAD, AUD, DKK, NOK, SEK. | – |
| **PTAX closing rate only** | Only the official closing bulletin (off = also opening and intermediate bulletins). | on |
| **Start date / End date** | Period (YYYY-MM-DD). | last 30 days |
| **Lookback days** | Used when Start date is empty. | 30 |
| **Only new observations** | Monitoring mode. | off |
| **Max results / Max requests / Max run time** | Hard limits that control cost. | 5000 / 100 / 300 s |

At least one of SGS series, Focus indicators or PTAX currencies is required.

#### Popular SGS codes

| Code | Series | Unit |
|---|---|---|
| 432 | Selic target rate defined by Copom | % per year |
| 11 | Selic rate – daily | % per day |
| 1178 | Selic rate annualized (base 252) | % per year |
| 4390 | Selic rate accumulated in the month | % per month |
| 12 | CDI rate – daily | % per day |
| 4389 | CDI rate annualized (base 252) | % per year |
| 433 | IPCA – monthly change | % per month |
| 13522 | IPCA – 12-month change | % |
| 189 | IGP-M – monthly change | % per month |
| 1 | US dollar exchange rate (sell) | BRL/USD |
| 10813 | US dollar exchange rate (buy) | BRL/USD |
| 21619 | Euro exchange rate (sell) | BRL/EUR |
| 24363 / 24364 | IBC-Br activity index (not adjusted / seasonally adjusted) | index |
| 4380 | Monthly GDP, current prices | BRL million |
| 24369 | Unemployment rate (PNAD Contínua) | % |

Any other SGS code also works; its name and unit are then returned as `null`.

#### Example input

```json
{
  "sgsSeries": ["432", "433", "1"],
  "focusIndicators": ["IPCA", "Selic"],
  "focusType": "annual",
  "ptaxCurrencies": ["USD", "EUR"],
  "startDate": "2025-01-01",
  "endDate": "2025-12-31"
}
```

### Output

One row per observation. Fields that do not apply to a source are `null`.

```json
{
  "source": "SGS",
  "seriesId": "433",
  "seriesName": "IPCA - monthly change",
  "date": "2025-01-01",
  "value": 0.16,
  "unit": "% per month",
  "observationKey": "SGS|433|2025-01-01|||||",
  "fetchedAt": "2026-11-14T19:00:00+00:00",
  "attribution": "Fonte: Banco Central do Brasil (ODbL)"
}
```

Focus rows add `referencePeriod` (year, month, quarter or Copom meeting), `mean`, `median` (also in `value`), `stdDev`, `min`, `max`, `respondents`, `calculationBase` (0 = last 30 days, 1 = last 5 business days) and `indicatorDetail`. PTAX rows add `buyRate`, `sellRate` (also in `value`), `buyParity`, `sellParity`, `bulletinType` and `quotedAt`.

A run summary is saved as **SUMMARY** in the run's key-value store: observations per series, errors per series, requests used, duration and the stop reason.

### Cost control

- **Max results** caps the number of billable rows.
- **Max requests** and **Max run time** cap the work done.
- The maximum charge you set for a run is respected: the Actor stops before exceeding it.
- No observations in the period means no result charges.

### Pricing

Pay per event: a small fee when a run starts and a fee per observation delivered. See the pricing tab for current values.

### Tips

- The Focus survey is published weekly, a few days after the survey date. Use at least 14 lookback days for the latest Focus release.
- For a daily dashboard, schedule the Actor with **Only new observations** on: each run returns only what is new for the same series.
- The memory of delivered observations is kept in a named key-value store in your account (`brazil-central-bank-series-state`).

### Limitations

- Data, revisions and publication delays are those of the Banco Central. Some series are discontinued (they return data only up to their last date).
- The Selic target series (432) contains dates up to the next Copom meeting.
- If the source is temporarily unavailable, the Actor retries 3 times with increasing waits and then reports a clear error.

### Data source and license

- Source: public APIs of the Banco Central do Brasil (SGS and the Olinda services for Focus expectations and PTAX). No login or API key is required.
- The Banco Central open data portal publishes these datasets under the Open Data Commons Open Database License (ODbL). Keep the attribution "Fonte: Banco Central do Brasil" and the ODbL terms when you share databases built from this data.
- No personal data is collected.
- This Actor is an independent tool and is not affiliated with or endorsed by the Banco Central do Brasil.

# Changelog

This Actor's version history is a separate document: https://apify.com/formative_cobia/brazil-central-bank-series/changelog.md

# Actor input Schema

## `sgsSeries` (type: `array`):

Numeric codes of SGS time series. Examples: 432 Selic target, 11 Selic daily, 12 CDI daily, 433 IPCA monthly, 13522 IPCA 12 months, 189 IGP-M, 1 US dollar (sell), 21619 Euro, 24364 IBC-Br. Any SGS code works.

## `focusIndicators` (type: `array`):

Indicator names as published in the Focus survey, e.g. IPCA, Selic, Câmbio, PIB Total, IGP-M, IPCA Livres, Taxa de desocupação.

## `focusType` (type: `string`):

Which Focus table to read.

## `ptaxCurrencies` (type: `array`):

Official PTAX exchange rates against the Brazilian real. Supported: USD, EUR, GBP, JPY, CHF, CAD, AUD, DKK, NOK, SEK.

## `ptaxClosingOnly` (type: `boolean`):

Return only the daily closing (official PTAX) bulletin. Turn off to also get opening and intermediate bulletins.

## `startDate` (type: `string`):

First date (YYYY-MM-DD). If empty, uses the last N days (see Lookback days). Long ranges of daily series are split automatically.

## `endDate` (type: `string`):

Last date (YYYY-MM-DD). Defaults to today.

## `lookbackDays` (type: `integer`):

Used when Start date is empty.

## `onlyNew` (type: `boolean`):

Remember what was already delivered for the same series and return only new observations. Ideal with a daily schedule.

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

Hard limit of observations per run (controls the cost).

## `maxRequests` (type: `integer`):

Hard limit of HTTP requests per run, retries included.

## `maxRunSeconds` (type: `integer`):

The run stops gracefully after this time, keeping the results found so far.

## Actor input object example

```json
{
  "sgsSeries": [
    "432",
    "433"
  ],
  "focusType": "annual",
  "ptaxClosingOnly": true,
  "lookbackDays": 30,
  "onlyNew": false,
  "maxItems": 5000,
  "maxRequests": 100,
  "maxRunSeconds": 300
}
```

# Actor output Schema

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

No description

## `summary` (type: `string`):

No description

# 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 = {
    "sgsSeries": [
        "432",
        "433"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("formative_cobia/brazil-central-bank-series").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 = { "sgsSeries": [
        "432",
        "433",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("formative_cobia/brazil-central-bank-series").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 '{
  "sgsSeries": [
    "432",
    "433"
  ]
}' |
apify call formative_cobia/brazil-central-bank-series --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,formative_cobia/brazil-central-bank-series"
        }
    }
}
```

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/LfMvXejgnAhUkebLR/builds/3pNHh9t3UtVRVAaJa/openapi.json
