Elections & Votes: Open Data
Terms of use
Open use. Must provide the source.
You may use this dataset for non-commercial purposes.
You may use this dataset for commercial purposes.
You must provide the source (author, title and link to the dataset).
Introduction
There are JSON alternatives for all important views. All responses contain the Last-Modified
HTTP Header with the last time, the data has change (i.e. the last time, results of an election or vote have been uploaded).
“Municipality” might refer to a district, ward, etc.
Contents
1 Summarized results
URL (latest): /json
URL (archive by year): /archive/{year}/json
URL (archive by date): /archive/{year}-{month}-{day}/json
URL (election): /election/{id}/summary
URL (vote): /vote/{id}/summary
The summarized results displayed at the home page (only the results of latest votes and elections) and the archive (browsable by year or date) is also available as JSON. The data contains some global informations and for every election and vote the following commong information:
Name |
Description |
---|---|
|
|
|
An object containing the translated titles. |
|
The date (ISO 8601). |
|
The domain of influence (federation, canton, …). |
|
A link to the detailed view. |
|
True, if the vote or election is completed. |
|
An object containing the number already counted municipalities/elections ( |
|
Last time, the data has changed (ISO 8601). |
|
Voter turnout in per cent. |
Vote results contain the following additional information:
Name |
Description |
---|---|
|
The answer of the vote: |
|
Yeas percentage. |
|
Nays percentage. |
|
Federal and cantonal votes within a communal instance may contain additionally the results of the municipality in the form of an object with |
Election results contain the following additional information:
Name |
Description |
---|---|
|
A list with the elected candidates. |
Election compound results contain the following additional information:
Name |
Description |
---|---|
|
A list with the elected candidates. |
|
A list with links to the elections. |
2 Election results
Processed results
URL: /election/{id}/json
Returns the data of the main view in a structured form.
Raw data
Candidate results
URL: /election/{id}/data-{format}
The raw data of the candidates are available in the following formats:
Format |
URL |
---|---|
JSON |
|
CSV |
|
The following fields are included in all formats:
Name |
Description |
---|---|
|
ID of the election. Used in the URL. |
|
Translated titles, for example |
|
Translated short titles, for example |
|
The date of the election (an ISO 8601 date string). |
|
federal ( |
|
proportional ( |
|
The number of mandates/seats. |
|
The absolute majority. Only relevant for elections based on majority system. |
|
Interim results ( |
|
The id of the municipality/locale. A value |
|
The name of the municipality. |
|
The district of the municipality. |
|
|
|
The number of people eligible to vote for this municipality. |
|
Number of expats for this municipality. |
|
The number of received ballots for this municipality. |
|
The number of blank ballots for this municipality. |
|
The number of invalid ballots for this municipality. |
|
The number of unaccounted ballots for this municipality. |
|
The number of accounted ballots for this municipality. |
|
The number of blank votes for this municipality. |
|
The number of invalid votes for this municipality. Zero for elections based on proportional representation. |
|
The number of accounted votes for this municipality. |
|
The name of the list this candidate appears on. Only relevant for elections based on proportional representation. |
|
The id of the list this candidate appears on. Only relevant for elections based on proportional representation. |
|
The color of the list as a hexadecimal value, e.g. |
|
The number of mandates this list has got. Only relevant for elections based on proportional representation. |
|
The number of votes this list has got. Only relevant for elections based on proportional representation. |
|
The ID of the list connection this list is connected to. Only relevant for elections based on proportional representation. |
|
The ID of the parent list connection this list is connected to. Only relevant for elections based on proportional representation. |
|
The number of votes the list got from the list with |
|
The family name of the candidate. |
|
The first name of the candidate. |
|
The ID of the candidate. |
|
True if the candidate has been elected. |
|
The name of the party. |
|
The color of the party as a hexadecimal value, e.g. |
|
The gender of the candidate: |
|
The year of the candidate. |
|
The number of votes this candidate got. |
|
The number of votes the candidate got from the list with |
Election compounds contain the following additional fields:
Name |
Description |
---|---|
|
ID of the election compound. Used in the URL. |
|
Translated titles, for example |
|
Translated short titles, for example |
|
The date of the election compound (an ISO 8601 date string). |
|
The total number of mandates/seats. |
Not yet counted municipalities are not included.
Party results
URL: /election/{id}/data-parties-{format}
The raw data of the parties are available in the following formats:
Format |
URL |
---|---|
JSON |
|
CSV |
|
The following fields are included in all formats:
Name |
Description |
---|---|
|
The domain of influence to which the line applies. Optional. |
|
The unit of the domain of influence to which the line applies. Optional. |
|
The year of the election. |
|
The total votes of the election. |
|
The name of the party in the default language. |
|
Translated name of the party, e.g. |
|
ID of the party. |
|
The color of the party as a hexadecimal value, e.g. |
|
The number of mandates. |
|
The number of votes. |
|
Voters count. The cumulative number of votes per total number of mandates per election. For election compounds only. |
|
Voters count (percentage). The cumulative number of votes per total number of mandates per election (percentage). For election compounds only. |
|
The number of votes the party got from the party with |
3 Vote results
Processed results
URL: /vote/{id}/json
Returns the data of the main view in a structured form.
Raw data
URL: /vote/{id}/{data-format}
The raw data used to display the results of votes is available in the following formats:
Format |
URL |
---|---|
JSON |
|
CSV |
|
The following fields are in JSON
and CSV
formats:
Name |
Description |
---|---|
|
ID of the vote. Used in the URL. |
|
Translated titles, for example |
|
Translated short titles, for example |
|
The date of the vote (an ISO 8601 date string). |
|
Internal shortcode (defines the ordering of votes on the same day). |
|
|
|
Interim results ( |
|
The answer of the vote: |
|
Type: |
|
The answer by type: |
|
|
|
The district of the municipality. |
|
The name of the municipality. |
|
The id of the municipality. A value |
|
True if the result was counted, False if the result not known yet (the voting counts are not final yet). |
|
The number of yes votes. |
|
The number of no votes. |
|
The number of invalid votes. |
|
The number of empty votes. |
|
The number of people eligible to vote. |
|
Number of expats. |
4 Sitemap
URL: /sitemap.xml
Returns a sitemap in XML format (https://www.sitemaps.org/protocol.html)
URL: /sitemap.json
Returns the sitemap as JSON.