State or province administrative division with name, code, country, population, and capital city. Used for geographic databases, address systems, and administrative data.
https://api.mockly.codes/states?page=1&limit=10&count=10Configure your request and click Send Request to see the response here.
/statesGet a collection of states
/location/states/states/:idGet a single state by ID
/location/states/:id/states/metaGet resource metadata and schema
/location/states/metaThe search feature allows you to filter results by searching for text across all or specific fields. Choose between ?q= or ?search= parameter names.
Search across all text fields:
GET https://api.mockly.codes/states?q=laptopGET https://api.mockly.codes/states?q=laptop&search_fields=name,descriptionsearch_fields, all text fields are searched// Get 10 states
fetch('https://api.mockly.codes/states?count=10')
.then(res => res.json())
.then(data => console.log(data));import requests
response = requests.get(
'https://api.mockly.codes/states?count=10'
)
data = response.json()curl "https://api.mockly.codes/states?count=10"fetch('https://api.mockly.codes/states?nocache=true')idintegerUnique identifier for the state record
random_intnamestringOfficial name of the state or province (e.g., California, Ontario, Bavaria)
statecodestringState or province code or abbreviation (e.g., CA, ON, BY)
wordcountrystringCountry where this state or province is located
countrypopulationintegerTotal population of the state or province
random_intcapitalstringCapital city of the state or province
citycountintegerNumber of items to return (default: 10, max: 100)
seedintegerSeed for reproducible data generation
nocachebooleanBypass cache and generate fresh data on every request