Elections Response Examples

 

ON THIS PAGE      Show

 

 

 

 

 

  Note

 

These examples currently show ELAPI v2 responses. For the ELAPI v3 response examples, please refer to What's New in v3.

 

 

 

State-Level Results

XML  |  JSON

This example shows state-level results of primary races for Governor in Vermont. Both contested and uncontested races are returned by default. Since the level parameter is not specified in the request, the response does not include the details for each of the reporting units.

 

  Note

 

For the general election in a presidential year, results at the default level=state also include presidential popular and electoral votes at the state and U.S. national rolled-up summary levels. For more information, see Example 5: Presidential Results and Electoral Counts - National and State-by-State.

 

 

 

Results by Reporting Unit

XML  |  JSON

This example (in XML and JSON) shows results by reporting unit for the primary races for Governor in Vermont. Since the level=ru parameter is specified in the request, the response includes results for both the specified state (Vermont) and each of the reporting units within this state (cities and towns in this example since Vermont is a New England state). Note that in addition to the reporting unit ID, the county FIPS code is also reported for each New England city or town, so that you can aggregate results to the county level.

Results by FIPS Code

XML  |  JSON

This example (in XML and JSON) shows results by FIPS code for the primary races for Governor in Vermont. Since the level=fipscode parameter is specified in the request, the response includes results for both the specified state (Vermont) and each of the county FIPS codes (city/town results aggregated to the county level in this example since Vermont is a New England state).

Results by District During Presidential Primaries

XML  |  JSON

This example (in XML and JSON) shows results by district (including the delegate count for each candidate if applicable) for the Democrat and Republican presidential primary races in West Virginia.

Presidential Results and Electoral Counts - National and State-by-State

XML  |  JSON

This example shows presidential popular votes and electoral counts for the state of New Jersey and U.S. national rolled-up summary popular vote and electoral count results at the default level=state. "ElectTotal" indicates the state or U.S. national electoral count, and "ElectWon" shows the candidate’s electoral votes. Only four candidates are shown at the U.S. national level for illustration purposes; however, the actual response will include every presidential candidate across the country, even if they are on the ballot in one state. 

 

 

  Notes

 

  • When level=ru or level=fipscode is specified in the request, electoral counts (both the state electoral count and the candidates’ electoral votes) are added to the state results summary returned at the top of these responses. Only presidential popular vote results are available for the lower-level reporting units (counties or cities/towns for the New England states for level=ru or FIPS codes for level=fipscode).

  • Effective 2024 GE, a candidate’s electoral count (electWon in JSON, ElectWon in XML) is returned only for one or more electoral votes won by a candidate; "electWon": 0 in JSON (ElectWon="0" in XML) is NOT returned before or after a race call.

 

 

 

Presidential Results and Electoral Counts by District

2020 GE and Prior

XML  |  JSON

This example shows presidential popular votes and electoral counts by district for the presidential election in Maine, a state that awards presidential electoral votes using the district-based method instead of the “Winner-Take-All” method. The district-based method is currently used in Maine and Nebraska.

In the response, "ElectTotal" shows the district or state electoral count, and "ElectWon" shows the candidate’s electoral votes. This example shows the 2012 test data for illustration purposes only.

Effective 2024 GE

For information and an example, see Presidential Results and Electoral Counts by District.

A-Report Votes

XML  |  JSON

If the avotes=true parameter is specified in the request, the A-report votes are returned for each candidate, if available, in the "AVotes" attribute in XML or the "avotes" property in JSON. A-reports represent advance voting data as provided to the AP on election night, which may include absentee votes, early poll votes, or a combination of these.

 

  Notes

 

  • A-reports do not necessarily represent all of the advance votes. A-reports could include only the early votes (if the state has early voting), or early votes plus some of the absentee mail ballot votes, or only some of the mail ballot votes.

  • A-reports are almost exclusively compiled by the AP when they are available as the first report of the night in a county.

  • The AP predominantly captures advance votes as one or zero precinct reporting.

  • Some states do not provide A-reports. In states where the AP is provided with A-reports, they may not be provided for each county.

 

 

 

Certified Results

XML  |  JSON

If the resultsType=c parameter is specified in the request, certified results are returned in the vote count field if available. Certified results represent the final, official vote totals provided by each state or, in some cases, individual counties. They may be made available to the AP anywhere between a few days to over a month after the election. Certified results are indicated by ResultsType="c" in XML and "resultsType": "certified" in JSON.