Base URL: https://api.districtapi.devยทCurrent version: v1ยทData: NCES 2024-25
Pass your API key via the X-API-Key header on every request. Alternatively, use Authorization: Bearer <key>.
curl "https://api.districtapi.dev/v1/districts?address=12865+Main+St+Apple+Valley+CA" \ -H "X-API-Key: sk_live_your_api_key"
Two limits apply on every request:
Monthly quotas reset on the 1st of each calendar month. Exceeding the per-minute limit returns 429. Exceeding the monthly quota returns 402.
/v1/districtsLook up a district by address, lat/lng, or NCES LEA ID. Provide exactly one of: address, lat+lng, or nces_id.
addressstringoptionalStreet address โ geocoded to lat/lng, then spatial lookup against district boundaries.latnumberoptionalLatitude (use with lng)lngnumberoptionalLongitude (use with lat)nces_idstringoptional7-digit NCES LEA ID{
"data": [
{
"ncesId": "0600017",
"name": "Apple Valley Unified",
"state": "CA",
"county": "San Bernardino",
"locale": { "code": "21", "name": "Suburb, Large" },
"type": { "code": 1, "name": "Regular School District" },
"status": "open",
"grades": { "low": "KG", "high": "12" },
"address": { "street": "12865 Main St", "city": "Apple Valley", "state": "CA", "zip": "92308" },
"phone": "(760) 247-8001",
"website": "https://www.avusd.us",
"geo": { "lat": 34.4988, "lng": -117.1858 },
"enrollment": { "total": 21450, "year": "2024-25" },
"finance": { "perPupilExpenditure": 10842, "fiscalYear": "2022-23" },
"schoolsCount": 31
}
],
"meta": { "requestId": "req_9f4b2a1c8e3d", "creditsUsed": 1, "creditsRemaining": 499 },
"source": { "ncesYear": "2024-25", "updatedAt": "2025-12-15" }
}/v1/districts/{id}Get the full profile for a district by its 7-digit NCES LEA ID.
/v1/districts/{id}/schoolsList all open schools in a district.
typeintegeroptionalFilter by school type (1=Regular, 2=Special Ed, 3=Vocational, 4=Alternative)charterbooleanoptionalFilter to charter schools only{
"data": [
{
"ncesId": "060001706027",
"name": "Apple Valley High School",
"grades": { "low": "09", "high": "12" },
"type": "Regular School",
"isCharter": false,
"enrollment": 2841,
"lat": 34.5012,
"lng": -117.2134,
"address": { "street": "11837 Standing Rock Rd", "city": "Apple Valley", "state": "CA", "zip": "92308" }
}
],
"meta": { "requestId": "req_4c1a9b3d7e2f", "creditsUsed": 1, "creditsRemaining": 248 },
"source": { "ncesYear": "2024-25", "updatedAt": "2025-12-15" }
}/v1/districts/searchSearch districts by name, state, or county. Provide at least one parameter.
namestringoptionalDistrict name (full-text search)statestringoptionalTwo-letter state abbreviationcountystringoptionalCounty name (partial match)limitintegeroptionalResults per page (max 100, default 20)offsetintegeroptionalPagination offset (default 0){
"data": [
{
"ncesId": "0600017",
"name": "Apple Valley Unified",
"state": "CA",
"county": "San Bernardino",
"status": "open",
"grades": { "low": "KG", "high": "12" },
"enrollmentTotal": 21450,
"lat": 34.4988,
"lng": -117.1858
}
],
"meta": { "requestId": "req_2b8e5d1f4a7c", "creditsUsed": 1, "creditsRemaining": 247 },
"source": { "ncesYear": "2024-25", "updatedAt": "2025-12-15" }
}/v1/schoolsFind schools near an address or coordinates. Provide either address or lat+lng.
addressstringoptionalCenter address for radius searchlatnumberoptionalLatitudelngnumberoptionalLongituderadius_milesnumberoptionalSearch radius in miles (max 50, default 5)limitintegeroptionalMax results (max 100, default 20){
"data": [
{
"ncesId": "060001706027",
"name": "Apple Valley High School",
"state": "CA",
"county": "San Bernardino",
"grades": { "low": "09", "high": "12" },
"type": { "code": 1, "name": "Regular School" },
"status": "open",
"flags": { "isCharter": false, "isMagnet": false, "isVirtual": false },
"enrollment": { "total": 2841, "year": "2024-25" },
"geo": { "lat": 34.5012, "lng": -117.2134 }
}
],
"meta": { "requestId": "req_7d3f1e9c2a8b", "creditsUsed": 1, "creditsRemaining": 246 },
"source": { "ncesYear": "2024-25", "updatedAt": "2025-12-15" }
}/v1/schools/{id}Get the full profile for a school by its 12-digit NCES school ID.
/v1/schools/{id}/districtGet the parent district for a school.
Every response is wrapped in a consistent envelope. Field names are camelCase.
{
"data": { ... },
"meta": {
"requestId": "req_9f4b2a1c8e3d",
"creditsUsed": 1,
"creditsRemaining": 249
},
"source": {
"ncesYear": "2024-25",
"updatedAt": "2025-12-15",
"freshnessDays": 127
}
}All errors return a consistent JSON body:
{
"detail": {
"code": "DISTRICT_NOT_FOUND",
"message": "No school district found for the provided location."
}
}INVALID_PARAMSRequired parameters are missing or conflicting. Check the error message for specifics.INVALID_ADDRESSThe provided address could not be geocoded. Ensure it is a valid US address.INVALID_API_KEYThe API key is missing, invalid, or has been deactivated.QUOTA_EXCEEDEDYour monthly request quota has been reached. Upgrade your plan or wait for the monthly reset.DISTRICT_NOT_FOUNDNo district found for the given NCES ID or coordinates.SCHOOL_NOT_FOUNDNo school found for the given NCES school ID.RATE_LIMIT_EXCEEDEDToo many requests per minute. Slow down and retry after a moment.INTERNAL_ERRORAn unexpected server error occurred. If this persists, contact support.DistrictAPI is designed to work well inside AI assistants, agents, and RAG pipelines. A machine-readable reference covering all endpoints, schemas, and examples is available at:
districtapi.dev/llms.txtโUse DistrictAPI directly inside Claude, Cursor, and any MCP-compatible assistant. Ask about districts by address, name, or ID โ no code required.
Typed client for Python. Wrap any agent tool call around a single function โ no raw HTTP required.
Typed client for Node.js and TypeScript. Works in LangChain tool definitions, Vercel AI SDK, and plain fetch wrappers.