Documentation menu
POST/v1/jobs/optimise
Access and price
| Auth | An API key, as Authorization: Bearer snk_… or ?api_key=snk_…. Metered. Needs a full key; a browser (maps) key is refused. |
|---|---|
| Price | As the synchronous twin, doubled when relax_if_unassigned reserves a second solve; the unused half is refunded when the job finishes. Class: standard, or premium for truck and ADR work. Published as unit_rules.async_jobs in /pricing.json. |
| Premium | When the body asks for truck routing: "costing": "truck", a top-level adr object or "hazmat": true |
What it does
Submit an optimisation problem to the asynchronous lane.
An API key, as Authorization: Bearer snk_… or ?api_key=snk_…. Metered. Price: As the synchronous twin, doubled when relax_if_unassigned reserves a second solve; the unused half is refunded when the job finishes.
Call it
curl -fsS -X POST "https://api.mapmap.ai/v1/jobs/optimise" \
-H "Authorization: Bearer $MAPMAP_KEY" \
-H "Content-Type: application/json" \
-d '{"costing":"auto","jobs":[{"id":10,"location":{"lat":52.4862,"lon":-1.8904}},{"id":11,"location":{"lat":53.4808,"lon":-2.2426}}],"vehicles":[{"id":1,"start":{"lat":51.5074,"lon":-0.1278}}]}'Request body
application/json
Exactly the POST /optimise body: vehicles, jobs, optional shipments, costing, costing_options, adr, eu_drivers_hours, plus an optional webhook_url. The unique-location cap here is SN_OPTIMISE_MAX_LOCATIONS_ASYNC (2,000 by default), ten times the synchronous 200: the synchronous cap is bound by the request deadline, and there is no request to hold open here
Example: From website/public/docs/api-reference.md:3081
{
"costing": "auto",
"jobs": [
{
"id": 10,
"location": {
"lat": 52.4862,
"lon": -1.8904
}
},
{
"id": 11,
"location": {
"lat": 53.4808,
"lon": -2.2426
}
}
],
"vehicles": [
{
"id": 1,
"start": {
"lat": 51.5074,
"lon": -0.1278
}
}
]
}Responses
result_url, or wait for the signed webhook| Field | Type | Required | Description |
|---|---|---|---|
| id | string | yes | The job id to poll. |
| kind | string | yes | optimise, replan, matrix or coverage. |
| result_url | string | yes | Where to fetch it. The same URL the webhook will carry. |
| status | string | yes | Always queued, the worker has not looked at it yet. |
| units_charged | integer | yes | Quota 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
{
"id": "string",
"kind": "string",
"result_url": "string",
"status": "string",
"units_charged": 0
}webhook_url (must be https and publicly resolvable)application/problem+json · Problem
unauthorized); the body carries signup, docs and a one-call hint for a free keyapplication/problem+json · Problem
X-PAYMENT). Not problem+jsonapplication/json · X402PaymentRequired
scope-insufficient), a request from an origin the key does not allow (origin-not-allowed), or an account restriction (forbidden)application/problem+json · Problem
webhook_url was given but the key has no webhook signing secretapplication/problem+json · Problem
text/plain
SN_OPTIMISE_MAX_LOCATIONS_ASYNC unique locations. (A problem too large for the solver's cost arithmetic is accepted here and fails as a job, refunded like any failed job.)application/problem+json · Problem
rate-limited, with Retry-After), or monthly quota exhausted with no payment path (quota-exceeded)application/problem+json · Problem
application/problem+json · Problem
request-timeout)application/problem+json · Problem
Error bodies follow the shared problem model documented on API conventions.
Also under Optimisation and jobs
Generated from https://api.mapmap.ai/openapi.json on 2026-11-12 · operationId post_optimise_job