# Brazil Electricity Tariffs — Tarifas de Energia ANEEL (`matheus_dev_natal/brazil-electricity-tariffs-aneel`) Actor

Get Brazilian electricity tariffs (TUSD/TE) by utility, compare tariffs across utilities, and read the current tariff flag — straight from ANEEL's official open data API. No scraping, no proxy.

- **URL**: https://apify.com/matheus\_dev\_natal/brazil-electricity-tariffs-aneel.md
- **Developed by:** [Matheus Coelho](https://apify.com/matheus_dev_natal) (community)
- **Categories:** Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.60 / 1,000 results

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Brazil Electricity Tariffs — Tarifas de Energia ANEEL

Get Brazilian electricity tariffs (TUSD and TE) by utility, compare tariffs across all utilities, and read the current tariff flag — straight from **ANEEL's official open data API** (`dadosabertos.aneel.gov.br`). No scraping, no browser, no proxy: it is a plain HTTP call to a public government API.

*Consulte tarifas de energia elétrica (TUSD/TE) por distribuidora, compare tarifas entre distribuidoras e veja a bandeira tarifária vigente, direto da API oficial de dados abertos da ANEEL.*

### What it does

Three query modes:

- **`tarifas_distribuidora`** — current TUSD/TE tariffs for one specific utility (e.g. EDP ES, CPFL PAULISTA, ENEL SP), filtered by subgroup (B1-B4) and tariff modality.
- **`ranking`** — compares the full tariff (TUSD+TE) across every utility in Brazil for the same subgroup/modality, cheapest to most expensive.
- **`bandeira`** — the tariff flag in force (or for a given month) and the surcharge it adds, in both R$/MWh (ANEEL's original unit) and R$/kWh (the unit on the consumer's bill).

### What it does NOT do

- Does not compute your final electricity bill — it excludes ICMS/PIS/COFINS taxes, which vary by state and are not part of this data source.
- Does not cover distributed generation / net metering (SCEE).
- Does not cover discounted tariffs (tarifa social, baixa renda) — always the standard full tariff for the subgroup.
- Does not cover group A (high voltage) in this version — only group B (B1-B4, low voltage).

### Output example

```json
{
  "mode": "tarifas_distribuidora",
  "coletadoEm": "2026-08-20T16:44:59Z",
  "distribuidora": "EDP ES",
  "cnpjDistribuidora": "28152650000171",
  "subgrupo": "B1",
  "modalidadeTarifaria": "Convencional",
  "classeConsumo": "Residencial",
  "postoTarifario": "Não se aplica",
  "unidade": "MWh",
  "tarifaTUSD": 506.32,
  "tarifaTE": 337.39,
  "inicioVigencia": "2026-08-07",
  "fimVigencia": "2027-08-06",
  "resolucaoHomologatoria": "RESOLUÇÃO HOMOLOGATÓRIA Nº 3.600, DE 31 DE JULHO DE 2026"
}
```

### How to use

Pick a mode and fill the matching filters. No proxy or advanced setup needed — the source is a public API with no IP blocking.

- Mode `tarifas_distribuidora`: set `distribuidora` to the exact utility code (see the [official list](https://dadosabertos.aneel.gov.br/dataset/tarifas-distribuidoras-energia-eletrica)).
- Mode `ranking`: no `distribuidora` needed — it compares all of them at once.
- Mode `bandeira`: optionally set `competencia` (`YYYY-MM`); leave blank for the most recent months.

### Who uses it

- **Energy consultancies & efficiency firms** — benchmark tariffs across utilities and regions.
- **Industry, retail & logistics** — track energy cost per site.
- **Fintechs & insurers** — feed cost models with official tariff data.
- **Solar / distributed generation platforms** — compare against the grid tariff.
- **Journalists & researchers** — official, citable tariff data with the resolution number.

### Known limitations

- Covers group B only (low voltage: residential, rural, commercial/industrial, public lighting). Group A (high voltage) is planned for a future version.
- Consumption class is determined by the subgroup (B1=Residential, B2=Rural, B3=not applicable — single tariff, B4=Public lighting). It is not a free choice, because ANEEL does not allow arbitrary combinations.
- B4 (public lighting) uses subclass "B4a" (street lighting) only — B4b exists in the source but is not covered in this version.
- Not every subgroup + modality combination exists (e.g. B4 has no "Branca" modality) — the Actor returns an empty dataset with a clear warning in those cases, not an error.
- `ranking` uses each utility's canonical line (full tariff, no discount, no SCEE) and only considers utilities whose tariff is **still in force today** — a merged or inactive utility does not enter the comparison even if it has history in the dataset.
- Utilities that were merged or renamed stop receiving new homologated tariffs under the old code — if a name returns nothing in `tarifas_distribuidora`, check the current code on ANEEL's portal.

### Pricing

**US$ 0.003 per delivered record**, no start fee. You only pay for items actually written to your dataset — the Actor honours `maxItems` strictly.

### Data source

ANEEL Open Data Portal — [dadosabertos.aneel.gov.br](https://dadosabertos.aneel.gov.br/). Datasets: [utility tariffs](https://dadosabertos.aneel.gov.br/dataset/tarifas-distribuidoras-energia-eletrica) and [tariff flags](https://dadosabertos.aneel.gov.br/dataset/bandeiras-tarifarias). ODbL licence.

*This Actor is unofficial and is not affiliated with or endorsed by ANEEL. It collects publicly available open data only.*

# Actor input Schema

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

'Tarifas de uma distribuidora' devolve TUSD/TE vigentes de uma distribuidora. 'Ranking' compara a tarifa cheia (TUSD+TE) entre todas as distribuidoras para o mesmo subgrupo/modalidade, da mais barata pra mais cara. 'Bandeira tarifária' devolve o adicional cobrado no mês (nacional).

## `distribuidora` (type: `string`):

Sigla do agente conforme cadastro da ANEEL, ex.: 'EDP ES', 'CPFL PAULISTA', 'ENEL SP', 'LIGHT'. Só usado no modo 'Tarifas de uma distribuidora'. Consulte a lista oficial em dadosabertos.aneel.gov.br.

## `subgrupo` (type: `string`):

A classe de consumo (residencial, rural, etc.) já é determinada pelo subgrupo escolhido — não existe como opção separada na ANEEL, por isso não é um campo aqui. B1 é residencial — deixe assim se não tiver certeza. Usado nos modos 'Tarifas de uma distribuidora' e 'Ranking'. Só cobre grupo B (baixa tensão, tarifa em R$/MWh) — grupo A tem componente de demanda (kW) separado e não entra numa comparação direta nesta versão.

## `modalidadeTarifaria` (type: `string`):

Modalidade de cobrança contratada. A maioria dos consumidores do grupo B está na Convencional. Azul/Verde são modalidades do grupo A (fora do escopo desta versão). Usado nos modos 'Tarifas de uma distribuidora' e 'Ranking'.

## `competencia` (type: `string`):

Formato AAAA-MM. Deixe em branco para o mês corrente. Só usado no modo 'Bandeira tarifária'.

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

Número máximo de registros retornados nesta execução. O actor para assim que atingir esse limite — você não paga por nenhum item além do pedido.

## `proxyConfiguration` (type: `object`):

Não é necessário na maioria dos casos — a API da ANEEL responde à conexão direta. Ligue apenas se o run falhar com erro de SSL (o portal às vezes bloqueia IPs de datacenter); nesse caso, proxy residencial com país Brasil é o mais confiável.

## Actor input object example

```json
{
  "mode": "tarifas_distribuidora",
  "distribuidora": "EDP ES",
  "subgrupo": "B1",
  "modalidadeTarifaria": "Convencional",
  "maxItems": 10,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Todos os registros coletados nesta execução, em JSON.

## `resultsCsv` (type: `string`):

Os mesmos registros em CSV, prontos para abrir em Excel ou Google Sheets.

# 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 = {
    "mode": "tarifas_distribuidora",
    "distribuidora": "EDP ES",
    "subgrupo": "B1",
    "modalidadeTarifaria": "Convencional",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("matheus_dev_natal/brazil-electricity-tariffs-aneel").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 = {
    "mode": "tarifas_distribuidora",
    "distribuidora": "EDP ES",
    "subgrupo": "B1",
    "modalidadeTarifaria": "Convencional",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("matheus_dev_natal/brazil-electricity-tariffs-aneel").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 '{
  "mode": "tarifas_distribuidora",
  "distribuidora": "EDP ES",
  "subgrupo": "B1",
  "modalidadeTarifaria": "Convencional",
  "maxItems": 10
}' |
apify call matheus_dev_natal/brazil-electricity-tariffs-aneel --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,matheus_dev_natal/brazil-electricity-tariffs-aneel"
        }
    }
}

```

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/kCjQ4qMSTKQpGbvps/builds/ZeGfaeJ9zWJdYmDbH/openapi.json
