API reference
The routes of the API, from its OpenAPI document, openapi.yaml, which tools such as Postman import.
Address
GET/v1/addresses
Suggest addresses as the customer types
Narrows to an address from the starts of its words, its number and its outward code, in any order (`ches 37 brom mk43`), forgiving a typo. Scope `address:search`. Free: the lookup of the pick is charged.
| Parameter | In | Type | About |
|---|---|---|---|
q * | query | string |
200At most 10 suggestions, the best first.
GET/v1/addresses/{uprn}
Look up an address by its UPRN
Scope `address:lookup`. One credit where the address is found.
| Parameter | In | Type | About |
|---|---|---|---|
uprn * | path | string |
200The address's record.404A failure, with its code.
GET/v1/postcodes/{postcode}/addresses
Every address of a postcode
Scope `address:lookup`. One credit where the postcode has addresses.
| Parameter | In | Type | About |
|---|---|---|---|
postcode * | path | string |
200The postcode as Royal Mail writes it, and its addresses in order.404A failure, with its code.
Geocoding
GET/v1/geocode/forward
Geocode an address as written
Scope `geocode`. One credit.
| Parameter | In | Type | About |
|---|---|---|---|
q * | query | string | |
limit | query | integer | At most 10. |
200The addresses that the text may be, the best first.
POST/v1/geocode/forward
Geocode up to 100 addresses
Scope `geocode`. One credit each.
| Body field | Type | About |
|---|---|---|
queries | object[] | At most 100. |
200What each query found, in their order.
GET/v1/geocode/reverse
The addresses nearest a point
Scope `geocode`. One credit.
| Parameter | In | Type | About |
|---|---|---|---|
lat * | query | number | |
lng * | query | number | |
radius | query | number | Metres. At most 500. |
limit | query | integer | At most 10. |
nearest_point | query | boolean | Every address at the nearest point |
200The addresses within the radius, nearest first.
POST/v1/geocode/reverse
Reverse geocode up to 100 points
Scope `geocode`. One credit each.
| Body field | Type | About |
|---|---|---|
queries | object[] | At most 100. |
200What each query found, in their order.
Cleansing
POST/v1/cleansing/jobs
Send a job of addresses to cleanse
Up to 100,000 addresses as written, each matched to its record apart from this request. Scope `geocode`. One credit each, as each is cleansed; a live job needs the credits it will use (`credits_exhausted`).
| Body field | Type | About |
|---|---|---|
items | object[] | At most 100000. |
202The job, to poll at its `Location`.
GET/v1/cleansing/jobs/{id}
A job, and how far through it is
| Parameter | In | Type | About |
|---|---|---|---|
id * | path | string |
200The job.404A failure, with its code.
GET/v1/cleansing/jobs/{id}/results
A page of a job's results
| Parameter | In | Type | About |
|---|---|---|---|
id * | path | string | |
after | query | integer | The position to start from. |
limit | query | integer | At most 1000. |
200The job, its items from `after`, and the `after` of the next page.404A failure, with its code.
Place
GET/v1/geography
The areas of a point or a postcode
Give a point (`lat`, `lng`), for the areas whose boundaries cover it, or a `postcode`, for those the ONS Postcode Directory gives it. Scope `place:read`. One credit.
| Parameter | In | Type | About |
|---|---|---|---|
lat | query | number | |
lng | query | number | |
postcode | query | string |
200The areas, by kind.404A failure, with its code.
POST/v1/zones/contains
Which of your zones hold each point
Scope `place:read`. One credit for each point.
| Body field | Type | About |
|---|---|---|
zones | object | A GeoJSON FeatureCollection of Polygons and MultiPolygons, at most 100, with 100,000 positions in all. A zone's ID is its Feature's `id`, or its property `id`. |
points | object[] | At most 1000. |
200Each point, and the IDs of the zones that hold it.
GET/v1/places
Places of interest near a point
Rail stations, Tube, metro and tram stations and bus stops (Great Britain), and schools with their Ofsted inspection (England). Scope `place:read`. One credit.
| Parameter | In | Type | About |
|---|---|---|---|
lat * | query | number | |
lng * | query | number | |
categories | query | string | A comma list of rail_station, metro_station, bus_stop and school. Every one by default. |
radius_m | query | number | At most 10000. |
limit | query | integer | At most 100. |
200The places, nearest first.
GET/v1/places/amenities
The nearest place of each category
Scope `place:read`. One credit.
| Parameter | In | Type | About |
|---|---|---|---|
lat * | query | number | |
lng * | query | number | |
categories | query | string | |
max_distance_m | query | number | At most 50000. |
200The nearest of each category within the distance, in the order of the categories.
Locations
GET/v1/location-lists
Your location lists
Scope `locations:read`.
200The lists.
POST/v1/location-lists
Make a location list
Scope `locations:write`.
| Body field | Type | About |
|---|---|---|
name | string |
201The list.
GET/v1/location-lists/{list_id}
A list
| Parameter | In | Type | About |
|---|---|---|---|
list_id * | path | string |
200The list.404A failure, with its code.
PATCH/v1/location-lists/{list_id}
Rename a list
| Parameter | In | Type | About |
|---|---|---|---|
list_id * | path | string |
200The list.
DELETE/v1/location-lists/{list_id}
Delete a list and its locations
| Parameter | In | Type | About |
|---|---|---|---|
list_id * | path | string |
204Deleted.404A failure, with its code.
GET/v1/location-lists/{list_id}/locations
A page of a list's locations
Scope `locations:read`.
| Parameter | In | Type | About |
|---|---|---|---|
list_id * | path | string | |
cursor | query | string | |
limit | query | integer | At most 500. |
200The locations, and the cursor of the next page.
POST/v1/location-lists/{list_id}/locations
Write up to 1,000 locations
Each item has its own result; the batch is `200` unless the list is not found or it has too many items. Scope `locations:write`.
| Parameter | In | Type | About |
|---|---|---|---|
list_id * | path | string |
| Body field | Type | About |
|---|---|---|
locations | object[] | At most 1000. |
200A result for each item, in their order.
GET/v1/location-lists/{list_id}/locations/{id}
A location
| Parameter | In | Type | About |
|---|---|---|---|
list_id * | path | string | |
id * | path | string | Your ID of the location. |
200The location.404A failure, with its code.
PUT/v1/location-lists/{list_id}/locations/{id}
Write a location in full
An address without `lat` and `lng` is geocoded, for one credit. Scope `locations:write`.
| Parameter | In | Type | About |
|---|---|---|---|
list_id * | path | string | |
id * | path | string | Your ID of the location. |
200Updated201Created.
PATCH/v1/location-lists/{list_id}/locations/{id}
Change some of a location's fields
A field given as `null` is removed.
| Parameter | In | Type | About |
|---|---|---|---|
list_id * | path | string | |
id * | path | string | Your ID of the location. |
200The location.
DELETE/v1/location-lists/{list_id}/locations/{id}
Delete a location
| Parameter | In | Type | About |
|---|---|---|---|
list_id * | path | string | |
id * | path | string | Your ID of the location. |
204Deleted.404A failure, with its code.
GET/v1/location-lists/{list_id}/changes
A list's changes since a sequence
| Parameter | In | Type | About |
|---|---|---|---|
list_id * | path | string | |
since | query | integer | |
limit | query | integer | At most 500. |
200The changes in order, the cursor of the next page, and the list's sequence.
GET/v1/location-lists/{list_id}/nearest
The nearest of a list's locations
From a point, a postcode or an address (one credit more), within a radius or a box. Scope `locations:query`, which a publishable key may have. One credit.
| Parameter | In | Type | About |
|---|---|---|---|
list_id * | path | string | |
lat | query | number | |
lng | query | number | |
postcode | query | string | |
address | query | string | |
radius_m | query | number | At most 1000000. |
bbox | query | string | `west,south,east,north` |
limit | query | integer | At most 100. |
tags | query | string | A comma list; a location has them all. |
status | query | "active" | "inactive" | "all" | |
open_now | query | boolean |
200The origin as it was found, and the locations, nearest first.
GET/v1/location-lists/{list_id}/search
Search a list by name or ID
| Parameter | In | Type | About |
|---|---|---|---|
list_id * | path | string | |
q * | query | string | |
limit | query | integer | At most 100. |
tags | query | string | |
status | query | string | |
open_now | query | boolean |
200The matches, the best first.
POST/v1/locations/nearest
The nearest of up to 1,000 points sent with the query
| Body field | Type | About |
|---|---|---|
lat | number | |
lng | number | |
postcode | string | |
address | string | |
radius_m | number | |
bbox | number[] | At most 4. |
limit | integer | |
locations | object[] | At most 1000. |
200The origin, and the points nearest first.
Maps
GET/v1/maps/styles/{style}
A map's style
For MapLibre GL: `new maplibregl.Map({style: 'https://api.zapex.co.uk/v1/maps/styles/color?key=zpx_pk_live_…'})`. Its parts are at the routes below, with the publishable key in their URLs. Scope `maps:read`. One credit: a map load.
| Parameter | In | Type | About |
|---|---|---|---|
style * | path | "color" |
200A MapLibre style.
GET/v1/maps/tilesets/{archive}
The TileJSON of an archive
| Parameter | In | Type | About |
|---|---|---|---|
archive * | path | "basemap" | "terrain" | "landcover" |
200TileJSON 3.0.0.
GET/v1/maps/tiles/{archive}/{z}/{x}/{y}
A tile
As it is stored, with its `Content-Encoding`. Not rate limited, and not charged.
| Parameter | In | Type | About |
|---|---|---|---|
archive * | path | string | |
z * | path | integer | |
x * | path | integer | |
y * | path | string | The row |
200The tile.204The archive has no tile there.
GET/v1/maps/fonts/{fontstack}/{range}
A range of a font stack's glyphs
| Parameter | In | Type | About |
|---|---|---|---|
fontstack * | path | string | |
range * | path | string |
200The glyphs.
GET/v1/maps/sprites/{style}/{file}
A file of a style's sprite
| Parameter | In | Type | About |
|---|---|---|---|
style * | path | string | |
file * | path | "sprite.json" | "sprite.png" | "sprite@2x.json" | "sprite@2x.png" |
200The file.
GET/v1/maps/static
A static map, as a PNG
Scope `maps:read`. One credit.
| Parameter | In | Type | About |
|---|---|---|---|
lat * | query | number | |
lng * | query | number | |
zoom * | query | number | At most 20. |
width * | query | integer | At most 1280. |
height * | query | integer | At most 1280. |
scale | query | 1 | 2 | |
markers | query | string | Up to 50, as `lng,lat;lng,lat`. |
style | query | string |
200The map.
Datasets
GET/v1/datasets
The datasets the API answers from
Each dataset's publisher, licence and coverage, and the release loaded. No key is needed.
200The datasets.
Error codes
invalid_request, invalid_param, geocode_failed, list_not_found, location_not_found, name_taken, list_limit_reached, out_of_coverage, invalid_api_key, organisation_suspended, insufficient_scope, origin_not_allowed, secret_key_from_browser, rate_limited, credits_exhausted, monthly_cap_reached, insufficient_role, cross_site_request, already_member, last_owner, payment_failed