Skip to content

Instantly share code, notes, and snippets.

@marcosci
Created April 25, 2026 06:54
Show Gist options
  • Select an option

  • Save marcosci/26714f56b52d36b64ba6efc333beac6a to your computer and use it in GitHub Desktop.

Select an option

Save marcosci/26714f56b52d36b64ba6efc333beac6a to your computer and use it in GitHub Desktop.
Pelias OpenAPI 3.1 spec — draft for pelias/api#1699

Pelias Geocoder — OpenAPI 3.1

A full OpenAPI 3.1 description of the Pelias geocoder HTTP API (v1, matching pelias/api 7.x). The spec is hand-written from the upstream route handlers, sanitizers, and pelias/documentation — not auto-derived, so every parameter, enum, and schema reflects real server behaviour.

Layout

openapi/
├── openapi.yaml          # the spec (single file, self-contained)
├── examples/             # realistic request / response JSON pairs
│   ├── search.response.json
│   ├── autocomplete.response.json
│   └── reverse.response.json
├── package.json          # redocly devDependency + scripts
└── .gitignore

Validate

npx --yes @redocly/cli@latest lint openapi.yaml
# or, after `npm install`:
npm run lint

Preview

Interactive ReDoc preview with hot reload:

npm run preview
# open http://127.0.0.1:8080

Static HTML build:

npm run build          # writes dist/index.html
npm run bundle         # writes dist/openapi.bundled.yaml

Generate clients

With openapi-generator-cli:

# TypeScript (fetch)
npx @openapitools/openapi-generator-cli generate \
  -i openapi.yaml \
  -g typescript-fetch \
  -o ./clients/ts

# Python
npx @openapitools/openapi-generator-cli generate \
  -i openapi.yaml \
  -g python \
  -o ./clients/python \
  --additional-properties=packageName=pelias_client

What's covered

  • GET /search, POST /search
  • GET /search/structured
  • GET /autocomplete
  • GET /reverse
  • GET /nearby
  • GET /place
  • GET /status
  • GET /attribution
  • Every documented query parameter (text, focus.point.*, boundary.rect.*, boundary.circle.*, boundary.country, boundary.gid, sources, layers, categories, lang, size, plus the eight structured fields).
  • Full GeoJSON FeatureCollection / Feature / Point schemas, the Pelias geocoding envelope, and the full properties hierarchy (country → neighbourhood, match_type, accuracy, confidence, distance, addendum).
  • Enums for layers, sources, match_type, accuracy.

What's NOT covered

  • Authentication. The reference pelias/api ships with no auth. Hosted providers (Geocode Earth etc.) layer their own API-key schemes on top — the spec declares both api_key query and Authorization header security schemes, but the details vary per provider.
  • Admin / debug routes (/v1/debug, _search, internal /config). Not part of the public surface.
  • Per-provider rate-limit headers (e.g. X-RateLimit-Remaining). Not emitted by the reference server.
  • Deprecated quattroshapes source. Replaced by whosonfirst in 2016.

Contributing

This spec is intended to be upstream-able to pelias/documentation. PRs welcome — keep parameter names, defaults, and caps in sync with pelias/api's sanitizer/ directory.

Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
openapi: 3.1.0
info:
title: Pelias Geocoder API
version: 1.0.0
summary: Open-source modular geocoder — forward, reverse, autocomplete, structured, and place lookup.
description: |
OpenAPI 3.1 specification for the [Pelias](https://github.com/pelias/api) geocoder
(HTTP API v1, matching upstream `pelias/api` v7.x).
Pelias returns [GeoJSON](https://geojson.org) `FeatureCollection` responses
augmented with a top-level `geocoding` block containing query metadata,
engine info, warnings, and errors.
Covered endpoints:
- `GET /search`, `POST /search` — forward geocoding of free-form text
- `GET /search/structured` — forward geocoding of component fields
- `GET /autocomplete` — type-ahead suggestions
- `GET /reverse` — reverse geocoding from a lat/lon
- `GET /nearby` — nearby features from a lat/lon (no text)
- `GET /place` — lookup one or more features by Pelias GID
- `GET /status` — service liveness
- `GET /attribution` — data and engine attribution
**Authentication.** The reference `pelias/api` ships with no auth. Hosted
providers (for example Geocode Earth) require an `api_key` query parameter
or `Authorization` header — see the hosted service docs.
**Rate limits.** Self-hosted installs are unlimited; hosted providers
advertise their own quotas. `size` ranges enforced by the server are
documented on each endpoint.
contact:
name: Pelias
url: https://github.com/pelias/api/issues
license:
name: MIT
identifier: MIT
termsOfService: https://github.com/pelias/api/blob/master/LICENSE.txt
servers:
- url: https://api.geocode.earth/v1
description: Geocode Earth hosted Pelias (requires api_key)
- url: http://{host}:{port}/v1
description: Self-hosted Pelias
variables:
host:
default: 127.0.0.1
description: Host of the self-hosted Pelias API container.
port:
default: '4000'
description: Default Pelias API port.
tags:
- name: Forward geocoding
description: Resolve text and component fields to coordinates.
- name: Reverse geocoding
description: Resolve coordinates to features.
- name: Autocomplete
description: Low-latency type-ahead suggestions.
- name: Place lookup
description: Retrieve features by Pelias GID.
- name: Service
description: Status and attribution.
security:
- {}
- ApiKeyQuery: []
- ApiKeyHeader: []
paths:
/search:
get:
tags: [Forward geocoding]
summary: Forward geocoding (free-form text)
operationId: search
description: |
Resolve a free-form query (`text`) to one or more ranked features.
Combine with `focus.point.*` to bias toward a location,
`boundary.*` to restrict results, and `sources`/`layers`/`lang`
to narrow the dataset.
parameters:
- $ref: '#/components/parameters/Text'
- $ref: '#/components/parameters/FocusPointLat'
- $ref: '#/components/parameters/FocusPointLon'
- $ref: '#/components/parameters/BoundaryRectMinLat'
- $ref: '#/components/parameters/BoundaryRectMinLon'
- $ref: '#/components/parameters/BoundaryRectMaxLat'
- $ref: '#/components/parameters/BoundaryRectMaxLon'
- $ref: '#/components/parameters/BoundaryCircleLat'
- $ref: '#/components/parameters/BoundaryCircleLon'
- $ref: '#/components/parameters/BoundaryCircleRadius'
- $ref: '#/components/parameters/BoundaryCountry'
- $ref: '#/components/parameters/BoundaryGid'
- $ref: '#/components/parameters/Sources'
- $ref: '#/components/parameters/Layers'
- $ref: '#/components/parameters/Categories'
- $ref: '#/components/parameters/Lang'
- name: size
in: query
description: Number of results to return.
schema:
type: integer
minimum: 1
maximum: 40
default: 10
responses:
'200':
description: GeoJSON FeatureCollection of ranked features.
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureCollection'
examples:
flatironBuilding:
$ref: '#/components/examples/SearchResponse'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/ServerError'
post:
tags: [Forward geocoding]
summary: Forward geocoding (free-form text, POST body)
operationId: searchPost
description: |
Same semantics as `GET /search`, accepting the same parameters as a
JSON body. Useful when the query string would exceed URL length limits.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SearchRequest'
examples:
freeText:
value:
text: 30 W 26th St, New York
focus.point.lat: 40.7128
focus.point.lon: -74.006
size: 5
responses:
'200':
description: GeoJSON FeatureCollection of ranked features.
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureCollection'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/ServerError'
/search/structured:
get:
tags: [Forward geocoding]
summary: Forward geocoding (component fields)
operationId: searchStructured
description: |
Forward geocoding where the query is split into structured fields
(address, locality, region, ...). At least one structured field is
required. All `/search` focus and boundary parameters are also
accepted.
parameters:
- name: address
in: query
description: Full street address or street name (with optional house number).
schema: { type: string }
example: 30 W 26th St
- name: neighbourhood
in: query
description: Vernacular geographic entity; may not be an official division.
schema: { type: string }
example: Flatiron District
- name: borough
in: query
description: Administrative division (e.g. NYC boroughs).
schema: { type: string }
example: Manhattan
- name: locality
in: query
description: City-level administrative division.
schema: { type: string }
example: New York
- name: county
in: query
description: Administrative division between locality and region.
schema: { type: string }
example: New York County
- name: region
in: query
description: First-level admin division (state, province). Accepts full names or abbreviations.
schema: { type: string }
example: NY
- name: postalcode
in: query
description: Postal/ZIP code.
schema: { type: string }
example: '10010'
- name: country
in: query
description: Country name or ISO 3166 alpha-2 / alpha-3 code.
schema: { type: string }
example: USA
- $ref: '#/components/parameters/FocusPointLat'
- $ref: '#/components/parameters/FocusPointLon'
- $ref: '#/components/parameters/BoundaryRectMinLat'
- $ref: '#/components/parameters/BoundaryRectMinLon'
- $ref: '#/components/parameters/BoundaryRectMaxLat'
- $ref: '#/components/parameters/BoundaryRectMaxLon'
- $ref: '#/components/parameters/BoundaryCircleLat'
- $ref: '#/components/parameters/BoundaryCircleLon'
- $ref: '#/components/parameters/BoundaryCircleRadius'
- $ref: '#/components/parameters/BoundaryCountry'
- $ref: '#/components/parameters/BoundaryGid'
- $ref: '#/components/parameters/Sources'
- $ref: '#/components/parameters/Layers'
- $ref: '#/components/parameters/Lang'
- name: size
in: query
description: Number of results to return.
schema:
type: integer
minimum: 1
maximum: 40
default: 10
responses:
'200':
description: GeoJSON FeatureCollection of ranked features.
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureCollection'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/ServerError'
/autocomplete:
get:
tags: [Autocomplete]
summary: Type-ahead suggestions
operationId: autocomplete
description: |
Low-latency partial-match endpoint intended for UI type-ahead. The
reference server caps `size` at 10. The underlying Elasticsearch query
uses token edge n-grams; responses ship quickly but with less
thorough scoring than `/search`.
parameters:
- $ref: '#/components/parameters/Text'
- $ref: '#/components/parameters/FocusPointLat'
- $ref: '#/components/parameters/FocusPointLon'
- $ref: '#/components/parameters/BoundaryRectMinLat'
- $ref: '#/components/parameters/BoundaryRectMinLon'
- $ref: '#/components/parameters/BoundaryRectMaxLat'
- $ref: '#/components/parameters/BoundaryRectMaxLon'
- $ref: '#/components/parameters/BoundaryCircleLat'
- $ref: '#/components/parameters/BoundaryCircleLon'
- $ref: '#/components/parameters/BoundaryCircleRadius'
- $ref: '#/components/parameters/BoundaryCountry'
- $ref: '#/components/parameters/BoundaryGid'
- $ref: '#/components/parameters/Sources'
- $ref: '#/components/parameters/Layers'
- $ref: '#/components/parameters/Lang'
- name: size
in: query
description: Number of results. Default 10. Hard cap controlled by `api.maxSize` (default 40).
schema:
type: integer
minimum: 1
maximum: 40
default: 10
responses:
'200':
description: GeoJSON FeatureCollection of suggestions.
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureCollection'
examples:
partialQuery:
$ref: '#/components/examples/AutocompleteResponse'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/ServerError'
/reverse:
get:
tags: [Reverse geocoding]
summary: Reverse geocode a coordinate
operationId: reverse
description: |
Return features closest to `point.lat`/`point.lon`. The circle radius
is capped at **5 km** on the reference server to conserve I/O.
parameters:
- name: point.lat
in: query
required: true
description: Latitude of the query point in decimal degrees.
schema:
type: number
format: double
minimum: -90
maximum: 90
example: 40.7444
- name: point.lon
in: query
required: true
description: Longitude of the query point in decimal degrees.
schema:
type: number
format: double
minimum: -180
maximum: 180
example: -73.9904
- name: boundary.circle.radius
in: query
description: Radius in kilometres. Reverse is capped at 5 km.
schema:
type: number
format: double
minimum: 0
maximum: 5
default: 1
- $ref: '#/components/parameters/BoundaryCountry'
- $ref: '#/components/parameters/Sources'
- $ref: '#/components/parameters/Layers'
- $ref: '#/components/parameters/Categories'
- $ref: '#/components/parameters/Lang'
- name: size
in: query
description: Number of results to return.
schema:
type: integer
minimum: 1
maximum: 40
default: 10
responses:
'200':
description: GeoJSON FeatureCollection of nearby features.
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureCollection'
examples:
timesSquare:
$ref: '#/components/examples/ReverseResponse'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/ServerError'
/nearby:
get:
tags: [Reverse geocoding]
summary: Nearby features (no text match)
operationId: nearby
description: |
Return features near `point.lat`/`point.lon` without textual matching.
Similar to `/reverse` but optimised for pure proximity lookups.
parameters:
- name: point.lat
in: query
required: true
description: Latitude of the query point in decimal degrees.
schema:
type: number
format: double
minimum: -90
maximum: 90
- name: point.lon
in: query
required: true
description: Longitude of the query point in decimal degrees.
schema:
type: number
format: double
minimum: -180
maximum: 180
- name: boundary.circle.radius
in: query
description: Search radius in kilometres.
schema:
type: number
format: double
minimum: 0
default: 1
- $ref: '#/components/parameters/BoundaryCountry'
- $ref: '#/components/parameters/BoundaryGid'
- $ref: '#/components/parameters/Sources'
- $ref: '#/components/parameters/Layers'
- $ref: '#/components/parameters/Categories'
- $ref: '#/components/parameters/Lang'
- name: size
in: query
description: Number of results to return.
schema:
type: integer
minimum: 1
maximum: 40
default: 10
responses:
'200':
description: GeoJSON FeatureCollection of nearby features.
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureCollection'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/ServerError'
/place:
get:
tags: [Place lookup]
summary: Look up features by Pelias GID
operationId: place
description: |
Fetch one or more features by their Pelias global identifier (GID).
Multiple GIDs are comma-separated in `ids`. Results are returned in
the order requested. If a GID is not found it is silently omitted
(GeoJSON cannot express per-item errors).
parameters:
- name: ids
in: query
required: true
description: |
Comma-separated list of Pelias GIDs
(`<source>:<layer>:<id>`), e.g.
`whosonfirst:locality:101750367,openstreetmap:venue:node/1234`.
schema:
type: string
example: whosonfirst:locality:101750367,openstreetmap:venue:node/1234567890
- $ref: '#/components/parameters/Categories'
- $ref: '#/components/parameters/Lang'
responses:
'200':
description: GeoJSON FeatureCollection of matched features.
content:
application/json:
schema:
$ref: '#/components/schemas/FeatureCollection'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/ServerError'
/status:
get:
tags: [Service]
summary: Service status
operationId: status
security: []
description: Lightweight liveness probe.
responses:
'200':
description: Service is up.
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
example:
status: ok
'404':
description: Endpoint not mounted (rare; `/status` is usually a singleton).
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
'503':
description: Service is unavailable.
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
/attribution:
get:
tags: [Service]
summary: Data and engine attribution
operationId: attribution
security: []
description: |
Returns the attribution page (plain HTML). Included in the spec for
completeness — clients usually consume the per-response
`geocoding.attribution` string instead.
responses:
'200':
description: HTML attribution page.
content:
text/html:
schema:
type: string
example: |
<h2>Data Sources</h2>
<ul>
<li>OpenStreetMap: © OpenStreetMap contributors, ODbL 1.0</li>
<li>OpenAddresses: various licenses per source</li>
<li>Who's on First: CC-BY 4.0</li>
<li>GeoNames: CC-BY 4.0</li>
</ul>
'404':
description: Attribution page not configured.
content:
text/plain:
schema:
type: string
components:
securitySchemes:
ApiKeyQuery:
type: apiKey
in: query
name: api_key
description: Hosted-provider API key passed as query string.
ApiKeyHeader:
type: apiKey
in: header
name: Authorization
description: Hosted-provider API key passed as header.
parameters:
Text:
name: text
in: query
required: true
description: Free-form query text.
schema:
type: string
minLength: 1
example: Flatiron Building
FocusPointLat:
name: focus.point.lat
in: query
description: Latitude used to bias ranking toward nearby results.
schema:
type: number
format: double
minimum: -90
maximum: 90
example: 40.7128
FocusPointLon:
name: focus.point.lon
in: query
description: Longitude used to bias ranking toward nearby results.
schema:
type: number
format: double
minimum: -180
maximum: 180
example: -74.006
BoundaryRectMinLat:
name: boundary.rect.min_lat
in: query
description: Minimum latitude of the bounding rectangle.
schema:
type: number
format: double
minimum: -90
maximum: 90
BoundaryRectMinLon:
name: boundary.rect.min_lon
in: query
description: Minimum longitude of the bounding rectangle.
schema:
type: number
format: double
minimum: -180
maximum: 180
BoundaryRectMaxLat:
name: boundary.rect.max_lat
in: query
description: Maximum latitude of the bounding rectangle.
schema:
type: number
format: double
minimum: -90
maximum: 90
BoundaryRectMaxLon:
name: boundary.rect.max_lon
in: query
description: Maximum longitude of the bounding rectangle.
schema:
type: number
format: double
minimum: -180
maximum: 180
BoundaryCircleLat:
name: boundary.circle.lat
in: query
description: Centre latitude of the circular boundary.
schema:
type: number
format: double
minimum: -90
maximum: 90
BoundaryCircleLon:
name: boundary.circle.lon
in: query
description: Centre longitude of the circular boundary.
schema:
type: number
format: double
minimum: -180
maximum: 180
BoundaryCircleRadius:
name: boundary.circle.radius
in: query
description: Radius of the circular boundary in kilometres.
schema:
type: number
format: double
minimum: 0
default: 50
BoundaryCountry:
name: boundary.country
in: query
description: |
Restrict to one or more countries by ISO 3166 alpha-2 or alpha-3 code
(comma-separated), e.g. `GBR` or `US,CA,MX`.
schema:
type: string
pattern: '^[A-Za-z]{2,3}(,[A-Za-z]{2,3})*$'
example: GBR
BoundaryGid:
name: boundary.gid
in: query
description: |
Restrict results to descendants of a Pelias GID
(`<source>:<layer>:<id>`), e.g. `whosonfirst:region:85688697`.
schema:
type: string
example: whosonfirst:region:85688697
Sources:
name: sources
in: query
description: |
Comma-separated list of data sources. Short codes and long names are
both accepted.
style: form
explode: false
schema:
type: array
items:
type: string
enum: [osm, openstreetmap, oa, openaddresses, wof, whosonfirst, gn, geonames]
example: [osm, wof]
Layers:
name: layers
in: query
description: |
Comma-separated list of feature layer types. `coarse` is an alias for
every administrative layer (everything except `venue` and `address`).
style: form
explode: false
schema:
type: array
items:
type: string
enum:
- venue
- address
- street
- country
- macroregion
- region
- macrocounty
- county
- locality
- localadmin
- borough
- neighbourhood
- postalcode
- coarse
- dependency
- empire
- marinearea
- disputed
- continent
- ocean
example: [address, venue]
Categories:
name: categories
in: query
description: |
Comma-separated list of venue categories (OpenStreetMap/WhosOnFirst
taxonomy). Only returns venues matching one of the listed categories.
style: form
explode: false
schema:
type: array
items:
type: string
example: [food, education]
Lang:
name: lang
in: query
description: |
BCP47 language tag (only the language subtag is used). Falls back to
the dataset default when unavailable; the response `geocoding` block
echoes the effective language and a `defaulted` flag.
schema:
type: string
pattern: '^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$'
example: de
responses:
BadRequest:
description: Invalid or missing query parameters.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
geocoding:
version: '0.2'
attribution: https://api.geocode.earth/v1/attribution
query: {}
errors: ["invalid param 'text': text length, must be >0"]
warnings: []
engine: { name: Pelias, author: Mapzen, version: '1.0' }
timestamp: 1713993600000
type: FeatureCollection
features: []
ServerError:
description: Upstream backend failure.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
schemas:
# ------- Request bodies -------
SearchRequest:
type: object
required: [text]
additionalProperties: false
properties:
text: { type: string, minLength: 1 }
'focus.point.lat': { type: number, format: double, minimum: -90, maximum: 90 }
'focus.point.lon': { type: number, format: double, minimum: -180, maximum: 180 }
'boundary.rect.min_lat': { type: number, format: double }
'boundary.rect.min_lon': { type: number, format: double }
'boundary.rect.max_lat': { type: number, format: double }
'boundary.rect.max_lon': { type: number, format: double }
'boundary.circle.lat': { type: number, format: double }
'boundary.circle.lon': { type: number, format: double }
'boundary.circle.radius': { type: number, format: double, minimum: 0 }
'boundary.country':
type: string
pattern: '^[A-Za-z]{2,3}(,[A-Za-z]{2,3})*$'
'boundary.gid': { type: string }
sources:
type: array
items:
type: string
enum: [osm, openstreetmap, oa, openaddresses, wof, whosonfirst, gn, geonames]
layers:
type: array
items:
$ref: '#/components/schemas/Layer'
categories:
type: array
items: { type: string }
lang:
type: string
pattern: '^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$'
size: { type: integer, minimum: 1, maximum: 40, default: 10 }
# ------- GeoJSON core -------
FeatureCollection:
type: object
required: [type, features, geocoding]
properties:
geocoding:
$ref: '#/components/schemas/Geocoding'
type:
type: string
const: FeatureCollection
features:
type: array
items:
$ref: '#/components/schemas/Feature'
bbox:
$ref: '#/components/schemas/BoundingBox'
example:
geocoding:
version: '0.2'
attribution: https://api.geocode.earth/v1/attribution
query:
text: Flatiron Building
size: 10
private: false
lang: { name: English, iso6391: en, iso6393: eng, via: default, defaulted: true }
querySize: 20
warnings: []
errors: []
engine: { name: Pelias, author: Mapzen, version: '1.0' }
timestamp: 1713993600000
type: FeatureCollection
features: []
Feature:
type: object
required: [type, geometry, properties]
properties:
type:
type: string
const: Feature
geometry:
$ref: '#/components/schemas/Point'
properties:
$ref: '#/components/schemas/Properties'
bbox:
$ref: '#/components/schemas/BoundingBox'
Point:
type: object
required: [type, coordinates]
properties:
type:
type: string
const: Point
coordinates:
type: array
minItems: 2
maxItems: 3
items:
type: number
format: double
description: '[longitude, latitude] in decimal degrees (WGS84). Optional third element: elevation in metres.'
example: [-73.989, 40.741]
BoundingBox:
type: array
description: '[minLon, minLat, maxLon, maxLat].'
minItems: 4
maxItems: 4
items:
type: number
format: double
example: [-73.99, 40.74, -73.98, 40.75]
# ------- Feature properties -------
Properties:
type: object
required: [gid, layer, source, source_id, name, label]
description: |
Feature-level metadata. Hierarchy fields (`country`, `region`,
`locality`, ...) are only populated where known; most are optional.
properties:
gid:
type: string
description: Globally-unique Pelias identifier `<source>:<layer>:<id>`.
example: openstreetmap:venue:way/34633854
layer:
$ref: '#/components/schemas/Layer'
source:
type: string
enum: [openstreetmap, openaddresses, whosonfirst, geonames]
example: openstreetmap
source_id:
type: string
description: Identifier within the source dataset.
example: way/34633854
name:
type: string
description: Display name of the feature.
example: Flatiron Building
housenumber:
type: string
description: House / building number.
example: '175'
street:
type: string
example: 5th Avenue
postalcode:
type: string
example: '10010'
confidence:
type: number
format: float
minimum: 0
maximum: 1
description: Pelias confidence score in the range 0..1.
example: 0.947
match_type:
$ref: '#/components/schemas/MatchType'
accuracy:
$ref: '#/components/schemas/Accuracy'
distance:
type: number
format: double
description: Great-circle distance (km) from the query point. Reverse/nearby only.
example: 0.082
country:
type: string
example: United States
country_a:
type: string
description: ISO 3166 alpha-3 country code.
example: USA
country_gid:
type: string
example: whosonfirst:country:85633793
macroregion:
type: string
macroregion_a:
type: string
macroregion_gid:
type: string
region:
type: string
example: New York
region_a:
type: string
example: NY
region_gid:
type: string
example: whosonfirst:region:85688543
macrocounty:
type: string
macrocounty_a:
type: string
macrocounty_gid:
type: string
county:
type: string
example: New York County
county_a:
type: string
county_gid:
type: string
example: whosonfirst:county:102081863
localadmin:
type: string
example: Manhattan
localadmin_a:
type: string
localadmin_gid:
type: string
locality:
type: string
example: New York
locality_a:
type: string
locality_gid:
type: string
example: whosonfirst:locality:85977539
borough:
type: string
example: Manhattan
borough_gid:
type: string
example: whosonfirst:borough:421205771
neighbourhood:
type: string
example: Flatiron District
neighbourhood_gid:
type: string
example: whosonfirst:neighbourhood:85869245
continent:
type: string
continent_gid:
type: string
label:
type: string
description: Human-readable composed label.
example: Flatiron Building, New York, NY, USA
addendum:
type: object
description: |
Per-source extended attributes (e.g. `addendum.osm` contains
OpenStreetMap tags not otherwise modelled).
additionalProperties: true
example:
osm:
wikidata: Q80307
website: https://flatironbuilding.com
phone: '+1 212-877-7700'
categories:
type: array
items: { type: string }
description: Venue categories when `categories` is requested or set on the record.
example: [retail, office]
Layer:
type: string
description: Pelias feature layer.
enum:
- venue
- address
- street
- country
- macroregion
- region
- macrocounty
- county
- locality
- localadmin
- borough
- neighbourhood
- postalcode
- coarse
- dependency
- empire
- marinearea
- disputed
- continent
- ocean
MatchType:
type: string
description: Quality of text match against the requested query.
enum: [exact, interpolated, fallback]
Accuracy:
type: string
description: Geometric precision of the returned coordinate.
enum: [point, centroid, rooftop, interpolated]
# ------- geocoding block -------
Geocoding:
type: object
required: [version, attribution, query, engine, timestamp]
properties:
version:
type: string
example: '0.2'
attribution:
type: string
format: uri
example: https://api.geocode.earth/v1/attribution
query:
type: object
additionalProperties: true
description: Echo of the sanitised query and internal tuning parameters.
engine:
type: object
required: [name, author, version]
properties:
name:
type: string
example: Pelias
author:
type: string
example: Mapzen
version:
type: string
example: '1.0'
timestamp:
type: integer
format: int64
description: Server response time (Unix epoch milliseconds).
example: 1713993600000
warnings:
type: array
items: { type: string }
errors:
type: array
items: { type: string }
# ------- service -------
StatusResponse:
type: object
required: [status]
properties:
status:
type: string
enum: [ok, degraded]
example: ok
ErrorResponse:
allOf:
- $ref: '#/components/schemas/FeatureCollection'
- type: object
description: |
Pelias returns errors using the standard envelope with `features: []`
and the error messages populated under `geocoding.errors`.
examples:
SearchResponse:
summary: Search for a venue
value:
geocoding:
version: '0.2'
attribution: https://api.geocode.earth/v1/attribution
query:
text: Flatiron Building
size: 1
layers: [venue]
private: false
lang:
name: English
iso6391: en
iso6393: eng
via: default
defaulted: true
querySize: 20
warnings: []
errors: []
engine: { name: Pelias, author: Mapzen, version: '1.0' }
timestamp: 1713993600000
type: FeatureCollection
features:
- type: Feature
geometry: { type: Point, coordinates: [-73.9896, 40.7411] }
properties:
gid: openstreetmap:venue:way/34633854
layer: venue
source: openstreetmap
source_id: way/34633854
name: Flatiron Building
confidence: 0.947
match_type: exact
accuracy: centroid
country: United States
country_a: USA
country_gid: whosonfirst:country:85633793
region: New York
region_a: NY
region_gid: whosonfirst:region:85688543
county: New York County
county_gid: whosonfirst:county:102081863
locality: New York
locality_gid: whosonfirst:locality:85977539
borough: Manhattan
borough_gid: whosonfirst:borough:421205771
neighbourhood: Flatiron District
neighbourhood_gid: whosonfirst:neighbourhood:85869245
label: Flatiron Building, New York, NY, USA
bbox: [-73.9897, 40.741, -73.9895, 40.7412]
AutocompleteResponse:
summary: Autocomplete for partial query "flat"
value:
geocoding:
version: '0.2'
attribution: https://api.geocode.earth/v1/attribution
query:
text: flat
parser: pelias
size: 10
private: false
'focus.point.lat': 40.7128
'focus.point.lon': -74.006
lang: { name: English, iso6391: en, iso6393: eng, via: default, defaulted: true }
querySize: 20
warnings: []
errors: []
engine: { name: Pelias, author: Mapzen, version: '1.0' }
timestamp: 1713993600000
type: FeatureCollection
features:
- type: Feature
geometry: { type: Point, coordinates: [-73.9896, 40.7411] }
properties:
gid: openstreetmap:venue:way/34633854
layer: venue
source: openstreetmap
source_id: way/34633854
name: Flatiron Building
confidence: 0.8
match_type: exact
accuracy: centroid
country: United States
country_a: USA
region: New York
region_a: NY
locality: New York
label: Flatiron Building, New York, NY, USA
bbox: [-73.9897, 40.741, -73.9895, 40.7412]
ReverseResponse:
summary: Reverse near 40.7580, -73.9855 (Times Square)
value:
geocoding:
version: '0.2'
attribution: https://api.geocode.earth/v1/attribution
query:
size: 1
private: false
'point.lat': 40.758
'point.lon': -73.9855
'boundary.circle.lat': 40.758
'boundary.circle.lon': -73.9855
'boundary.circle.radius': 1
lang: { name: English, iso6391: en, iso6393: eng, via: default, defaulted: true }
querySize: 20
warnings: []
errors: []
engine: { name: Pelias, author: Mapzen, version: '1.0' }
timestamp: 1713993600000
type: FeatureCollection
features:
- type: Feature
geometry: { type: Point, coordinates: [-73.9855, 40.758] }
properties:
gid: openstreetmap:venue:node/3117224105
layer: venue
source: openstreetmap
source_id: node/3117224105
name: Times Square
confidence: 1
accuracy: point
distance: 0.004
country: United States
country_a: USA
region: New York
region_a: NY
locality: New York
borough: Manhattan
neighbourhood: Midtown
label: Times Square, New York, NY, USA
bbox: [-73.9856, 40.7579, -73.9854, 40.7581]
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment