{
  "openapi": "3.0.1",
  "info": {
    "title": "Brazilian Politics Data API",
    "description": "Official Brazilian politics data in one format: deputies, senators, their expenses and votes, bills, TSE candidates and assets, budget amendments, municipal gazettes and SAPL legislatures. Run as a job or as an HTTP API.",
    "version": "0.1",
    "x-build-id": "ZjoMiqBvCitlYjbl3"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/elaborate_guide~brasil-politica/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-elaborate_guide-brasil-politica",
        "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/elaborate_guide~brasil-politica/runs": {
      "post": {
        "operationId": "runs-sync-elaborate_guide-brasil-politica",
        "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/elaborate_guide~brasil-politica/run-sync": {
      "post": {
        "operationId": "run-sync-elaborate_guide-brasil-politica",
        "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",
        "properties": {
          "datasets": {
            "title": "What to fetch",
            "type": "array",
            "description": "One or more datasets. They run in parallel and land in the same output, each row tagged with its `dataset`.",
            "items": {
              "type": "string",
              "enum": [
                "camara.deputados",
                "camara.despesas",
                "camara.votacoes",
                "camara.proposicoes",
                "senado.senadores",
                "senado.despesas",
                "senado.votacoes",
                "tse.candidatos",
                "tse.bens",
                "transparencia.emendas",
                "diarios.publicacoes",
                "sapl.parlamentares",
                "sapl.materias"
              ],
              "enumTitles": [
                "Câmara — federal deputies",
                "Câmara — deputies' expenses (cota parlamentar)",
                "Câmara — plenary votes",
                "Câmara — bills (proposições)",
                "Senado — senators",
                "Senado — senators' expenses (CEAPS)",
                "Senado — plenary votes",
                "TSE — election candidates",
                "TSE — candidates' declared assets",
                "Portal da Transparência — budget amendments (needs API key)",
                "Diários oficiais municipais (Querido Diário)",
                "SAPL — state/city legislators",
                "SAPL — state/city bills"
              ]
            },
            "default": [
              "camara.deputados"
            ]
          },
          "maxItemsPerDataset": {
            "title": "Max records per dataset",
            "minimum": 1,
            "type": "integer",
            "description": "Stops each dataset after this many records.",
            "default": 200
          },
          "name": {
            "title": "Politician name",
            "type": "string",
            "description": "Part of a name, accents and case ignored, e.g. \"tabata\" or \"Randolfe\". With vote datasets, returns how this person voted."
          },
          "politicianId": {
            "title": "Politician ID",
            "type": "string",
            "description": "The source's own ID (Câmara deputy id, Senado código parlamentar, TSE SQ_CANDIDATO, SAPL id). Taken from `politician.id` in earlier results."
          },
          "uf": {
            "title": "States (UF)",
            "type": "array",
            "description": "Two-letter state codes, e.g. SP, RJ. Strongly recommended for TSE datasets, which otherwise download every state.",
            "items": {
              "type": "string"
            }
          },
          "party": {
            "title": "Parties",
            "type": "array",
            "description": "Party acronyms, e.g. PT, PL, MDB.",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Keywords",
            "type": "string",
            "description": "Searches bill summaries, vote descriptions, expense categories/suppliers, assets and gazette text."
          },
          "dateFrom": {
            "title": "From date",
            "type": "string",
            "description": "YYYY-MM-DD. Used by votes, bills, gazettes and expenses. Default: 30 days ago."
          },
          "dateTo": {
            "title": "To date",
            "type": "string",
            "description": "YYYY-MM-DD. Default: today."
          },
          "year": {
            "title": "Year (expenses, amendments)",
            "minimum": 2008,
            "type": "integer",
            "description": "Which year's expenses or amendments to read. Default: current year."
          },
          "month": {
            "title": "Month (expenses)",
            "minimum": 1,
            "maximum": 12,
            "type": "integer",
            "description": "Optional 1–12."
          },
          "includeVotes": {
            "title": "Include every individual vote",
            "type": "boolean",
            "description": "For vote datasets without a person filter, attach each legislator's vote and a tally to every voting session.",
            "default": false
          },
          "electionYear": {
            "title": "Election year (TSE)",
            "minimum": 2000,
            "type": "integer",
            "description": "e.g. 2022 (general) or 2024 (municipal). Default: the most recent election."
          },
          "office": {
            "title": "Office (TSE)",
            "type": "string",
            "description": "Exact office, accents and case ignored, e.g. VEREADOR, PREFEITO, VICE-PREFEITO, GOVERNADOR, DEPUTADO ESTADUAL, DEPUTADO FEDERAL, SENADOR."
          },
          "municipality": {
            "title": "Municipality (TSE)",
            "type": "string",
            "description": "City name for municipal elections, e.g. CAMPINAS."
          },
          "electedOnly": {
            "title": "Elected only (TSE)",
            "type": "boolean",
            "description": "Only candidates who won.",
            "default": false
          },
          "saplUrls": {
            "title": "SAPL legislatures",
            "type": "array",
            "description": "Base URLs of SAPL installs (many câmaras municipais and some assembleias), e.g. https://sapl.al.ac.leg.br",
            "items": {
              "type": "string"
            }
          },
          "territoryIds": {
            "title": "Cities for gazettes (IBGE codes)",
            "type": "array",
            "description": "7-digit IBGE codes, e.g. 3550308 (São Paulo), 3509502 (Campinas). Leave empty to search every covered city.",
            "items": {
              "type": "string"
            }
          },
          "transparenciaApiKey": {
            "title": "Portal da Transparência API key",
            "type": "string",
            "description": "Free key from portaldatransparencia.gov.br/api-de-dados/cadastrar-email. Only needed for budget amendments."
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}