{
  "openapi": "3.0.1",
  "info": {
    "title": "Brazil Electricity Tariffs — Tarifas de Energia ANEEL",
    "description": "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.",
    "version": "0.1",
    "x-build-id": "ZeGfaeJ9zWJdYmDbH"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/matheus_dev_natal~brazil-electricity-tariffs-aneel/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-matheus_dev_natal-brazil-electricity-tariffs-aneel",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/matheus_dev_natal~brazil-electricity-tariffs-aneel/runs": {
      "post": {
        "operationId": "runs-sync-matheus_dev_natal-brazil-electricity-tariffs-aneel",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/matheus_dev_natal~brazil-electricity-tariffs-aneel/run-sync": {
      "post": {
        "operationId": "run-sync-matheus_dev_natal-brazil-electricity-tariffs-aneel",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "mode",
          "maxItems"
        ],
        "properties": {
          "mode": {
            "title": "O que buscar",
            "enum": [
              "tarifas_distribuidora",
              "ranking",
              "bandeira"
            ],
            "type": "string",
            "description": "'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).",
            "default": "tarifas_distribuidora"
          },
          "distribuidora": {
            "title": "Distribuidora",
            "type": "string",
            "description": "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": {
            "title": "Subgrupo tarifário",
            "enum": [
              "B1",
              "B2",
              "B3",
              "B4"
            ],
            "type": "string",
            "description": "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.",
            "default": "B1"
          },
          "modalidadeTarifaria": {
            "title": "Modalidade tarifária",
            "enum": [
              "Convencional",
              "Branca"
            ],
            "type": "string",
            "description": "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'.",
            "default": "Convencional"
          },
          "competencia": {
            "title": "Mês de referência",
            "type": "string",
            "description": "Formato AAAA-MM. Deixe em branco para o mês corrente. Só usado no modo 'Bandeira tarifária'."
          },
          "maxItems": {
            "title": "Quantidade máxima de registros",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "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.",
            "default": 10
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "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.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}