Skip to content
Developers

Delivery zones

Store your own areas and ask which one a point is in: delivery zones, branch catchments, pricing areas.

Base URLhttps://makani-k8s.lamah.com

Zones belong to a project

A zone is a name and a polygon you draw: the area a branch delivers to, a district with its own fee. Zones belong to a project, like the keys that ask about them, so a staging project and a production one keep separate sets.

  • group keeps sets of zones apart, for example delivery and branches. A request can ask about one group only.
  • properties is a small flat object of your own values (a fee, a branch id), returned with every match.
  • An inactive zone (active: false) is kept and never matches a point.

Draw zones in the console (Data and maps, Zones), import a GeoJSON file there, or manage them with a key that has the zones:write scope. Managing zones is free.

Add a zone

Send a name, the country and a GeoJSON Polygon or MultiPolygon. Positions are [longitude, latitude], and every ring is closed: its last position equals its first. The outline must not cross itself, and the zone must lie inside the country it names.

POST/v1/zonesScopezones:write
curl -X POST "https://makani-k8s.lamah.com/v1/zones" \  -H "x-api-key: $MAKANI_API_KEY" \  -H "content-type: application/json" \  -d '{    "name": "Tripoli centre",    "group": "delivery",    "countryCode": "LY",    "geometry": {      "type": "Polygon",      "coordinates": [        [          [            13.17,            32.87          ],          [            13.21,            32.87          ],          [            13.21,            32.9          ],          [            13.17,            32.9          ],          [            13.17,            32.87          ]        ]      ]    },    "properties": {      "fee": 5,      "branch": "TIP-01"    }  }'

Change a zone with PATCH /v1/zones/{id} (any of its name, group, shape, properties or active) and remove it with DELETE /v1/zones/{id}. A change applies to the next request.

  • 400ZONE_GEOMETRY_INVALIDThe shape is not a valid polygon: a ring is open, a position is out of range, or the outline crosses itself. message says which.
  • 400ZONE_TOO_MANY_POINTSThe outline has more points than a zone may have (details.maxVertices). Simplify it.
  • 400ZONE_TOO_LARGEThe zone covers more area than a zone may.
  • 400ZONE_OUTSIDE_COUNTRYThe zone does not lie inside the country it names.
  • 409ZONE_LIMIT_REACHEDThe project holds as many zones as it may (details.max). Delete one or ask us to raise the limit.
  • 404ZONE_NOT_FOUNDNo zone with this id belongs to the key's project.

Which zone is this point in?

Send up to 100 points, optionally with a group. The answer has one entry per point, in the order sent, with the active zones that contain it and their properties. A point on a zone's edge is inside it, and a point outside every zone has an empty list.

Use it at checkout to choose the branch and the fee, or in dispatch to assign a courier's area. Each point is one billable unit of the Zone lookups product.

POST/v1/zones/containsScopezones:read
curl -X POST "https://makani-k8s.lamah.com/v1/zones/contains" \  -H "x-api-key: $MAKANI_API_KEY" \  -H "content-type: application/json" \  -d '{    "points": [      {        "latitude": 32.8872,        "longitude": 13.1913      },      {        "latitude": 32.86,        "longitude": 13.23      }    ],    "group": "delivery"  }'

Draw your zones on a map

Read the project's zones as a GeoJSON FeatureCollection and add it to your map as a layer. Each feature carries the zone's name, group, active and properties. This request is free.

GET/v1/zonesScopezones:read
curl "https://makani-k8s.lamah.com/v1/zones?group=delivery" \  -H "x-api-key: $MAKANI_API_KEY"

What it costs

Only POST /v1/zones/contains is billed: one unit per point, counted against your plan's included units like an address request. Creating, changing, deleting and listing zones are free. The price per 1,000 beyond the plan is in the live price list:

Loading prices…