Community. Driven. Weather. Data.Always Ad-FreeDeveloper FriendlyChecking statusDiscord
Become a supporter
Sign in

Locations

Turn a place name, ZIP or county into coordinates, and list the places people look up most.


Base URL: https://api.wxalerts.org

Most routes in this API take a latitude and longitude. These two give you one from what a person actually types.

GET /locations/search

Fuzzy search over US states, counties, cities and ZIPs.

Access. Anonymous, or an API key holding locations:read. Also served at /v1/locations/search, where a key (or the app or website sign-in) is required. Anonymous requests share the per-address limit, and a request with a key is charged to the key. See Rate limits.

Free text search over US states, counties, cities, unincorporated communities and ZIP codes, for a search box. Each result carries an id that other endpoints accept as location_id, a centroid and a suggested map zoom. The gazetteer changes about once a year, so results are cacheable for a day on the unprefixed path.

Parameters

Name In Type Required Default Bounds Description
q query string yes none at least 1 character, at most 120 characters Free text: place, ZIP or state, 1 to 120 characters
limit query integer no 8 1 to 25 Most results to return, 1 to 25. Default 8

Response

Returns object.

Field Type Description
query string The query that was searched, as sent.
results array of object Matches, best first, at most limit. Empty when nothing matched.
results[].id integer Stable place id. Pass it as location_id to /forecast, /weather and similar.
results[].kind “state” | “county” | “city” | “community” | “zip” What kind of place this is: state, county, city, community or zip.
results[].name string Bare name, e.g. ‘Pensacola’
results[].display_name string Disambiguated label, e.g. ‘Pensacola, FL’
results[].state string or null Two-letter state or territory, when there is one.
results[].population integer or null 2023 Census estimate; null for CDPs, communities and ZIPs, which the series omits
results[].lat number Latitude of the place’s centroid, degrees.
results[].lon number Longitude of the place’s centroid, degrees.
results[].zoom integer Suggested map zoom. Locations carry a centroid rather than an extent, so this is derived from the geography type and its land area.
{
  "query": "pensacola",
  "results": [
    {
      "display_name": "Pensacola, FL",
      "id": 40512,
      "kind": "city",
      "lat": 30.4213,
      "lon": -87.2169,
      "name": "Pensacola",
      "population": 54312,
      "state": "FL",
      "zoom": 11
    },
    {
      "display_name": "32501, Pensacola, FL",
      "id": 91874,
      "kind": "zip",
      "lat": 30.4097,
      "lon": -87.2112,
      "name": "32501",
      "state": "FL",
      "zoom": 12
    }
  ]
}

Errors

Status Meaning
422 A parameter is missing, malformed or out of range. detail lists which.

Plus the common errors every route can return (400 key_in_query, 401, 403, 429, 500).

Caching and limits

Cache-Control: public, max-age=86400: the gazetteer changes about once a year. Under /v1 it is private, max-age=86400. No ETag.

GET /locations/popular

The places most searched for a forecast over the last week.

Access. Anonymous, or an API key holding locations:read. Also served at /v1/locations/popular, where a key (or the app or website sign-in) is required. Anonymous requests share the per-address limit, and a request with a key is charged to the key. See Rate limits.

The places people have most searched for a forecast over the last week, most searched first. The list is empty until enough people have searched, so a client should keep defaults of its own for that case.

Parameters

Name In Type Required Default Bounds Description
limit query integer no 5 1 to 25 Most places to return, 1 to 25. Default 5

Response

Returns object.

Field Type Description
window_days integer How many days of searches the ranking covers
results array of object Most searched first. Empty until enough people have searched; a client should keep its own defaults for that case.
results[].id integer Stable place id. Pass it as location_id to /forecast, /weather and similar.
results[].kind “state” | “county” | “city” | “community” | “zip” What kind of place this is: state, county, city, community or zip.
results[].name string Bare name, e.g. ‘Pensacola’
results[].display_name string Disambiguated label, e.g. ‘Pensacola, FL’
results[].state string or null Two-letter state or territory, when there is one.
results[].population integer or null 2023 Census estimate; null for CDPs, communities and ZIPs, which the series omits
results[].lat number Latitude of the place’s centroid, degrees.
results[].lon number Longitude of the place’s centroid, degrees.
results[].zoom integer Suggested map zoom. Locations carry a centroid rather than an extent, so this is derived from the geography type and its land area.
{
  "results": [
    {
      "display_name": "Pensacola, FL",
      "id": 40512,
      "kind": "city",
      "lat": 30.4213,
      "lon": -87.2169,
      "name": "Pensacola",
      "population": 54312,
      "state": "FL",
      "zoom": 11
    }
  ],
  "window_days": 7
}

Errors

Status Meaning
422 A parameter is missing, malformed or out of range. detail lists which.

Plus the common errors every route can return (400 key_in_query, 401, 403, 429, 500).

Caching and limits

Cache-Control: public, max-age=3600. Under /v1 it is private, max-age=3600. No ETag.

View this page as Markdown

May we use Microsoft Clarity to see how pages are used (clicks, scrolling and replays of a visit, with anything you type hidden), plus a random ID linking that to crash reports? Only to find bugs and confusing screens. Never advertising, never sold.