US Elections

Election Races

US elections as races: president, U.S. Senate, U.S. House, governor, other statewide offices, state legislature, ballot measures and judicial races, each with the winner or leader, the runner-up, votes and shares, total votes, margin, party margin, swing against the previous comparable race, whether the winning party changed, live reporting progress and the status of the numbers.

All filters are optional and can be combined. The answer is {total, limit, offset, sort, order, rows, about}; sort is year, state, office, district, total_votes, margin, rd_margin, swing or name.

get/elections/races

Request

  • Base URL: https://api.dataporium.io
  • URL: https://api.dataporium.io/elections/races
  • Auth: API key in query parameter apikey

Query parameters

yearinteger

Election year

year_frominteger

First election year

year_tointeger

Last election year

officestring

president, us_senate, us_house, governor, lt_governor, attorney_general, secretary_of_state, treasurer, other_statewide, state_senate, state_house, ballot_measure or judicial (comma-separated)

statestring

Two-letter state code(s), comma-separated (US for the national race)

districtstring

District number such as 07 (00 = at large)

specialboolean

true = special elections only, false = without them

statusstring

live, state_certified or certified_final

winner_partystring

Party of the winner or leader: D, R or other

flippedboolean

true = the winning party changed since the previous comparable race

margin_maxnumber

Largest margin in points (close races)

margin_minnumber

Smallest margin in points (landslides)

qstring

Text in the race title or a candidate name

racestring

One race by race_id

sortstring

Sort field (see the endpoint description)

orderstring

asc or desc

limitinteger

Rows per page (default 50 to 100, at most 1000)

offsetinteger

Rows to skip, for paging

Response

Successful response (JSON).

object required

Changes

No recorded changes to this operation across all 1 revision of this API.