Getting Vote Types
Description
The votetypes=true parameter in the Elections request allows you to receive votes by type for each candidate if available.
- All election events taking place prior to Aug. 4, 2026 use the classic vote type model.
- The 2026 vote type model will be used for all election events taking place on and after Aug. 4, 2026. Before that date, you can use the 2026 vote type model for testing.
|
Notes
|
|
-
Not all vote types are available in any particular state or RU. The available data may change for future election dates depending on the rules and regulations for a particular election. The Elections API returns specific vote types only if available.
-
The names of the vote type response elements in the XML response are similar to the names of the JSON properties. For more information, see Elections Response.
-
For backwards compatibility, the "avotes" field for each candidate is returned when the avotes=true parameter or the votetypes=true parameter is specified in the request. The value returned in "avotes" field is the A-report votes for a particular candidate as provided by the state and may differ from the "advanceTotal" value.
|
|
|
|
|
Required Request Headers
|
Header
|
Description
|
Example
|
|
x-api-key
|
Specifies the API key to authorize the request. The x-apikey header is also currently supported.
|
apikey
|
|
Accept-Encoding
|
Compresses the response to the gzip format.
|
gzip
|
Request URI
|
Method
|
Request URI
|
|
GET
|
https://api.ap.org/v3/elections/{electionDate}?votetypes=true[{OtherParameters}]
|
|
Important
|
|
|
The request URI must be URL-encoded.
|
|
|
|
|
Request URI Example
|
Sample URI
|
Returned Results
|
|
https://api.ap.org/v3/elections/2026-08-04?statepostal=VA&level=ru&votetypes=true&format=json
|
Returns 8/4/2026 VA statewide and RU-level votes by type in addition to the current total vote count for each candidate in the JSON format.
|
Parameters Used in the Sample URI
|
Parameter
|
Description
|
Example
|
|
electionDate
|
Date of the election in the YYYY-MM-DD format.
|
2026-08-04
|
|
statePostal
|
Two-character state postal code. Multiple values must be separated by commas. When the statePostal parameter is not specified in the request, advance turnout for all states is returned.
|
VA
|
|
votetypes
|
Indicates whether to return vote types. Valid values are:
-
true (includes the vote types for each candidate, if available).
-
false (returns the cumulative total; this is the default).
|
true
|
|
format
|
The response format (xml or json).
|
json
|
Response
On success, returns the standard HTTP status code of "200 – OK" and results in the requested format (XML or JSON). The response contains a list of races, reporting units within each race and candidates in each reporting unit.
If available, vote types are returned for each candidate, and EEVP values for each available vote type are returned for each RU (for example, eevpEdayInPerson, eevpAbsenteeMail). For information about the returned fields, see Elections Response.
For information about error codes, see API Codes.
Response Examples
The following examples show partial JSON and XML responses to the sample request (for brevity, in a single RU). The returned vote types are from the 2026 model.
|
JSON
|
XML
|
 |
 |