API reference

Ballot races (elections, contests and their choices), endorsers and endorsements across the U.S., what chosen endorsers recommend in each race, and a stream of endorsement changes. Address and geography lookups (the ballot at an address, districts and boundaries, representatives by location) have been retired.

Base URL
https://api.endorsedby.org
Authentication
Authorization: Bearer <your key> on every request
OpenAPI
openapi.json (version 1.0.0, OpenAPI 3.1.0)
GET/v1/statesStates
200
Every state
400
An error
401
An error
403
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/states"
GET/v1/electionsElections
ParameterInTypeDescription
statesquerystringUSPS codes. Comma-separated; any of them matches.
typesquerystringgeneral, primary, special, special_primary, runoff, consolidated. Comma-separated; any of them matches.
upcomingqueryboolean
fromquerystring, dateElections on or after this date.
toquerystring, dateElections on or before this date.
langquerystring, one of en, es, default enes for Spanish ballot text (titles, choices, measure text, statements) where the state publishes it; English otherwise.
limitqueryinteger, 1…500
cursorquerystringnext_cursor from the previous page.
200
A page of elections, with voting rules (all-mail, ranked choice, fusion, runoff dates) in details
400
An error
401
An error
403
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/elections"
GET/v1/endorser-categoriesKinds of endorser (labor, newspaper, …)
ParameterInTypeDescription
langquerystring, one of en, es, default enes for Spanish ballot text (titles, choices, measure text, statements) where the state publishes it; English otherwise.
200
Every category
400
An error
401
An error
403
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/endorser-categories"
GET/v1/endorsersEndorsers
ParameterInTypeDescription
categoriesquerystringCategory slugs. Comma-separated; any of them matches.
statesquerystringHome states, or national. Comma-separated; any of them matches.
electionsquerystringOnly endorsers with endorsements in these elections. Comma-separated; any of them matches.
qquerystringName contains.
langquerystring, one of en, es, default enes for Spanish ballot text (titles, choices, measure text, statements) where the state publishes it; English otherwise.
limitqueryinteger, 1…500
cursorquerystringnext_cursor from the previous page.
200
A page of endorsers
400
An error
401
An error
403
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/endorsers"
GET/v1/endorsers/{slug}One endorser, with the elections they’ve endorsed in
ParameterInTypeDescription
slugrequiredpathstring
langquerystring, one of en, es, default enes for Spanish ballot text (titles, choices, measure text, statements) where the state publishes it; English otherwise.
200
The endorser
400
An error
401
An error
403
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/endorsers/{slug}"
GET/v1/contestsContests with their choices and voting rules
ParameterInTypeDescription
electionsquerystringElection slugs. Comma-separated; any of them matches.
statesquerystringUSPS codes. Comma-separated; any of them matches.
levelsquerystringDistrict levels. Comma-separated; any of them matches.
contest_kindsquerystringcandidate, measure, retention. Comma-separated; any of them matches.
districtsquerystringOCD division ids. Comma-separated; any of them matches.
upcomingqueryboolean
langquerystring, one of en, es, default enes for Spanish ballot text (titles, choices, measure text, statements) where the state publishes it; English otherwise.
limitqueryinteger, 1…500
cursorquerystringnext_cursor from the previous page.
200
A page of contests
400
An error
401
An error
403
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/contests"
GET/v1/contests/{id}One contest with every endorser’s position
ParameterInTypeDescription
idrequiredpathinteger
categoriesquerystringOnly these endorser categories. Comma-separated; any of them matches.
endorsersquerystringOnly these endorsers. Comma-separated; any of them matches.
endorser_statesquerystringEndorsers based in these states, or "national". Comma-separated; any of them matches.
langquerystring, one of en, es, default enes for Spanish ballot text (titles, choices, measure text, statements) where the state publishes it; English otherwise.
200
The contest
400
An error
401
An error
403
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/contests/{id}"
GET/v1/endorsementsEndorsements, one per endorser and choice
ParameterInTypeDescription
categoriesquerystringEndorser category slugs. Comma-separated; any of them matches.
endorsersquerystringEndorser slugs. Comma-separated; any of them matches.
endorser_statesquerystringEndorsers’ home states (USPS codes), or national. Comma-separated; any of them matches.
statesquerystringStates the contests are voted in. Comma-separated; any of them matches.
electionsquerystringElection slugs. Comma-separated; any of them matches.
contest_kindsquerystringcandidate, measure, retention. Comma-separated; any of them matches.
levelsquerystringDistrict levels: federal, state, county, city, school, special. Comma-separated; any of them matches.
contestqueryinteger
upcomingqueryboolean
langquerystring, one of en, es, default enes for Spanish ballot text (titles, choices, measure text, statements) where the state publishes it; English otherwise.
limitqueryinteger, 1…500
cursorquerystringnext_cursor from the previous page.
200
A page of endorsements
400
An error
401
An error
403
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/endorsements"
GET/v1/recommendationsWhat chosen endorsers recommend in each contest, grouped by election

Choose the contests with state (a state’s upcoming contests), election or contest; a state is required unless an election or contest is given. Address and location lookups (location, address, zip, city, county, lat, lng) have been retired and are refused with 400.

ParameterInTypeDescription
statequerystringUSPS code of the state the contests are voted in (comma-separated for several). Required unless election or contest is given; on its own it covers upcoming elections.
electionquerystringElection slugs, past or upcoming. Comma-separated; any of them matches.
contestquerystringContest ids. Comma-separated; any of them matches.
subscriptionquerystringA saved subscription (id or name) choosing the endorsers; its states, elections, contest kinds and levels narrow the contests too.
categoriesquerystringEndorser categories. Comma-separated; any of them matches.
endorsersquerystringEndorser slugs. Comma-separated; any of them matches.
endorser_statesquerystringEndorsers based in these states, or "national". Comma-separated; any of them matches.
levelsquerystringDistrict levels. Comma-separated; any of them matches.
contest_kindsquerystringcandidate, measure, retention. Comma-separated; any of them matches.
only_endorsedquerybooleanLeave out contests none of the chosen endorsers took a position in.
langquerystring, one of en, es, default enes for Spanish ballot text (titles, choices, measure text, statements) where the state publishes it; English otherwise.
200
The scope, the endorsers, and each election’s contests with their choices, backers and recommendation
400
An error
401
An error
403
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/recommendations"
GET/v1/officeholdersPeople in office now, with party, term and contact details, by state, office, level or seat
ParameterInTypeDescription
statesquerystringUSPS codes. Comma-separated; any of them matches.
officesquerystringus_senator, us_representative, governor, lieutenant_governor, attorney_general, secretary_of_state, chief_election_officer, treasurer, auditor, state_senator, state_representative, state_legislator, city_council. Comma-separated; any of them matches.
levelsquerystringfederal, state, city. Comma-separated; any of them matches.
districtsquerystringOCD division ids of the seats. Comma-separated; any of them matches.
qquerystringName contains.
langquerystring, one of en, es, default enes for Spanish ballot text (titles, choices, measure text, statements) where the state publishes it; English otherwise.
limitqueryinteger, 1…500
cursorquerystringnext_cursor from the previous page.
200
A page of officeholders
400
An error
401
An error
403
An error
429
An error
503
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/officeholders"
GET/v1/officeholders/{id}One officeholder by person_id, with every seat they hold
ParameterInTypeDescription
idrequiredpathstring, uuid
langquerystring, one of en, es, default enes for Spanish ballot text (titles, choices, measure text, statements) where the state publishes it; English otherwise.
200
The officeholder
400
An error
401
An error
403
An error
429
An error
503
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/officeholders/{id}"
GET/v1/coverageWhat the API has for each state
ParameterInTypeDescription
upcomingqueryboolean, default trueCount only upcoming elections (default true).
200
Elections, contests, measures, endorsers and endorsements per state, and when they last changed
400
An error
401
An error
403
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/coverage"
GET/v1/eventsEndorsement changes after a cursor (polling)
ParameterInTypeDescription
subscriptionquerystringA saved subscription’s id or name (instead of filter parameters).
categoriesquerystringEndorser category slugs. Comma-separated; any of them matches.
endorsersquerystringEndorser slugs. Comma-separated; any of them matches.
endorser_statesquerystringEndorsers’ home states (USPS codes), or national. Comma-separated; any of them matches.
statesquerystringStates the contests are voted in. Comma-separated; any of them matches.
electionsquerystringElection slugs. Comma-separated; any of them matches.
contest_kindsquerystringcandidate, measure, retention. Comma-separated; any of them matches.
levelsquerystringDistrict levels: federal, state, county, city, school, special. Comma-separated; any of them matches.
typesquerystringcreated, updated, deleted. Comma-separated; any of them matches.
cursorquerystringResume after this position (next_cursor, or an SSE event id).
fromquerystring, one of latest, earliest, default latest
sincequerystring, date-timeStart at changes from this time (ISO 8601), within the stream’s retention.
limitqueryinteger, …1000
waitqueryinteger, …25Seconds to wait for a change (long polling).
200
Events and the next cursor
400
An error
401
An error
403
An error
410
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/events"
GET/v1/streamEndorsement changes as Server-Sent Events
ParameterInTypeDescription
subscriptionquerystringA saved subscription’s id or name (instead of filter parameters).
categoriesquerystringEndorser category slugs. Comma-separated; any of them matches.
endorsersquerystringEndorser slugs. Comma-separated; any of them matches.
endorser_statesquerystringEndorsers’ home states (USPS codes), or national. Comma-separated; any of them matches.
statesquerystringStates the contests are voted in. Comma-separated; any of them matches.
electionsquerystringElection slugs. Comma-separated; any of them matches.
contest_kindsquerystringcandidate, measure, retention. Comma-separated; any of them matches.
levelsquerystringDistrict levels: federal, state, county, city, school, special. Comma-separated; any of them matches.
typesquerystringcreated, updated, deleted. Comma-separated; any of them matches.
cursorquerystringResume after this position (next_cursor, or an SSE event id).
fromquerystring, one of latest, earliest, default latest
sincequerystring, date-timeStart at changes from this time (ISO 8601), within the stream’s retention.
200
text/event-stream: ready, endorsement, checkpoint and reconnect events
400
An error
401
An error
403
An error
410
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/stream"
GET/v1/subscriptionsSaved subscriptions
200
Every subscription
400
An error
401
An error
403
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/subscriptions"
POST/v1/subscriptionsSave a subscription
201
Created
400
An error
401
An error
403
An error
429
An error
GET/v1/subscriptions/{id}One subscription
ParameterInTypeDescription
idrequiredpathinteger
200
The subscription
400
An error
401
An error
403
An error
429
An error
curl -H "Authorization: Bearer $BALLOTDATA_KEY" \
  "https://api.endorsedby.org/v1/subscriptions/{id}"
PUT/v1/subscriptions/{id}Replace a subscription
ParameterInTypeDescription
idrequiredpathinteger
200
Saved
400
An error
401
An error
403
An error
429
An error
DELETE/v1/subscriptions/{id}Delete a subscription
ParameterInTypeDescription
idrequiredpathinteger
204
Deleted
400
An error
401
An error
403
An error
429
An error