Skip to content
Join the community

onpe-cli brings election results to the terminal

An agent-first CLI for ONPE election data: mesas, actas, rankings and summaries.

onpe-cli queries Peru's official election results API from the terminal. It is for journalists, analysts and AI agents that need mesas, actas and summaries as data instead of a web page. It needs no authentication. Docs are at onpe-cli.crafter.run.

The same command gives a human view on a terminal and JSON for an agent.

One output for people, one for agents#

On a terminal, onpe-cli resumen draws progress bars for counted actas and turnout. Piped or with --json, it returns JSON plus next-step hints that tell an agent which command to run after it.

From the national summary down to one mesa#

Look up a mesa by its code, read a full acta by ID, list ubigeos by department, province or district, or get a download URL for an acta file. onpe-cli doctor checks that the ONPE API is reachable before you start.

onpe-cli homepage: Query ONPE with one CLI
The homepage at onpe-cli.crafter.run.

Try it#

bun add -g @crafter/onpe-cli
onpe-cli resumen
onpe-cli mesa 900001 --json

Commands#

  • resumen: general election summary
  • ranking: national candidate ranking
  • mesa <codigo> and acta <id>: one mesa or acta in detail
  • ubigeos [nivel] [padre]: departments, provinces and districts
  • file-url <fileId>: download URL for an acta file
  • doctor: API connectivity and status