> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maple.inc/llms.txt
> Use this file to discover all available pages before exploring further.

# Update delivery zone

> Updates a delivery zone belonging to a connected location; only the provided fields change.

PATCH`https://api.maple.inc/v1/locations/{locationId}/delivery_zones/{zoneId}`API key

Updates a delivery zone belonging to a connected location; only the provided fields change. Zones synced from a POS (such as Linga) cannot be updated; change them in the POS. Requires `delivery_zones:write` and an active connection to the location.

## Authorization

Send your API key as `Authorization: Bearer <key>`: `mpk_test_…` against the sandbox (`https://api.staging.maple.inc/v1`), `mpk_live_…` against production. See [Authentication](https://docs.maple.inc/developer-api/concepts/authentication.md). The samples read the key from `MAPLE_KEY` and the base URL from `MAPLE_BASE`, as set up in the [Quickstart](https://docs.maple.inc/developer-api/quickstart.md).

## Parameters

- `locationId` string path required

- `zoneId` string path required

## Request body

`application/json`, required.

- `name` string or null

- `polygon` object or null

- `polygon.type` string required

  Always `Polygon`.

- `polygon.coordinates` \[number, number]\[]\[] required

- `delivery_fee_cents` number or null

- `min_order_cents` integer or null

- `max_distance_miles` number or null

- `is_active` boolean or null

- `priority` number or null

- `zone_type` string or null

- `radius_miles` number or null

## Responses

### 200 OK

A delivery zone. `delivery_fee_cents` and `min_order_cents` are integer USD cents; `created_at` / `updated_at` are ISO 8601 timestamps.

- `object` string required

  Always `delivery_zone`.

- `id` string required

- `location_id` string required

- `name` string required

- `zone_type` string required

  One of `polygon`, `circle`.

- `polygon` object required

  A GeoJSON Polygon. Coordinates are `[longitude, latitude]` rings; the first ring must be closed.

- `polygon.type` string required

  Always `Polygon`.

- `polygon.coordinates` \[number, number]\[]\[] required

- `radius_miles` number or null required

- `delivery_fee_cents` number required

- `min_order_cents` number or null required

- `max_distance_miles` number or null required

- `is_active` boolean required

- `priority` number required

- `created_at` string required

- `updated_at` string required

### Errors

- `400` Bad request DeveloperApiBadRequest

- `401` Unauthorized DeveloperApiUnauthorized

- `403` Forbidden DeveloperApiForbidden

- `404` Not found DeveloperApiNotFound

- `429` Too many requests DeveloperApiRateLimited

Every error body names the error in `_tag`, explains it in `message`, and says where to report it in `feedback`. See [Errors](https://docs.maple.inc/developer-api/concepts/errors.md).

A `429` also sends `Retry-After`: Seconds to wait before retrying; also returned as retry\_after in the body.

Update delivery zone

```sh
curl -X PATCH "$MAPLE_BASE/locations/str_123/delivery_zones/ZONE_ID" \
  -H "Authorization: Bearer $MAPLE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"string","polygon":{"type":"Polygon","coordinates":[[[1.5,1.5]]]},"delivery_fee_cents":1.5,"min_order_cents":0,"max_distance_miles":1.5,"is_active":true,"priority":1.5,"zone_type":"polygon","radius_miles":1.5}'
```

```python
import os
import requests


r = requests.patch(
    f"{os.environ['MAPLE_BASE']}/locations/str_123/delivery_zones/ZONE_ID",
    headers={"Authorization": f"Bearer {os.environ['MAPLE_KEY']}"},
    json={
        "name": "string",
        "polygon": {
            "type": "Polygon",
            "coordinates": [
                [
                    [
                        1.5,
                        1.5,
                    ],
                ],
            ],
        },
        "delivery_fee_cents": 1.5,
        "min_order_cents": 0,
        "max_distance_miles": 1.5,
        "is_active": True,
        "priority": 1.5,
        "zone_type": "polygon",
        "radius_miles": 1.5,
    },
    timeout=30,
)
r.raise_for_status()
print(r.json())
```

```js
const res = await fetch(`${process.env.MAPLE_BASE}/locations/str_123/delivery_zones/ZONE_ID`, {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.MAPLE_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "string",
    "polygon": {
      "type": "Polygon",
      "coordinates": [
        [
          [
            1.5,
            1.5
          ]
        ]
      ]
    },
    "delivery_fee_cents": 1.5,
    "min_order_cents": 0,
    "max_distance_miles": 1.5,
    "is_active": true,
    "priority": 1.5,
    "zone_type": "polygon",
    "radius_miles": 1.5
  }),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());
```

```json
{
  "object": "delivery_zone",
  "id": "string",
  "location_id": "str_123",
  "name": "string",
  "zone_type": "polygon",
  "polygon": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          1.5,
          1.5
        ]
      ]
    ]
  },
  "radius_miles": 1.5,
  "delivery_fee_cents": 1.5,
  "min_order_cents": 1.5,
  "max_distance_miles": 1.5,
  "is_active": true,
  "priority": 1.5,
  "created_at": "string",
  "updated_at": "string"
}
```

```json
{
  "_tag": "DeveloperApiBadRequest",
  "code": "string",
  "message": "string",
  "feedback": "string"
}
```
