Coordinates Lookup API
Turn a free-text place name — a city, neighborhood, landmark, or airport — into geographic coordinates you can use anywhere.
Overview
Primary Use Case
Resolve a place name to latitude/longitude, then feed those coordinates into any of StayAPI's location-based endpoints (for example, searching for hotels or restaurants near a location).
Many StayAPI endpoints search by latitude and longitude. This endpoint is the bridge: give it a place name and it returns the resolved location with coordinates, a place type, and a country code.
Endpoint URL
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| term | string | Required |
The place name to resolve (e.g. Manhattan, Central Park, Paris). Whitespace is trimmed; an empty value returns a 400.
|
| limit | integer | Optional | Maximum number of locations to return (1–25, default 10). The lookup typically resolves to a single best match. |
Response Format
Success Response (200 OK)
| Field | Type | Description |
|---|---|---|
| success | boolean | Always true on a 2xx response |
| query | string | The (trimmed) term you searched |
| total | integer | Number of locations returned (0 if nothing matched) |
| locations | array | List of matching locations (see fields below) |
Location Object
| Field | Type | Description |
|---|---|---|
| name | string | Full formatted address / label of the place |
| type | string | Place type — e.g. locality, country, airport, point_of_interest |
| latitude | number | Latitude of the location |
| longitude | number | Longitude of the location |
| country | string | ISO 3166-1 alpha-2 country code (may be null) |
| place_id | string | Stable identifier for the location |
No matches
A valid query that matches nothing is still a success: you get HTTP 200 with "total": 0 and an empty "locations" array — not an error.
Common Use Cases
Powering Location Search
Let users type a city or neighborhood, resolve it to coordinates, then search hotels or restaurants near that point.
Map Centering
Center a map on a searched place using the returned latitude and longitude.
Data Enrichment
Attach coordinates and a country code to place names in your own database.
Autosuggest Backends
Resolve a selected suggestion to coordinates before running a geo query.
Error Responses
Errors follow the RFC 7807 Problem Details format.
400 Bad Request
The term parameter is missing or empty.
{
"type": "https://api.stayapi.com/errors/invalid-input",
"title": "Invalid Input",
"status": 400,
"detail": "Parameter 'term' must not be empty.",
"error_code": "INVALID_INPUT"
}
502 Upstream Error
The lookup provider was temporarily unavailable. Retry after a short delay.
{
"type": "https://api.stayapi.com/errors/upstream-error",
"title": "Upstream Error",
"status": 502,
"detail": "Failed to resolve the location",
"error_code": "UPSTREAM_ERROR"
}