API and widgets
Everything on Hola Política is open data under a CC-BY 4.0 licence. You can query the REST API directly, embed widgets on your site or download the full data. See methodology →
Public REST API
The API lives at https://api.holapolitica.org. Queries need no key; there is a per-IP limit meant for people, not for downloading everything. For the full data use the key-based downloads, which are free.
| Endpoint | Description |
|---|---|
GET /votes | Paginated list of votes. Filters: chamber_id, legislature_id, topic_slug, proposing_group_slug, result, date_from, date_to, q. |
GET /votes/{id} | A single vote: totals (yes, no, abstain, absent), description, file number, proposer, plain summary. |
GET /initiatives/{id} | Parliamentary initiative: original title, status, linked votes, topics. |
GET /topics | Closed topic taxonomy (17 editorial + 17 SDGs). Optional parameter kind=theme|sdg. |
GET /topics/{slug} | Topic detail with multilingual name and description. |
GET /topics/{slug}/initiatives | Initiatives classified under a topic. Filters: legislature_id, status. |
GET /groups | Active parliamentary groups. Filter: legislature_id. |
GET /groups/{slug} | A parliamentary group. |
GET /groups/{slug}/members | The group's sitting deputies with membership dates. |
GET /groups/{slug}/composition | Breakdown by gender, age and electoral party. |
GET /persons | Paginated list of deputies. Filters: q, legislature_id. |
GET /persons/{id} | Public deputy profile (never private data). |
GET /persons/{id}/kpis | Aggregate indicators: attendance, dissent, votes cast. |
GET /stats/summary | Global counts (initiatives, votes, classified). |
GET /metrics/cohesion?vote_id=N | Cohesion per group in a given vote. |
GET /metrics/coincidence?legislature_id=N | Full agreement matrix between pairs of groups. |
GET /metrics/attendance?legislature_id=N | Attendance per deputy over the requested period. |
GET /metrics/dissidence?legislature_id=N | Individual dissent from the group line. |
curl example - the five latest votes proposed by PSOE:
curl -s "https://api.holapolitica.org/votes?proposing_group_slug=psoe&page_size=5" \
| jq '.items[] | {id, title, voted_at, result}'Routes are stable; signature changes are announced in advance in the CHANGELOG.
Full downloads (free key)
The /dump/votes, /dump/initiatives, /dump/deputies and /dump/vote-records routes return the whole dataset in a few requests. They need a free key: ask for it here and you get it straight away. We only ask who you are, what you will use the data for, and that you credit Hola Política.
curl -s -H "X-API-Key: hp_…" "https://api.holapolitica.org/dump/votes"
Embeddable widgets
Widgets made for news articles: embed them with an <iframe>, with no third-party scripts or cookies. No trackers, loads in under a second, factual content only, credited to Hola Política with a link to the source.
| Route | What it shows | Height |
|---|---|---|
/embed/llei/{id} | A law in the site's design: plain headline, who it affects, result and each group's vote. | 620px |
/embed/ple/{data|darrer} | One day's plenary: figures, topics and each law with its result. “darrer” = the latest plenary. | 560px |
/embed/diputats/{província} | The deputies of a constituency, by party (the name as Congress writes it, URL-encoded). Add ?partit=gp-socialista (or any group slug) to show just one; readers can also switch it in the widget. | 760px |
/embed/votes/{id} | A vote's result: totals, proposer, stacked bar. | 320px |
/embed/groups/{slug} | Average cohesion, average attendance, group size. | 220px |
/embed/topics/{slug} | Breakdown of initiatives on the topic (passed, rejected, in progress). | 220px |
/embed/persons/{id} | Short deputy card: photo, group, indicators (attendance, dissent). | 220px |
/votes/{id}/opengraph-image | 1200×630 social image (PNG) for Open Graph and X. The same convention works for /groups/{slug}, /topics/{slug}, /persons/{id}, /initiatives/{id}, /stats. | - |
iframe example:
<iframe src="https://www.holapolitica.org/embed/votes/12345" width="100%" height="320" frameborder="0" sandbox="allow-scripts allow-same-origin" loading="lazy" title="Vote in Congress - Hola Política" ></iframe>
The sandbox is recommended but optional. If the height doesn't fit, adjust the height attribute: the content adapts to the width.
Data dictionary essentials
The most-used fields. The full definition is in the source code (models/__init__.py).
- vote.result:
approved|rejected|tie. A tie only when yes exactly equals no. - vote.proposed_by_government: boolean. When it is
true,proposing_group_slugis usuallynull: the government proposes, not a group. - vote.expediente_raw: Congress's official file code (e.g.
122/000262), the key for searching the original source. - initiative.type: enum of
proyecto_ley,proposicion_ley,proposicion_no_ley,real_decreto_ley,mocion,interpelacion,other. - cohesion: share of group members voting the same way as the group majority.
nullwhen fewer than 3 members vote. - coincidence: share of votes where two groups vote the same way (yes and yes, no and no, abstain and abstain).
- attendance: share of votes in which the deputy casts a vote (yes, no or abstain). Excused absences and leave count as absent because the source does not tell them apart.
- dissidence: share of votes where the deputy votes differently from their group's majority. Deputies holding an institutional post (government, Bureau) have values that are not comparable;
role_kindflags them.
Licences and attribution
- Data: CC-BY 4.0. Reuse it crediting Hola Política and the original source (Congreso de los Diputados).
- Source code: EUPL-1.2 (GitHub).
- Widgets and social images: free to use in media and on social networks, with the same attribution requirement.
Technical contact: dades@holapolitica.org.
If your newsroom needs a specific cut (say, all of a party's votes in a quarter), open an issue on the repository and we will prioritise it.
Open an issue on GitHub