1. Documentation
  2. API
  3. Precincts
  4. List

Listing Precincts

Get a list of Precinct. By default, we return a paginated list all precincts across all elections, which problaby isn't very useful to you, so you probably want to include some query parameters to filter the list for the precincts you actually want.

GET /v1/precincts
https://api.ballotapi.org/v1/precincts
https://api.ballotapi.org/v1/precincts?elections=1238es8f
https://api.ballotapi.org/v1/precincts?contests=3094ur4u2e
https://api.ballotapi.org/v1/precincts?contests=3094ur4u2e&extra=merge_geos
Parameter Format Description Example
String A comma separated list of specific Precinct ids to include in the response. ids=49uhe3,493u03-5
OCD-ID Filter by a comma separated list of specific Open Civic Data Identifers for precincts. ocd_ids=ocd-jurisdiction%2F...
String Filter by a comma separated list of Election ids. elections=08h31-0,i5uu03
String Filter by a comma separated list of Contest ids. contests=aaaa12,bbbb13
String

A comma separated list of extra values you want to include in the extra results parameter.

Options are:
extra=merge_geos

If you include the extra=merge_geos query parameter in your request, we will merge all of the areas of the resulting precincts and return that merged geometry as a GeoJSON object in the extra results parameter. This is useful for generating district maps.

{
    "type": "response",
    "data": [...],
    "next": "...",
    "extra": {
        "merge_geos": {
            "type": "MultiPolygon",
            ...
        },
    },
    "timestamp": "...",
    "url": "..."
}

We will return the results of your request as a Response object with the data attribute as the list of Precincts.

Responses can be paginated! Be sure to check the next attribute for the next page of data.

Example response:

{
    "type": "response",
    "data": [
        {
            "type": "precinct",
            "id": "345-6",
            "ocd_id": null,
            "election_id": "123-4",
            "voting_info": {...},
            "geo": {...},
        },
        ...
    ],
    "next": "https://api.ballotapi.org/...",
    "extra": {},
    "timestamp": "2018-01-01T00:00:00+00:00",
    "url": "https://api.ballotapi.org/..."
}
Code Response Format Description
Response Successful request.
Error Response The query parameters you included were invalid. The Error Response will include a message describing exactly was invalid.
N/A You are making too many requests to the API. Check the Retry-After header for how many seconds to wait until trying the request again. See our docs on Rate Limiting.
N/A An internal server error occurred. We log these errors and try to fix them quickly, so if you keep getting 500 errors for a few days, please email us.
N/A We are down for maintenance. Please try your request again in a few minutes.
N/A Your request timed out. Please try your request again in a few minutes.