# Zones

> Canonical URL: https://docs.mountaya.com/en/apis/map-studio/reference/zones/
> Last updated: 2026-11-26
> Rules for agents: https://docs.mountaya.com/llms.txt#rules-for-agents

Areas with something to say about them: an avalanche bulletin, a closure, a permit boundary.

 A zone carries a severity level and an optional validity window, which the zone tiles filter on when asked for an instant, so a warning that has expired drops off such a map without anybody deleting it. A zone is published as an itinerary is, and what is drawn outside the organization is its last publication.

## The Zone object

A geographic annotation drawn on the map, such as a hazard zone, an information marker, or a custom area.

- `created_at` (string (date-time), required): Timestamp of the zone's creation.

- `created_by` (object, required): The user who created the zone. It is the author rather than the last editor, and it does not move when another member edits the zone.
  - `id` (string (uuid), required): Identifier of the user this relation is about.

- `description` (string | null, required): Free-text description of the zone. Null when it has none.

- `end_at` (string (date-time) | null, required): End of the temporal validity window. After this time the zone is not in force. Null when the zone has no expiration.

- `etag` (string, required): The version of everything a read of this zone returns, the one the `ETag` of that read carries, opaque and compared whole. It moves on every write to the zone and on a publish or unpublish, so a client holding it knows whether anything it shows is stale. A draft read and a read served the published snapshot carry different tags. Send it as `If-Match` to make `patchZone`, `deleteZone`, `postZonePublication` or `deleteZonePublication` conditional.

- `geojson` (object, required): The zone's area, as a GeoJSON Feature whose `id` is the zone id. On a sourced zone this is the polygon the source computed, not the inputs that produced it; `source` carries those.
  - `type` (string, required, one of: `Feature`): Discriminator for the GeoJSON object type. Always `Feature`.
  - `id` (string (uuid)): The zone's id. On a read it is always present and equals the zone's own `id`. On a create it is optional: a UUID sent here becomes the zone's id, and the server mints one when it is omitted. A UUID another zone already has is a `409`. On an update it is ignored.
  - `geometry` (object, required): The zone's area. Positions are `[longitude, latitude]`; an optional third value is accepted and not kept, because a zone is a region on the ground.

    Latitude runs from -90 to 90. Longitude runs from -360 to 360, a turn wider than a point's, so that a ring crossing the antimeridian stays one ring: its longitudes are counted on past 180, or below -180, and no two neighbours stand on opposite edges of the map. `[179.5, -17]` followed by `[180.4, -17]` is nine tenths of a degree of ring. Written `[179.5, -17]` then `[-179.6, -17]`, the same two places are joined the other way round the world. The area is stored and returned with the longitudes it was written with.
    - `type` (string, required, one of: `Polygon`): Discriminator for the geometry type. Always `Polygon` for this schema.
    - `coordinates` (array of array of array of number (double), required): One coordinate array per ring, exterior ring first and any others holes. At least one ring, and each ring is CLOSED: it carries at least four positions and its last repeats its first. The closure is the part JSON Schema cannot state, so it is stated here; a ring whose ends differ is rejected on write, as is a polygon carrying no ring at all. No position carries fewer than two values or more than three. There is no declared ceiling on rings or on positions per ring, deliberately: a ring is not a tuple and no useful ceiling exists for one.
  - `properties` (object, required): Free-form properties. They are accepted and not kept, since a zone's own fields carry what it says about itself, so a read returns an empty object. At most 64 fields and 16 KiB as sent.

- `has_unpublished_changes` (boolean, required): Whether the draft has been edited since the last publish, so the public surfaces are serving something older than what the studio shows. Derived server-side by comparing the zone's updated_at against its latest publication; read-only and never accepted as an input. Always false while status is draft.

- `id` (string (uuid), required): Unique identifier of the zone.

- `is_private` (boolean, required): Whether the zone is private. A private zone is reached only with the key of the organization that owns it, so a private personal zone, owned by no organization, is reached by no key. A public zone is readable by id, read-only, by any publishable key, as last published, and it is listed only in its own organization's listings. A collection's share token reaches the zones that collection holds whatever this says. Public never grants editing, which takes a write role in the owning organization. Privacy is read from the draft, so a change takes effect at once rather than at the next publish.

- `level` (string, required, one of: `info`, `resolved`, `warning`, `danger`): How serious the zone is, which is what a renderer picks its styling from. It carries no access meaning: a zone is visible or not by `is_private` and its publication, never by its level.

- `mode` (string, required, one of: `polygon`, `circle`, `sensor`, `sector`, `freehand`): How the zone's area was drawn or computed. A zone computed from `source` is `polygon`.

- `name` (string, required): Display name of the zone.

- `organization_id` (string (uuid) | null, required): Identifier of the organization that owns this zone. Null for a personal zone, made from an individual account and owned by no organization.

- `published_at` (string (date-time) | null, required): Timestamp of the zone's live publication, or null when it has none: when it has never been published, or has been taken down. Derived server-side: publishing is the only thing that sets it, taking the zone down clears it, and it is never accepted as an input.

- `revision` (integer (int32), required): Revision number of the zone, incremented by every `patchZone`, even one that changes nothing. Publishing and unpublishing leave it where it is. On a read served the published snapshot it is the publication number instead. A consumer holding an older copy compares it with the `revision` a change frame carries; no request takes it.

- `source` (ZoneSource | null, required): Provenance of the zone's geometry. Populated for a computed zone and null for a zone drawn by hand. The polygon is computed from these inputs on create and recomputed only by a `patchZone` that sends `source`. A `patchZone` sending `geojson` replaces the area and clears this, one sending `source: null` clears it and keeps the area, and every other write keeps both.
  - `kind` (string, required, one of: `isochrones`): The generative engine that produced the zone. `isochrones` computes a reachability polygon for an activity from a single origin point.
  - `activity` (string, required, one of: `hiking-and-trail`, `professional-trail`, `running`, `road-cycling`, `gravel-bike`, `mountain-bike`, `backcountry-skiing`, `ski-touring`, `cross-country-skiing`, `snowshoe-walking`): The outdoor activity whose routing profile the reachability polygon is computed for (e.g. `hiking-and-trail`, `road-cycling`).
  - `location` (array of number (double), required): Origin point the isochrone is measured from, as a `[longitude, latitude]` WGS84 coordinate pair. Longitude is bounded to -180..180 and latitude to -90..90, the same bounds every other coordinate in this contract carries. The declared bounds are the wider of the two, since one `items` schema covers both positions; the per-axis rule above is the one enforced.
  - `range_type` (string, required, one of: `time`, `distance`): Whether `range` is measured as travel time (seconds) or travel distance (meters).
  - `range` (number (double), required): This zone's band value: seconds when `range_type` is `time`, meters when `range_type` is `distance`. This single band drives the zone's polygon. At least 1, and at most 7,200 seconds for a `time` band and 25,000 meters for a `distance` band, the ceilings the Data API's `isochrones` holds a range to, since a sourced zone's polygon is the isochrone of its source; anything else is a `400` naming `range`.
  - `speed` (number (double)): Travel speed in km/h, overriding the activity's default pace. Accepted only when `range_type` is `time`, and a 400 beside `distance`: the reachable area at a given travel time is the one the stated pace covers, so a slower walker reaches less ground in the same hour. Omit to let the activity's own pace resolve at compute time, which is what a zone created without a stated pace stores. Between 0.5 and 100 km/h.
  - `ranges` (array of number (double)): The full set of band values this zone was created alongside, when it is one of several coverage bands. Informational: only `range` drives this zone's polygon, but `range` must be one of these values when present. A zone authored one band at a time carries no set and omits this. At most six bands, the ceiling a coverage computation is allowed to request; a longer set is refused with a validation error.

    The ceiling is stated here rather than declared as `maxItems`, deliberately. The TypeScript generator expands a `maxItems` of 7 or lower that has no `minItems` beside it into a union of tuples of every length up to it, so declaring this one would hand every consumer `[] | [number] | [number, number] | ...` in place of `number[]`, and no ordinary array operation would type-check against it. A ceiling of 8 or more generates a plain array and is declared, which is why a waypoint's `properties` carries `maxItems: 20` and this carries none.
  - `context` (object): Free-form provenance context, such as the matrix ranking that justified a coverage zone. Stored and echoed back verbatim; never interpreted by the API. At most 32 top-level fields and 4 KiB once serialized, since it is stored and echoed on every read of the zone.

- `start_at` (string (date-time) | null, required): Start of the temporal validity window. Before this time the zone is not in force. Null when the zone is in force at once.

- `status` (string, required, one of: `draft`, `published`): Whether the zone is published right now, that is whether it has a live publication. Derived server-side; read-only and never accepted as an input. Taking a zone down returns it to `draft`, although its publication number is kept, so a later publish takes the next one. Note this is independent of is_private: a draft is invisible on the public surfaces however public its privacy setting says it is.

- `updated_at` (string (date-time), required): When the zone's latest revision was written. Every `patchZone` moves it, even one that changes nothing. Always present: it equals `created_at` until the first patch.

### An example Zone

```json
{
  "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
  "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
  "name": "Tricot trailhead, one hour",
  "description": "Terrain reachable on foot within an hour of the Col du Tricot trailhead.",
  "level": "info",
  "mode": "polygon",
  "is_private": false,
  "status": "published",
  "published_at": "2026-06-28T16:05:00Z",
  "has_unpublished_changes": false,
  "start_at": "2026-07-01T00:00:00Z",
  "end_at": "2026-08-31T23:59:59Z",
  "source": {
    "kind": "isochrones",
    "activity": "hiking-and-trail",
    "location": [
      6.7845,
      45.8612
    ],
    "range_type": "time",
    "range": 3600
  },
  "geojson": {
    "type": "Feature",
    "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
    "properties": {},
    "geometry": {
      "type": "Polygon",
      "coordinates": [
        [
          [
            6.7845,
            45.8612
          ],
          [
            6.7961,
            45.8612
          ],
          [
            6.7961,
            45.8698
          ],
          [
            6.7845,
            45.8698
          ],
          [
            6.7845,
            45.8612
          ]
        ]
      ]
    }
  },
  "revision": 4,
  "etag": "\"d4\"",
  "created_by": {
    "id": "7a3e5d18-4c60-49b2-8f75-e2d1c9a4b607"
  },
  "created_at": "2026-05-12T09:14:00Z",
  "updated_at": "2026-06-28T16:02:00Z"
}
```

## List zones

### GET /v1/zones

- Operation: `getZones`
- Requires: scope `publishing`
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Returns the zones of the key's organization, one page at a time. A zone belongs to the organization that owns it, not to the user who drew it, so this is the listing every member shares.

The listing is always the key's organization. `organization_id` may name that organization, which changes nothing, and naming any other organization is a `403` whether or not it exists. A personal zone, owned by no organization, never appears.

WHICH zones appear depends on the credential. A publishable key alone lists the organization's PUBLIC zones that are currently published, and serves the published snapshot of each: one never published, or taken down, is absent, and so is every zone while the organization's agreement does not include Map Publishing. The same key with a session token naming a member lists its private ones and its unpublished ones as well, and serves the draft of each; a session token minted without `user_id`, whatever surface it was minted for, lists and serves what the key alone does. A caller that finds its own zones missing is almost always sending the key without a session naming a member. A share token does not open this listing: the zones a collection link reaches are listed with `getCollectionZones`. See the read tiers in the API description.

`level`, `mode` and `active_at` narrow the listing to the zones a map draws: of one severity, drawn with one tool, or in force at one instant. Every filter sent narrows the listing further, and none of them widens what the credential reaches: a zone is listed only when it matches every one sent. They read each zone as it is served, so under a key alone a zone is matched on its last published snapshot. `status` and `is_private` read each zone as it is served too, so under a key alone, and under a session token minted without `user_id`, `status=draft` and `is_private=true` list nothing.

The page is cut after authorization, so it never holds a zone the caller may not see. The listing ends at the page whose `extensions.metadata.pagination.next_cursor` is `null`.

Reads are limited per minute. A publishable key sent without a session token, or with one minted without `user_id`, is held to 600 per client IP address and then 6000 per organization, and a key with a session token naming a user to 1200 per user the token names and then 6000 per organization, counted apart from the reads made under the key alone. Past any of them the read is a `429` carrying `Retry-After`.

Requires a publishable key with the `publishing` scope, or the `studio-embedded` scope that includes it.

**Query parameters**

- `cursor` (string, in query, optional): Where the page starts: the `next_cursor` the previous page reported at `extensions.metadata.pagination`, sent back unchanged. Omitted, the listing starts at its first item.

  A cursor is opaque: it is not an offset and not an identifier, and a client never builds or edits one, and it is never longer than 1024 characters. It is bound to the operation that issued it, to its filters and its `sort`, and to the scope it listed, such as the organization or the collection in the path or the key's own organization. On `getItineraries`, `getZones` and `getCollections`, whose scope `organization_id` may leave implicit, it is bound as well to the tier of the credential it was issued to, a key alone (or with a session token minted without `user_id`, which reads as one) or a key with a session token naming a member. The next page is asked for the same way. A cursor sent to another operation, with different filters, a different `sort`, another scope or, on those three, another tier of credential, or altered in any way, is a `400` at `["request", "query", "cursor"]`. On every listing, each page applies the read tier of the credential that asks for it. Paging is by position in the sort order rather than by count, so an item whose sort key does not change is never skipped or served twice, whatever is created or deleted between two pages.

- `limit` (integer (int32), in query, optional, default: `50`): How many items one page holds, between 1 and 100; 50 when omitted, on every listing that pages. `extensions.metadata.pagination.limit` reports the size the page was served at. A page shorter than `limit` is not how the end is told: the end is a `next_cursor` of `null`. The page is cut after authorization, so it never widens what a caller can read.

- `organization_id` (string (uuid), in query, optional): The organization to list for. It can only be the key's organization, which is also what the listing covers when this is omitted; any other identifier is a `403`, whether or not it exists. A personal resource, owned by no organization, is never listed under a key.

- `status` (string, in query, optional, one of: `draft`, `published`): Lists only the zones in this publication state: `published` those with a live publication, `draft` those with none. Omitted, both are listed. A key alone is served published zones only, and so is a key with a session token minted without `user_id`, so `draft` lists nothing under either.

- `is_private` (boolean, in query, optional): `true` lists only private items and `false` only public ones; omitted, both are listed. It narrows and never widens: what a credential lists is still decided by the [read tiers](https://docs.mountaya.com/en/authentication.md#what-a-bare-publishable-key-reaches), so a key without a session token naming a member lists no private item whatever this says.

- `level` (string, in query, optional, one of: `info`, `resolved`, `warning`, `danger`): Lists only the zones of this level.

- `mode` (string, in query, optional, one of: `polygon`, `circle`, `sensor`, `sector`, `freehand`): Lists only the zones drawn or computed this way. A zone computed from a `source` is `polygon`.

- `active_at` (string (date-time), in query, optional): Lists only the zones in force at this instant: those whose validity window contains it, with a `start_at` at or before it, or none, and an `end_at` at or after it, or none. Send the current time to list what applies now.

- `updated_since` (string (date-time), in query, optional): Lists only what changed at or after this instant, compared with each item's `updated_at`. With `sort=updated_at`, it is how a client picks up what changed since its last read without walking the whole listing.

- `q` (string, in query, optional): Lists only the items whose `name` contains this text, compared without regard to case. 1 to 100 characters; leading and trailing whitespace is ignored.

- `sort` (string, in query, optional, default: `-updated_at`, one of: `-updated_at`, `updated_at`, `-created_at`, `created_at`, `name`, `-name`): The order the listing is served in, by one key: `updated_at`, `created_at` or `name`, ascending as written and descending with a leading `-`. `-updated_at` when omitted, so the zone changed last comes first. Ties break on `id`, so no two items share a place in the order, and a page boundary never falls between two that compare equal.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Response** `200`

One page of the zones this credential reaches, in the order `sort` names. `extensions.metadata.pagination.next_cursor` asks for the next page, and is `null` on the last.

- `extensions` (object, required): The envelope's second half, everything the answer carries that is not the answer itself. Here that is `metadata.pagination` alone: the `limit` this page was served at, and the `next_cursor` that asks for the next one, `null` on the last page.
  - `metadata` (ListMetadata, required): The `extensions.metadata` object every listing that pages returns. It carries the page and nothing else, so `extensions.metadata.pagination` is the one path a client reads paging from. A listing that does not page, a catalog or a usage series, answers with no `extensions` at all.
    - `pagination` (object, required): The page this listing served, and the cursor of the next one.
      - `limit` (integer (int32), required): The page size the listing was served at: the `limit` sent, or 50 when none was.
      - `next_cursor` (string | null, required): The `cursor` that asks for the page after this one, with the same filters and `sort`, or null when this page is the last. A page that is not the last may hold fewer than `limit` items; the end is told by this field alone.

- `data` (array of Zone, required): See [the Zone object](https://docs.mountaya.com/en/apis/map-studio/reference/zones.md#zone-object).

**Errors** `400`, `401`, `402`, `403`, `404`, `429`, `500`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: Bad Request
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Map Publishing, the product the `publishing` scope belongs to. Map Publishing is granted by the organization's agreement with Mountaya, so this is answered to an organization whose agreement does not include it, and it clears when the agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. Under a key carrying `studio-embedded`, the organization is refused for Map Publishing only when it holds neither Map Publishing nor Embedded Studio with Map Studio, so an organization that edits in an Embedded Studio reads its work back without Map Publishing.
- `403`: The credential is valid and this operation is not open to it: the key carries neither the `publishing` scope nor the `studio-embedded` scope that includes it, or `organization_id` names an organization other than the key's own, whether or not it exists. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `404`: Answered only from Mountaya's web application: `organization_id` names an organization the person is not a member of, or one that does not exist. The two answer alike, so the parameter cannot be used to learn which organizations exist. Under a publishable key an identifier other than the key's organization is a `403` instead, whether or not it exists.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# With a session token naming a member the page holds the organization's
# drafts, private ones included; the key alone lists its published public
# zones.
curl -s "https://api.mountaya.com/v1/zones?level=danger&active_at=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token"
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});

const { data } = await mountaya.studio.zones.getZones({
  query: { level: "danger", active_at: "2026-07-15T08:00:00Z" },
});

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://api.mountaya.com/v1/zones",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
    },
    params={"level": "danger", "active_at": "2026-07-15T08:00:00Z"},
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": [
    {
      "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
      "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
      "name": "Tricot trailhead, one hour",
      "description": "Terrain reachable on foot within an hour of the Col du Tricot trailhead.",
      "level": "info",
      "mode": "polygon",
      "is_private": false,
      "status": "published",
      "published_at": "2026-06-28T16:05:00Z",
      "has_unpublished_changes": false,
      "start_at": "2026-07-01T00:00:00Z",
      "end_at": "2026-08-31T23:59:59Z",
      "source": {
        "kind": "isochrones",
        "activity": "hiking-and-trail",
        "location": [
          6.7845,
          45.8612
        ],
        "range_type": "time",
        "range": 3600
      },
      "geojson": {
        "type": "Feature",
        "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
        "properties": {},
        "geometry": {
          "type": "Polygon",
          "coordinates": [
            [
              [
                6.7845,
                45.8612
              ],
              [
                6.7961,
                45.8612
              ],
              [
                6.7961,
                45.8698
              ],
              [
                6.7845,
                45.8698
              ],
              [
                6.7845,
                45.8612
              ]
            ]
          ]
        }
      },
      "revision": 4,
      "etag": "\"d4\"",
      "created_by": {
        "id": "7a3e5d18-4c60-49b2-8f75-e2d1c9a4b607"
      },
      "created_at": "2026-05-12T09:14:00Z",
      "updated_at": "2026-06-28T16:02:00Z"
    }
  ],
  "extensions": {
    "metadata": {
      "pagination": {
        "limit": 50,
        "next_cursor": "eyJ2IjoxLCJzIjoiLXVwZGF0ZWRfYXQifQ"
      }
    }
  }
}
```

## Create a new zone

### POST /v1/zones

- Operation: `postZone`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member) · an `Idempotency-Key` header, the same on every retry
- Behavior: answers within 30000 ms or times out

Creates a zone in the key's organization: a named area drawn by hand as a single Polygon, or computed from a `source`. Any geometry other than a Polygon, a `null` geometry included, is a `400` naming `geojson.geometry`, and so is a Polygon whose outline one meridian or one parallel crosses more than 512 times, every ring counted, which is too intricate to be stored, and one that is not a valid polygon, in degrees as sent or once projected to Web Mercator, as a map draws it: a ring that crosses itself or another ring, a ring that touches itself, or a hole outside its shell. A straight edge in degrees is drawn as another line on a map, so an outline valid in degrees can cross itself once projected, and is refused. An area computed from a `source` held to none of these, or of more than 10,000 positions, is a `400` naming `source`: change its location or range, or draw the zone. An `end_at` earlier than `start_at` is a `400` naming `end_at`.

A new zone is a draft: the public surfaces serve nothing of it until `postZonePublication` publishes it, whatever `is_private` says, and `is_private` decides who may read it once it is.

A zone's name is unique within the organization: a name another zone there already carries is a `409` naming that zone. So is an id: a `geojson.id` another zone already has is a `409` naming it.

A new zone always belongs to an organization, and the organization must hold Map Studio, or the create is refused with a `402`. No new zone is personal: a request that would create one owned by no organization, which only Mountaya's web application can send, is refused with a `403`.

A zone computed from a `source` runs that computation for the organization. Under a key each run is recorded as `studio-embedded` data usage, so the organization sees it, and is never counted toward the Data API's per-minute limit, its monthly allowance or its invoice.

Creating zones is limited to 30 per user and 300 per organization per minute; over either, the create is a `429` carrying `Retry-After`, and nothing is created.

Requires a publishable key with the `studio-embedded` scope AND a session token minted for `studio-embedded` naming a user, a member with a write role, whom the request acts as. A publishable key without a session token minted for `studio-embedded` naming a user, a token minted for another surface included, is refused with **401**.

**Webhook events** [`zone.created`](https://docs.mountaya.com/en/webhooks/events/zone.md#zone-created), recorded by the task `zone.create`.

**Headers**

- `Idempotency-Key` (string, in header, optional): A value the caller chooses once per logical write and sends again, unchanged, on every retry of it, so a write whose answer was lost runs at most once. A UUID is the usual choice; any 1 to 255 printable ASCII characters without a space are accepted. The key is held for 12 hours, for the credential that sent it (the publishable key and the user its session token names) and for this operation.

  The first request runs. A request repeating the key with the same method, path, query and body, sent as the same media type, is answered with the first one's stored status and body, its `Location` and `ETag` included, and carries `Idempotent-Replayed: true`; nothing runs a second time and no limit is charged again. `Content-Type` is compared as the media type it names, with its `charset`, rather than as the header was written, so the letter case of the type and the spacing around its parameters do not make two requests different. `If-Match` is not compared: a key sent again after a `412`, with a fresh tag, is answered with that same `412`, so a write retried with a new tag takes a new key. Every answer below `500` other than a `429` is stored that way, a refusal included, so a retried request that was refused is refused again in the same words. A request refused before the write is reached stores nothing, and a retry with the same key runs again: every `401`, and every `413` refusing a body over the operation's ceiling. The `413` that `postItineraryPreview` answers for the source it has read, a file or a track too large, is stored as any other refusal is.

  A `5xx` answered before anything was written stores nothing and releases the key: a retry with the same key runs again. A `5xx` answered after the write was made keeps the key, and a request repeating it is a `409` whose entry is coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`, as is a request repeating the key of an answer too large to store whole. Either way the write was made: the `409` carries no `Location`, and its `extensions.metadata` (`ResponseMetadataIdempotentAnswer`) names the `status` the first request was answered with and, where that answer carried them, its `location` and `etag`. Read the resource again rather than sending the write once more, which is answered the same way.

  The same key with a different request is a `400` at `["request", "headers", "Idempotency-Key"]`, and nothing runs, whether the first request is still running or was answered. The same request while its first one is still running is a `409` whose entry is coded `IDEMPOTENCY_KEY_IN_USE`, carrying `Retry-After`: send it again once that has passed. Without the header a write runs every time it is sent, which is harmless on the writes `x-idempotent` marks safe to repeat and creates a second resource on the others. A stream's answer is never stored.

  Keys are kept on a best-effort basis. While Mountaya cannot read or record them, a write runs as if it carried no key, so a retry sent in that moment can run it a second time.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Body**

The new zone: its level, its validity window, and either the polygon to store as sent, less any altitude and feature properties, or the source to compute one from. Send exactly one of the two.

- `description` (string, in body, optional): Free-text description of the zone, at most 100 characters as sent, stored with leading and trailing whitespace trimmed. Omit it, or send one that trims to nothing, to create the zone without one.

- `end_at` (string (date-time), in body, optional): End of the temporal validity window. Optional and not nullable: omit it for a zone with no expiration. One earlier than `start_at` is a `400` naming `end_at`.

- `geojson` (object, in body, optional): The area of a zone drawn by hand. Provide exactly one of `geojson` or `source`. An `id` on the feature becomes the zone's id; one that another zone already has is a `409`.

  The ring rules stated on `GeoJSONPolygon` are enforced here. A ring whose ends differ, a ring of fewer than four positions, a polygon carrying no ring, and a position outside the angle ranges the feature's `geometry` states are each a `400` naming the ring or position at fault, and so is an area of more than 10,000 positions in total, naming `geojson`. An outline one meridian or one parallel crosses more than 512 times, every ring counted, is too intricate to be stored, and one that is not a valid polygon, in degrees as sent or once projected to Web Mercator, as a map draws it (a ring that crosses itself or another ring, a ring that touches itself, or a hole outside its shell), is refused too: each is a `400` naming `geojson.geometry`, without saying where.
  - `type` (string, required, one of: `Feature`): Discriminator for the GeoJSON object type. Always `Feature`.
  - `id` (string (uuid), optional): The zone's id. On a read it is always present and equals the zone's own `id`. On a create it is optional: a UUID sent here becomes the zone's id, and the server mints one when it is omitted. A UUID another zone already has is a `409`. On an update it is ignored.
  - `geometry` (object, required): The zone's area. Positions are `[longitude, latitude]`; an optional third value is accepted and not kept, because a zone is a region on the ground.

    Latitude runs from -90 to 90. Longitude runs from -360 to 360, a turn wider than a point's, so that a ring crossing the antimeridian stays one ring: its longitudes are counted on past 180, or below -180, and no two neighbours stand on opposite edges of the map. `[179.5, -17]` followed by `[180.4, -17]` is nine tenths of a degree of ring. Written `[179.5, -17]` then `[-179.6, -17]`, the same two places are joined the other way round the world. The area is stored and returned with the longitudes it was written with.
    - `type` (string, required, one of: `Polygon`): Discriminator for the geometry type. Always `Polygon` for this schema.
    - `coordinates` (array of array of array of number (double), required): One coordinate array per ring, exterior ring first and any others holes. At least one ring, and each ring is CLOSED: it carries at least four positions and its last repeats its first. The closure is the part JSON Schema cannot state, so it is stated here; a ring whose ends differ is rejected on write, as is a polygon carrying no ring at all. No position carries fewer than two values or more than three. There is no declared ceiling on rings or on positions per ring, deliberately: a ring is not a tuple and no useful ceiling exists for one.
  - `properties` (object, required): Free-form properties. They are accepted and not kept, since a zone's own fields carry what it says about itself, so a read returns an empty object. At most 64 fields and 16 KiB as sent.

- `is_private` (boolean, in body, required): Whether the zone is private. A private zone is reached only with the key of the organization that owns it, so a private personal zone, owned by no organization, is reached by no key. A public zone is readable by id, read-only, by any publishable key, as last published, and it is listed only in its own organization's listings. A collection's share token reaches the zones that collection holds whatever this says. Public never grants editing, which takes a write role in the owning organization. Privacy is read from the draft, so a change takes effect at once rather than at the next publish.

- `level` (string, in body, required, one of: `info`, `resolved`, `warning`, `danger`): How serious the zone is, which is what a renderer picks its styling from. It carries no access meaning: a zone is visible or not by `is_private` and its publication, never by its level.

- `mode` (string, in body, required, one of: `polygon`, `circle`, `sensor`, `sector`, `freehand`): How the zone's area is drawn or computed. A zone given a `source` must be `polygon`; any other mode beside a `source` is a 400.

- `name` (string, in body, required): Display name of the zone, at most 30 characters as sent, and at least 2 once leading and trailing whitespace is trimmed. Refused with a `409` when another zone in the organization already carries it. Names are compared exactly after trimming, case included, so `Alps` and `alps` are two different names. A name is one line: a tab, a line break or a line separator between two of its characters is a `400`, and one at either end is trimmed with the whitespace there.

- `organization_id` (string (uuid), in body, optional): Identifier of the organization that will own the zone. It must be the key's organization; omitted, it is that organization.

- `source` (object, in body, optional): Provenance inputs for a computed zone. Provide exactly one of `geojson` or `source`; when `source` is given the zone's polygon is computed from these inputs and the source is kept, so the zone can be refreshed by sending it again on an update. An area computed from the source is held to every rule a drawn one is, its 10,000 positions included, and one that breaks any is a `400` naming `source`, and nothing is created.

  Optional and not nullable: send it for a computed zone, or leave it out and send `geojson`. The update operation types the same field nullable, because there `null` detaches an existing source and keeps the computed area as it stands.
  - `kind` (string, required, one of: `isochrones`): The generative engine that produced the zone. `isochrones` computes a reachability polygon for an activity from a single origin point.
  - `activity` (string, required, one of: `hiking-and-trail`, `professional-trail`, `running`, `road-cycling`, `gravel-bike`, `mountain-bike`, `backcountry-skiing`, `ski-touring`, `cross-country-skiing`, `snowshoe-walking`): The outdoor activity whose routing profile the reachability polygon is computed for (e.g. `hiking-and-trail`, `road-cycling`).
  - `location` (array of number (double), required): Origin point the isochrone is measured from, as a `[longitude, latitude]` WGS84 coordinate pair. Longitude is bounded to -180..180 and latitude to -90..90, the same bounds every other coordinate in this contract carries. The declared bounds are the wider of the two, since one `items` schema covers both positions; the per-axis rule above is the one enforced.
  - `range_type` (string, required, one of: `time`, `distance`): Whether `range` is measured as travel time (seconds) or travel distance (meters).
  - `range` (number (double), required): This zone's band value: seconds when `range_type` is `time`, meters when `range_type` is `distance`. This single band drives the zone's polygon. At least 1, and at most 7,200 seconds for a `time` band and 25,000 meters for a `distance` band, the ceilings the Data API's `isochrones` holds a range to, since a sourced zone's polygon is the isochrone of its source; anything else is a `400` naming `range`.
  - `speed` (number (double), optional): Travel speed in km/h, overriding the activity's default pace. Accepted only when `range_type` is `time`, and a 400 beside `distance`: the reachable area at a given travel time is the one the stated pace covers, so a slower walker reaches less ground in the same hour. Omit to let the activity's own pace resolve at compute time, which is what a zone created without a stated pace stores. Between 0.5 and 100 km/h.
  - `ranges` (array of number (double), optional): The full set of band values this zone was created alongside, when it is one of several coverage bands. Informational: only `range` drives this zone's polygon, but `range` must be one of these values when present. A zone authored one band at a time carries no set and omits this. At most six bands, the ceiling a coverage computation is allowed to request; a longer set is refused with a validation error.

    The ceiling is stated here rather than declared as `maxItems`, deliberately. The TypeScript generator expands a `maxItems` of 7 or lower that has no `minItems` beside it into a union of tuples of every length up to it, so declaring this one would hand every consumer `[] | [number] | [number, number] | ...` in place of `number[]`, and no ordinary array operation would type-check against it. A ceiling of 8 or more generates a plain array and is declared, which is why a waypoint's `properties` carries `maxItems: 20` and this carries none.
  - `context` (object, optional): Free-form provenance context, such as the matrix ranking that justified a coverage zone. Stored and echoed back verbatim; never interpreted by the API. At most 32 top-level fields and 4 KiB once serialized, since it is stored and echoed on every read of the zone.

- `start_at` (string (date-time), in body, optional): Start of the temporal validity window. Optional and not nullable: omit it for a zone that is active immediately.

**Response** `201`

The zone as created, with its polygon either stored as sent, less any altitude and feature properties, or computed from the source. `Location` names it, `/v1/zones/{zone_id}`, and `ETag` carries its first version.

- `extensions` (object): Top-level extensions map for 2xx responses. Mirrors the GraphQL-spec response extensions: a free-form map for response-scoped metadata.
  - `metadata` (object): Response-scoped metadata. Its shape is per-operation: the operation that emits it names the schema, and an operation that documents none never emits this field.

- `data` (Zone, required): A geographic annotation drawn on the map, such as a hazard zone, an information marker, or a custom area.

  See [the Zone object](https://docs.mountaya.com/en/apis/map-studio/reference/zones.md#zone-object).

Response headers:

- `Location`: The path of what the request created, relative to this host. A part of an itinerary is addressed under its itinerary, so a new segment's is `/v1/itineraries/{itinerary_id}/segments/{segment_id}`.
- `ETag`: The version of the resource this answer returns, an opaque strong tag in double quotes, equal to that resource's `etag` field. Send it back as `If-Match` to make a write conditional on nobody having changed the resource since. It changes whenever what this read returns changes; compare it whole and never parse it. Present on every answer that returns the resource, and on the `412` that refuses a stale `If-Match`.
- `Idempotent-Replayed`: `true` when this answer is the stored answer to an earlier request carrying the same `Idempotency-Key`, replayed rather than run again. Absent on an answer that ran.

**Errors** `400`, `401`, `402`, `403`, `404`, `409`, `413`, `429`, `500`, `503`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: The request was malformed, or a field failed validation: each entry names what, a field-level one at its `path`. The same `Idempotency-Key` sent with another request is refused here too, at `["request", "headers", "Idempotency-Key"]`. A refusal the write itself made is stored for its key, so a repeat of the key is refused again in the same words, marked `Idempotent-Replayed: true`.
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Embedded Studio, the product the `studio-embedded` scope belongs to and the one a publishable key needs to act as a member. It is agreed rather than bought, so it clears when the organization's agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. The reads that take `publishing` are unaffected. It is also a plain `PAYMENT_REQUIRED` when the organization the request creates the zone in does not hold Map Studio, which every change to an organization's itineraries, collections and zones needs. Map Studio is granted by the organization's agreement, so this too clears when the agreement changes rather than when the request does.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `studio-embedded` scope, or the user the session token names is not a member of the key's organization, or holds a role there that reads only, or `organization_id` names an organization other than the key's own, whether or not it exists. A user outside the organization and a member without the role answer alike. A zone owned by no organization, which only Mountaya's web application could ask for, is refused here as well. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `404`: Answered only from Mountaya's web application: `organization_id` names an organization the person is not a member of, or one that does not exist. The two answer alike, so it cannot be used to learn which organizations exist. Under a publishable key an identifier other than the key's organization is a `403` instead, whether or not it exists, and an omitted one is the key's organization. Nothing is created.
- `409`: Another zone in the organization already carries the name, or another zone already has the `geojson.id` sent. Nothing is created. `extensions.metadata.zone.id` is the zone that collided: send a different name or id, or update that zone rather than creating a second. A request carrying the same `Idempotency-Key` as one still running is refused here too: its entry is coded `IDEMPOTENCY_KEY_IN_USE`, names no resource at `extensions.metadata`, and it carries `Retry-After`, after which the same request is answered with the first one's outcome. A request repeating the key of one whose answer cannot be replayed is refused here as well, its entry coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`: the answer was too large to keep whole, or the request failed with a `5xx` after its write was made. Either way that write was made, and `extensions.metadata` is the `ResponseMetadataIdempotentAnswer` naming how it was answered, so read the resource again rather than sending the write once more. Its `location` names the zone made, `/v1/zones/{zone_id}`, after a `5xx` as after a `201`, so carry on with that one rather than creating it again.
- `413`: Payload Too Large
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `503`: The check of the outline sent could not finish in time on Mountaya's side, under load: the outline was neither accepted nor refused, and nothing was written. Send the write again once `Retry-After` has passed. An outline the rules admit is checked in well under a second.
- `504`: Gateway Timeout

**cURL**

```bash
# The geometry is a GeoJSON Feature, not a bare geometry. start_at and end_at
# bound when the zone is in force; omit both for one that never expires.
curl -s https://api.mountaya.com/v1/zones \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Tricot rockfall closure",
    "description": "Rockfall closure below the Col du Tricot.",
    "level": "danger",
    "mode": "polygon",
    "is_private": true,
    "start_at": "2026-07-01T00:00:00Z",
    "end_at": "2026-08-31T23:59:59Z",
    "geojson": {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [[
          [6.7845, 45.8612], [6.7961, 45.8612],
          [6.7961, 45.8698], [6.7845, 45.8698], [6.7845, 45.8612]
        ]]
      }
    }
  }'
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});

const { data } = await mountaya.studio.zones.postZone({
  body: {
    name: "Tricot rockfall closure",
    description: "Rockfall closure below the Col du Tricot.",
    level: "danger",
    mode: "polygon",
    is_private: true,
    start_at: new Date("2026-07-01T00:00:00Z"),
    end_at: new Date("2026-08-31T23:59:59Z"),
    geojson: {
      type: "Feature",
      properties: {},
      geometry: {
        type: "Polygon",
        coordinates: [
          [
            [6.7845, 45.8612],
            [6.7961, 45.8612],
            [6.7961, 45.8698],
            [6.7845, 45.8698],
            [6.7845, 45.8612],
          ],
        ],
      },
    },
  },
});

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.post(
    "https://api.mountaya.com/v1/zones",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "name": "Tricot rockfall closure",
        "description": "Rockfall closure below the Col du Tricot.",
        "level": "danger",
        "mode": "polygon",
        "is_private": True,
        "start_at": "2026-07-01T00:00:00Z",
        "end_at": "2026-08-31T23:59:59Z",
        "geojson": {
            "type": "Feature",
            "properties": {},
            "geometry": {
                "type": "Polygon",
                "coordinates": [
                    [
                        [6.7845, 45.8612],
                        [6.7961, 45.8612],
                        [6.7961, 45.8698],
                        [6.7845, 45.8698],
                        [6.7845, 45.8612],
                    ],
                ],
            },
        },
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 201:

```json
{
  "data": {
    "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
    "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "name": "Tricot trailhead, one hour",
    "description": "Terrain reachable on foot within an hour of the Col du Tricot trailhead.",
    "level": "info",
    "mode": "polygon",
    "is_private": false,
    "status": "published",
    "published_at": "2026-06-28T16:05:00Z",
    "has_unpublished_changes": false,
    "start_at": "2026-07-01T00:00:00Z",
    "end_at": "2026-08-31T23:59:59Z",
    "source": {
      "kind": "isochrones",
      "activity": "hiking-and-trail",
      "location": [
        6.7845,
        45.8612
      ],
      "range_type": "time",
      "range": 3600
    },
    "geojson": {
      "type": "Feature",
      "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              6.7845,
              45.8612
            ],
            [
              6.7961,
              45.8612
            ],
            [
              6.7961,
              45.8698
            ],
            [
              6.7845,
              45.8698
            ],
            [
              6.7845,
              45.8612
            ]
          ]
        ]
      }
    },
    "revision": 4,
    "etag": "\"d4\"",
    "created_by": {
      "id": "7a3e5d18-4c60-49b2-8f75-e2d1c9a4b607"
    },
    "created_at": "2026-05-12T09:14:00Z",
    "updated_at": "2026-06-28T16:02:00Z"
  }
}
```

## Retrieve a single zone with its geometry

### GET /v1/zones/{zone_id}

- Operation: `getZone`
- Requires: scope `publishing`
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Returns the zone, including the full `geojson` geometry, `created_by`, and the temporal validity window (`start_at` / `end_at`). This is the authoritative geometry for editing, unlike the simplified, clipped geometry served by the tile endpoint.

A COLLECTION share token also reaches this endpoint, for the zones inside the collection it was minted for, read-only and regardless of privacy. An itinerary token never does: it grants exactly its one itinerary. A zone has no share link of its own.

WHICH VERSION you are served depends on the credential. A publishable key alone, and a share token, are served the last PUBLISHED snapshot; the same key with a session token naming a member is served its own organization's DRAFT, which is what the studio edits, unless it passes `surface=published`. A session token minted without `user_id`, such as the one a read-only viewer runs on, is served what the key alone is, the published snapshot and never the draft, whatever surface it was minted for. Another organization's public zone is served as it was last published whatever the credential. Whenever the published snapshot is what a request is served, a zone that has never been published, or has been taken down, answers 404, and so does one whose organization's agreement does not include Map Publishing, which withdraws what the organization published rather than refusing it; a share token of such an organization does not resolve at all and answers `401`. A bare publishable key, and the key with a session token minted without `user_id`, reaches its own organization's zones whether public or private, and another organization's public one; a share token reaches only what its link names. See the read tiers in the API description.

Refused with 403 when `surface=published` names a PERSONAL zone, that is, one owned by no organization, as a personal itinerary is. The published surface is what an embed is made of, and an embed is an output of an organization's products, which a personal zone, owned by none, never has, whatever the credential. A request without the opt-in is not refused this way. Only the person whose zone it is reads it as its draft and is refused this way; every other caller, every publishable key included, reads it as published, is served nothing of a personal zone, which is never published, and is answered `404` before this refusal is reached, as a caller who cannot view it is.

The answer carries `ETag`, the version of what it returns, which is also the body's `etag`: send it as `If-Match` on a write to the zone to make that write conditional on nobody having changed it since.

Reads are limited per minute. A publishable key sent without a session token, or with one minted without `user_id`, is held to 600 per client IP address and then 6000 per organization; a key with a session token naming a user to 1200 per user the token names and then 6000 per organization, counted apart from the reads made under the key alone; and a share token to 600 per client IP address and then 6000 per organization that owns the link. Past any of them the read is a `429` carrying `Retry-After`. A share token not resolved moments earlier is refused the same way when its client IP address has had 60 unknown share tokens refused within the minute.

A publishable key needs the `publishing` scope, or the `studio-embedded` scope that includes it. A share token carries its own authority and needs none.

**Path parameters**

- `zone_id` (string (uuid), in path, required): Identifier of the zone the operation acts on.

**Query parameters**

- `surface` (string, in query, optional, one of: `published`): Reads the published snapshot rather than the draft. `published` is the only accepted value: there is deliberately no `draft` spelling, because the param only ever narrows what the caller is served. An unrecognized value is rejected with a validation error rather than silently ignored. A read of one itinerary, or of one zone, refuses it with `403` when it is personal, owned by no organization, to the person whose it is: the published surface is what a video and an embed are made of, and a personal itinerary or zone makes neither. Every other caller reads a personal itinerary or zone as published, and since one is never published it is answered as one that does not exist.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Response** `200`

The zone with its geometry, level and validity window.

- `extensions` (object): Top-level extensions map for 2xx responses. Mirrors the GraphQL-spec response extensions: a free-form map for response-scoped metadata.
  - `metadata` (object): Response-scoped metadata. Its shape is per-operation: the operation that emits it names the schema, and an operation that documents none never emits this field.

- `data` (Zone, required): A geographic annotation drawn on the map, such as a hazard zone, an information marker, or a custom area.

  See [the Zone object](https://docs.mountaya.com/en/apis/map-studio/reference/zones.md#zone-object).

Response headers:

- `Cache-Control`: `public, max-age=300, stale-while-revalidate=60` when a publishable key reads the published snapshot of a public zone. A draft, a read through a share token, and any response about a private zone carry `private` instead, so they never land in a shared cache. Every such response also carries `Vary` naming `X-API-Key`, `X-Session-Token` and `X-Share-Token` beside `Origin`, because each of them changes what is served.
- `ETag`: The version of the resource this answer returns, an opaque strong tag in double quotes, equal to that resource's `etag` field. Send it back as `If-Match` to make a write conditional on nobody having changed the resource since. It changes whenever what this read returns changes; compare it whole and never parse it. Present on every answer that returns the resource, and on the `412` that refuses a stale `If-Match`.

**Errors** `400`, `401`, `402`, `403`, `404`, `429`, `500`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: Bad Request
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Map Publishing, the product the `publishing` scope belongs to. Map Publishing is granted by the organization's agreement with Mountaya, so this is answered to an organization whose agreement does not include it, and it clears when the agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. A share-token request is never refused this way. Under a key carrying `studio-embedded`, the organization is refused for Map Publishing only when it holds neither Map Publishing nor Embedded Studio with Map Studio, so an organization that edits in an Embedded Studio reads its work back without Map Publishing.
- `403`: The credential is valid and this operation is not open to it: the key carries neither the `publishing` scope nor the `studio-embedded` scope that includes it. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well; a share token is held to Mountaya's own origin rather than to that list. A request that passes `surface=published` for a personal zone, one owned by no organization, is refused here as well: see the description above.
- `404`: No zone with that identifier is reachable: either none exists, or this credential cannot view it. The two answer alike, so this status cannot be used to learn which zone ids exist. So does a zone that has never been published, or has been taken down, or whose organization's agreement does not include Map Publishing, when the published snapshot is what the request is served. A share token asking for anything outside its grant is answered the same way.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# A session token naming a member is what serves your own organization's
# draft; the key alone is served the published snapshot, and so is a token
# minted without `user_id`.
curl -s https://api.mountaya.com/v1/zones/c40f8a25-7e63-4d19-b8a0-9f2e5c31d764 \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" | jq '.data'
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});

const { data } = await mountaya.studio.zones.getZone({ zone_id: "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764" });

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://api.mountaya.com/v1/zones/c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

**cURL: Read the published snapshot**

```bash
curl -s "https://api.mountaya.com/v1/zones/c40f8a25-7e63-4d19-b8a0-9f2e5c31d764?surface=published" \
  -H "X-API-Key: pk_your_publishable_key" | jq '.data'
```

Response 200:

```json
{
  "data": {
    "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
    "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "name": "Tricot trailhead, one hour",
    "description": "Terrain reachable on foot within an hour of the Col du Tricot trailhead.",
    "level": "info",
    "mode": "polygon",
    "is_private": false,
    "status": "published",
    "published_at": "2026-06-28T16:05:00Z",
    "has_unpublished_changes": false,
    "start_at": "2026-07-01T00:00:00Z",
    "end_at": "2026-08-31T23:59:59Z",
    "source": {
      "kind": "isochrones",
      "activity": "hiking-and-trail",
      "location": [
        6.7845,
        45.8612
      ],
      "range_type": "time",
      "range": 3600
    },
    "geojson": {
      "type": "Feature",
      "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              6.7845,
              45.8612
            ],
            [
              6.7961,
              45.8612
            ],
            [
              6.7961,
              45.8698
            ],
            [
              6.7845,
              45.8698
            ],
            [
              6.7845,
              45.8612
            ]
          ]
        ]
      }
    },
    "revision": 4,
    "etag": "\"d4\"",
    "created_by": {
      "id": "7a3e5d18-4c60-49b2-8f75-e2d1c9a4b607"
    },
    "created_at": "2026-05-12T09:14:00Z",
    "updated_at": "2026-06-28T16:02:00Z"
  }
}
```

## Update an existing zone

### PATCH /v1/zones/{zone_id}

- Operation: `patchZone`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member) · an `Idempotency-Key` header, the same on every retry
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Updates the zone's name, description, level and temporal validity window. Every field is optional and an omitted field keeps its current value. The area may be replaced by providing `geojson`, which must be a Polygon whose outline no meridian and no parallel crosses more than 512 times, every ring counted, and which is a valid polygon in degrees as sent and once projected to Web Mercator, as a map draws it: an outline too intricate, a ring that crosses itself or another ring, in either, a ring that touches itself, or a hole outside its shell is a `400` naming `geojson.geometry`. When omitted the existing area is carried forward, as it is. An area computed from a `source` held to none of these, or of more than 10,000 positions, is a `400` naming `source`, and nothing is written. A `mode` is sent with the area it describes: beside `geojson` any mode, beside a `source` only `polygon`, and a `mode` sent with neither is a `400` naming `mode`. Only a zone whose mode, sent or kept, is `polygon` takes a `source`: on any other mode it is a `400` naming `source`. `is_private` makes the zone private or public, independently of whether it is published. An `end_at` earlier than the zone's resulting `start_at`, whether either was sent or kept, is a `400` naming `end_at`. Every call writes a new revision, even one that changes nothing, so `revision` and `updated_at` move and, on a published zone, `has_unpublished_changes` is set: what the public surfaces serve moves only at the next `postZonePublication`, privacy aside, which is read from the draft and takes effect at once.

A zone's name is unique within the organization: renaming it to a name another zone there already carries is a `409` naming that zone. Sending its current name again is not a conflict.

While another member of the zone's collaboration session holds the soft edit lock on the zone, taken with a `lock.acquire` through `postZoneCollab`, the update is a `409` naming that member, and nothing is written. A lock held by the user the session token names does not refuse it. A lock lapses 60 seconds after its holder's editor stream ends, so the update succeeds once the holder releases it or goes away.

Send the zone's `etag` as `If-Match` to make the update conditional: a zone changed since that read is a `412`, and nothing is written.

The organization the zone belongs to must hold Map Studio, or the update is refused with a `402`. A zone owned by no organization is personal and is never edited: it stays readable and can be deleted, and an update to it is refused with a `403`.

An update that sends a `source` runs that computation again for the organization. Under a key each run is recorded as `studio-embedded` data usage, so the organization sees it, and is never counted toward the Data API's per-minute limit, its monthly allowance or its invoice.

Updating zones is limited to 30 per user and 300 per organization per minute; over either, the update is a `429` carrying `Retry-After`, and nothing is written.

Requires a publishable key with the `studio-embedded` scope AND a session token minted for `studio-embedded` naming a user, a member with a write role, whom the request acts as. A publishable key without a session token minted for `studio-embedded` naming a user, a token minted for another surface included, is refused with **401**.

**Webhook events** [`zone.updated`](https://docs.mountaya.com/en/webhooks/events/zone.md#zone-updated), recorded by the task `zone.update`.

**Path parameters**

- `zone_id` (string (uuid), in path, required): Identifier of the zone the operation acts on.

**Headers**

- `Idempotency-Key` (string, in header, optional): A value the caller chooses once per logical write and sends again, unchanged, on every retry of it, so a write whose answer was lost runs at most once. A UUID is the usual choice; any 1 to 255 printable ASCII characters without a space are accepted. The key is held for 12 hours, for the credential that sent it (the publishable key and the user its session token names) and for this operation.

  The first request runs. A request repeating the key with the same method, path, query and body, sent as the same media type, is answered with the first one's stored status and body, its `Location` and `ETag` included, and carries `Idempotent-Replayed: true`; nothing runs a second time and no limit is charged again. `Content-Type` is compared as the media type it names, with its `charset`, rather than as the header was written, so the letter case of the type and the spacing around its parameters do not make two requests different. `If-Match` is not compared: a key sent again after a `412`, with a fresh tag, is answered with that same `412`, so a write retried with a new tag takes a new key. Every answer below `500` other than a `429` is stored that way, a refusal included, so a retried request that was refused is refused again in the same words. A request refused before the write is reached stores nothing, and a retry with the same key runs again: every `401`, and every `413` refusing a body over the operation's ceiling. The `413` that `postItineraryPreview` answers for the source it has read, a file or a track too large, is stored as any other refusal is.

  A `5xx` answered before anything was written stores nothing and releases the key: a retry with the same key runs again. A `5xx` answered after the write was made keeps the key, and a request repeating it is a `409` whose entry is coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`, as is a request repeating the key of an answer too large to store whole. Either way the write was made: the `409` carries no `Location`, and its `extensions.metadata` (`ResponseMetadataIdempotentAnswer`) names the `status` the first request was answered with and, where that answer carried them, its `location` and `etag`. Read the resource again rather than sending the write once more, which is answered the same way.

  The same key with a different request is a `400` at `["request", "headers", "Idempotency-Key"]`, and nothing runs, whether the first request is still running or was answered. The same request while its first one is still running is a `409` whose entry is coded `IDEMPOTENCY_KEY_IN_USE`, carrying `Retry-After`: send it again once that has passed. Without the header a write runs every time it is sent, which is harmless on the writes `x-idempotent` marks safe to repeat and creates a second resource on the others. A stream's answer is never stored.

  Keys are kept on a best-effort basis. While Mountaya cannot read or record them, a write runs as if it carried no key, so a retry sent in that moment can run it a second time.

- `If-Match` (string, in header, optional): Makes the write conditional on the resource still being the version the caller read: the `ETag` an earlier answer carried, which is also that resource's `etag` field, or `*` for any version. When the resource has changed since, the write is refused with `412` `PRECONDITION_FAILED`, nothing is changed, and the answer carries the current `ETag`, so the caller reads the resource again and decides. Omitted, the write is unconditional and the last write wins.

  One strong tag in double quotes, or `*`. A list of tags, a weak tag (`W/`) or any other spelling is a `400` naming the header. A resource the caller cannot see is answered `404` before the condition is asked, so a stale tag never tells a caller anything a read would not.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Body**

The zone fields to change. Every field is optional; omitted fields are left as they are.

- `description` (string | null, in body, optional): Free-text description of the zone, at most 100 characters as sent, stored with leading and trailing whitespace trimmed. Omit to keep the current value; `null`, or a value that trims to nothing, clears it.

- `end_at` (string (date-time) | null, in body, optional): End of the temporal validity window. Omit to keep the current value; `null` removes the expiration. The window a request leaves must not end before it starts: an `end_at` earlier than the resulting `start_at`, sent or kept, is a `400` naming `end_at`.

- `geojson` (object, in body, optional): Replacement area, which replaces the stored one wholesale rather than merging into it. Optional and not nullable: omit it to keep the current area. Sent on a sourced zone, it replaces the computed area and detaches the source. Mutually exclusive with `source` in the same request.

  The ring rules stated on `GeoJSONPolygon` are enforced here. A ring whose ends differ, a ring of fewer than four positions, a polygon carrying no ring, and a position outside the angle ranges the feature's `geometry` states are each a `400` naming the ring or position at fault, and so is an area of more than 10,000 positions in total, naming `geojson`. An outline one meridian or one parallel crosses more than 512 times, every ring counted, is too intricate to be stored, and one that is not a valid polygon, in degrees as sent or once projected to Web Mercator, as a map draws it (a ring that crosses itself or another ring, a ring that touches itself, or a hole outside its shell), is refused too: each is a `400` naming `geojson.geometry`, without saying where.
  - `type` (string, required, one of: `Feature`): Discriminator for the GeoJSON object type. Always `Feature`.
  - `id` (string (uuid), optional): The zone's id. On a read it is always present and equals the zone's own `id`. On a create it is optional: a UUID sent here becomes the zone's id, and the server mints one when it is omitted. A UUID another zone already has is a `409`. On an update it is ignored.
  - `geometry` (object, required): The zone's area. Positions are `[longitude, latitude]`; an optional third value is accepted and not kept, because a zone is a region on the ground.

    Latitude runs from -90 to 90. Longitude runs from -360 to 360, a turn wider than a point's, so that a ring crossing the antimeridian stays one ring: its longitudes are counted on past 180, or below -180, and no two neighbours stand on opposite edges of the map. `[179.5, -17]` followed by `[180.4, -17]` is nine tenths of a degree of ring. Written `[179.5, -17]` then `[-179.6, -17]`, the same two places are joined the other way round the world. The area is stored and returned with the longitudes it was written with.
    - `type` (string, required, one of: `Polygon`): Discriminator for the geometry type. Always `Polygon` for this schema.
    - `coordinates` (array of array of array of number (double), required): One coordinate array per ring, exterior ring first and any others holes. At least one ring, and each ring is CLOSED: it carries at least four positions and its last repeats its first. The closure is the part JSON Schema cannot state, so it is stated here; a ring whose ends differ is rejected on write, as is a polygon carrying no ring at all. No position carries fewer than two values or more than three. There is no declared ceiling on rings or on positions per ring, deliberately: a ring is not a tuple and no useful ceiling exists for one.
  - `properties` (object, required): Free-form properties. They are accepted and not kept, since a zone's own fields carry what it says about itself, so a read returns an empty object. At most 64 fields and 16 KiB as sent.

- `is_private` (boolean, in body, optional): Whether the zone is private. A private zone is reached only with the key of the organization that owns it, so a private personal zone, owned by no organization, is reached by no key. A public zone is readable by id, read-only, by any publishable key, as last published, and it is listed only in its own organization's listings. A collection's share token reaches the zones that collection holds whatever this says. Public never grants editing, which takes a write role in the owning organization. Privacy is read from the draft, so a change takes effect at once rather than at the next publish. Omit to keep the current value.

- `level` (string, in body, optional, one of: `info`, `resolved`, `warning`, `danger`): How serious the zone is, which is what a renderer picks its styling from. It carries no access meaning: a zone is visible or not by `is_private` and its publication, never by its level. Optional and not nullable: omit it to keep the current level.

- `mode` (string, in body, optional, one of: `polygon`, `circle`, `sensor`, `sector`, `freehand`): How the area sent beside it was drawn or computed, which a client reopens the zone in. Optional and not nullable: omit it to keep the current mode. It describes an area, so it is sent with one: beside `geojson` any mode is taken, beside a `source` only `polygon` is, and a `mode` sent with neither, or another mode beside a `source`, is a `400` naming `mode`. A zone reshaped into a shape of another kind is sent the new kind's mode with its `geojson`.

- `name` (string, in body, optional): Display name of the zone, at most 30 characters as sent, and at least 2 once leading and trailing whitespace is trimmed. Optional and not nullable: omit it to keep the current name. Refused with a `409` when another zone in the organization already carries it; names are compared exactly after trimming, case included, so `Alps` and `alps` are two different names. Sending its current name again is not a conflict. A name is one line: a tab, a line break or a line separator between two of its characters is a `400`, and one at either end is trimmed with the whitespace there.

- `source` (ZoneSource | null, in body, optional): Provenance inputs for a computed zone. When provided, the zone's polygon is recomputed from these inputs and replaces the geometry, which is how a computed zone is refreshed. Only a zone whose `mode`, sent or kept, is `polygon` takes one: on any other mode it is a `400` naming `source`. Omit it to keep the current source; `null` detaches it and keeps the current area as it stands. Mutually exclusive with `geojson` in the same request.
  - `kind` (string, required, one of: `isochrones`): The generative engine that produced the zone. `isochrones` computes a reachability polygon for an activity from a single origin point.
  - `activity` (string, required, one of: `hiking-and-trail`, `professional-trail`, `running`, `road-cycling`, `gravel-bike`, `mountain-bike`, `backcountry-skiing`, `ski-touring`, `cross-country-skiing`, `snowshoe-walking`): The outdoor activity whose routing profile the reachability polygon is computed for (e.g. `hiking-and-trail`, `road-cycling`).
  - `location` (array of number (double), required): Origin point the isochrone is measured from, as a `[longitude, latitude]` WGS84 coordinate pair. Longitude is bounded to -180..180 and latitude to -90..90, the same bounds every other coordinate in this contract carries. The declared bounds are the wider of the two, since one `items` schema covers both positions; the per-axis rule above is the one enforced.
  - `range_type` (string, required, one of: `time`, `distance`): Whether `range` is measured as travel time (seconds) or travel distance (meters).
  - `range` (number (double), required): This zone's band value: seconds when `range_type` is `time`, meters when `range_type` is `distance`. This single band drives the zone's polygon. At least 1, and at most 7,200 seconds for a `time` band and 25,000 meters for a `distance` band, the ceilings the Data API's `isochrones` holds a range to, since a sourced zone's polygon is the isochrone of its source; anything else is a `400` naming `range`.
  - `speed` (number (double), optional): Travel speed in km/h, overriding the activity's default pace. Accepted only when `range_type` is `time`, and a 400 beside `distance`: the reachable area at a given travel time is the one the stated pace covers, so a slower walker reaches less ground in the same hour. Omit to let the activity's own pace resolve at compute time, which is what a zone created without a stated pace stores. Between 0.5 and 100 km/h.
  - `ranges` (array of number (double), optional): The full set of band values this zone was created alongside, when it is one of several coverage bands. Informational: only `range` drives this zone's polygon, but `range` must be one of these values when present. A zone authored one band at a time carries no set and omits this. At most six bands, the ceiling a coverage computation is allowed to request; a longer set is refused with a validation error.

    The ceiling is stated here rather than declared as `maxItems`, deliberately. The TypeScript generator expands a `maxItems` of 7 or lower that has no `minItems` beside it into a union of tuples of every length up to it, so declaring this one would hand every consumer `[] | [number] | [number, number] | ...` in place of `number[]`, and no ordinary array operation would type-check against it. A ceiling of 8 or more generates a plain array and is declared, which is why a waypoint's `properties` carries `maxItems: 20` and this carries none.
  - `context` (object, optional): Free-form provenance context, such as the matrix ranking that justified a coverage zone. Stored and echoed back verbatim; never interpreted by the API. At most 32 top-level fields and 4 KiB once serialized, since it is stored and echoed on every read of the zone.

- `start_at` (string (date-time) | null, in body, optional): Start of the temporal validity window. Omit to keep the current value; `null` makes the zone active immediately.

**Response** `200`

The zone after the change, with its new `revision` and `etag`.

- `extensions` (object): Top-level extensions map for 2xx responses. Mirrors the GraphQL-spec response extensions: a free-form map for response-scoped metadata.
  - `metadata` (object): Response-scoped metadata. Its shape is per-operation: the operation that emits it names the schema, and an operation that documents none never emits this field.

- `data` (Zone, required): A geographic annotation drawn on the map, such as a hazard zone, an information marker, or a custom area.

  See [the Zone object](https://docs.mountaya.com/en/apis/map-studio/reference/zones.md#zone-object).

Response headers:

- `ETag`: The version of the resource this answer returns, an opaque strong tag in double quotes, equal to that resource's `etag` field. Send it back as `If-Match` to make a write conditional on nobody having changed the resource since. It changes whenever what this read returns changes; compare it whole and never parse it. Present on every answer that returns the resource, and on the `412` that refuses a stale `If-Match`.
- `Idempotent-Replayed`: `true` when this answer is the stored answer to an earlier request carrying the same `Idempotency-Key`, replayed rather than run again. Absent on an answer that ran.

**Errors** `400`, `401`, `402`, `403`, `404`, `409`, `412`, `413`, `429`, `500`, `503`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: The request was malformed, or a field failed validation: each entry names what, a field-level one at its `path`. The same `Idempotency-Key` sent with another request is refused here too, at `["request", "headers", "Idempotency-Key"]`. A refusal the write itself made is stored for its key, so a repeat of the key is refused again in the same words, marked `Idempotent-Replayed: true`.
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Embedded Studio, the product the `studio-embedded` scope belongs to and the one a publishable key needs to act as a member. It is agreed rather than bought, so it clears when the organization's agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. The reads that take `publishing` are unaffected. It is also a plain `PAYMENT_REQUIRED` when the organization the zone belongs to does not hold Map Studio, which every change to an organization's itineraries, collections and zones needs. Map Studio is granted by the organization's agreement, so this too clears when the agreement changes rather than when the request does.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `studio-embedded` scope, or the user the session token names is not a member of the key's organization, or holds a role there that reads only, or the zone is one this credential can read and not edit, such as another organization's public zone while its publication is served, or the zone is personal, owned by no organization, which is never edited. A user outside the organization and a member without the role answer alike. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `404`: No zone with that identifier is reachable: either none exists, or this credential cannot view it. The two answer alike, so this status cannot be used to learn which zone ids exist. So does a zone that has never been published, or has been taken down, or whose organization's agreement does not include Map Publishing, when this credential reads it as published rather than as its draft: a write answers it as a read does.
- `409`: Conflict, from either of two causes. Both carry `extensions.code` `CONFLICT`, so what tells them apart is which member of `extensions.metadata` is present. Nothing is written either way. `zone`: another zone in the organization already carries the requested name. Re-sending the zone's current name is never a conflict. `extensions.metadata.zone.id` is the zone holding the name: send a different name. `holder`: another member of the zone's collaboration session holds the soft edit lock on the zone. The holder is at `extensions.metadata.holder.id`: wait for the lock to be released, or to lapse, and send the update again. A body this operation refuses is answered with its `400` before any lock is looked at, so a peer's lock is reported only for a request that is otherwise well formed. A request carrying the same `Idempotency-Key` as one still running is refused here too: its entry is coded `IDEMPOTENCY_KEY_IN_USE`, names no resource at `extensions.metadata`, and it carries `Retry-After`, after which the same request is answered with the first one's outcome. A request repeating the key of one whose answer cannot be replayed is refused here as well, its entry coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`: the answer was too large to keep whole, or the request failed with a `5xx` after its write was made. Either way that write was made, and `extensions.metadata` is the `ResponseMetadataIdempotentAnswer` naming how it was answered, so read the resource again rather than sending the write once more.
- `412`: `PreconditionFailed`, given in full at the end of this page.
- `413`: Payload Too Large
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `503`: The check of the outline sent could not finish in time on Mountaya's side, under load: the outline was neither accepted nor refused, and nothing was written. Send the write again once `Retry-After` has passed. An outline the rules admit is checked in well under a second.
- `504`: Gateway Timeout

**cURL**

```bash
# PATCH merges: an omitted field is left alone, and an explicit null clears the ones
# that are nullable.
curl -s -X PATCH https://api.mountaya.com/v1/zones/c40f8a25-7e63-4d19-b8a0-9f2e5c31d764 \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Rockfall closure below the Col du Tricot, extended.",
    "level": "danger",
    "start_at": "2026-07-01T00:00:00Z",
    "end_at": "2026-09-30T23:59:59Z"
  }'
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});

const { data } = await mountaya.studio.zones.patchZone({
  zone_id: "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
  body: {
    description: "Rockfall closure below the Col du Tricot, extended.",
    level: "danger",
    start_at: new Date("2026-07-01T00:00:00Z"),
    end_at: new Date("2026-09-30T23:59:59Z"),
  },
});

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.patch(
    "https://api.mountaya.com/v1/zones/c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "description": "Rockfall closure below the Col du Tricot, extended.",
        "level": "danger",
        "start_at": "2026-07-01T00:00:00Z",
        "end_at": "2026-09-30T23:59:59Z",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
    "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "name": "Tricot trailhead, one hour",
    "description": "Terrain reachable on foot within an hour of the Col du Tricot trailhead.",
    "level": "info",
    "mode": "polygon",
    "is_private": false,
    "status": "published",
    "published_at": "2026-06-28T16:05:00Z",
    "has_unpublished_changes": false,
    "start_at": "2026-07-01T00:00:00Z",
    "end_at": "2026-08-31T23:59:59Z",
    "source": {
      "kind": "isochrones",
      "activity": "hiking-and-trail",
      "location": [
        6.7845,
        45.8612
      ],
      "range_type": "time",
      "range": 3600
    },
    "geojson": {
      "type": "Feature",
      "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              6.7845,
              45.8612
            ],
            [
              6.7961,
              45.8612
            ],
            [
              6.7961,
              45.8698
            ],
            [
              6.7845,
              45.8698
            ],
            [
              6.7845,
              45.8612
            ]
          ]
        ]
      }
    },
    "revision": 4,
    "etag": "\"d4\"",
    "created_by": {
      "id": "7a3e5d18-4c60-49b2-8f75-e2d1c9a4b607"
    },
    "created_at": "2026-05-12T09:14:00Z",
    "updated_at": "2026-06-28T16:02:00Z"
  }
}
```

## Delete a zone

### DELETE /v1/zones/{zone_id}

- Operation: `deleteZone`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member) · an `Idempotency-Key` header, the same on every retry
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Permanently deletes the zone and removes it from every collection that held it. This action cannot be undone.

Send the zone's `etag` as `If-Match` to make the delete conditional: a zone changed since that read is a `412`, and nothing is deleted.

Requires a publishable key with the `studio-embedded` scope AND a session token minted for `studio-embedded` naming a user, a member with a write role, whom the request acts as. A publishable key without a session token minted for `studio-embedded` naming a user, a token minted for another surface included, is refused with **401**.

**Webhook events** [`zone.deleted`](https://docs.mountaya.com/en/webhooks/events/zone.md#zone-deleted), [`collection.zone.removed`](https://docs.mountaya.com/en/webhooks/events/collection-zone.md#collection-zone-removed), recorded by the task `zone.delete`.

**Path parameters**

- `zone_id` (string (uuid), in path, required): Identifier of the zone the operation acts on.

**Headers**

- `Idempotency-Key` (string, in header, optional): A value the caller chooses once per logical write and sends again, unchanged, on every retry of it, so a write whose answer was lost runs at most once. A UUID is the usual choice; any 1 to 255 printable ASCII characters without a space are accepted. The key is held for 12 hours, for the credential that sent it (the publishable key and the user its session token names) and for this operation.

  The first request runs. A request repeating the key with the same method, path, query and body, sent as the same media type, is answered with the first one's stored status and body, its `Location` and `ETag` included, and carries `Idempotent-Replayed: true`; nothing runs a second time and no limit is charged again. `Content-Type` is compared as the media type it names, with its `charset`, rather than as the header was written, so the letter case of the type and the spacing around its parameters do not make two requests different. `If-Match` is not compared: a key sent again after a `412`, with a fresh tag, is answered with that same `412`, so a write retried with a new tag takes a new key. Every answer below `500` other than a `429` is stored that way, a refusal included, so a retried request that was refused is refused again in the same words. A request refused before the write is reached stores nothing, and a retry with the same key runs again: every `401`, and every `413` refusing a body over the operation's ceiling. The `413` that `postItineraryPreview` answers for the source it has read, a file or a track too large, is stored as any other refusal is.

  A `5xx` answered before anything was written stores nothing and releases the key: a retry with the same key runs again. A `5xx` answered after the write was made keeps the key, and a request repeating it is a `409` whose entry is coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`, as is a request repeating the key of an answer too large to store whole. Either way the write was made: the `409` carries no `Location`, and its `extensions.metadata` (`ResponseMetadataIdempotentAnswer`) names the `status` the first request was answered with and, where that answer carried them, its `location` and `etag`. Read the resource again rather than sending the write once more, which is answered the same way.

  The same key with a different request is a `400` at `["request", "headers", "Idempotency-Key"]`, and nothing runs, whether the first request is still running or was answered. The same request while its first one is still running is a `409` whose entry is coded `IDEMPOTENCY_KEY_IN_USE`, carrying `Retry-After`: send it again once that has passed. Without the header a write runs every time it is sent, which is harmless on the writes `x-idempotent` marks safe to repeat and creates a second resource on the others. A stream's answer is never stored.

  Keys are kept on a best-effort basis. While Mountaya cannot read or record them, a write runs as if it carried no key, so a retry sent in that moment can run it a second time.

- `If-Match` (string, in header, optional): Makes the write conditional on the resource still being the version the caller read: the `ETag` an earlier answer carried, which is also that resource's `etag` field, or `*` for any version. When the resource has changed since, the write is refused with `412` `PRECONDITION_FAILED`, nothing is changed, and the answer carries the current `ETag`, so the caller reads the resource again and decides. Omitted, the write is unconditional and the last write wins.

  One strong tag in double quotes, or `*`. A list of tags, a weak tag (`W/`) or any other spelling is a `400` naming the header. A resource the caller cannot see is answered `404` before the condition is asked, so a stale tag never tells a caller anything a read would not.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Response** `200`

The zone is deleted and removed from every collection holding it. `data` is null.

- `extensions` (object): Top-level extensions map for 2xx responses. Mirrors the GraphQL-spec response extensions: a free-form map for response-scoped metadata.
  - `metadata` (object): Response-scoped metadata. Its shape is per-operation: the operation that emits it names the schema, and an operation that documents none never emits this field.

- `data` (any | null, required): Always null: this operation answers with no payload.

Response headers:

- `Idempotent-Replayed`: `true` when this answer is the stored answer to an earlier request carrying the same `Idempotency-Key`, replayed rather than run again. Absent on an answer that ran.

**Errors** `400`, `401`, `402`, `403`, `404`, `409`, `412`, `429`, `500`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: The request was malformed, or a field failed validation: each entry names what, a field-level one at its `path`. The same `Idempotency-Key` sent with another request is refused here too, at `["request", "headers", "Idempotency-Key"]`. A refusal the write itself made is stored for its key, so a repeat of the key is refused again in the same words, marked `Idempotent-Replayed: true`.
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Embedded Studio, the product the `studio-embedded` scope belongs to and the one a publishable key needs to act as a member. It is agreed rather than bought, so it clears when the organization's agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. The reads that take `publishing` are unaffected. It asks for Embedded Studio alone and never for Map Studio: an act that takes something down is never refused for Map Studio, so an organization whose agreement does not include it still takes down what it has.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `studio-embedded` scope, or the user the session token names is not a member of the key's organization, or holds a role there that reads only, or the zone is one this credential can read and not edit, such as another organization's public zone while its publication is served. A user outside the organization and a member without the role answer alike. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `404`: No zone with that identifier is reachable: either none exists, or this credential cannot view it. The two answer alike, so this status cannot be used to learn which zone ids exist. So does a zone that has never been published, or has been taken down, or whose organization's agreement does not include Map Publishing, when this credential reads it as published rather than as its draft: a write answers it as a read does. A second delete of the same zone answers here too: send a retried delete with the same `Idempotency-Key` and it is answered with the first one's 200.
- `409`: `IdempotencyKeyInUse`, given in full at the end of this page.
- `412`: `PreconditionFailed`, given in full at the end of this page.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# Deleting a zone removes it from every collection that held it.
curl -s -X DELETE https://api.mountaya.com/v1/zones/c40f8a25-7e63-4d19-b8a0-9f2e5c31d764 \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token"
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});

const { data } = await mountaya.studio.zones.deleteZone({ zone_id: "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764" });

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.delete(
    "https://api.mountaya.com/v1/zones/c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": null
}
```

## Publish the zone's current draft

### POST /v1/zones/{zone_id}/publication

- Operation: `postZonePublication`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member) · an `Idempotency-Key` header, the same on every retry
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Sets the zone's publication to its current draft: the draft's name, description, level, mode, area, validity window and source are frozen into a publication and become what the public surfaces serve. Until the first publish, the public surfaces resolve nothing for the zone: a read of it as published answers `404`, and the tiles drawn from published content, Mountaya's hosted embed among them, do not draw it. After it, they serve that snapshot and are unaffected by any further draft edit until the zone is published again. The studio always reads and writes the draft, whatever is published.

The publication is a state the zone is set to, so the request is safe to repeat: sent again with nothing changed in between, it leaves what readers are served as it is and returns the zone. Sent after the draft has been edited, it publishes the edits.

Publishing copies content rather than referencing it, so the published version can never be altered by a later draft edit. Each publish creates the next publication and the live one is never rewritten in place.

One publication is retained: the most recent. Publishing again supersedes the previous one and its content is discarded, so there is no version history to read back. The publication NUMBER is never reissued; it only ever climbs, which is what lets a client tell one publication's cached tiles apart from another's.

Publication is what every published output of a zone hangs off: every read, listing and tile made without a session of the owning organization naming a member, a collection's share link among them, and Mountaya's hosted embed, which draws a collection's published public zones, all read the live publication this sets. Only that organization's key with a session token naming a member reads the draft instead, unless it passes `surface=published`; a token minted without `user_id` reads as the key alone does. A zone has no share link of its own. Publishing charges nothing and raises no invoice: how many zones an organization may have published at once is set by its agreement with Mountaya.

Refused with 402 for one of three reasons. The first is the one every `studio-embedded` operation shares: the organization does not hold Embedded Studio. The second is the one every change to an organization's zones shares: the organization does not hold Map Studio. The third is publishing's own: the organization does not hold Map Publishing, the product every published output of a zone belongs to. All three are a plain `PAYMENT_REQUIRED`. Taking a zone down is never refused for the last two, so the one 402 `deleteZonePublication` declares is the first. A personal zone, owned by no organization, is never published, and is refused with a `403`.

Refused with a `429` coded `LIMIT_REACHED` for the organization's limit: it already has as many zones published as its agreement allows, which is none until the agreement names a number, and a higher one is agreed rather than bought. The entry carries a `path`, `["request", "params", "zone_id"]`, naming the zone that could not take a place, and `extensions.metadata` names the ceiling, `published-zones`, with how many it allows and how many are published, so a client says what is full without a second read. It carries no `Retry-After`, since no wait lifts it: it clears by unpublishing something or by agreeing a higher limit. It refuses a FIRST publish only: republishing a zone that is already live is never refused by it. It holds for publishes sent at the same moment too: two requests cannot both take the last place. Taking a zone down is never refused by it.

Refused with 409 when the zone is locked in the collaboration session, including by the user the session token names: a held lock means an in-flight edit that has not been committed, and publishing it would freeze a half-finished state. When more than one refusal applies, the missing Embedded Studio product is answered first (`402`), then the missing Map Studio product (`402`), then the missing Map Publishing product (`402`), then the held lock (`409`), then the published-zone limit (`429`), and last a stale `If-Match` (`412`), so a stale tag is answered only for a publish that would otherwise go through.

Publishing changes what a read of the zone returns, so it moves the zone's `etag`. Send the zone's `ETag` as `If-Match` to publish only the version you read; a stale tag is refused with `412` and nothing is published.

Takes no request body. Returns the zone's draft, with the derived status, published_at, and has_unpublished_changes fields reflecting the new publication.

Requires a publishable key with the `studio-embedded` scope AND a session token minted for `studio-embedded` naming a user, a member with a write role, whom the request acts as. A publishable key without a session token minted for `studio-embedded` naming a user, a token minted for another surface included, is refused with **401**.

**Webhook events** [`zone.published`](https://docs.mountaya.com/en/webhooks/events/zone.md#zone-published), recorded by the task `zone.publish`.

**Path parameters**

- `zone_id` (string (uuid), in path, required): Identifier of the zone the operation acts on.

**Headers**

- `Idempotency-Key` (string, in header, optional): A value the caller chooses once per logical write and sends again, unchanged, on every retry of it, so a write whose answer was lost runs at most once. A UUID is the usual choice; any 1 to 255 printable ASCII characters without a space are accepted. The key is held for 12 hours, for the credential that sent it (the publishable key and the user its session token names) and for this operation.

  The first request runs. A request repeating the key with the same method, path, query and body, sent as the same media type, is answered with the first one's stored status and body, its `Location` and `ETag` included, and carries `Idempotent-Replayed: true`; nothing runs a second time and no limit is charged again. `Content-Type` is compared as the media type it names, with its `charset`, rather than as the header was written, so the letter case of the type and the spacing around its parameters do not make two requests different. `If-Match` is not compared: a key sent again after a `412`, with a fresh tag, is answered with that same `412`, so a write retried with a new tag takes a new key. Every answer below `500` other than a `429` is stored that way, a refusal included, so a retried request that was refused is refused again in the same words. A request refused before the write is reached stores nothing, and a retry with the same key runs again: every `401`, and every `413` refusing a body over the operation's ceiling. The `413` that `postItineraryPreview` answers for the source it has read, a file or a track too large, is stored as any other refusal is.

  A `5xx` answered before anything was written stores nothing and releases the key: a retry with the same key runs again. A `5xx` answered after the write was made keeps the key, and a request repeating it is a `409` whose entry is coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`, as is a request repeating the key of an answer too large to store whole. Either way the write was made: the `409` carries no `Location`, and its `extensions.metadata` (`ResponseMetadataIdempotentAnswer`) names the `status` the first request was answered with and, where that answer carried them, its `location` and `etag`. Read the resource again rather than sending the write once more, which is answered the same way.

  The same key with a different request is a `400` at `["request", "headers", "Idempotency-Key"]`, and nothing runs, whether the first request is still running or was answered. The same request while its first one is still running is a `409` whose entry is coded `IDEMPOTENCY_KEY_IN_USE`, carrying `Retry-After`: send it again once that has passed. Without the header a write runs every time it is sent, which is harmless on the writes `x-idempotent` marks safe to repeat and creates a second resource on the others. A stream's answer is never stored.

  Keys are kept on a best-effort basis. While Mountaya cannot read or record them, a write runs as if it carried no key, so a retry sent in that moment can run it a second time.

- `If-Match` (string, in header, optional): Makes the write conditional on the resource still being the version the caller read: the `ETag` an earlier answer carried, which is also that resource's `etag` field, or `*` for any version. When the resource has changed since, the write is refused with `412` `PRECONDITION_FAILED`, nothing is changed, and the answer carries the current `ETag`, so the caller reads the resource again and decides. Omitted, the write is unconditional and the last write wins.

  One strong tag in double quotes, or `*`. A list of tags, a weak tag (`W/`) or any other spelling is a `400` naming the header. A resource the caller cannot see is answered `404` before the condition is asked, so a stale tag never tells a caller anything a read would not.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Response** `200`

The zone as published, with `status` published and `published_at` set, and its new `ETag`.

- `extensions` (object): Top-level extensions map for 2xx responses. Mirrors the GraphQL-spec response extensions: a free-form map for response-scoped metadata.
  - `metadata` (object): Response-scoped metadata. Its shape is per-operation: the operation that emits it names the schema, and an operation that documents none never emits this field.

- `data` (Zone, required): A geographic annotation drawn on the map, such as a hazard zone, an information marker, or a custom area.

  See [the Zone object](https://docs.mountaya.com/en/apis/map-studio/reference/zones.md#zone-object).

Response headers:

- `ETag`: The version of the resource this answer returns, an opaque strong tag in double quotes, equal to that resource's `etag` field. Send it back as `If-Match` to make a write conditional on nobody having changed the resource since. It changes whenever what this read returns changes; compare it whole and never parse it. Present on every answer that returns the resource, and on the `412` that refuses a stale `If-Match`.
- `Idempotent-Replayed`: `true` when this answer is the stored answer to an earlier request carrying the same `Idempotency-Key`, replayed rather than run again. Absent on an answer that ran.

**Errors** `400`, `401`, `402`, `403`, `404`, `409`, `412`, `429`, `500`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: The request was malformed, or a field failed validation: each entry names what, a field-level one at its `path`. The same `Idempotency-Key` sent with another request is refused here too, at `["request", "headers", "Idempotency-Key"]`. A refusal the write itself made is stored for its key, so a repeat of the key is refused again in the same words, marked `Idempotent-Replayed: true`.
- `401`: Unauthorized
- `402`: A `402`, for one of three reasons. The first is the one every `studio-embedded` operation shares: the organization does not hold Embedded Studio, the product the scope belongs to, checked before the key's scopes and before every refusal below. The second is the one every change to an organization's zones shares: the organization does not hold Map Studio. The third is publishing's own: the organization does not hold Map Publishing, the product every published output of a zone belongs to, its published reads and tiles and Mountaya's hosted embed. All three are plain, with no per-entry refinement and no `extensions`, and each clears when the organization's agreement includes the product. Taking a zone down is never refused for the last two, so the one 402 `deleteZonePublication` declares is the first. The organization's published-zones limit is not a `402`: it is the `429` coded `LIMIT_REACHED`.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `studio-embedded` scope, or the user the session token names is not a member of the key's organization, or holds a role there that reads only, or the zone is one this credential can read and not edit, such as another organization's public zone while its publication is served, or the zone is personal, owned by no organization, which is never published. A user outside the organization and a member without the role answer alike. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `404`: No zone with that identifier is reachable: either none exists, or this credential cannot view it. The two answer alike, so this status cannot be used to learn which zone ids exist. So does a zone that has never been published, or has been taken down, or whose organization's agreement does not include Map Publishing, when this credential reads it as published rather than as its draft: a write answers it as a read does.
- `409`: Conflict, from either of two causes. Both carry `extensions.code` `CONFLICT`, so what tells them apart is `extensions.metadata`. Present, carrying a holder: the zone is locked in the collaboration session, so an uncommitted edit is in flight. The holder is at `extensions.metadata.holder.id`. Absent: another writer reached the zone first, either publishing it concurrently or committing a draft edit that aborted this publication. Nothing is published; retry against what the zone holds at that point. Nothing holds a lock, so there is no holder to name and `extensions` is not required. A request carrying the same `Idempotency-Key` as one still running is refused here too: its entry is coded `IDEMPOTENCY_KEY_IN_USE` and it carries `Retry-After`, after which the same request is answered with the first one's outcome. A request repeating the key of one whose answer cannot be replayed is refused here as well, its entry coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`: the answer was too large to keep whole, or the request failed with a `5xx` after its write was made. Either way that write was made, and `extensions.metadata` is the `ResponseMetadataIdempotentAnswer` naming how it was answered, so read the resource again rather than sending the write once more.
- `412`: `PreconditionFailed`, given in full at the end of this page.
- `429`: `TooManyRequestsOrLimitReached`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# No body. The answer is the zone with published_at and
# has_unpublished_changes reflecting the new publication.
curl -s -X POST https://api.mountaya.com/v1/zones/c40f8a25-7e63-4d19-b8a0-9f2e5c31d764/publication \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Idempotency-Key: $(uuidgen)" | jq '.data.published_at'
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});

const { data } = await mountaya.studio.zones.postZonePublication({ zone_id: "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764" });

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.post(
    "https://api.mountaya.com/v1/zones/c40f8a25-7e63-4d19-b8a0-9f2e5c31d764/publication",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
    "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "name": "Tricot trailhead, one hour",
    "description": "Terrain reachable on foot within an hour of the Col du Tricot trailhead.",
    "level": "info",
    "mode": "polygon",
    "is_private": false,
    "status": "published",
    "published_at": "2026-06-28T16:05:00Z",
    "has_unpublished_changes": false,
    "start_at": "2026-07-01T00:00:00Z",
    "end_at": "2026-08-31T23:59:59Z",
    "source": {
      "kind": "isochrones",
      "activity": "hiking-and-trail",
      "location": [
        6.7845,
        45.8612
      ],
      "range_type": "time",
      "range": 3600
    },
    "geojson": {
      "type": "Feature",
      "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              6.7845,
              45.8612
            ],
            [
              6.7961,
              45.8612
            ],
            [
              6.7961,
              45.8698
            ],
            [
              6.7845,
              45.8698
            ],
            [
              6.7845,
              45.8612
            ]
          ]
        ]
      }
    },
    "revision": 4,
    "etag": "\"d4\"",
    "created_by": {
      "id": "7a3e5d18-4c60-49b2-8f75-e2d1c9a4b607"
    },
    "created_at": "2026-05-12T09:14:00Z",
    "updated_at": "2026-06-28T16:02:00Z"
  }
}
```

## Take the zone's publication down

### DELETE /v1/zones/{zone_id}/publication

- Operation: `deleteZonePublication`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member) · an `Idempotency-Key` header, the same on every retry
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Takes the zone off the public surfaces. Mountaya stops serving it from the next request: a read of it as published answers `404`, the tiles drawn from published content, Mountaya's hosted embed among them, stop drawing it, and Mountaya's own caches stop serving its published tiles: they are not evicted, but nothing reaches them and they age out. An answer a shared cache between a reader and Mountaya already holds is served from there until its lifetime runs out, which taking the zone down does not shorten: at most 6 minutes for a published read of the zone (`max-age=300` and `stale-while-revalidate=60`), and 5 for a public tile of it (`max-age=300`).

It acts on a state, so a zone that is not published is answered `200` as well, whether it never was or is already taken down: the request leaves it unpublished either way, and a repeated request is harmless.

The publication is kept, not deleted. Publishing again therefore creates the NEXT publication rather than reusing the number that was live: a publication number is never reissued, so a client that cached one can always tell the two apart. What unpublishing clears is whether a publication is live, not the publication itself.

The draft is untouched. The studio reads and writes the draft whatever is published, so unpublishing changes nothing a member sees in the editor; it changes what everyone else sees, which is nothing.

Unlike publishing, this is never refused for a held collaboration lock. Publishing freezes a state and so cannot run over an in-flight edit; unpublishing freezes nothing.

Unpublishing frees the zone's place under the organization's published-zones limit at once. It is never refused for Map Studio, for Map Publishing or for that limit, so an organization whose agreement includes neither can still take its zones down, and the one 402 it declares is the one every `studio-embedded` operation shares.

Taking the publication down changes what a read of the zone returns, so it moves the zone's `etag`. Send the zone's `ETag` as `If-Match` to make it conditional on nobody having changed the zone since you read it; a stale tag is refused with `412`.

Takes no request body. Returns the zone's draft, with `status` back to draft and `published_at` null.

Requires a publishable key with the `studio-embedded` scope AND a session token minted for `studio-embedded` naming a user, a member with a write role, whom the request acts as. A publishable key without a session token minted for `studio-embedded` naming a user, a token minted for another surface included, is refused with **401**.

**Webhook events** [`zone.unpublished`](https://docs.mountaya.com/en/webhooks/events/zone.md#zone-unpublished), recorded by the task `zone.unpublish`.

**Path parameters**

- `zone_id` (string (uuid), in path, required): Identifier of the zone the operation acts on.

**Headers**

- `Idempotency-Key` (string, in header, optional): A value the caller chooses once per logical write and sends again, unchanged, on every retry of it, so a write whose answer was lost runs at most once. A UUID is the usual choice; any 1 to 255 printable ASCII characters without a space are accepted. The key is held for 12 hours, for the credential that sent it (the publishable key and the user its session token names) and for this operation.

  The first request runs. A request repeating the key with the same method, path, query and body, sent as the same media type, is answered with the first one's stored status and body, its `Location` and `ETag` included, and carries `Idempotent-Replayed: true`; nothing runs a second time and no limit is charged again. `Content-Type` is compared as the media type it names, with its `charset`, rather than as the header was written, so the letter case of the type and the spacing around its parameters do not make two requests different. `If-Match` is not compared: a key sent again after a `412`, with a fresh tag, is answered with that same `412`, so a write retried with a new tag takes a new key. Every answer below `500` other than a `429` is stored that way, a refusal included, so a retried request that was refused is refused again in the same words. A request refused before the write is reached stores nothing, and a retry with the same key runs again: every `401`, and every `413` refusing a body over the operation's ceiling. The `413` that `postItineraryPreview` answers for the source it has read, a file or a track too large, is stored as any other refusal is.

  A `5xx` answered before anything was written stores nothing and releases the key: a retry with the same key runs again. A `5xx` answered after the write was made keeps the key, and a request repeating it is a `409` whose entry is coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`, as is a request repeating the key of an answer too large to store whole. Either way the write was made: the `409` carries no `Location`, and its `extensions.metadata` (`ResponseMetadataIdempotentAnswer`) names the `status` the first request was answered with and, where that answer carried them, its `location` and `etag`. Read the resource again rather than sending the write once more, which is answered the same way.

  The same key with a different request is a `400` at `["request", "headers", "Idempotency-Key"]`, and nothing runs, whether the first request is still running or was answered. The same request while its first one is still running is a `409` whose entry is coded `IDEMPOTENCY_KEY_IN_USE`, carrying `Retry-After`: send it again once that has passed. Without the header a write runs every time it is sent, which is harmless on the writes `x-idempotent` marks safe to repeat and creates a second resource on the others. A stream's answer is never stored.

  Keys are kept on a best-effort basis. While Mountaya cannot read or record them, a write runs as if it carried no key, so a retry sent in that moment can run it a second time.

- `If-Match` (string, in header, optional): Makes the write conditional on the resource still being the version the caller read: the `ETag` an earlier answer carried, which is also that resource's `etag` field, or `*` for any version. When the resource has changed since, the write is refused with `412` `PRECONDITION_FAILED`, nothing is changed, and the answer carries the current `ETag`, so the caller reads the resource again and decides. Omitted, the write is unconditional and the last write wins.

  One strong tag in double quotes, or `*`. A list of tags, a weak tag (`W/`) or any other spelling is a `400` naming the header. A resource the caller cannot see is answered `404` before the condition is asked, so a stale tag never tells a caller anything a read would not.

Also takes `Accept-Language`, as every operation of this API does: the [overview](https://docs.mountaya.com/en/apis/map-studio/reference.md) describes it.

**Response** `200`

The zone unpublished, with `status` draft and `published_at` null, and its `ETag`. A zone that was not published is answered the same way.

- `extensions` (object): Top-level extensions map for 2xx responses. Mirrors the GraphQL-spec response extensions: a free-form map for response-scoped metadata.
  - `metadata` (object): Response-scoped metadata. Its shape is per-operation: the operation that emits it names the schema, and an operation that documents none never emits this field.

- `data` (Zone, required): A geographic annotation drawn on the map, such as a hazard zone, an information marker, or a custom area.

  See [the Zone object](https://docs.mountaya.com/en/apis/map-studio/reference/zones.md#zone-object).

Response headers:

- `ETag`: The version of the resource this answer returns, an opaque strong tag in double quotes, equal to that resource's `etag` field. Send it back as `If-Match` to make a write conditional on nobody having changed the resource since. It changes whenever what this read returns changes; compare it whole and never parse it. Present on every answer that returns the resource, and on the `412` that refuses a stale `If-Match`.
- `Idempotent-Replayed`: `true` when this answer is the stored answer to an earlier request carrying the same `Idempotency-Key`, replayed rather than run again. Absent on an answer that ran.

**Errors** `400`, `401`, `402`, `403`, `404`, `409`, `412`, `429`, `500`, `504`. See [Errors](https://docs.mountaya.com/en/apis/conventions/errors.md).

- `400`: The request was malformed, or a field failed validation: each entry names what, a field-level one at its `path`. The same `Idempotency-Key` sent with another request is refused here too, at `["request", "headers", "Idempotency-Key"]`. A refusal the write itself made is stored for its key, so a repeat of the key is refused again in the same words, marked `Idempotent-Replayed: true`.
- `401`: Unauthorized
- `402`: A plain `PAYMENT_REQUIRED`, with no per-entry refinement: the organization does not hold Embedded Studio, the product the `studio-embedded` scope belongs to and the one a publishable key needs to act as a member. It is agreed rather than bought, so it clears when the organization's agreement changes rather than when the request does. The product is checked before the key's scopes, so a key that lacks the scope as well is answered this rather than a `403`. The reads that take `publishing` are unaffected. It asks for Embedded Studio alone and never for Map Studio or Map Publishing: an act that takes something down is never refused for either, so an organization whose agreement includes neither still takes down what it has.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the `studio-embedded` scope, or the user the session token names is not a member of the key's organization, or holds a role there that reads only, or the zone is one this credential can read and not edit, such as another organization's public zone while its publication is served. A user outside the organization and a member without the role answer alike. The blanket refusal in the [order of checks](https://docs.mountaya.com/en/apis/conventions/errors.md#which-refusal-you-get-first), an `Origin` or `Referer` the organization does not allow, answers here as well.
- `404`: No zone with that identifier is reachable: either none exists, or this credential cannot view it. The two answer alike, so this status cannot be used to learn which zone ids exist. So does a zone that has never been published, or has been taken down, or whose organization's agreement does not include Map Publishing, when this credential reads it as published rather than as its draft: a write answers it as a read does. A zone this credential reads as its draft is never answered here for not being published: that is a `200`.
- `409`: `IdempotencyKeyInUse`, given in full at the end of this page.
- `412`: `PreconditionFailed`, given in full at the end of this page.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# Withdraws the live publication. The public surfaces resolve nothing for the
# zone again; the draft is untouched, and the zone stops counting toward the
# organization's published-zones limit.
curl -s -X DELETE https://api.mountaya.com/v1/zones/c40f8a25-7e63-4d19-b8a0-9f2e5c31d764/publication \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" | jq '.data.status'
```

**TypeScript**

```typescript
import { Mountaya } from "@mountaya/client";

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken },
});

const { data } = await mountaya.studio.zones.deleteZonePublication({ zone_id: "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764" });

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.delete(
    "https://api.mountaya.com/v1/zones/c40f8a25-7e63-4d19-b8a0-9f2e5c31d764/publication",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
    "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "name": "Tricot trailhead, one hour",
    "description": "Terrain reachable on foot within an hour of the Col du Tricot trailhead.",
    "level": "info",
    "mode": "polygon",
    "is_private": false,
    "status": "published",
    "published_at": "2026-06-28T16:05:00Z",
    "has_unpublished_changes": false,
    "start_at": "2026-07-01T00:00:00Z",
    "end_at": "2026-08-31T23:59:59Z",
    "source": {
      "kind": "isochrones",
      "activity": "hiking-and-trail",
      "location": [
        6.7845,
        45.8612
      ],
      "range_type": "time",
      "range": 3600
    },
    "geojson": {
      "type": "Feature",
      "id": "c40f8a25-7e63-4d19-b8a0-9f2e5c31d764",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              6.7845,
              45.8612
            ],
            [
              6.7961,
              45.8612
            ],
            [
              6.7961,
              45.8698
            ],
            [
              6.7845,
              45.8698
            ],
            [
              6.7845,
              45.8612
            ]
          ]
        ]
      }
    },
    "revision": 4,
    "etag": "\"d4\"",
    "created_by": {
      "id": "7a3e5d18-4c60-49b2-8f75-e2d1c9a4b607"
    },
    "created_at": "2026-05-12T09:14:00Z",
    "updated_at": "2026-06-28T16:02:00Z"
  }
}
```

**Error answers the operations of this page share**

- `TooManyRequests` (`429`): A limit on this operation's requests is spent: the [rate limits](https://docs.mountaya.com/en/apis/conventions/rate-limits.md) page lists every one, the unknown publishable keys one address may present among them, and the operation's description names any of its own. The request was counted and nothing was done. `Retry-After` says how long until the limit lifts; wait that long, with a little jitter of your own, and send the request again. Where the operation takes an `Idempotency-Key`, a write sent again with the same key runs once.
- `PreconditionFailed` (`412`): `If-Match` named a version the resource has moved on from: somebody changed it after the caller read it. Nothing was changed. The one entry is coded `PRECONDITION_FAILED`, and `ETag` carries the current version, so read the resource again, decide whether the change still applies, and send it with the new tag. Retrying with the same tag is refused the same way. A resource the caller cannot see is answered `404` before the condition is asked, and a write refused for any other reason is refused for that reason first.
- `IdempotencyKeyInUse` (`409`): The `Idempotency-Key` this request carries is one an earlier request was sent with, and the answer to that one cannot be given here. Nothing was done by this request. Its entry says which. `IDEMPOTENCY_KEY_IN_USE`: the first request is still running. Wait the `Retry-After` this carries and send the same request again, which is then answered with the first request's outcome. `IDEMPOTENCY_ANSWER_UNAVAILABLE`: the first request's write was made, and its answer cannot be given again, because it was too large to keep whole, because the request failed with a `5xx` after the write was made, or because it carried a credential shown only once, which is never kept. `extensions.metadata` names the status it was answered with, and its `Location` and `ETag` where it carried them; a create whose operation says so names what it made there after a `5xx` too. Read the resource again rather than sending the write once more, which is answered the same way. A credential cannot be read again: where the operation says its answer carries one, the one it created is at `metadata.location`, so revoke that one and create another.
- `TooManyRequestsOrLimitReached` (`429`): A limit or a ceiling refused the request, and nothing was done. Its entry says which. `TOO_MANY_REQUESTS`: a limit counted over a window is spent, one the [rate limits](https://docs.mountaya.com/en/apis/conventions/rate-limits.md) page lists or the operation's description names. `Retry-After` says how long until it lifts; wait that long, with a little jitter of your own, and send the request again. Where the operation takes an `Idempotency-Key`, a write sent again with the same key runs once. `LIMIT_REACHED`: a ceiling the operation's description names is reached, a count of something the organization or the person holds rather than a rate. `extensions.metadata` names the ceiling, with how many it allows and how many are held, and no `Retry-After` is sent, since no wait lifts it: the same request is refused the same way until something is freed or the organization's agreement allows more, so it is not sent again as it is. The refusal is not kept for the request's `Idempotency-Key`, so the same request sent with that key once a place is free runs then.
