SWMAPS DocumentationAPI portal

Reference

HTTP API reference

Public map-service endpoints, authentication requirements, request parameters and response contracts.

On this page

Request conventions #

Prerequisites: the maps origin and a key with the scopes listed below. All URLs are relative to that maps root, not the portal. Send JSON for pack POST requests and X-API-Key where possible. Coordinates use lng,lat; bounding boxes use [W,S,E,N]. Service responses are JSON/GeoJSON. Maps CORS permits GET, HEAD, POST and OPTIONS, including Range and X-API-Key headers.

bash
curl --fail-with-body -H "X-API-Key: YOUR_API_KEY"   "https://maps.example/depth?at=126.8,10"

The v1 release/pack manifests carry schemaVersion:1. Existing search/route/depth responses do not all carry schemaVersion; do not require a field the service does not emit. Within the v1 client contract, additions should remain compatible and clients should ignore unknown fields.

Search, routing and depth endpoints #

Method / pathScope and inputSuccess response
GET /searchsearch; q required (1–200 chars), limit 1–20 default 10, near=lng,lat optional, lang optionalFeatureCollection {query:string, features:[place]}
GET /search/reversesearch; at=lng,lat required, limit 1–10 default 1, lang optionalFeatureCollection {query:[lng,lat], features:[place with distance_m]}
GET /search/statussearch; no parameters{ok,engine:"photon",...engine status}
GET /routeroute; from,to required; via up to 5 semicolon-separated points; mode car|foot|bike; alternates 0–2; depart local YYYY-MM-DDTHH:MMFeatureCollection of route LineStrings
GET /route/isochroneroute; at required; mode car|foot|bike; minutes=10,20,30 default, 1–4 integers each 1–120FeatureCollection {query,features:[Polygon/MultiPolygon with mode,minutes]}
GET /route/statusroute; no parameters{ok,engine:"valhalla",version,tileset_last_modified}
GET /depthdepth; at=lng,lat required{at,elevation_m,depth_m,source,method,measured,cell_m,not_for_navigation:true}
GET /healthzPublic; no parametersGateway health text; not proof every engine is ready

Place properties: name, label, kind, category, address, osm; optional GeoJSON bbox. Address fields are optional. Route properties: mode, distance_m, duration_s, depart_at, arrive_at, legs[]. Each leg has distance_m, duration_s and steps[{instruction,distance_m,duration_s,streets,location}]. Search/route features can be empty; handle that before indexing features[0]. See service chapters for complete JavaScript and curl examples.

Release and static resource endpoints #

Method / pathScopeResponse / options
GET /maps/v1/releases/currentmapsCurrent release document (release.json)
GET /maps/v1/releases/<mapdata-YYYYMMDD>/manifest.jsonmapsThat retained release document, also release.json; this is not the build provenance manifest.json
GET/HEAD /maps/v1/releases/<id>/files/<path>mapsRelease file, Range supported. Includes tiles/, fonts/, sprites/, bathymetry/, packs/ and provenance/checksum files if present
GET /maps/styles/<light|dark>.jsonmapsResolved current style; optional key, base, raw=1
GET /maps/v1/releases/<id>/files/styles/<name>.jsonmapsResolved pinned style; same options
GET/HEAD /maps/<path>mapsCurrent release resources, including tiles, fonts, sprites and bathymetry
GET /PublicReference viewer
GET /sw-*.js, /vendor/<path>PublicClient modules and pinned vendor assets
GET /npm/index.json, /npm/<tarball>PublicPublished package index and tarballs

Style raw=1 leaves __MAP_BASE__ intact. base overrides the data-resource root; key is propagated into generated URLs. Styles and dated file URLs are discussed in Styles and overlays. The internal /_auth nginx subrequest is not an application endpoint. Photon and Valhalla are not public APIs.

Pack endpoints #

Method / pathScopeBehavior
POST /maps/v1/packspacksBuild, reuse or estimate a pack; JSON body below
GET /maps/v1/packs/<packId>mapsCached manifest with maps-root-relative file URLs
GET/HEAD /maps/v1/packs/<packId>/manifest.jsonmapsCached manifest file; may have only file paths
GET/HEAD /maps/v1/packs/<packId>/<path>mapsPack file, Range/resume supported
GET/HEAD /maps/v1/releases/<id>/files/packs/<packId>/<path>mapsPrebuilt pack resources, resolve relative paths against their manifest URL
json
{
  "release": "current",
  "bbox": [123.6, 10.1, 124.1, 10.6],
  "shore": [[123.88, 10.28, 123.95, 10.35]],
  "layers": ["base", "gmrt", "contours"],
  "styles": ["dark", "light"],
  "dryRun": true
}

Required: bbox. Defaults: release current, no shore boxes, layers base/gmrt/contours, styles dark/light, dryRun false. Discover optional layers first. POST returns 201 for a new build or 200 for a cached build/dry run. Dry-run fields include schemaVersion,dryRun,packId,release,cached,bbox,shore,layers,styles,files,totalBytes,limits. It has no downloadable pack until a build completes. Limits and the full download recipe are in Download offline maps.

Errors, HTTP caching and Range #

Status / codeMeaning
400Invalid parameters or JSON; pack errors include bad-request
401 no-keyNo application key
403 bad-key / key-expired / scopeCredential invalid, retired, suspended, expired or not scoped for this operation
404No route, missing file/style, unknown-release or unknown-pack
405Unsupported operation on a pack endpoint
413Pack request body too large; service limit 16 KiB
422Outside coverage or pack constraint; see pack refusal codes
429 rate-limitedNew pack build budget exhausted
500 internalUnexpected pack-building error
502 / 504Upstream engine unavailable/error or timed out
503Engine not ready, missing depth grid or authorization backend unavailable

Errors generally include error; pack and authentication errors also include code. Gateway static-file errors may be text/HTML: do not assume every error body is JSON. Current release metadata should be refreshed; named release files are immutable under the client contract. Retained releases and pack caches can disappear, returning 404. Check response cache headers instead of inventing a permanent retention guarantee.

Resume with Range: bytes=<offset>-. A 206 response must match Content-Range; a 200 response means restart the file. Preserve ETag, Content-Length, Content-Range and Accept-Ranges through gateways and CORS. Do not gzip PMTiles or cache partial HTTP responses as whole files. OPTIONS preflights are answered without a key.