AP VoteCast Request

 

ON THIS PAGE      Show

 

 

 

 

 

  Important

 

To request updates to the list of AP VoteCast result files, use the 'next request' links (see Receiving Election Updates).

 

 

 

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

Optional Request Header

Header

Description

Example

Accept

The MIME type of the returned data format: XML or JSON. The default is application/xml. The format parameter value takes precedence over the Accept header value when both are specified.

application/json

Request URI

 

Method

Request URI

GET

https://api.ap.org/{version}/votecasts/{electionDate}?[{OptionalParameters}]

 

  Important

 

The request URI must be URL-encoded.

 

 

 

Required Parameters

 

Parameter

Description

Example

version

The API version: v3.

v3

electionDate

Date of the election in the YYYY-MM-DD format.

2024-06-04

Optional Parameters

 

Parameter

Description

Example

resultsType

Indicates whether to return live or test VoteCast data. Possible values are t (test data) or l (live data; this is the default).

  Important

 

To receive test VoteCast data, make sure to add the optional resultsType=t parameter to the request URL.

 

 

 

t

statePostal

The geo code, such as a two-character state postal code or "US" for national VoteCast results. By default, all state and national data available to your account is returned. Multiple values must be separated by commas.

VT,US

format

The response format (xml or json). The format parameter value takes precedence over the Accept header value when both are specified. If no format is specified as the format parameter value or in the Accept header, XML is returned.

  Note

 

This parameter specifies the format of the API call response, which is a list of VoteCast result files. The format of the actual result files is always JSON.

 

 

 

json

stage

Results delivery stage. Ad hoc deliveries can include an additional letter; for example, "3A". Multiple values are not allowed. All stages available to your account are returned by default.

1

code

Election code used by AP VoteCast. For the list of values, see Election Codes. Multiple values are not allowed. By default, all are returned.

G

includesignature

Returns a digital signature in the HTTP response header. Possible values are sha256, eddsa and none (the default). For more information, see Requesting Digital Signatures.

sha256

Request URI Examples

Sample URI

Returned Results

https://api.ap.org/v3/votecasts/2024-03-05?format=json

A list of all the latest VoteCast JSON files from the 03-05-2024 election date currently available to you.

https://api.ap.org/v3/votecasts/2024-01-15?statePostal=IA&format=json

A list of all the latest available AP VoteCast JSON files from the 01-15-2024 election in Iowa.

https://api.ap.org/v3/votecasts/2024-06-04?resultsType=t&format=json

A list of test VoteCast JSON files from the 06-04-2024 election date.