# Encuestas Electorales LatAm API: Argentina, Brasil, Chile, Perú (`tuneup_argentina/latam-encuestas`) Actor

Encuestas electorales de Argentina y LatAm normalizadas: encuestadora, fecha, muestra, candidato y %. Election opinion polls dataset from Wikipedia (CC BY-SA).

- **URL**: https://apify.com/tuneup_argentina/latam-encuestas.md
- **Developed by:** [Luis Santangelo](https://apify.com/tuneup_argentina) (community)
- **Categories:** News, Business, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 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.

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

## 🗳️ Encuestas Electorales LatAm — Election Opinion Polls for Argentina, Brazil, Chile, Peru & more

Turn Wikipedia's opinion-polling tables into a **clean, long-format dataset**: one row per poll × candidate with **pollster, fieldwork date, sample size, margin of error, candidate/party and %**. Works with any "Opinion polling for the … election" page in English, Spanish or Portuguese Wikipedia — Argentina, Brazil, Chile, Peru, Colombia, Mexico, Uruguay…

**Source:** official [MediaWiki API](https://www.mediawiki.org/wiki/API:Parse) (no HTML scraping, no login). Content is © Wikipedia contributors under **CC BY-SA 4.0**; every row carries `sourceUrl`, `revisionId` and `license` so you can attribute and reproduce.

### Input

- `pages`: list of page titles, optional language prefix (`en:`, `es:`, `pt:`). Default: Brazil 2026, Peru 2026, Chile 2025, Argentina 2023. Add the Argentina 2027 page as soon as Wikipedia creates it.
- `maxPollsPerPage`: default 15 (0 = all, can be thousands of rows) · `sinceYear`: e.g. `2026`

### Output

Example row (illustrative):
`{"page":"Opinion polling for the 2026 Brazilian presidential election","section":"Aug–Oct (Campaign period)","pollster":"Quaest","fieldworkDate":"2–4 Oct 2026","sampleSize":2004,"marginOfError":"2%","candidate":"Lula PT","percent":44,"isElectionResult":false,"sourceUrl":"…","revisionId":1380570709,"license":"CC BY-SA 4.0 (Wikipedia contributors)"}`

Rows for actual election results (pollster "Results") are flagged with `isElectionResult: true`. Undecided/blank/"others" columns are skipped.

### Use cases

Poll trackers and averages, newsroom charts, political research, prediction models, Google Sheets/Looker dashboards, AI agents. Schedule daily during campaigns.

### Limitations

Wikipedia tables differ by page and are edited by volunteers; column detection is heuristic. Check `section`/`tableIndex` when a page has several scenarios (first round, runoff, etc.).

***

### 🇪🇸 En español

Encuestas electorales de Argentina y Latinoamérica en un dataset limpio: **encuestadora, fecha de campo, muestra, margen de error, candidato/partido y %**, una fila por encuesta y candidato. Toma las tablas de "Opinion polling / Encuestas" de Wikipedia mediante su API oficial (licencia CC BY-SA 4.0, con atribución en cada fila). Ideal para promedios de encuestas, gráficos periodísticos, investigación y tableros. Programalo diario en campaña.

*Data as-is from Wikipedia contributors (CC BY-SA 4.0). Not affiliated with any pollster.*

# Actor input Schema

## `pages` (type: `array`):

Opinion-polling page titles, optionally prefixed with language (en:, es:, pt:). Default: Brazil 2026, Peru 2026, Chile 2025, Argentina 2023.

## `maxPollsPerPage` (type: `integer`):

Most recent polls per page (top of the tables). 0 = all (can be thousands of rows).

## `sinceYear` (type: `integer`):

Keep polls whose fieldwork date mentions this year or later.

## Actor input object example

```json
{
  "pages": [
    "en:Opinion polling for the 2026 Brazilian presidential election",
    "en:Opinion polling for the 2023 Argentine general election"
  ],
  "maxPollsPerPage": 15
}
```

# Actor output Schema

## `overview` (type: `string`):

Polls (one row per poll × candidate)

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

Item count and errors.

# 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 = {
    "pages": [
        "en:Opinion polling for the 2026 Brazilian presidential election",
        "en:Opinion polling for the 2023 Argentine general election"
    ],
    "maxPollsPerPage": 15
};

// Run the Actor and wait for it to finish
const run = await client.actor("tuneup_argentina/latam-encuestas").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 = {
    "pages": [
        "en:Opinion polling for the 2026 Brazilian presidential election",
        "en:Opinion polling for the 2023 Argentine general election",
    ],
    "maxPollsPerPage": 15,
}

# Run the Actor and wait for it to finish
run = client.actor("tuneup_argentina/latam-encuestas").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 '{
  "pages": [
    "en:Opinion polling for the 2026 Brazilian presidential election",
    "en:Opinion polling for the 2023 Argentine general election"
  ],
  "maxPollsPerPage": 15
}' |
apify call tuneup_argentina/latam-encuestas --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tuneup_argentina/latam-encuestas"
        }
    }
}
```

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/DKjEj9rYJieDGihAv/builds/0oMDWV4ClkGC9ppIL/openapi.json
