Skip to content
Documentation menu
docs / api / post-v1-jobs-territory
Offline territories

POST/v1/jobs/territory

Access and price

AuthAn API key, as Authorization: Bearer snk_… or ?api_key=snk_…. Metered. Needs a full key; a browser (maps) key is refused.
Price1 call per request. Class: standard, or premium for truck and ADR work. Published as unit_rules.default in /pricing.json.
PremiumWhen the body asks for truck routing: "costing": "truck", a top-level adr object or "hazmat": true

What it does

Submit a custom-region cut to the asynchronous lane.

An API key, as Authorization: Bearer snk_… or ?api_key=snk_…. Metered. Price: 1 call per request.

Call it

bash
curl -fsS -X POST "https://api.mapmap.ai/v1/jobs/territory" \
  -H "Authorization: Bearer $MAPMAP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"bbox":[0],"boundary_id":"string","layers":["string"],"polygon":{},"source":"string","webhook_url":"string"}'

Request body

application/json · TerritoryJobRequest

Exactly one of a bbox ([west, south, east, north]), a GeoJSON polygon and a boundary_id (from GET /v1/boundaries; its stored polygon is the area, limited and priced exactly as that polygon), optional layers (any of valhalla-tiles, pmtiles, geocode-index, style; default all), optional source territory and webhook_url. The area is cut out of ONE published country package, at most SN_REGION_MAX_AREA_KM2 (5,000 km² by default), with a bounding box of at most SN_REGION_MAX_BBOX_KM2 (15,000 km² by default), and SN_REGION_MAX_MIB installed (2,048 MiB by default). New cuts run one at a time, in order (SN_REGION_MAX_CONCURRENT_CUTS, default 1): a job waiting its turn stays queued and never fails for waiting, and a repeat of an area already cut answers at once. The result is a signed territory (region-… id, versioned by the source package version) a device installs from index_url like any other; its layer downloads count against the download allowance exactly as a country download does. A repeat request for an area already cut from the current source version costs nothing

FieldTypeRequiredDescription
bboxnumber[]no[west, south, east, north] in WGS84 degrees. Exactly one of bbox, polygon and boundary_id.
boundary_idstringnoAn administrative boundary from GET /v1/boundaries, e.g. osm-r51827: its stored polygon (the one GET /v1/boundaries/{id} returns) is the area, limited and priced exactly as that polygon would be.
layersstring[]noLayer kinds to carry: any of valhalla-tiles, pmtiles, geocode-index, style (default: all four). style needs pmtiles.
polygonobjectnoA GeoJSON Polygon or MultiPolygon (or a Feature wrapping one).
sourcestringnoTerritory to cut from, e.g. uk. Default: among the published territories whose bounding box contains the area, the one whose data covers it (the share of the area inside the extract the package was built from); for a boundary_id, a package of the boundary's own country first. The result's source_choice says which and why. A named source with no data in the area is refused (region-no-data).
webhook_urlstringnoSigned completion notification target (the ordinary job lane field).

Example: A request assembled from this schema's own field examples, enums, defaults and types; not a recorded call

json
{
  "bbox": [
    0
  ],
  "boundary_id": "string",
  "layers": [
    "string"
  ],
  "polygon": {},
  "source": "string",
  "webhook_url": "string"
}

Responses

202Accepted and queued (or already cut, in which case the submission is not billed and the job finishes at once). Poll result_url
FieldTypeRequiredDescription
idstringyesThe job id to poll.
kindstringyesoptimise, replan, matrix or coverage.
result_urlstringyesWhere to fetch it. The same URL the webhook will carry.
statusstringyesAlways queued, the worker has not looked at it yet.
units_chargedintegeryesQuota units this submission drew. Charged now, refunded in full if the job fails.

Example: A response assembled from this schema's own field examples, enums, defaults and types; not a recorded call

json
{
  "id": "string",
  "kind": "string",
  "result_url": "string",
  "status": "string",
  "units_charged": 0
}
400Malformed area, boundary id or layer list, more than one of bbox, polygon and boundary_id, or an unusable webhook_url

application/problem+json · Problem

401Missing or invalid API key. Also: No key, or a missing, malformed, unknown, revoked or expired one (unauthorized); the body carries signup, docs and a one-call hint for a free key

application/problem+json · Problem

402Beyond the included volume with no way to pay this call: an x402 body naming how to pay (provisional key past its allowance, prepaid balance below the price, or a rejected X-PAYMENT). Not problem+json

application/json · X402PaymentRequired

403Provisional or email-less key: territory downloads require a verified account. Also: The key may not call this: a browser key outside its scope (scope-insufficient), a request from an origin the key does not allow (origin-not-allowed), or an account restriction (forbidden)

application/problem+json · Problem

409A webhook_url was given but the key has no webhook signing secret

application/problem+json · Problem

413The request declares a body larger than 1048576 bytes (plain text, not problem+json)

text/plain

422region-area-too-large (over SN_REGION_MAX_AREA_KM2, with limit and value), region-bbox-too-large (the area's bounding box is over SN_REGION_MAX_BBOX_KM2, with limit and value: the box drives the cut's memory, so split the area), region-crosses-territories (not inside one published territory; the detail names the territories it touches), region-not-covered, region-unknown-source, region-unknown-boundary (no such boundary_id here) or region-no-data

application/problem+json · Problem

429Quota, rate limit, or too many jobs already queued or running. Also: Per-key rate limit (rate-limited, with Retry-After), or monthly quota exhausted with no payment path (quota-exceeded)

application/problem+json · Problem

501A boundary_id on a deployment without boundaries data (SN_BOUNDARIES_DIR unset)

application/problem+json · Problem

503Custom regions are not enabled on this deployment

application/problem+json · Problem

504The request did not finish within the gateway's request deadline (request-timeout)

application/problem+json · Problem

Error bodies follow the shared problem model documented on API conventions.

Also under Offline territories

Generated from https://api.mapmap.ai/openapi.json on 2026-11-12 · operationId post_territory_job