Search places
Search for a Place.
The Places API gives you a read-only interface to PredictHQ's places data. A place represents a Geonames Feature, which can be either an Area, an Administrative Feature, or a Populated Place.
You can use the Places API to search and filter events using named geographic features rather than a radius, latitude, and longitude (see events' place.scope and place.exact parameters). This is helpful when searching for all events that apply to a continent, country, state, region, province, county, or city.
Search for places by text query, country, geographic coordinates, or place IDs.
At least one of q, country, location, or id must be provided — otherwise a 400 is returned.
Filtering:
q— free-text search on place name.country— comma-separated ISO 3166-1 alpha-2 country codes.location— coordinates inlat,lonor@lat,lonformat. Lat must be between −90 and 90, lon between −180 and 180.id— comma-separated place IDs. Whenidis the only filter and no pagination parameters are set, an optimised multi-get is used instead of a search query.type— comma-separated place types. Accepts admin level values as well as aliases (e.g.localexpands toneighbourhood,locality, andlocaladmin).
Results are paginated with offset and limit.
Enter your PredictHQ API key. The Bearer prefix is added automatically.
When calling the API directly, send: Authorization: Bearer <YOUR_API_KEY> as documented at https://docs.predicthq.com/api/overview/authenticating
Zero-based index of the first result to return.
0Maximum number of results to return per page.
10A comma-separated list of place identifiers.
E.g. ?id=5115985
A comma-separated list of ISO 3166-1 alpha-2 country code.
E.g. ?country=US
A coordinate in the form @{latitude},{longitude}.
E.g. ?location=@40.66677,-73.88236
A full-text search query.
E.g. ?q=New+York
Successful Response
Total number of places matching the query
URL to next page
URL to previous page
Bad Request
Unauthorized
Forbidden
GET /v1/places HTTP/1.1
Host: api.predicthq.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"count": 1,
"next": "text",
"previous": "text",
"results": [
{
"id": "text",
"type": "planet",
"name": "text",
"county": "text",
"region": "text",
"country": "text",
"country_alpha2": "text",
"country_alpha3": "text",
"location": [
1
]
}
]
}Examples
The following examples search for places named New York:
OpenAPI spec
See the OpenAPI spec for the Places API.
Guides
The following guides are relevant to this API:
Last updated
Was this helpful?