Statedoku US States API

FREE CORS NO AUTH

A free, public JSON API for US states data. Use it in your projects, tutorials, demos, or learning material.

Quick example

curl https://statedoku.com/api/states/california

{
  "id": "CA",
  "name": "California",
  "capital": "Sacramento",
  "largestCity": "Los Angeles",
  "region": "west",
  "areaRank": 3,
  "admitted": 1850,
  ...
}

Endpoints

GET /api/states

Returns all 50 US states as a JSON array.

GET /api/states/{id}

Returns a single state. The {id} can be a USPS 2-letter abbreviation (CA, tx) or a name slug (california, new-york).

Query parameters

ParameterExampleDescription
fields?fields=id, capital, regionReturn only these fields. Comma-separated.
region?region=westFilter to only states in a region. Valid values: west, south, midwest, northeast.
pretty?pretty=truePretty-print the JSON response.

Response fields

Each state object contains:

FieldTypeExample
idstring (2 letters)"CA"
namestring"California"
namesobject{en, fr, es}
capitalstring"Sacramento"
largestCitystring"Los Angeles"
regionstring"west"
subregionstring"pacific"
populationstring (range)">10M"
areaRanknumber (1-50)3
admittednumber (year)1850
timezonestring"pacific"
coastlinearray["pacific"]
landlockedbooleanfalse
bordersCanadabooleanfalse
bordersMexicobooleantrue
original13booleanfalse
confederatebooleanfalse
presidentBirthplacebooleantrue
noIncomeTaxbooleanfalse

JavaScript example

// All 50 states
const states = await fetch('https://statedoku.com/api/states').then(r => r.json());
console.log(`There are ${states.length} states.`);

// Just the West coast
const west = await fetch('https://statedoku.com/api/states?region=west')
  .then(r => r.json());

// Get California
const ca = await fetch('https://statedoku.com/api/states/CA').then(r => r.json());
console.log(`${ca.name} capital is ${ca.capital}.`);

// Just capitals
const capitals = await fetch('https://statedoku.com/api/states?fields=name, capital')
  .then(r => r.json());

Python example

import requests

# All 50
states = requests.get('https://statedoku.com/api/states').json()

# Single state
ca = requests.get('https://statedoku.com/api/states/CA').json()
print(f"{ca['name']} → {ca['capital']}")

# With filters
sun_belt = requests.get(
    'https://statedoku.com/api/states',
    params={'region': 'south', 'fields': 'name, capital, population'}
).json()

Rate limits & caching

The API is cached aggressively at the edge (1 day TTL). Hammer it freely. There's no hard rate limit, but please cache responses client-side too.

License & attribution

Free to use for any purpose, personal, commercial, educational. Attribution appreciated but not required. If you build something cool with it, a link to https://statedoku.com/ in your project's credits is the kind thing to do.

Suggested attribution

<!-- Data from -->
<a href="https://statedoku.com/api/">Statedoku US States API</a>

Source & changelog

Data is curated and maintained by Statedoku. Updates happen as state-level data evolves (rare for stable fields like capitals, more common for population estimates). The raw underlying dataset is also available at https://statedoku.com/data/states.json if you want all 137 internal fields.

Built something with the API?

Let us know, we love seeing what people build. Reply by email or tag us on Twitter.

contact@statedoku.com

Related resources