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.

ParameterInTypeAbout
q *querystring
  • 200 At 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.

ParameterInTypeAbout
uprn *pathstring
  • 200 The address's record.
  • 404 A failure, with its code.

GET/v1/postcodes/{postcode}/addresses

Every address of a postcode

Scope `address:lookup`. One credit where the postcode has addresses.

ParameterInTypeAbout
postcode *pathstring
  • 200 The postcode as Royal Mail writes it, and its addresses in order.
  • 404 A failure, with its code.

Geocoding

GET/v1/geocode/forward

Geocode an address as written

Scope `geocode`. One credit.

ParameterInTypeAbout
q *querystring
limitqueryintegerAt most 10.
  • 200 The addresses that the text may be, the best first.

POST/v1/geocode/forward

Geocode up to 100 addresses

Scope `geocode`. One credit each.

Body fieldTypeAbout
queriesobject[]At most 100.
  • 200 What each query found, in their order.

GET/v1/geocode/reverse

The addresses nearest a point

Scope `geocode`. One credit.

ParameterInTypeAbout
lat *querynumber
lng *querynumber
radiusquerynumberMetres. At most 500.
limitqueryintegerAt most 10.
nearest_pointquerybooleanEvery address at the nearest point
  • 200 The addresses within the radius, nearest first.

POST/v1/geocode/reverse

Reverse geocode up to 100 points

Scope `geocode`. One credit each.

Body fieldTypeAbout
queriesobject[]At most 100.
  • 200 What 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 fieldTypeAbout
itemsobject[]At most 100000.
  • 202 The job, to poll at its `Location`.

GET/v1/cleansing/jobs/{id}

A job, and how far through it is

ParameterInTypeAbout
id *pathstring
  • 200 The job.
  • 404 A failure, with its code.

GET/v1/cleansing/jobs/{id}/results

A page of a job's results

ParameterInTypeAbout
id *pathstring
afterqueryintegerThe position to start from.
limitqueryintegerAt most 1000.
  • 200 The job, its items from `after`, and the `after` of the next page.
  • 404 A 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.

ParameterInTypeAbout
latquerynumber
lngquerynumber
postcodequerystring
  • 200 The areas, by kind.
  • 404 A failure, with its code.

POST/v1/zones/contains

Which of your zones hold each point

Scope `place:read`. One credit for each point.

Body fieldTypeAbout
zonesobjectA 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`.
pointsobject[]At most 1000.
  • 200 Each 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.

ParameterInTypeAbout
lat *querynumber
lng *querynumber
categoriesquerystringA comma list of rail_station, metro_station, bus_stop and school. Every one by default.
radius_mquerynumberAt most 10000.
limitqueryintegerAt most 100.
  • 200 The places, nearest first.

GET/v1/places/amenities

The nearest place of each category

Scope `place:read`. One credit.

ParameterInTypeAbout
lat *querynumber
lng *querynumber
categoriesquerystring
max_distance_mquerynumberAt most 50000.
  • 200 The nearest of each category within the distance, in the order of the categories.

Locations

GET/v1/location-lists

Your location lists

Scope `locations:read`.

  • 200 The lists.

POST/v1/location-lists

Make a location list

Scope `locations:write`.

Body fieldTypeAbout
namestring
  • 201 The list.

GET/v1/location-lists/{list_id}

A list

ParameterInTypeAbout
list_id *pathstring
  • 200 The list.
  • 404 A failure, with its code.

PATCH/v1/location-lists/{list_id}

Rename a list

ParameterInTypeAbout
list_id *pathstring
  • 200 The list.

DELETE/v1/location-lists/{list_id}

Delete a list and its locations

ParameterInTypeAbout
list_id *pathstring
  • 204 Deleted.
  • 404 A failure, with its code.

GET/v1/location-lists/{list_id}/locations

A page of a list's locations

Scope `locations:read`.

ParameterInTypeAbout
list_id *pathstring
cursorquerystring
limitqueryintegerAt most 500.
  • 200 The 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`.

ParameterInTypeAbout
list_id *pathstring
Body fieldTypeAbout
locationsobject[]At most 1000.
  • 200 A result for each item, in their order.

GET/v1/location-lists/{list_id}/locations/{id}

A location

ParameterInTypeAbout
list_id *pathstring
id *pathstringYour ID of the location.
  • 200 The location.
  • 404 A 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`.

ParameterInTypeAbout
list_id *pathstring
id *pathstringYour ID of the location.
  • 200 Updated
  • 201 Created.

PATCH/v1/location-lists/{list_id}/locations/{id}

Change some of a location's fields

A field given as `null` is removed.

ParameterInTypeAbout
list_id *pathstring
id *pathstringYour ID of the location.
  • 200 The location.

DELETE/v1/location-lists/{list_id}/locations/{id}

Delete a location

ParameterInTypeAbout
list_id *pathstring
id *pathstringYour ID of the location.
  • 204 Deleted.
  • 404 A failure, with its code.

GET/v1/location-lists/{list_id}/changes

A list's changes since a sequence

ParameterInTypeAbout
list_id *pathstring
sincequeryinteger
limitqueryintegerAt most 500.
  • 200 The 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.

ParameterInTypeAbout
list_id *pathstring
latquerynumber
lngquerynumber
postcodequerystring
addressquerystring
radius_mquerynumberAt most 1000000.
bboxquerystring`west,south,east,north`
limitqueryintegerAt most 100.
tagsquerystringA comma list; a location has them all.
statusquery"active" | "inactive" | "all"
open_nowqueryboolean
  • 200 The origin as it was found, and the locations, nearest first.

GET/v1/location-lists/{list_id}/search

Search a list by name or ID

ParameterInTypeAbout
list_id *pathstring
q *querystring
limitqueryintegerAt most 100.
tagsquerystring
statusquerystring
open_nowqueryboolean
  • 200 The matches, the best first.

POST/v1/locations/nearest

The nearest of up to 1,000 points sent with the query

Body fieldTypeAbout
latnumber
lngnumber
postcodestring
addressstring
radius_mnumber
bboxnumber[]At most 4.
limitinteger
locationsobject[]At most 1000.
  • 200 The 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.

ParameterInTypeAbout
style *path"color"
  • 200 A MapLibre style.

GET/v1/maps/tilesets/{archive}

The TileJSON of an archive

ParameterInTypeAbout
archive *path"basemap" | "terrain" | "landcover"
  • 200 TileJSON 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.

ParameterInTypeAbout
archive *pathstring
z *pathinteger
x *pathinteger
y *pathstringThe row
  • 200 The tile.
  • 204 The archive has no tile there.

GET/v1/maps/fonts/{fontstack}/{range}

A range of a font stack's glyphs

ParameterInTypeAbout
fontstack *pathstring
range *pathstring
  • 200 The glyphs.

GET/v1/maps/sprites/{style}/{file}

A file of a style's sprite

ParameterInTypeAbout
style *pathstring
file *path"sprite.json" | "sprite.png" | "sprite@2x.json" | "sprite@2x.png"
  • 200 The file.

GET/v1/maps/static

A static map, as a PNG

Scope `maps:read`. One credit.

ParameterInTypeAbout
lat *querynumber
lng *querynumber
zoom *querynumberAt most 20.
width *queryintegerAt most 1280.
height *queryintegerAt most 1280.
scalequery1 | 2
markersquerystringUp to 50, as `lng,lat;lng,lat`.
stylequerystring
  • 200 The 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.

  • 200 The 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