get_election_results
US election results with margins, swing, turnout and partisan lean. Coverage: president and US Senate by state
for every election 1976 to 2024, US House by district 1976 to 2024 and county results of the presidential race 2000 to 2024;
county, city or town, congressional district and precinct results, governors, other statewide offices, state legislature
seats and statewide ballot measures for 2016, 2018, 2020, 2022 and 2024. Results
are certified; election-night rows (status live) are unofficial counts and a race is only called when called_at
is set. party_margin/rd_margin_pct = Republican share minus Democratic share in points (positive = Republican
lead, R+3.2 means Republicans led by 3.2 points); swing_pct is the change of that margin against the previous
comparable race in the same area (positive = toward Republicans); flipped = the winning party changed.
view "races" (default): races with winner or leader, runner-up, votes and shares, margin, swing, flip; filter by
year, office (president, us_senate, us_house, governor, lt_governor, attorney_general, secretary_of_state,
treasurer, other_statewide, state_senate, state_house, ballot_measure, judicial; several with commas), state
(two-letter code), name (race or candidate text) and filters such as {"margin_max": 5} (close races), {"flipped":
true}, {"winner_party": "R"}, {"status": "live"}. Each row has race_id: use it as race in view "results".
view "results": one race (race = race_id such as "2024-president", "2024-us-senate-tx", "2022-governor-az") with
every candidate (votes and share) and the result by area: level state, county, cousub (city or town), cd
(district) or precinct (precinct needs county = 5-digit code); state limits to a state; name searches area names;
sort total_votes, rd_margin, swing, dem_pct, rep_pct, turnout or name.
view "candidates": people who ran: name, state, office, year, filters {"party": "D", "won": true, "in_congress":
true}; with slug (from a candidate row) one candidate with every race.
view "geography": one area with its races, partisan lean, bellwether record, split tickets, turnout and
demographics: level state, county, cousub, cd or national and area_code (state: 2-digit code such as 48; county:
5-digit code such as 48453), or for a county give state and county name instead of area_code.
view "area": the latest elections for a state, county (name) and/or city in one call (state, county, city).
view "summary": analysis = trend (national presidential vote by year), seats (seats won by party and change),
legislatures (control of state legislature chambers), flips and swing (areas that changed party or moved most;
year, office, level state or county), bellwethers, split_tickets, lean (partisan lean index), demographics
(county results next to income, education, age and race) or coverage (what is loaded).
view "turnout": turnout by state or county and year (share of citizen voting-age adults, registered voters where
reported); level state or county, state, name, filters {"min_turnout": 60}.
On election night the answer also has election_night_note ("Election night: unofficial, still counting, last
update HH:MM UTC"): share it; live rows are only ever "Leading" (leader_label), never a winner.
The answer has website_link: share it so the user can see the pages on dataporium.tech.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_election_results"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| city | No | City or town name (with state), for view 'area'. | |
| name | No | Text to search: a race or candidate name, or an area name. | |
| race | No | A race_id from view 'races', e.g. '2024-president', '2024-us-senate-tx' or '2022-governor-az'. | |
| slug | No | Candidate slug from a candidates row, for one candidate with every race. | |
| sort | No | Sort field (depends on the view, e.g. year, margin, total_votes, rd_margin, swing, turnout, name). | |
| view | No | 'races' (list races), 'results' (one race by area), 'candidates', 'geography' (one area in full), 'area' (latest elections of a state, county or city), 'summary' (analysis, see analysis) or 'turnout'. | races |
| year | No | Election year, e.g. 2024. | |
| level | No | Area level: state, county, cousub (city or town), cd (congressional district), precinct or national; for turnout state or county. | |
| limit | No | Rows to return, 1 to 100 (default 25). | |
| order | No | ||
| state | No | Two-letter state code, e.g. 'TX'. | |
| county | No | County name, e.g. 'Travis' (with state), or for precinct results the 5-digit county code. | |
| office | No | Office: president, us_senate, us_house, governor, lt_governor, attorney_general, secretary_of_state, treasurer, other_statewide, state_senate, state_house, ballot_measure or judicial; several separated by commas. | |
| offset | No | Rows to skip, for the next page. | |
| filters | No | Extra API filters, e.g. {"margin_max": 5, "flipped": true}. list_filters('get_election_results') shows all. | |
| analysis | No | For view 'summary': trend, seats, legislatures, flips, swing, bellwethers, split_tickets, lean, demographics or coverage. | |
| area_code | No | Area code: 2-digit state code (48), 5-digit county code (48453) or 10-digit city or town code. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | The records: a list of objects (or one object) with the requested data. | |
| note | No | Present when the answer was shortened, with how to get the rest. | |
| rows | No | Number of records the API returned (before any shortening). | |
| error | No | Present when the call failed, with the reason. | |
| detail | No | Extra error detail from the API, e.g. which filter is required. | |
| paging | No | For paged answers: offset, rows_shown, total and next_offset (call again with offset=next_offset for more rows). | |
| endpoint | No | DataPorium API endpoint that answered, e.g. /company-info. | |
| filters_sent | No | Filters sent to the API for this answer. | |
| allowed_filters | No | On an unknown-filter error: the filters this endpoint accepts. |