ParseForge Scrapers

ONPE Peru Elections Results Scraper

parseforge/onpe-peru-elections-scraper

AutomationIntegrationsNews & media

Scrapes official Peruvian election results from ONPE by geographic level and round. Returns votes, percentages, and candidate totals as flat rows.

Run this scraper See the API call
Total users
1
Monthly active
0
Total runs
90
Bookmarked
0
Rating
Not rated yet
Last modified
8 days ago

Overview

ParseForge

ONPE Peru Elections Results Scraper

Scrape official Peru election results from ONPE, by department, province, or district, for both rounds of the 2021 general election. Every row includes votes, percentages, and candidate totals, ready for CSV, JSON, Excel, or XML.

ONPE publishes Peru's official election results on its public web portal, but the data is spread across pages and not built for bulk analysis. This Actor reads the results directly, filtered by geographic level and election round, and returns each match in one fixed schema. No login, no API key, no manual copying.

Who uses it What they scrape ONPE Peru for
Political analysts Compare vote distribution across departments and provinces
Journalists Verify official counts for election coverage
Academic researchers Build datasets for electoral studies
NGOs and observers Monitor regional turnout and results
Data engineers Feed election data into dashboards and models

What it does

This Actor collects official Peruvian election results from ONPE by geographic level and round, and returns each result as a flat row.

  • πŸ—ΊοΈ Geographic levels: national, department, province, or district results.
  • πŸ—³οΈ Both rounds: first round (Primera vuelta) and second round (Segunda vuelta).
  • πŸ“Š Structured rows: each result includes votes, percentages, and candidate totals.
  • ⚑ Bulk export: up to one million results per run, in CSV, JSON, Excel, or XML.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

What you can do with ONPE Peru data

πŸ“ˆ Track regional voting patterns.

A political analyst scrapes department-level results for both rounds to see how support shifted between candidates.

πŸ“° Verify election reporting.

A journalist pulls official district counts to fact-check numbers before publishing a story.

πŸŽ“ Build academic datasets.

A researcher collects province-level results to study turnout and vote share across Peru.

πŸ›‘οΈ Monitor electoral integrity.

An election observer scrapes national results to compare against preliminary counts and detect discrepancies.

πŸ“Š Feed dashboards and models.

A data engineer schedules regular runs to update a live dashboard with the latest official results.

Why choose this scraper

What you get
Official source Data comes directly from ONPE, Peru's electoral authority
No API key Scrapes the public web portal, no registration or OAuth
Flexible geography Get results at national, department, province, or district level
Both rounds First and second round of the 2021 general election
Bulk ready Export up to a million rows in common formats

How it compares

This Actor is the only one on Apify that scrapes official ONPE Peru election results. The competitors below target different sources, so this table shows how they compare on general scraping capabilities.

Feature ParseForge 🏯 Tiktok Scraper (Pay Per Result)
Scrapes ONPE Peru election results Yes Not listed
Geographic level filtering Yes Not listed
Election round selection Yes Not listed
Bulk export up to 1 million rows Yes Not listed
No API key required Yes Not listed

Configure the run

Drive the Actor by geographic level and election round, and set a maximum number of results to collect per run. The Input tab lists every parameter.

A first run with the defaults:

{
 "level": "DEPARTAMENTO",
 "round": "P",
 "maxItems": 10
}

A larger pull:

{
 "level": "DEPARTAMENTO",
 "round": "P",
 "maxItems": 200
}

Pricing

Pay-per-result: $0.0085 per result collected. You pay only for the results written to your dataset.

Results collected Approximate cost
100 results $0.85
1,000 results $8.50
10,000 results $85.00

New Apify accounts start with $5 in free credit.

Free users

Free-plan runs return up to 10 results as a preview. Upgrade your Apify plan to collect up to 1,000,000 results per run.

Run it

  1. Create a free Apify account with $5 in credit.
  2. Open the ONPE Peru Elections Results Scraper.
  3. Set your inputs and any filters, then click Start.
  4. Export the results as CSV, Excel, JSON, or XML from the Dataset tab.

Run it programmatically through the Apify API (run-sync-get-dataset-items) or the ApifyClient for JavaScript and Python.

Use with AI agents (MCP)

Give an AI agent live access to ONPE Peru through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

claude mcp add --transport http apify "https://mcp.apify.com?tools=parseforge/onpe-peru-elections-scraper"

Then prompt it in plain language to run the scraper and read back the results.

Troubleshooting

Why am I getting no results?

Check that the geographic level and round are valid. Also ensure maxItems is set to at least 1. If the problem persists, the ONPE website may have changed its structure.

The run is slow or times out.

Reduce maxItems or choose a higher geographic level like national or department, which returns fewer rows.

Some fields are empty in the output.

ONPE may not publish all data for every geographic unit. Empty fields mean the value was not available on the source page.

I get an error about the website.

ONPE may be temporarily unavailable. Retry the run later. If the error persists, contact support with the run ID.

FAQ

Question Answer
What elections does this Actor cover? It covers the 2021 Peruvian general election, both the first round (Primera vuelta) and the second round (Segunda vuelta).
Which geographic levels can I scrape? You can choose national, department, province, or district level results.
Do I need an API key or login? No. The Actor reads the public ONPE web portal directly, so no registration or authentication is required.
What data does each result include? Each row includes votes, percentages, and candidate totals for the selected geographic level and round.
Can I get both rounds in one run? No, each run is for one round. Run the Actor twice, once for the first round and once for the second.
How many results can I collect? You can set a maximum of up to one million results per run.
What export formats are supported? You can export to CSV, JSON, Excel, or XML.
Is the data official? Yes, the data comes directly from ONPE, Peru's official electoral authority.
Can I filter by candidate? No, the Actor returns all candidates for the selected geographic level and round. You can filter the output dataset afterwards.
Does this Actor work for other elections? Currently it is configured for the 2021 general election. Contact support if you need other elections.

Related actors

Browse the full ParseForge collection for more scrapers.

πŸ†˜ Need help? Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ Disclaimer. This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by Oficina Nacional de Procesos Electorales (ONPE). It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

Input

FieldTypeWhat it doesDefault
level string (2 options) Aggregation level for presidential results: national totals or per-department breakdown. DEPARTAMENTO
maxItems integer How many election result rows to collect per run. 10

Pricing

from $7.50 per 1,000 results

Charged forWhat it isPrice each
result Single result in the default dataset. $0.0075 to $0.0085

Tiered: the lower figure is the price on a higher Apify plan. Billing and the free credit live on Apify.

API

One POST returns the dataset directly. Same shape for every scraper in the library, so swapping the slug is the only change.

POST Β· run and get results
curl -X POST "https://api.apify.com/v2/acts/parseforge~onpe-peru-elections-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "helloWorld": 123
  }'

Examples

Input that runs as-is.

input.json
{
  "helloWorld": 123
}

Reviews

No reviews yet. Be the first.

Issues

We build and maintain this scraper, so a problem with it comes to us. Report it on the Apify listing and the thread stays attached to the scraper where the next person can find it: open an issue.

Broken and urgent, or you would rather not post in public? Write to parseforge@protonmail.com and it reaches the people who wrote it.

Related scrapers

Run ONPE Peru Elections Results Scraper on Apify All scrapers