Search addresses
GET/search
const url = 'http://127.0.0.1:8080/search?q=10%20King%20Street%2C%20Toronto&layer=address&country=NZ%2CAU&focus=-79.38%2C43.65&bbox=-79.64%2C43.58%2C-79.12%2C43.86';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'http://127.0.0.1:8080/search?q=10%20King%20Street%2C%20Toronto&layer=address&country=NZ%2CAU&focus=-79.38%2C43.65&bbox=-79.64%2C43.58%2C-79.12%2C43.86'Geocodes free-form text, such as a full address, to coordinates. Results
are sorted by score, highest first.
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Text to geocode, such as a full address.
Example
10 King Street, TorontoMaximum number of results. 0, the default, lets the server choose.
Kind of result: an address, a street, a POI, or an area such as a locality or region.
Return only results of this layer. An unknown layer returns 400.
Return only results in these countries, as comma-separated ISO 3166-1 alpha-2 codes. A code that is not two letters returns 400. A code the Pack does not cover returns no results.
Example
NZ,AUPoint to prefer results near, as lon,lat. Breaks ties between equally good matches only.
Example
-79.38,43.65Return only results inside this box, as min_lon,min_lat,max_lon,max_lat. The box cannot cross the antimeridian.
Example
-79.64,43.58,-79.12,43.86Responses
Section titled “Responses”Matching results, highest score first.
A GeoJSON FeatureCollection answering /search, /autocomplete or
/geocode.
object
One forward geocoding result.
object
GeoJSON Point. coordinates is [lon, lat].
object
Properties of a forward geocoding result.
object
How precisely the coordinates locate the result, most precise first.
rooftop: the address or POI itself.interpolated: a house number placed between known neighbours.street: a point on the street.centroid: the centre of a mapped area.approximate: a point standing for something larger, such as a town or postcode.
Address parts stated by the source record.
object
Areas below the locality, outermost first (OSM addr:suburb,
addr:quarter, addr:neighbourhood).
Named place the house number belongs to where there is no street
(OSM addr:place).
POI category, such as amenity:cafe. Present only on POIs.
Administrative areas containing the result.
object
object
Stable ID from the source data, as in a result’s id.
object
Stable ID from the source data, as in a result’s id.
object
Stable ID from the source data, as in a result’s id.
object
Stable ID from the source data, as in a result’s id.
Named area outside the administrative levels, usually an island.
object
Stable ID from the source data, as in a result’s id.
object
Stable ID from the source data, as in a result’s id.
object
Stable ID from the source data, as in a result’s id.
object
Stable ID from the source data, as in a result’s id.
object
Stable ID from the source data, as in a result’s id.
Stable ID from the source data, such as osm:node:123.
One-line display label: name followed by its location.
Kind of result: an address, a street, a POI, or an area such as a locality or region.
House number and street for an address (12 King Street West), or
the name of a street, area or POI.
Row of the record in this Pack. Changes between Pack builds.
Source data the result comes from.
object
Source object type: an OSM node, way or relation, or a row of an
address dataset such as OpenAddresses.
Probability, from 0 to 1, that this is the address the query asks
for. Of results at 0.8, about 8 in 10 are correct. Present only when
the Pack is calibrated. 0 on a fallback result.
true when no match was found and the result is the most precise
area the query names instead: its postcode, a town or other area,
its region or its country. layer says which. Absent otherwise.
Text relevance. Higher is better. Comparable only within one
response: use confidence to judge a single result.
The query, API version and data attribution.
object
Attribution required by the data licence.
Query as received, trimmed, with each run of whitespace collapsed to one space.
API version. Changes only when a field is removed or changes meaning. New optional fields keep the version.
Example
{ "features": [ { "geometry": { "type": "Point" }, "properties": { "accuracy": "rooftop", "layer": "address", "source": { "object_type": "node" } }, "type": "Feature" } ], "geocoding": { "attribution": "© OpenStreetMap contributors, ODbL", "version": "1" }, "type": "FeatureCollection"}Headers
Section titled “Headers”ID the request is logged under: the request’s own X-Request-Id when it sent one. Include it in bug reports.
q is empty or too long, limit is too large, focus or bbox is out of range, or a parameter is malformed.
Error response, an RFC 9457 problem document.
object
Human-readable explanation. Absent on 500 errors.
Stable error code. Branch on this.
Rejected parameters. Present only when the error is about parameters.
A rejected parameter.
object
Parameter name.
Why it was rejected.
ID the request is logged under. Include it in bug reports.
Name of the HTTP status. Do not branch on it.
URI identifying the problem type. Currently always about:blank.
Example
{ "detail": "q must not be empty", "error_code": "invalid_query", "invalid_params": [ { "name": "limit", "reason": "must be at most 50" } ], "request_id": "01JA7Q2K3M4N5P6Q7R8S9T0V1W", "status": 400, "title": "Bad Request", "type": "about:blank"}Headers
Section titled “Headers”ID the request is logged under: the request’s own X-Request-Id when it sent one. Include it in bug reports.
Method not allowed. The route accepts GET only.
Error response, an RFC 9457 problem document.
object
Human-readable explanation. Absent on 500 errors.
Stable error code. Branch on this.
Rejected parameters. Present only when the error is about parameters.
A rejected parameter.
object
Parameter name.
Why it was rejected.
ID the request is logged under. Include it in bug reports.
Name of the HTTP status. Do not branch on it.
URI identifying the problem type. Currently always about:blank.
Example
{ "detail": "q must not be empty", "error_code": "invalid_query", "invalid_params": [ { "name": "limit", "reason": "must be at most 50" } ], "request_id": "01JA7Q2K3M4N5P6Q7R8S9T0V1W", "status": 400, "title": "Bad Request", "type": "about:blank"}Headers
Section titled “Headers”Example
GETMethods the route accepts.
ID the request is logged under: the request’s own X-Request-Id when it sent one. Include it in bug reports.
Internal server error.
Error response, an RFC 9457 problem document.
object
Human-readable explanation. Absent on 500 errors.
Stable error code. Branch on this.
Rejected parameters. Present only when the error is about parameters.
A rejected parameter.
object
Parameter name.
Why it was rejected.
ID the request is logged under. Include it in bug reports.
Name of the HTTP status. Do not branch on it.
URI identifying the problem type. Currently always about:blank.
Example
{ "detail": "q must not be empty", "error_code": "invalid_query", "invalid_params": [ { "name": "limit", "reason": "must be at most 50" } ], "request_id": "01JA7Q2K3M4N5P6Q7R8S9T0V1W", "status": 400, "title": "Bad Request", "type": "about:blank"}Headers
Section titled “Headers”ID the request is logged under: the request’s own X-Request-Id when it sent one. Include it in bug reports.

