Base URL: https://api.publicsafetyapi.dev·Current version: v1·Data: HIFLD 2024
Pass your API key via the X-API-Key header on every request. Alternatively, use Authorization: Bearer <key>.
curl "https://api.publicsafetyapi.dev/v1/stations/nearby?lat=34.50&lon=-117.19&type=fire" \ -H "X-API-Key: psk_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/stations/nearbyFind the nearest public safety facilities to a coordinate, filtered by type. The primary endpoint — lat/lon in, ranked stations out.
latnumberrequiredLatitude (WGS84)lonnumberrequiredLongitude (WGS84)typeenumoptional"fire" | "police" | "hospital" | "ems". Omit to return all types.radiusnumberoptionalSearch radius in miles. Min 0.1, max 100, default 10.limitintegeroptionalMax results. Min 1, max 100, default 10.{
"data": [
{
"id": "fire_CA_12345",
"name": "Apple Valley Fire Station 335",
"type": "fire",
"address": { "street": "20763 US-18", "city": "Apple Valley", "state": "CA", "zip": "92308" },
"phone": null,
"geo": { "lat": 34.4801, "lng": -117.2091 },
"distance_miles": 1.47
}
],
"meta": { "requestId": "req_a1b2c3d4", "creditsUsed": 1, "creditsRemaining": 499 },
"source": { "dataVersion": "2026-05", "updatedAt": "2026-05-27" }
}/v1/stations/{station_id}Get a single station by its ID.
/v1/stationsList all stations. Filter by type and/or state. Results are paginated.
typeenumoptional"fire" | "police" | "hospital" | "ems"statestringoptionalTwo-letter state abbreviation (e.g. CA)limitintegeroptionalResults per page. Max 1000, default 100.offsetintegeroptionalPagination offset. Default 0./v1/jurisdictionDetermine which Census-defined jurisdiction (city/town or county) contains a coordinate. Useful for building coverage reports or routing context.
latnumberrequiredLatitude (WGS84)lonnumberrequiredLongitude (WGS84){
"data": {
"city": { "geoid": "0603526000", "name": "Apple Valley", "state": "CA", "type": "town" },
"county": { "geoid": "06071", "name": "San Bernardino County", "state": "CA" }
},
"meta": { "requestId": "req_e5f6g7h8", "creditsUsed": 1, "creditsRemaining": 498 }
}/v1/states/{code}/summaryState-level facility counts broken down by type.
{
"data": {
"state": "CA",
"counts": {
"fire": 3210,
"police": 1845,
"hospital": 512,
"ems": 934
},
"total": 6501
},
"meta": { ... },
"source": { "dataVersion": "2026-05", "updatedAt": "2026-05-27" }
}/v1/healthService health check. Returns DB connectivity and data freshness. Does NOT consume a credit and does NOT require an API key.
Every response is wrapped in a consistent envelope. Field names are camelCase.
{
"data": { ... },
"meta": {
"requestId": "req_a1b2c3d4",
"creditsUsed": 1,
"creditsRemaining": 499
},
"source": {
"dataVersion": "2026-05",
"updatedAt": "2026-05-27"
}
}All errors return a consistent JSON body:
{
"detail": {
"code": "NO_STATIONS_NEARBY",
"message": "No stations within 10 miles."
}
}INVALID_PARAMSRequired parameters are missing or invalid.INVALID_API_KEYThe API key is missing, invalid, or deactivated.QUOTA_EXCEEDEDMonthly request quota reached. Upgrade or wait for the monthly reset.STATION_NOT_FOUNDNo station found for the given ID.NO_STATIONS_NEARBYNo stations within the requested radius. Try a larger radius.RATE_LIMITEDToo many requests per minute. Slow down and retry.INTERNAL_ERRORUnexpected server error. Contact support if this persists.All records trace back to HIFLD (Homeland Infrastructure Foundation-Level Data), maintained by DHS/CISA. Public domain, commercially usable.
Datasets: Local Law Enforcement Locations, Fire Stations, Hospitals, and EMS Stations. Facility coordinates are WGS84, spatial-indexed with PostGIS for sub-100ms nearby queries.
We supplement with Census TIGER incorporated places and counties for the jurisdiction endpoint.
A machine-readable reference covering all endpoints, schemas, and examples lives at:
publicsafetyapi.dev/llms.txt↗