# Brazil Inflation Calculator (IPCA, IGP-M, Selic) (`br_data_hub/br-monetary-correction`) Actor

Correct BRL amounts in bulk by IPCA, INPC, IGP-M, IGP-DI, IPC-Fipe, Selic, CDI, TR or savings (poupança) using public data from the Central Bank of Brazil (SGS): corrected value, factor, accumulated % and month-by-month breakdown. The Calculadora do Cidadão rules, in bulk and by API.

- **URL**: https://apify.com/br_data_hub/br-monetary-correction.md
- **Developed by:** [br_data_hub](https://apify.com/br_data_hub) (community)
- **Categories:** AI, Developer tools, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.10 / 1,000 calculations

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 Inflation Calculator (IPCA, IGP-M, Selic)

Correct **Brazilian real (BRL) amounts in bulk** by **IPCA, INPC, IGP-M, IGP-DI, IPC-Fipe, Selic, CDI, TR or savings (poupança)**. The Actor uses public data from the **Central Bank of Brazil (Banco Central do Brasil, SGS API)**. For each request you get the corrected amount, the correction factor, the accumulated % and a **month-by-month breakdown**. Each result also states the rule that was applied.

It applies the rules of the Central Bank's free **Calculadora do Cidadão**, but for thousands of amounts per run and through an API. The calculator only takes one amount at a time through a web form. The IPCA results reproduce published Calculadora do Cidadão results to the 7th decimal (see *Accuracy*).

Typical uses: rent and contract adjustments (IGP-M, IPCA), court and tax debts (Selic), comparing an investment with CDI or savings, and giving an AI agent a reliable inflation tool.

### Input

**Mode `correction`** (default): one object per amount in `calculations`.

```json
{
  "mode": "correction",
  "calculations": [
    {"id": "rent-contract", "amount": 2000, "startDate": "2019-12", "endDate": "2023-12", "index": "IPCA"},
    {"id": "court-debt", "amount": 10000, "startDate": "2024-01-02", "endDate": "2024-12-31", "index": "SELIC"},
    {"id": "investment", "amount": 5000, "startDate": "2024-01-02", "endDate": "2024-12-31", "index": "CDI", "percentOfIndex": 110},
    {"id": "savings", "amount": 1000, "startDate": "2023-01-15", "endDate": "2024-01-15", "index": "POUPANCA"}
  ],
  "includeBreakdown": true
}
```

| Field | Description |
|---|---|
| `amount` | Amount in BRL. |
| `startDate`, `endDate` | `YYYY-MM-DD`, `YYYY-MM`, `DD/MM/YYYY` or `MM/YYYY`. |
| `index` | `IPCA`, `INPC`, `IGP-M`, `IGP-DI`, `IPC-FIPE`, `SELIC`, `CDI`, `TR` or `POUPANCA`. Case and accents are ignored. |
| `percentOfIndex` | Optional, SELIC and CDI only, e.g. `110` for 110% of CDI. Default 100. |
| `id` | Optional, copied to the output so you can match results with your records. |
| `includeBreakdown` | Month-by-month detail (default on). |

Up to 10,000 calculations per run. Every series is downloaded **once per run** and cached, so 1,000 calculations on 4 indices make only 4 calls to the Central Bank.

**Mode `series`**: returns the raw index values for the period, for people who only want the numbers: `seriesIndices` (e.g. `["IPCA", "SELIC"]`), `seriesStartDate`, `seriesEndDate`.

#### Rules applied (also explained in each result's `rule` field)

| Index type | Indices | Rule |
|---|---|---|
| Monthly price index | IPCA, INPC, IGP-M, IGP-DI, IPC-Fipe | Compounds the monthly variation of **every month from the start month to the end month, both included**. This is the Calculadora do Cidadão convention, so Jan–Dec counts 12 months. The day of the month is ignored. |
| Daily rate | Selic, CDI | Compounds the daily rate of **each business day from the start date (included) to the end date (excluded)**. Weekends and holidays have no rate, so the pro-rata is by business days (252-day year), not calendar days. `percentOfIndex` scales the daily rate (110% of CDI). |
| Monthly period from an anniversary | TR | Compounds the TR of each **complete** monthly period starting on the anniversary day. An incomplete last period earns nothing. |
| Savings (poupança) | POUPANCA | Deposits **up to 2012-05-03** (old rule): 0.5% a month + TR (series 25). Deposits **from 2012-05-04** (new rule, Law 12,703/2012): 0.5% a month + TR while the Selic target is above 8.5% a year, otherwise 70% of the Selic target + TR (series 195). Only complete monthly periods earn, and deposits made on days 29–31 have their anniversary on day 1 of the next month. |

The factor is rounded to 7 decimals before it is applied, as the Calculadora do Cidadão does. The corrected amount is rounded to cents (half up).

### Output

One dataset item per calculation:

```json
{
  "id": "rent-contract",
  "index": "IPCA",
  "indexName": "IPCA - consumer prices (IBGE)",
  "sgsCode": 433,
  "amount": 2000,
  "startDate": "2019-12",
  "endDate": "2023-12",
  "correctedAmount": 2575.49,
  "factor": 1.2877474,
  "accumulatedPercent": 28.77474,
  "periods": 49,
  "rule": "Monthly price index: compounds the monthly % variation of every month from the start month to the end month, both included ...",
  "breakdown": [
    {"period": "2019-12", "ratePercent": 1.15, "factor": 1.0115, "cumulativeFactor": 1.0115, "amount": 2023.0},
    {"period": "2020-01", "ratePercent": 0.21, "factor": 1.0021, "cumulativeFactor": 1.01362415, "amount": 2027.25}
  ],
  "source": "https://api.bcb.gov.br/dados/serie/bcdata.sgs.433/dados",
  "dataOrigin": "sgs-live",
  "error": null
}
```

Selic and CDI results add `businessDays`, and their breakdown rows have `businessDays` per month. TR and savings results add `anniversaryDay`, and their breakdown rows are periods with `periodEnd`.

If a request cannot be calculated, for example because of an unknown index or an index not yet published for the end month, the item has `error` filled in and is **not charged**.

`dataOrigin` is `sgs-live` when the numbers came from the SGS API in this run. If the API does not answer, the Actor falls back to a reference copy bundled in the Actor, and `dataOrigin` says `bundled-reference (saved YYYY-MM-DD)`. Requests outside that copy return an error and are not charged.

Series mode returns one item per index: `{index, sgsCode, unit, startDate, endDate, count, points: [{date, value}]}`.

### How much does it cost?

Pay per event, two events:

- **`calculation`**: one per amount corrected in correction mode, or one per series returned in series mode. Errors are not charged.
- **`apify-actor-start`**: Apify's standard start event, charged automatically by the platform at its default price (US$ 0.00005 per run).

Suggested price: **US$ 0.003 per calculation (US$ 3 per 1,000)**.

- Measured cost: the default input (4 calculations) took 0.7 s and 72 MB. A batch of 1,000 calculations took 3.2 s and 75 MB, with 4 calls to the source. At 128 MB, even a 30-second run (container start + Central Bank latency) costs 0.125 GB × 30/3600 h × US$ 0.20/CU ≈ **US$ 0.0002**. Per calculation, the compute cost is close to zero.
- After Apify's 20% commission, US$ 0.003 leaves US$ 0.0024 per calculation. A single-calculation run keeps more than 90% margin, and larger batches keep almost all of it.
- Competitors in the Store (October 2026) sell raw Central Bank series, not corrections. Their prices run from US$ 0.0005 to US$ 0.05 per event (SGS scrapers at about US$ 0.009–0.011 per result). None applies the Calculadora do Cidadão rules.

**$0.003 per calculation** (`calculation` event, pay per event). Charged once per correction calculated. Rows with errors are free.

- `apify-actor-start`: $0.00005 (Charged once when a run starts (Apify synthetic event).)

| You get | Free tier | Bronze tier (10% off) | Gold tier (30% off) |
|---|---|---|---|
| 100 calculations | $0.30 | $0.27 | $0.21 |
| 1,000 calculations | $3.00 | $2.70 | $2.10 |
| 10,000 calculations | $30.00 | $27.00 | $21.00 |

Discounts follow your Apify subscription tier: Bronze 10%, Silver 20%, Gold and above 30%. No subscription to this Actor and no charge for platform usage: you pay only for results.
The Apify Free plan includes $5 of monthly credit, enough for about **1,666 calculations** at the list price.
You can cap the cost of any run with **Maximum cost per run**; the Actor stops when it is reached.

### Data source

**Banco Central do Brasil, SGS (Sistema Gerenciador de Séries Temporais)**, the public API `https://api.bcb.gov.br/dados/serie/bcdata.sgs.{code}/dados?formato=json&dataInicial=dd/mm/aaaa&dataFinal=dd/mm/aaaa`. No key is needed. The Central Bank publishes the series on its open data portal (dadosabertos.bcb.gov.br) under the **Open Data Commons Open Database License (ODbL)**: commercial use is allowed with attribution. Each result links to its source series. The price indices are produced by IBGE (IPCA, INPC), FGV (IGP-M, IGP-DI) and Fipe (IPC-Fipe), and the Central Bank republishes them in SGS.

| Index | SGS code | Frequency in SGS |
|---|---|---|
| IPCA | 433 | monthly, % per month |
| INPC | 188 | monthly, % per month |
| IGP-M | 189 | monthly, % per month |
| IGP-DI | 190 | monthly, % per month |
| IPC-Fipe | 193 | monthly, % per month |
| Selic (effective, overnight) | 11 | daily, % per business day |
| CDI | 12 | daily, % per business day |
| TR | 226 | per start date, % for the month starting that day |
| Savings, deposits from 2012-05-04 | 195 | per start date (anniversary), % per month |
| Savings, deposits up to 2012-05-03 | 25 | per start date (anniversary), % per month |

SGS limits daily series queries to 10 years per call. The Actor splits longer ranges automatically. No personal data is collected.

If the SGS API does not answer, the Actor uses a reference copy of the series bundled in it. Some Brazilian government APIs refuse requests from servers outside Brazil, so this can happen. Each result says which origin was used.

**Not affiliated with, endorsed by or sponsored by the Banco Central do Brasil, IBGE, FGV or Fipe.** This is an independent tool that uses their public data.

#### Accuracy

The automated tests check the IPCA results against three published Calculadora do Cidadão results:

- 12/2019–12/2023: factor 1.2877474, and R$ 2,000.00 becomes R$ 2,575.49.
- 11/2020–10/2021: factor 1.1067267.
- 08/2024–07/2025: factor 1.0522522, and R$ 1,000.00 becomes R$ 1,052.25.

They also check the published yearly totals for INPC and IGP-M in 2023. The Calculadora do Cidadão may differ slightly for Selic and savings at the edges of a period, because some of its rules are not documented. For legal calculations, check the convention that the court or contract requires.

This Actor does one thing: monetary correction with Central Bank data. Company registry data and public contracts are in other Actors from the same publisher.

### More questions

#### Why does Jan–Dec count 12 months of IPCA?

For monthly price indices (IPCA, INPC, IGP-M, IGP-DI, IPC-Fipe) the Actor follows the Calculadora do Cidadão: the start month and the end month are both included, and the day of the month is ignored. Correcting from `2023-01` to `2023-12` compounds the 12 monthly variations of 2023. If your contract counts differently, shift `startDate` by one month.

#### What if the index for the end month is not out yet?

IBGE and FGV publish a month's variation only in the following month. A request whose end month is not yet in SGS comes back with the `error` field explaining which month is missing, and it is not charged. The other requests of the run are calculated normally.

#### Can I calculate "110% of CDI" or a court debt by Selic?

Yes. Use `"index": "CDI"` or `"SELIC"` with `"percentOfIndex": 110` (default 100). The daily rate of each business day from the start date (included) to the end date (excluded) is compounded, and the result shows `businessDays`. `percentOfIndex` is rejected for the other indices. The Actor does not add late-payment interest or fines on top: it returns the correction only.

#### How do I correct a whole spreadsheet?

Send each row as an object in `calculations`, up to 10,000 per run, with an `id` from your sheet so you can match the results back. Each index is downloaded once per run, so a large batch makes no extra calls to the Central Bank. Turn off `includeBreakdown` for a smaller output.

#### Which date formats and index names are accepted?

Dates as `YYYY-MM-DD`, `YYYY-MM`, `DD/MM/YYYY` or `MM/YYYY`; a month-only date means day 1. Index names ignore case, accents, spaces and hyphens, so `igpm`, `IGP-M` and `Poupança` all work. `DI` is read as CDI and `FIPE` as IPC-Fipe.

#### How is savings (poupança) calculated?

By complete monthly anniversaries only, as in a real savings account: an incomplete last month earns nothing, and deposits on days 29 to 31 have their anniversary on day 1 of the next month. Deposits up to 2012-05-03 follow the old rule (0.5% a month + TR) and deposits from 2012-05-04 follow Law 12,703/2012, using the Central Bank series for each.

#### Will the result match the Calculadora do Cidadão?

For IPCA, the tests reproduce three published Calculadora do Cidadão results to the 7th decimal of the factor, and the factor is rounded to 7 decimals as the Calculadora does. For Selic and savings, small differences can appear at the edges of a period, because the Calculadora does not document every convention. Each result describes the rule applied in `rule`.

#### Can I get just the index values?

Yes: `"mode": "series"` with `seriesIndices` (for example `["IPCA", "SELIC"]`), `seriesStartDate` and `seriesEndDate` returns one item per index with all the values in the period. Each series returned is one `calculation` event.

### Use it via API

Run it from any language and get the results as JSON. Replace `<YOUR_API_TOKEN>` with your [Apify API token](https://console.apify.com/settings/integrations).

```bash
curl -X POST "https://api.apify.com/v2/acts/br_data_hub~br-monetary-correction/run-sync-get-dataset-items?token=<YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"calculations": [{"id": "rent-contract", "amount": 2000, "startDate": "2019-12", "endDate": "2023-12", "index": "IPCA"}, {"id": "court-debt", "amount": 10000, "startDate": "2024-01-02", "endDate": "2024-12-31", "index": "SELIC"}, {"id": "savings", "amount": 1000, "startDate": "2023-01-15", "endDate": "2024-01-15", "index": "POUPANCA"}, {"id": "lease", "amount": 5000, "startDate": "2023-01", "endDate": "2023-12", "index": "IGP-M"}], "seriesIndices": ["IPCA", "IGP-M"]}'
```

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("br_data_hub/br-monetary-correction").call(run_input={'calculations': [{'id': 'rent-contract',
                                                        'amount': 2000,
                                                        'startDate': '2019-12',
                                                        'endDate': '2023-12',
                                                        'index': 'IPCA'},
                                                       {'id': 'court-debt',
                                                        'amount': 10000,
                                                        'startDate': '2024-01-02',
                                                        'endDate': '2024-12-31',
                                                        'index': 'SELIC'},
                                                       {'id': 'savings',
                                                        'amount': 1000,
                                                        'startDate': '2023-01-15',
                                                        'endDate': '2024-01-15',
                                                        'index': 'POUPANCA'},
                                                       {'id': 'lease',
                                                        'amount': 5000,
                                                        'startDate': '2023-01',
                                                        'endDate': '2023-12',
                                                        'index': 'IGP-M'}],
                                      'seriesIndices': ['IPCA', 'IGP-M']})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

You can also schedule runs, send results to webhooks, or connect the Actor to Make, Zapier, n8n, Google Sheets and other [integrations](https://docs.apify.com/platform/integrations).

### Use it with AI agents (MCP)

This Actor is ready for AI agents: typed input and output schemas, pay-per-event pricing, limited permissions and short runs.

- **Apify MCP server:** add `https://mcp.apify.com/?tools=br_data_hub/br-monetary-correction` to Claude, ChatGPT, Cursor, VS Code or any MCP client, and the agent can call this Actor as a tool.
- **Agent frameworks:** call it from LangChain, LlamaIndex, CrewAI or the OpenAI Agents SDK through the Apify integrations, or with the API call above.
- Results come as structured JSON with stable field names, documented in the **Output** tab.

### FAQ

#### Where does the data come from?

**Banco Central do Brasil, SGS (Sistema Gerenciador de Séries Temporais)**, the public API `https://api.bcb.gov.br/dados/serie/bcdata.sgs.{code}/dados?formato=json&dataInicial=dd/mm/aaaa&dataFinal=dd/mm/aaaa`. No key is needed. The Central Bank publishes the series on its open data portal (dadosabertos.bcb.gov.br) under the **Open Data Commons Open Database License (ODbL)**: commercial use is allowed with attribution. Each result links to its source series. The price indices are produced by IBGE (IPCA, INPC), FGV (IGP-M, IGP-DI) and Fipe (IPC-Fipe), and the Central Bank republishes them in SGS.

#### How much does it cost?

$0.003 per calculation. Discounts follow your Apify subscription tier: Bronze 10%, Silver 20%, Gold and above 30%. See **How much does it cost?** above for examples.

#### Do I pay for errors or empty results?

No. Charged once per correction calculated. Rows with errors are free.

#### Can I run it on a schedule or connect it to other tools?

Yes. Use Apify schedules to run it daily or weekly, webhooks to get notified, and integrations such as Make, Zapier, n8n and Google Sheets. Everything also works through the API.

#### Can AI agents use it?

Yes. It works as a tool in the Apify MCP server and in agent frameworks, and AI agents can pay per event. See **Use it with AI agents (MCP)**.

#### Is it legal to use this data?

The Actor reads only public, official sources and keeps personal data masked as the source publishes it. You are responsible for how you use the data, including LGPD compliance.

#### I found a bug or need a feature. What should I do?

Open an issue in the **Issues** tab. We answer within 14 days, usually much sooner.

### More Actors from BR Data Hub

| Actor | What it does |
|---|---|
| [Brazil Exchange Rates API (Cotação PTAX)](https://apify.com/br_data_hub/br-exchange-rates) | Get official PTAX exchange rates from Banco Central do Brasil: buy and sell rates in BRL, parities and bulleti |
| [Brazil Treasury Bonds API (Tesouro Direto)](https://apify.com/br_data_hub/br-tesouro-direto) | Daily rates and unit prices of Brazilian Treasury bonds (Tesouro Direto: Selic, Prefixado, IPCA+, Renda+, Educ |
| [Brazil Company Financials (CVM DFP/ITR, B3)](https://apify.com/br_data_hub/br-cvm-company-financials) | Standardized financial statements of Brazilian listed companies from CVM open data (DFP annual, ITR quarterly) |
| [Brazil Investment Fund Returns (Fundos CVM)](https://apify.com/br_data_hub/br-cvm-fund-performance) | Ready-made performance metrics for Brazilian investment funds from CVM open data: period, YTD and 12-month ret |
| [Brazil Fuel Prices by City (ANP Combustíveis)](https://apify.com/br_data_hub/br-anp-fuel-prices) | Weekly fuel prices in Brazil from the ANP open data survey (not affiliated with the ANP): average, minimum, ma |

See all our Actors at [apify.com/br_data_hub](https://apify.com/br_data_hub).

### Usar em português

Calculadora de **correção monetária em lote**, com os dados oficiais do **Banco Central (SGS)**: IPCA, INPC, IGP-M, IGP-DI, IPC-Fipe, Selic, CDI, TR e poupança. Para cada valor, devolve o valor corrigido, o fator, a variação acumulada em % e a composição mês a mês, com as regras da Calculadora do Cidadão.

**Para que serve:** reajuste de aluguel e de contratos (IGP-M, IPCA), atualização de débitos pela Selic, comparação de um investimento com o CDI ou a poupança, atualização de uma planilha inteira de parcelas, ou como ferramenta de inflação confiável para um agente de IA. A Calculadora do Cidadão faz um valor por vez num formulário; aqui são até 10.000 por execução, também pela API.

**Como usar em 3 passos:**

1. Em `calculations`, coloque um objeto por valor: `amount` (valor em reais), `startDate` e `endDate` (AAAA-MM-DD, AAAA-MM, DD/MM/AAAA ou MM/AAAA) e `index`.
2. Opcional: `id` para casar o resultado com a sua planilha e, só para Selic e CDI, `percentOfIndex` (por exemplo 110 para 110% do CDI). Desligue `includeBreakdown` se não quiser a composição mês a mês.
3. Rode e baixe o resultado em JSON, CSV ou Excel. Para receber só os números do índice, use `"mode": "series"` com `seriesIndices`, `seriesStartDate` e `seriesEndDate`.

**Exemplo de entrada:**

```json
{"calculations": [
  {"id": "aluguel", "amount": 2000, "startDate": "2019-12", "endDate": "2023-12", "index": "IPCA"},
  {"id": "aplicacao", "amount": 5000, "startDate": "2024-01-02", "endDate": "2024-12-31", "index": "CDI", "percentOfIndex": 110}
]}
```

**Regras aplicadas** (descritas também no campo `rule` de cada resultado):

- Índices mensais: contam o mês inicial e o final; o dia é ignorado. De janeiro a dezembro são 12 meses.
- Selic e CDI: taxa diária de cada dia útil, da data inicial (incluída) até a final (excluída).
- TR e poupança: só aniversários completos; depósitos nos dias 29 a 31 fazem aniversário no dia 1º do mês seguinte. A poupança segue a regra antiga (0,5% + TR) até 03/05/2012 e a nova (Lei 12.703/2012) a partir de 04/05/2012.
- O fator é arredondado em 7 casas, como na Calculadora do Cidadão; o valor corrigido, em centavos.

**Campos principais:** `id`, `index`, `amount`, `correctedAmount` (valor corrigido), `factor`, `accumulatedPercent`, `periods`, `businessDays` (Selic e CDI), `breakdown` (composição), `rule`, `source` (série no SGS), `dataOrigin` e `error`.

**Bom saber:**

- O índice de um mês só sai no mês seguinte. Pedido cujo mês final ainda não foi publicado volta com `error` e não é cobrado.
- O Actor calcula só a correção: não soma juros de mora nem multa.
- Se a API do Banco Central não responder, o Actor usa uma cópia de referência embutida e informa isso em `dataOrigin`.

**O que é grátis:** pedidos com erro (índice desconhecido, data inválida, mês ainda não publicado). Você paga por valor corrigido ou série devolvida (evento `calculation`), mais o evento padrão de início de execução da Apify (`apify-actor-start`). Ferramenta independente, sem vínculo com o Banco Central, o IBGE, a FGV ou a Fipe.

**Quanto custa:** $0.003 por resultado (`calculation`); 1.000 resultados saem por $3.00. Desconto pelo nível da assinatura Apify: Bronze 10%, Silver 20%, Gold ou acima 30%. Erros e consultas sem resultado não são cobrados. Use também pela API ou por agentes de IA no servidor MCP da Apify (`https://mcp.apify.com/?tools=br_data_hub/br-monetary-correction`).

# Actor input Schema

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

Choose Correct amounts to correct each item of Calculations (one charge per corrected amount), or Raw index series to get the index values of the Series section (one charge per series).

## `calculations` (type: `array`):

Enter a JSON list of objects such as {"amount": 1000, "startDate": "2023-01", "endDate": "2023-12", "index": "IPCA"}. Index: IPCA, INPC, IGP-M, IGP-DI, IPC-FIPE, SELIC, CDI, TR or POUPANCA. Dates: YYYY-MM-DD, YYYY-MM, DD/MM/YYYY or MM/YYYY. Monthly price indices use whole months, both included; SELIC and CDI use business days from startDate (included) to endDate (excluded); TR and POUPANCA use complete monthly anniversaries. Optional: "id" (echoed in the output) and "percentOfIndex" (SELIC/CDI only, e.g. 110 for 110% of CDI). Up to 10,000 items.

## `includeBreakdown` (type: `boolean`):

Keep on to add the rate, factor, cumulative factor and corrected amount of every month (or anniversary period) to each result. Turn off for smaller output.

## `seriesIndices` (type: `array`):

Enter the indices to return as raw SGS values, one per line, e.g. IPCA, SELIC, POUPANCA. One charge per series returned.

## `seriesStartDate` (type: `string`):

Type the first date or month, e.g. 2024-01 or 2024-01-15.

## `seriesEndDate` (type: `string`):

Type the last date or month, included, e.g. 2024-12 (a month means its last day for daily series).

## Actor input object example

```json
{
  "mode": "correction",
  "calculations": [
    {
      "id": "rent-contract",
      "amount": 2000,
      "startDate": "2019-12",
      "endDate": "2023-12",
      "index": "IPCA"
    },
    {
      "id": "court-debt",
      "amount": 10000,
      "startDate": "2024-01-02",
      "endDate": "2024-12-31",
      "index": "SELIC"
    },
    {
      "id": "savings",
      "amount": 1000,
      "startDate": "2023-01-15",
      "endDate": "2024-01-15",
      "index": "POUPANCA"
    },
    {
      "id": "lease",
      "amount": 5000,
      "startDate": "2023-01",
      "endDate": "2023-12",
      "index": "IGP-M"
    }
  ],
  "includeBreakdown": true,
  "seriesIndices": [
    "IPCA",
    "IGP-M"
  ],
  "seriesStartDate": "2024-01",
  "seriesEndDate": "2024-12"
}
```

# Actor output Schema

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

Dataset with all results

# 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 = {
    "calculations": [
        {
            "id": "rent-contract",
            "amount": 2000,
            "startDate": "2019-12",
            "endDate": "2023-12",
            "index": "IPCA"
        },
        {
            "id": "court-debt",
            "amount": 10000,
            "startDate": "2024-01-02",
            "endDate": "2024-12-31",
            "index": "SELIC"
        },
        {
            "id": "savings",
            "amount": 1000,
            "startDate": "2023-01-15",
            "endDate": "2024-01-15",
            "index": "POUPANCA"
        },
        {
            "id": "lease",
            "amount": 5000,
            "startDate": "2023-01",
            "endDate": "2023-12",
            "index": "IGP-M"
        }
    ],
    "seriesIndices": [
        "IPCA",
        "IGP-M"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("br_data_hub/br-monetary-correction").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 = {
    "calculations": [
        {
            "id": "rent-contract",
            "amount": 2000,
            "startDate": "2019-12",
            "endDate": "2023-12",
            "index": "IPCA",
        },
        {
            "id": "court-debt",
            "amount": 10000,
            "startDate": "2024-01-02",
            "endDate": "2024-12-31",
            "index": "SELIC",
        },
        {
            "id": "savings",
            "amount": 1000,
            "startDate": "2023-01-15",
            "endDate": "2024-01-15",
            "index": "POUPANCA",
        },
        {
            "id": "lease",
            "amount": 5000,
            "startDate": "2023-01",
            "endDate": "2023-12",
            "index": "IGP-M",
        },
    ],
    "seriesIndices": [
        "IPCA",
        "IGP-M",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("br_data_hub/br-monetary-correction").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 '{
  "calculations": [
    {
      "id": "rent-contract",
      "amount": 2000,
      "startDate": "2019-12",
      "endDate": "2023-12",
      "index": "IPCA"
    },
    {
      "id": "court-debt",
      "amount": 10000,
      "startDate": "2024-01-02",
      "endDate": "2024-12-31",
      "index": "SELIC"
    },
    {
      "id": "savings",
      "amount": 1000,
      "startDate": "2023-01-15",
      "endDate": "2024-01-15",
      "index": "POUPANCA"
    },
    {
      "id": "lease",
      "amount": 5000,
      "startDate": "2023-01",
      "endDate": "2023-12",
      "index": "IGP-M"
    }
  ],
  "seriesIndices": [
    "IPCA",
    "IGP-M"
  ]
}' |
apify call br_data_hub/br-monetary-correction --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,br_data_hub/br-monetary-correction"
        }
    }
}
```

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/v00bHcfTxvTZC5T96/builds/MfcTJGo8yoIx4HHY8/openapi.json
