API Reference

Base URL: https://api.districtapi.devยทCurrent version: v1ยทData: NCES 2024-25

Authentication

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"

Rate Limits

Two limits apply on every request:

PlanPer minutePer month
Free10 req/min500 req
Starter60 req/min10,000 req
Pro120 req/min50,000 req
Growth300 req/min200,000 req

Monthly quotas reset on the 1st of each calendar month. Exceeding the per-minute limit returns 429. Exceeding the monthly quota returns 402.

Endpoints

GET/v1/districts

Look up a district by address, lat/lng, or NCES LEA ID. Provide exactly one of: address, lat+lng, or nces_id.

Query Parameters
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
Example Response
{
  "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" }
}
GET/v1/districts/{id}

Get the full profile for a district by its 7-digit NCES LEA ID.

GET/v1/districts/{id}/schools

List all open schools in a district.

Query Parameters
typeintegeroptionalFilter by school type (1=Regular, 2=Special Ed, 3=Vocational, 4=Alternative)
charterbooleanoptionalFilter to charter schools only
Example Response
{
  "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" }
}
GET/v1/districts/search

Search districts by name, state, or county. Provide at least one parameter.

Query Parameters
namestringoptionalDistrict name (full-text search)
statestringoptionalTwo-letter state abbreviation
countystringoptionalCounty name (partial match)
limitintegeroptionalResults per page (max 100, default 20)
offsetintegeroptionalPagination offset (default 0)
Example Response
{
  "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" }
}
GET/v1/schools

Find schools near an address or coordinates. Provide either address or lat+lng.

Query Parameters
addressstringoptionalCenter address for radius search
latnumberoptionalLatitude
lngnumberoptionalLongitude
radius_milesnumberoptionalSearch radius in miles (max 50, default 5)
limitintegeroptionalMax results (max 100, default 20)
Example Response
{
  "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" }
}
GET/v1/schools/{id}

Get the full profile for a school by its 12-digit NCES school ID.

GET/v1/schools/{id}/district

Get the parent district for a school.

Response Envelope

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
  }
}

Error Codes

All errors return a consistent JSON body:

{
  "detail": {
    "code": "DISTRICT_NOT_FOUND",
    "message": "No school district found for the provided location."
  }
}
HTTPCodeDescription
400INVALID_PARAMSRequired parameters are missing or conflicting. Check the error message for specifics.
400INVALID_ADDRESSThe provided address could not be geocoded. Ensure it is a valid US address.
401INVALID_API_KEYThe API key is missing, invalid, or has been deactivated.
402QUOTA_EXCEEDEDYour monthly request quota has been reached. Upgrade your plan or wait for the monthly reset.
404DISTRICT_NOT_FOUNDNo district found for the given NCES ID or coordinates.
404SCHOOL_NOT_FOUNDNo school found for the given NCES school ID.
429RATE_LIMIT_EXCEEDEDToo many requests per minute. Slow down and retry after a moment.
500INTERNAL_ERRORAn unexpected server error occurred. If this persists, contact support.
๐Ÿค–

LLM & AI Integration

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โ†—
MCP Server

Use DistrictAPI directly inside Claude, Cursor, and any MCP-compatible assistant. Ask about districts by address, name, or ID โ€” no code required.

Python SDK

Typed client for Python. Wrap any agent tool call around a single function โ€” no raw HTTP required.

Node.js SDK

Typed client for Node.js and TypeScript. Works in LangChain tool definitions, Vercel AI SDK, and plain fetch wrappers.