# Collection Zones

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

Which zones belong to a collection.

## List the zones a collection contains

### GET /v1/collections/{collection_id}/zones

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

Returns the zones filed in the collection, one page at a time.

This is the forward direction of the membership question. `getCollections` with `zone_id` answers the inverse, which collections hold a given zone; this one answers which zones a given collection holds. `getCollection` reports how many there are as a count, and this returns them.

The listing reflects the READ TIER the credential opens. On a collection your organization owns, a publishable key alone lists its public zones that are currently published, each as last published, and the same key with a session token naming a member lists its private and unpublished ones too, each as its draft, while a session token minted without `user_id` lists what the key alone does. A share token minted for the collection lists the zones it holds that are currently published, each as last published, whatever their privacy. A zone never published, or taken down, is absent from every listing served the published snapshot. Another organization's public collection is readable by id, but under your key this lists none of its zones and its tiles draw none. See the read tiers in the API description.

A SHARE TOKEN minted for this collection reads it, which is what lets a collection link draw and label the zones it carries: the tiles arrive from `getCollectionTile`, and the detail behind each of them from here. `getZones`, the organization's listing, refuses a share token, so a link never reaches past the collection it names.

The page is cut after authorization, so it never holds a zone the caller may not see, and the collection's `count`, which counts every member, can be larger than what this lists. 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; 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**

- `collection_id` (string (uuid), in path, required): Identifier of the collection the operation acts on. A collection this credential does not reach is a 404 rather than a 403, and so is one that does not exist, so the parameter cannot be used to learn which collection ids exist.

**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.

- `sort` (string, in query, optional, default: `-updated_at`, one of: `-updated_at`, `updated_at`, `name`, `-name`): The order the listing is served in, by one key: `updated_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 collection contains, 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`. 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.
- `404`: No collection 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 collection ids exist. 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 share token enumerates the same way a key does, and is the credential a
# link-visitor holds. Swap `X-API-Key` for `X-Share-Token` to read as one.
curl -s "https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/zones?limit=50&sort=name" \
  -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.collections.getCollectionZones({
  collection_id: "3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13",
  query: { limit: 50, sort: "name" },
});

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/zones",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
    },
    params={"limit": 50, "sort": "name"},
    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"
      }
    }
  }
}
```

## Add zones to a collection

### POST /v1/collections/{collection_id}/zones

- Operation: `postCollectionZones`
- 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

Adds one or more zones to the collection. Zones that are already in the collection are silently ignored, so re-sending the same set is safe: it changes nothing, and answers the collection as it stands. The answer is the collection after the change, as `getCollection` reads it, so its `count` and `etag` include what was added.

Every zone must belong to the SAME organization as the collection. A collection is scoped by its organization, so holding a resource from another one would make it reachable to that organization's members through the folder. A zone from elsewhere whose publication this credential is served, another organization's public zone while it is published and that organization's agreement includes Map Publishing, is rejected with `400`, and the validation entry names the offending position in the submitted array. One it is served nothing of is the `404` below, as its read is: one it cannot view, and one it reads as published that has never been published, has been taken down, or whose organization's agreement does not include Map Publishing. Either way the whole call is refused, not partially applied.

The collection's organization must hold Map Studio, or the call is refused with a `402`. A personal collection, owned by no organization, holds no zone: adding one to it, which only Mountaya's web application could ask for, is refused with a `403`.

Send the collection's `etag` as `If-Match` to make the add conditional: a collection changed since that read, its contents included, is a `412`, and nothing is added.

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** [`collection.zone.added`](https://docs.mountaya.com/en/webhooks/events/collection-zone.md#collection-zone-added), recorded by the task `collection.zone.add`.

**Path parameters**

- `collection_id` (string (uuid), in path, required): Identifier of the collection the operation acts on. A collection this credential does not reach is a 404 rather than a 403, and so is one that does not exist, so the parameter cannot be used to learn which collection ids exist.

**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 zones to add to the collection, by id.

- `zone_ids` (array of string (uuid), in body, required): The zones to file into the collection. Every one is resolved and authorized before any membership is written, so the call succeeds or fails as a whole. A repeated identifier is collapsed rather than refused, which is the same answer as naming one that is already a member, and an empty array is a successful call that changes nothing.

  The bound sits far above any set a person can select in the studio, and matches the itinerary twin. It exists because each identifier costs an authorization lookup and a membership write, so an unbounded array is an unbounded amount of work bought with one request. Over the bound is a validation error, never a truncation: silently dropping identifiers would report a collection the caller does not have.

**Response** `200`

The zones are in the collection. `data` is the collection after the change, as `getCollection` reads it, with its new `etag`. Adding only what the collection already holds changes nothing, and `data` is the collection as it stands.

- `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` (Collection, required): A collection grouping itineraries and zones for shared access and map rendering, as it appears to the calling credential: the collection itself, what it contains, the `role` the request carries in the organization that owns it, and the tile sources that render its contents on a map.

  `role` is an ORGANIZATION role, not a per-collection grant. A read made with a publishable key or a share token reports the read-only floor `viewer`, because neither holds a membership; the response to a write reports the role of the user the session token names.

  See [the Collection object](https://docs.mountaya.com/en/apis/map-studio/reference/collections.md#collection-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`, `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 collection 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 collection is one this credential can view and not edit, such as another organization's public collection, or the collection is personal, owned by no organization, which holds no zone. 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`: Either no collection with that identifier is reachable, or one of the zone ids in the body names no zone this credential can view. A resource that does not exist and one this credential cannot view answer alike, and 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: the add answers it as the zone's own read does. Both cases arrive as one status and the difference is not machine-readable; read the collection back with `getCollectionZones` to see what it holds.
- `409`: `IdempotencyKeyInUse`, given in full at the end of this page.
- `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
- `504`: Gateway Timeout

**cURL**

```bash
# Membership is a set: adding a zone already in the collection is not an error. Every
# zone must belong to the same organization as the collection.
curl -s -X POST https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/zones \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Content-Type: application/json" \
  -d '{
    "zone_ids": [
      "5e8c3a91-7b24-4f0d-9c68-1a5e2d7b3f90",
      "0d6f2b47-9e13-4c8a-b5f0-7a2c4e8d1b39"
    ]
  }'
```

**TypeScript**

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

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

const { data } = await mountaya.studio.collections.postCollectionZones({
  collection_id: "3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13",
  body: {
    zone_ids: [
      "5e8c3a91-7b24-4f0d-9c68-1a5e2d7b3f90",
      "0d6f2b47-9e13-4c8a-b5f0-7a2c4e8d1b39",
    ],
  },
});

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.post(
    "https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/zones",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "zone_ids": [
            "5e8c3a91-7b24-4f0d-9c68-1a5e2d7b3f90",
            "0d6f2b47-9e13-4c8a-b5f0-7a2c4e8d1b39",
        ],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "id": "3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13",
    "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "name": "Mont-Blanc classics",
    "description": "Multi-day hikes around the Mont-Blanc massif.",
    "is_private": true,
    "sources": [
      {
        "id": "0e9788ba-f680-4a74-8354-e7b7fe5ee061",
        "type": "vector",
        "attribution": "<a href=\"https://mountaya.com/\" target=\"_blank\">&copy; Mountaya</a>",
        "tiles": [
          "https://tiles.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/{z}/{x}/{y}"
        ],
        "zoom_min": 5,
        "zoom_max": 18,
        "layers": [
          {
            "id": "itineraries/0e9788ba-f680-4a74-8354-e7b7fe5ee061/lines",
            "key": "",
            "type": "line",
            "source": "0e9788ba-f680-4a74-8354-e7b7fe5ee061",
            "source_layer": "itinerary_lines",
            "zoom_min": 5,
            "zoom_max": 18,
            "layout": {
              "line-cap": "round",
              "line-join": "round"
            },
            "paint": {
              "line-color": "#2f80ed",
              "line-width": 3
            }
          }
        ]
      }
    ],
    "created_by": {
      "id": "7a3e5d18-4c60-49b2-8f75-e2d1c9a4b607"
    },
    "created_at": "2026-05-12T09:14:00Z",
    "updated_at": "2026-06-28T16:02:00Z",
    "etag": "\"d12\"",
    "count": {
      "itineraries": 6,
      "zones": 2
    },
    "role": "owner"
  }
}
```

## Remove a zone from a collection

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

- Operation: `deleteCollectionZone`
- 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

Removes one zone from the collection. The zone itself is not deleted: only its place in this collection is, so it stays in its organization and in every other collection holding it. A link minted for this collection stops reaching it. The answer is the collection after the change, as `getCollection` reads it.

Removing a zone the collection does not hold is not refused: it changes nothing, and the answer is the collection as it stands, so a removal sent twice answers alike both times. A zone this credential cannot view is the `404` below, exactly like an identifier that names no zone, so the call cannot be used to learn which zone ids exist.

Send the collection's `etag` as `If-Match` to make the removal conditional: a collection changed since that read, its contents included, is a `412`, and nothing is removed.

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** [`collection.zone.removed`](https://docs.mountaya.com/en/webhooks/events/collection-zone.md#collection-zone-removed), recorded by the task `collection.zone.remove`.

**Path parameters**

- `collection_id` (string (uuid), in path, required): Identifier of the collection the operation acts on. A collection this credential does not reach is a 404 rather than a 403, and so is one that does not exist, so the parameter cannot be used to learn which collection ids exist.

- `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 not in the collection. `data` is the collection after the removal, as `getCollection` reads it, with its new `etag`, or the collection as it stands when it did not hold the zone.

- `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` (Collection, required): A collection grouping itineraries and zones for shared access and map rendering, as it appears to the calling credential: the collection itself, what it contains, the `role` the request carries in the organization that owns it, and the tile sources that render its contents on a map.

  `role` is an ORGANIZATION role, not a per-collection grant. A read made with a publishable key or a share token reports the read-only floor `viewer`, because neither holds a membership; the response to a write reports the role of the user the session token names.

  See [the Collection object](https://docs.mountaya.com/en/apis/map-studio/reference/collections.md#collection-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: 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 collection is one this credential can view and not edit, such as another organization's public collection. 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`: Either no collection with that identifier is reachable, or no zone with the identifier in the path is one this credential can view. A resource that does not exist and one this credential cannot view answer alike, so this status cannot be used to learn which ids exist. A zone this credential can view that the collection does not hold is not refused: the answer is the collection as it stands.
- `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
# Removes the membership only; the zone itself is untouched.
curl -s -X DELETE https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/zones/5e8c3a91-7b24-4f0d-9c68-1a5e2d7b3f90 \
  -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.collections.deleteCollectionZone({
  collection_id: "3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13",
  zone_id: "5e8c3a91-7b24-4f0d-9c68-1a5e2d7b3f90",
});

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.delete(
    "https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/zones/5e8c3a91-7b24-4f0d-9c68-1a5e2d7b3f90",
    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": "3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13",
    "organization_id": "d5a83e17-92c6-4b0f-a7d3-1e6482f9c05b",
    "name": "Mont-Blanc classics",
    "description": "Multi-day hikes around the Mont-Blanc massif.",
    "is_private": true,
    "sources": [
      {
        "id": "0e9788ba-f680-4a74-8354-e7b7fe5ee061",
        "type": "vector",
        "attribution": "<a href=\"https://mountaya.com/\" target=\"_blank\">&copy; Mountaya</a>",
        "tiles": [
          "https://tiles.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/{z}/{x}/{y}"
        ],
        "zoom_min": 5,
        "zoom_max": 18,
        "layers": [
          {
            "id": "itineraries/0e9788ba-f680-4a74-8354-e7b7fe5ee061/lines",
            "key": "",
            "type": "line",
            "source": "0e9788ba-f680-4a74-8354-e7b7fe5ee061",
            "source_layer": "itinerary_lines",
            "zoom_min": 5,
            "zoom_max": 18,
            "layout": {
              "line-cap": "round",
              "line-join": "round"
            },
            "paint": {
              "line-color": "#2f80ed",
              "line-width": 3
            }
          }
        ]
      }
    ],
    "created_by": {
      "id": "7a3e5d18-4c60-49b2-8f75-e2d1c9a4b607"
    },
    "created_at": "2026-05-12T09:14:00Z",
    "updated_at": "2026-06-28T16:02:00Z",
    "etag": "\"d12\"",
    "count": {
      "itineraries": 6,
      "zones": 2
    },
    "role": "owner"
  }
}
```

**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.
- `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.
- `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.
