Search docs

Responses and errors

Response shape, the geocoding block, and status codes.

By ยท Updated

Every endpoint returns a GeoJSON FeatureCollection in the Pelias shape.

The geocoding block

FieldMeaning
versionPelias response version.
attributionURL of the data attribution page.
enginename and version of the server.
queryThe parsed request: text or fields, size, and ranking. Reverse returns its point and radius instead.
query.rankingimportance (text score plus importance) or importance+distance (with a focus point).
errorsPresent only on errors: human-readable messages.

Feature properties

Each feature has id, gid, layer, source, name, label and importance, plus the fields that are known for that place: street, postalcode, locality, county, region, country and country_code. Text searches add confidence. Results near a focus point, and all reverse results, add distance in kilometres. The collection also has a bbox of all features.

Status codes

StatusWhen
200Success, including an empty result.
400A parameter is missing or invalid.
500The .glx file cannot be read. The error message is the search index is unavailable.

Validation errors

curl 'http://localhost:4000/v1/search'
# HTTP 400
{
  "features": [],
  "geocoding": {
    "errors": [
      "missing param 'text'"
    ]
  },
  "type": "FeatureCollection"
}
curl 'http://localhost:4000/v1/search?text=pune&size=0'
# HTTP 400
{
  "features": [],
  "geocoding": {
    "errors": [
      "size must be between 1 and 40"
    ]
  },
  "type": "FeatureCollection"
}
curl 'http://localhost:4000/v1/search?text=cafe&layers=planet'
# HTTP 400
{
  "features": [],
  "geocoding": {
    "errors": [
      "unknown layer 'planet'; supported: venue, address, street, locality, county, region, country"
    ]
  },
  "type": "FeatureCollection"
}
curl 'http://localhost:4000/v1/search?text=cafe&focus.point.lat=18'
# HTTP 400
{
  "features": [],
  "geocoding": {
    "errors": [
      "focus.point.lat and focus.point.lon must be set together"
    ]
  },
  "type": "FeatureCollection"
}