Documentation
API Endpoints
Elections
See examples of Election objects.
Election objects contain general details about a particular election, such as election type, date, a short description, and any particular overall requirements for the election. Additionally, you can optionally include the particular Contests or Precincts for an Election.
API Endpoints
-
GET
/elections
- List elections (can be searched and filtered). -
GET
/elections/{id}
- Get a specific election.
Attributes
Attribute | Format | Description | Example |
---|---|---|---|
type
|
ObjectType | This object's data type. Will always be "election". |
"election"
|
id
|
String | This is the unique id we assign to the Election. This is the id used in Contest.election_id and Precinct.election_id. NOTE: This is our own unique identifier for the election, which is different from the ocd_id for the election. |
"a74635..."
|
ocd_id
|
OCD-ID
or null
|
This is the
Open Civic Data Identifier
(OCD-ID) for this Election. If there is no OCD-ID, this
value will be null .
|
"ocd-election/country:us/..."
|
election_type
|
ElectionType | This is the type of election (e.g. general, primary, etc.). See the full list of Election Types for possible values and what they mean. |
"general"
|
election_name
|
String | This is a short display name for the election. We try to keep it under 10 words. |
"2018 Midterm Election"
|
date
|
Date | This is the official election date. NOTE: Since polling hours vary by location, we put those specific dates and times (with local timezones) in the Precinct.voting_info attribute. |
"2018-05-15"
|
short_info
|
String | This is a short description for the election. We try to keep it to a single sentence under 25 words. |
"This is a major national election that happens every two years to elect many federal, state, and local positions."
|
contests
|
Response | (only if included) These are the Contests that are part of this Election. NOTE: This response list can be paginated, so be sure to know how to handle paginated responses. |
{"type": "response", "data": [...], ...}
|
precincts
|
Response | (only if included) These are the Precincts that are part of this Election. NOTE: This response list can be paginated, so be sure to know how to handle paginated responses. |
{"type": "response", "data": [...], ...}
|
...
|
We may add more Election attributes in the future, so be able to handle unknown attributes. |
Examples
A general election:
{ "type": "election", "id": "123-4", "election_type": "general", "election_name": "Midterm Election", "date": "2018-11-05", "short_info": "This is a major national election that happens every two years to elect many federal, state, and local positions." }
A primary election:
{ "type": "election", "id": "3983-b823", "election_type": "primary", "election_name": "California Primary Election", "date": "2018-06-05", "short_info": "This is a major primary election for political parties in California." }
A special election:
{ "type": "election", "id": "339-83az", "election_type": "special", "election_name": "Arizona 8th U.S. Congressional District Special Election", "date": "2018-04-24", "short_info": "This is a special election to fill the vacant Arizona 8th U.S. Congressional District seat." }
Election Types
These are our general categories of election types.