# Collections

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

Named groups of itineraries and zones, scoped to an organization.

 A collection is how a set of routes is handed out together: to an embed, to a share link, or to a client filtering by one id instead of many.

## The Collection object

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.

- `count` (object, required): How many itineraries and zones the collection holds, whoever asks: a member the caller cannot see is counted all the same, so walking a member listing to its end can yield fewer than this.
  - `itineraries` (integer (int32), required): Number of itineraries tied to the collection.
  - `zones` (integer (int32), required): Number of zones tied to the collection.

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

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

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

- `etag` (string, required): The version of everything a read of this collection returns, the one the `ETag` of that read carries, opaque and compared whole. It moves on every write that changes the read, its contents included: an itinerary or a zone added, removed or moved. Send it as `If-Match` to make a write to the collection conditional.

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

- `is_private` (boolean, required): Whether the collection is private. A private collection is reached only with the key of the organization that owns it, so a private personal collection, owned by no organization, is reached by no key. A public collection is readable by id, read-only, with any publishable key that knows its identifier, and it is listed only in its own organization's listings. A share token reaches only what its link names, and reaches the collection it names whatever this says. Public never grants editing, which takes a write role in the owning organization.

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

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

- `role` (string, required, one of: `owner`, `admin`, `contributor`, `viewer`): The role this request carries in the organization that owns the collection, not a property of the collection: `viewer` on a read made with a publishable key or a share token, neither of which holds a membership, and on a write's response the role of the user the session token names. Offer edit controls from the role of the member who will act.

- `sources` (array of TileSource, required): Tile sources available for rendering this collection on a map.
  - `attribution` (string): Attribution HTML to display on the map for this source: the credit of whoever supplies its data, Mountaya for a resource source and the data provider for an overlay. Pass through to the `attribution` option of `map.addSource()`.
  - `id` (string, required): Unique source identifier. Use it as the first argument to `map.addSource()` and as the `source` of every layer that draws from it.

    Declared as a string rather than a UUID so that it stays opaque: a resource source is named by the resource's id, and an overlay or aggregate source by a fixed identifier of its own. Every one of them is spelled as a UUID, but that shape is not part of this contract, so treat it as an opaque string and match it against a layer's `source` rather than parsing it.
  - `layers` (array of TileLayer, required): Render-layers to draw from this source, in paint order. Each becomes one `map.addLayer()` call.
    - `filter` (array of any): Optional MapLibre/Mapbox filter expression restricting which features the layer renders. Pass through to the `filter` option of `map.addLayer()`. Omitted when no filter applies; never null and never an empty array.
    - `id` (string, required): Unique layer identifier. Use it as the first argument to `map.addLayer()`.

      A composite path rather than a UUID, for example `itineraries/<itinerary_id>/lines`. Treat it as an opaque string: the shape is a rendering detail and is free to change, and it is the only kind of `id` on this surface that a UUID parser would reject.
    - `key` (string, required): Stable, human-readable concept slug grouping render-layers that depict the same map concept (e.g. "parking", "hillshade"). Unlike `id`, which is the per-layer unique identifier, `key` MAY repeat across several layers of the same overlay when one concept is rendered with multiple layers (a fill plus a symbol, for instance). Clients group and toggle layers by `key`; `id` remains the uniqueness guarantee.

      The empty string is a real value, and means this layer belongs to no named concept: an itinerary's own line layers carry it. Group by `key` only after discarding the empty ones, or every unnamed layer collapses into one group.
    - `layout` (object | null, required): MapLibre/Mapbox layout properties for this layer (e.g. `visibility`, symbol placement). Pass through to the `layout` option of `map.addLayer()`. Null when the layer needs no layout overrides.
    - `legend` (object): Optional legend describing how to read the layer's colors or scale. Drives the map UI legend; not consumed by `map.addLayer()`. Omitted when the layer has no legend; never null.
      - `kind` (string, one of: `row`, `compass`): How the legend is laid out: `row` draws the steps below as an ordered row of color swatches, and `compass` as a compass dial, for a directional overlay such as aspect/slope.
      - `locales` (object, required): The legend's title and step labels per language. A language absent here is null rather than missing, which is the case to fall back from.
        - `de` (LocaleMap | null, required): The German strings for this legend. Null when the legend carries no German translation, which is the case a client falls back from rather than renders.
        - `en` (LocaleMap | null, required): The English strings for this legend. Null when the legend carries no English translation, which is the case a client falls back from rather than renders.
        - `es` (LocaleMap | null, required): The Spanish strings for this legend. Null when the legend carries no Spanish translation, which is the case a client falls back from rather than renders.
        - `fr` (LocaleMap | null, required): The French strings for this legend. Null when the legend carries no French translation, which is the case a client falls back from rather than renders.
        - `it` (LocaleMap | null, required): The Italian strings for this legend. Null when the legend carries no Italian translation, which is the case a client falls back from rather than renders.
        - `ja` (LocaleMap | null, required): The Japanese strings for this legend. Null when the legend carries no Japanese translation, which is the case a client falls back from rather than renders.
        - `zh` (LocaleMap | null, required): The Chinese strings for this legend. Null when the legend carries no Chinese translation, which is the case a client falls back from rather than renders.
      - `steps` (array of TileLegendStep): Ordered color stops mapping a value (or bucket) to the color the layer paints for it, from low to high. Drives a graduated or categorical legend.
        - `color` (string, required): CSS color the layer paints for this step (e.g. "#1c7ed6"). Matches the color used in the layer's paint expression.

          Case-insensitive, unlike the colors on an itinerary's segments, waypoints and segment groups. Those are values a caller wrote, normalized to the six-digit lowercase form on the way in; this one is read from the layer's own palette and served in whatever case that palette is written in. Compare these case-insensitively rather than by string equality.
        - `step` (string, required): Label for the value or bucket this color represents, such as a threshold like "20" or a range like "25 - 30". It is the same in every language: the legend's translated text is in its `locales`.
      - `unit` (string, one of: `km/h`, `degrees`, `m`, `cm`, `celsius`, `percent`): The unit the step values are measured in, for the suffix a legend prints beside each one. Absent when the steps are categories rather than quantities.
    - `paint` (object | null, required): MapLibre/Mapbox paint properties for this layer (colors, opacity, widths, data-driven expressions). Pass through to the `paint` option of `map.addLayer()`. Null when the layer relies on style defaults.
    - `source` (string): Identifier of the source this layer draws from. Matches the `id` of the enclosing tile source.
    - `source_layer` (string, required): Name of the layer within a vector tile to render (e.g. "fills", "points", "lines"). Pass through to the `source-layer` option of `map.addLayer()`. Only meaningful for vector sources.
    - `type` (string, required, one of: `raster`, `hillshade`, `fill`, `line`, `circle`, `symbol`): How this layer draws, and what `paint` may carry: a map library maps it onto its own layer type, so pass it through rather than inferring one from the source.
    - `zoom_max` (integer (int32), required): Highest zoom level at which the layer is drawn. Pass to the `maxzoom` option of `map.addLayer()`.
    - `zoom_min` (integer (int32), required): Lowest zoom level at which the layer is drawn. Pass to the `minzoom` option of `map.addLayer()`.
  - `size` (integer (int32), one of: `256`, `512`): Edge length in pixels of one raster tile, for `map.addSource()`'s `tileSize`. Omitted for vector sources, which have no pixel size of their own.
  - `tiles` (array of string, required): Tile URL templates with `{z}`, `{x}`, and `{y}` placeholders that the map library expands per tile. Usually a single entry pointing at the matching `{z}/{x}/{y}` endpoint. Hand the template to the map library with its placeholders intact: the library substitutes them as it pans and zooms, so a template expanded before it is handed over produces one tile rather than a map. An overlay's template, and in a layer catalog the itinerary and zone layers' templates, carry the `organization_id` the specification or the catalog was asked for with, when one was sent, as a query string of its own, so a credential added to such a template joins it with `&` rather than starting a second `?`.
  - `type` (string, required, one of: `vector`, `raster`, `raster-dem`): What kind of data the source serves, which decides how a map library reads its tiles. A `raster-dem` source carries elevation rather than pixels, so it feeds terrain and hillshade rather than being drawn directly.
  - `zoom_max` (integer (int32), required): Deepest zoom a map library requests this source's tiles at. A layer drawn from the source can reach deeper, and a map overzooms the source's tiles for it. It says where to ask rather than what is refused: a tile asked for deeper is still served, and on a specification served to a publishable key the value is brought within the organization's zoom bounds.
  - `zoom_min` (integer (int32), required): Shallowest zoom a map library requests this source's tiles at. Like `zoom_max`, it says where to ask rather than what is refused, and on a specification served to a publishable key it is brought within the organization's zoom bounds.

- `updated_at` (string (date-time), required): When the collection itself last changed. Every `patchCollection` moves it, even one that changes nothing, while adding, removing or reordering its itineraries and zones never does. Always present: it equals `created_at` until the first patch.

### An example Collection

```json
{
  "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"
}
```

## List collections

### GET /v1/collections

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

Returns the collections of the key's organization that this credential reaches, one page at a time. A collection belongs to the organization that owns it, not to the user who created it, so this is the listing every member shares.

The listing reflects the READ TIER the credential opens. A bare publishable key lists the organization's PUBLIC collections only: a private collection is never discoverable with one. The same key with a session token naming a member lists the organization's collections whole, private included, and with a session token minted without `user_id` lists the public ones only, as the key alone does. Either way each collection reports the role `viewer`, because a key holds no membership. Another organization's public collection is read by its identifier with `getCollection` and never appears here, and a key lists no personal collection, owned by no organization. A share token lists no collection: the one its link names is read with `getCollection`. See the read tiers in the API description.

`itinerary_id` and `zone_id` list only the collections holding that itinerary or that zone, which is how a client shows where something is filed. An identifier that names nothing this credential can view lists nothing, the same answer as one no collection holds, so neither filter can be used to learn which identifiers exist. Every filter sent narrows the listing further, and none of them widens what the credential reaches.

The page is cut after authorization, so it never holds a collection 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.

- `itinerary_id` (string (uuid), in query, optional): Lists only the collections holding this itinerary. An identifier that names nothing this credential can view lists nothing, the same answer as an itinerary no collection holds.

- `zone_id` (string (uuid), in query, optional): Lists only the collections holding this zone. An identifier that names nothing this credential can view lists nothing, the same answer as a zone no collection holds.

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

- `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 collection 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 collections 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 Collection, required): See [the Collection object](https://docs.mountaya.com/en/apis/map-studio/reference/collections.md#collection-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. Never for `itinerary_id` or `zone_id`: a filter naming nothing this credential can view lists nothing.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# Where an itinerary is filed, most recently changed first. With a session
# token naming a member the private collections are listed too.
curl -s "https://api.mountaya.com/v1/collections?itinerary_id=0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21" \
  -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.getCollections({
  query: { itinerary_id: "0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21" },
});

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://api.mountaya.com/v1/collections",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
    },
    params={"itinerary_id": "0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21"},
    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"
    }
  ],
  "extensions": {
    "metadata": {
      "pagination": {
        "limit": 50,
        "next_cursor": "eyJ2IjoxLCJzIjoiLXVwZGF0ZWRfYXQifQ"
      }
    }
  }
}
```

## Create a new collection

### POST /v1/collections

- Operation: `postCollection`
- 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 new collection in the key's organization. Returns 409 Conflict when another collection in that organization already carries the name.

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.created`](https://docs.mountaya.com/en/webhooks/events/collection.md#collection-created), recorded by the task `collection.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 collection's name, description and privacy, and the organization that owns it, which can only be the key's.

- `description` (string, in body, optional): Free-text description of the collection, 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 collection without one.

- `is_private` (boolean, in body, required): Whether the collection is private. A private collection is reached only with the key of the organization that owns it, so a private personal collection, owned by no organization, is reached by no key. A public collection is readable by id, read-only, with any publishable key that knows its identifier, and it is listed only in its own organization's listings. A share token reaches only what its link names, and reaches the collection it names whatever this says. Public never grants editing, which takes a write role in the owning organization.

- `name` (string, in body, required): Display name of the collection, at most 30 characters as sent, and at least 2 once leading and trailing whitespace is trimmed. Refused with a `409` when another collection 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 collection. It must be the key's organization; omitted, it is that organization.

**Response** `201`

The collection as created, empty. `Location` names it, `/v1/collections/{collection_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` (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:

- `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`, `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 collection 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. 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 collection in the organization already carries the name. Names are unique within the owning organization, so the same name is free in a different organization. Nothing is created. `extensions.metadata.collection.id` is the collection holding the name: send a different name, or add to that one 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 collection made, `/v1/collections/{collection_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
- `504`: Gateway Timeout

**cURL**

```bash
# The key makes a retry safe: the same key and body are answered with the first
# create's 201 rather than a second collection.
curl -s https://api.mountaya.com/v1/collections \
  -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": "Mont-Blanc classics",
    "description": "Multi-day hikes around the Mont-Blanc massif.",
    "is_private": true
  }'
```

**TypeScript**

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

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

const { data } = await mountaya.studio.collections.postCollection({
  body: {
    name: "Mont-Blanc classics",
    description: "Multi-day hikes around the Mont-Blanc massif.",
    is_private: true,
  },
});

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.post(
    "https://api.mountaya.com/v1/collections",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "name": "Mont-Blanc classics",
        "description": "Multi-day hikes around the Mont-Blanc massif.",
        "is_private": True,
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 201:

```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"
  }
}
```

## Retrieve a single collection with its itineraries and zones

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

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

Returns the collection details, with counts of the itineraries and zones it contains.

This is the read an embed makes, and the one a share link serves.

A collection is scoped by the organization that owns it. A private collection is reached only with that organization's key, and a personal one, owned by no organization, is reached by a key only when it is public. A public collection is additionally readable by id across organizations, but only the collection itself: under another organization's key, its itineraries and zones are neither listed nor drawn.

A share token minted for this collection reaches it read-only whatever its privacy, and reaches the itineraries and zones it contains. A collection this credential cannot view answers 404, exactly like an id that matches no collection.

A collection has no published snapshot: every credential reads it as it stands, and the itineraries and zones it holds are served by their own read tiers, as last published to every credential but a session naming a member. A bare publishable key reaches its own organization's collections whether public or private, and another organization's public one, and so does the key with a session token minted without `user_id`, which reads as the key alone does; a share token reaches only what its link names. See the read tiers in the API description.

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.

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 collection, with counts of the itineraries and zones it holds.

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

**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
# `count` is every itinerary and zone the collection holds, whoever asks. Its
# member listings hold only what YOU may see, so they can be shorter.
curl -s https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13 \
  -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.getCollection({ collection_id: "3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13" });

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13",
    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"])
```

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"
  }
}
```

## Update an existing collection

### PATCH /v1/collections/{collection_id}

- Operation: `patchCollection`
- 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 collection's name, description and privacy. Every field is optional and an omitted field keeps its current value; send `null`, or a description that trims to nothing, to clear the description.

Renaming or re-describing a collection is an administrative act on a shared folder, so it needs more than a write role: the user the session token names must have created the collection, or hold `owner` or `admin` in the owning organization. A contributor may change what a collection CONTAINS but not what it IS. Anything less is 403.

Returns 409 when another collection in the organization already carries the new name. The response carries the conflicting collection's id in `extensions.metadata`, so a client can link straight to it rather than making the user hunt for the clash.

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

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

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

- `is_private` (boolean, in body, optional): Whether the collection is private. A private collection is reached only with the key of the organization that owns it, so a private personal collection, owned by no organization, is reached by no key. A public collection is readable by id, read-only, with any publishable key that knows its identifier, and it is listed only in its own organization's listings. A share token reaches only what its link names, and reaches the collection it names whatever this says. Public never grants editing, which takes a write role in the owning organization. Omit to keep the current value.

- `name` (string, in body, optional): Display name of the collection. Omit to keep the current value. At most 30 characters as sent, and at least 2 once leading and trailing whitespace is trimmed; refused with a `409` when another collection 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.

**Response** `200`

The collection after the change, with 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` (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. A user outside the organization and a member without the role answer alike. Changing a collection's name, description or privacy also takes either its authorship or the owner or admin role. 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 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.
- `409`: Another collection in the organization already carries the requested name. Re-sending the collection's current name is never a conflict. No field is changed. `extensions.metadata.collection.id` is the collection holding the name. 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
- `504`: Gateway Timeout

**cURL**

```bash
# PATCH merges: an omitted field is left alone. Flipping `is_private` takes effect at
# once for key reads; a share link reaches the collection whatever its privacy.
curl -s -X PATCH https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13 \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Mont-Blanc classics",
    "description": "Multi-day hikes around the Mont-Blanc massif, refreshed for summer.",
    "is_private": false
  }'
```

**TypeScript**

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

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

const { data } = await mountaya.studio.collections.patchCollection({
  collection_id: "3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13",
  body: {
    name: "Mont-Blanc classics",
    description: "Multi-day hikes around the Mont-Blanc massif, refreshed for summer.",
    is_private: false,
  },
});

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.patch(
    "https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "name": "Mont-Blanc classics",
        "description": "Multi-day hikes around the Mont-Blanc massif, refreshed for summer.",
        "is_private": False,
    },
    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"
  }
}
```

## Delete a collection

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

- Operation: `deleteCollection`
- 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 collection. The itineraries and zones it held are NOT deleted: only the references linking them to this collection are, so every resource survives in the organization that owns it. This action cannot be undone.

Deleting is an administrative act on a shared folder, so it takes the same grant as renaming one: a write role, and on top of it either the collection's authorship or `owner` / `admin` in the owning organization. A `contributor`, who may add and remove the collection's contents, cannot delete a folder it did not create: changing what a collection CONTAINS and changing what it IS are separate permissions on purpose. Any active share link is disabled with it, and every URL built from that link stops resolving.

Send the collection's `etag` as `If-Match` to make the delete conditional: a collection 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** [`collection.deleted`](https://docs.mountaya.com/en/webhooks/events/collection.md#collection-deleted), recorded by the task `collection.delete`.

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

**Response** `200`

The collection is deleted. The itineraries and zones it held survive. `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 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. Deleting a collection also takes either its authorship or the owner or admin role. 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 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 second delete of the same collection 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
# Deletes the folder only. The itineraries and zones inside it are not deleted.
curl -s -X DELETE https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13 \
  -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.deleteCollection({ collection_id: "3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13" });

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.delete(
    "https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13",
    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
}
```

## Read the collection's share link

### GET /v1/collections/{collection_id}/share-link

- Operation: `getCollectionShareLink`
- Requires: scope `studio-embedded` · acting user required (a session token naming a member)
- Behavior: idempotent, safe to retry · answers within 30000 ms or times out

Returns the collection's share link, its token and when that token was minted, or `null` when the collection has none. Reading never mints one: `postCollectionShareLink` does.

Reading a link takes the same write role minting one takes, because the token opens the collection to anyone who holds it. A member who can only view the collection cannot read its link, and neither can another organization's key that sees the collection only because it is public.

Like every read made with a session token, it is limited to 1200 a minute per user the token names and then to 6000 a minute per organization; past either, the answer is a `429` carrying `Retry-After`.

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

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

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 collection's share link, or `null` when it has none: none was minted, or the last one was removed. An absent link is not an error, so a client reads it here and offers to mint one when `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` (ShareLink | null, required): See [the ShareLink object](https://docs.mountaya.com/en/apis/map-studio/reference/itineraries.md#share-link-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 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 the `studio-embedded` scope asks for beside Embedded Studio, and this too clears when the agreement changes rather than when the request does. Whatever this read answers, the link resolves to nothing while the agreement does not include Map Publishing.
- `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. Reading, minting, rotating and removing a link each take a write role in the organization that owns the collection. 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 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 collection with no share link is not refused: `data` is `null`.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# `data` is null when the collection has no link; this never mints one.
curl -s https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/share-link \
  -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.collections.getCollectionShareLink({ collection_id: "3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13" });

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/share-link",
    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"])
```

Response 200:

```json
{
  "data": {
    "share_token": "share_4f9c2a7e15b83d06e4a91c7fb250d83a",
    "created_at": "2026-09-14T10:22:05Z"
  }
}
```

## Mint the collection's share link, or return the one it has

### POST /v1/collections/{collection_id}/share-link

- Operation: `postCollectionShareLink`
- 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 collection's share link: mints one when the collection has none, answering `201`, and returns the existing one otherwise, answering `200`, so calling again never mints a second token. Both private and public collections are shareable.

Minting takes a write role in the organization that owns the collection. A member who can only view the collection cannot mint a link, and neither can another organization's key that sees it only because it is public, so a link never outlives the publisher flipping the collection private. A personal collection, owned by no organization, has no share link: minting one for it, which only Mountaya's web application could ask for, is refused with a `403`.

The resulting link exposes the collection's itineraries and zones read-only, each as last published. That is the deliberate difference from an itinerary share link, which exposes a single itinerary and never its collection's siblings.

A link is not part of what `getCollection` reads, so minting one does not move the collection's `etag`.

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.share_link.created`](https://docs.mountaya.com/en/webhooks/events/collection-share-link.md#collection-share-link-created), recorded by the task `collection.share_link.create`.

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

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 collection already had a share link, and this is it, unchanged. `getCollectionShareLink` reads the same link back; `getCollection` never carries the token.

- `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` (ShareLink, required): The share link of one itinerary or one collection: the token that opens it and when it was minted. A resource has at most one link at a time.

  The token grants a visitor with no key read-only access to exactly that resource, whether or not it is private: an itinerary's detail, its tiles, its export and its pace re-timed at a speed the visitor names, or a collection's detail and tiles and the itineraries and zones it contains, with what a share view needs to paint them, the organization that owns the resource and the layer and activity catalogs. It never authorizes a write or any other resource. Presented in `X-Share-Token`, or in the reserved `share_token` query parameter, it replaces the key rather than accompanying it. Rotating or removing the link has Mountaya refuse the token from the next request on; an answer a shared cache already holds for it is served until its lifetime runs out, as the rotation and the removal state. While the owning organization's agreement does not include Map Publishing the link resolves to nothing, answering `401` exactly as a removed one does, and it resolves again once the agreement includes Map Publishing.

  Reading, minting, rotating and removing a link all take a write role in the organization that owns the resource: handing a link out and breaking every URL already sent both act on people outside the organization. A member who can only view the resource cannot read its link, and neither can another organization's key that sees the resource only because it is public, so a link never outlives the publisher making it private. Treat the token as a secret: anyone holding it reads what it opens.

  See [the ShareLink object](https://docs.mountaya.com/en/apis/map-studio/reference/itineraries.md#share-link-object).

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`, `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. A user outside the organization and a member without the role answer alike. Reading, minting, rotating and removing a link each take a write role in the organization that owns the collection. 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 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.
- `409`: `IdempotencyKeyInUse`, 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
# No body. Calling it again returns the same token rather than a second one.
curl -s -X POST https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/share-link \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" | jq -r '.data.share_token'
```

**TypeScript**

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

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

const { data } = await mountaya.studio.collections.postCollectionShareLink({ collection_id: "3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13" });

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.post(
    "https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/share-link",
    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": {
    "share_token": "share_4f9c2a7e15b83d06e4a91c7fb250d83a",
    "created_at": "2026-09-14T10:22:05Z"
  }
}
```

## Remove the collection's share link

### DELETE /v1/collections/{collection_id}/share-link

- Operation: `deleteCollectionShareLink`
- 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 the collection's share link, so every URL built from its token stops resolving. Mountaya refuses the old token from the next request on, with a `401`. An answer a shared cache already holds for a request carrying it is served from there until its lifetime runs out: at most 5 minutes for a public tile and 25 hours for the layer catalog, as each states in its `Cache-Control`. It takes the same write role the mint takes. A collection with no share link is answered the same way, so removing a link that is already gone is not an error.

A link is not part of what `getCollection` reads, so removing one does not move the collection's `etag`.

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.share_link.deleted`](https://docs.mountaya.com/en/webhooks/events/collection-share-link.md#collection-share-link-deleted), recorded by the task `collection.share_link.delete`.

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

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 collection has no share link: this call removed it, or it had none. A request carrying the old token gets a `401` from the next request on, but for an answer a shared cache already holds. `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`, `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. Reading, minting, rotating and removing a link each take a write role in the organization that owns the collection. 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 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 collection with no share link is not refused: the answer is the `200` above.
- `409`: `IdempotencyKeyInUse`, 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
# Breaks every URL already handed out. There is no undo: minting again produces a
# new token, not the old one.
curl -s -X DELETE https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/share-link \
  -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.deleteCollectionShareLink({ collection_id: "3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13" });

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.delete(
    "https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/share-link",
    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
}
```

## Rotate the collection's share link

### POST /v1/collections/{collection_id}/share-link/rotate

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

Replaces the collection's share token with a freshly generated one and returns the link with it, so every URL built from the previous token stops resolving (the cut-off for a link that has spread too far or outlived its intended audience). It takes the same write role the mint takes. A collection with no share link has nothing to rotate, and is a `409`: mint one with `postCollectionShareLink`. A personal collection, owned by no organization, has no share link, and rotating one for it, which only Mountaya's web application could ask for, is refused with a `403` as the mint is.

**Send an `Idempotency-Key`.** Each rotation mints a new token, so a retry without one rotates again: if the first call succeeded but its response was lost (a timeout, a dropped connection) the retry mints a third token and invalidates the second, leaving a link nobody holds. A retry carrying the first call's key is answered with the first call's token instead.

A link is not part of what `getCollection` reads, so rotating one does not move the collection's `etag`.

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.share_link.rotated`](https://docs.mountaya.com/en/webhooks/events/collection-share-link.md#collection-share-link-rotated), recorded by the task `collection.share_link.rotate`.

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

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 share link with its new token. The previous token is refused from the next request on, but for an answer a shared cache already holds for it, which is served until its lifetime runs out: at most 5 minutes for a public tile and 25 hours for the layer catalog.

- `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` (ShareLink, required): The share link of one itinerary or one collection: the token that opens it and when it was minted. A resource has at most one link at a time.

  The token grants a visitor with no key read-only access to exactly that resource, whether or not it is private: an itinerary's detail, its tiles, its export and its pace re-timed at a speed the visitor names, or a collection's detail and tiles and the itineraries and zones it contains, with what a share view needs to paint them, the organization that owns the resource and the layer and activity catalogs. It never authorizes a write or any other resource. Presented in `X-Share-Token`, or in the reserved `share_token` query parameter, it replaces the key rather than accompanying it. Rotating or removing the link has Mountaya refuse the token from the next request on; an answer a shared cache already holds for it is served until its lifetime runs out, as the rotation and the removal state. While the owning organization's agreement does not include Map Publishing the link resolves to nothing, answering `401` exactly as a removed one does, and it resolves again once the agreement includes Map Publishing.

  Reading, minting, rotating and removing a link all take a write role in the organization that owns the resource: handing a link out and breaking every URL already sent both act on people outside the organization. A member who can only view the resource cannot read its link, and neither can another organization's key that sees the resource only because it is public, so a link never outlives the publisher making it private. Treat the token as a secret: anyone holding it reads what it opens.

  See [the ShareLink object](https://docs.mountaya.com/en/apis/map-studio/reference/itineraries.md#share-link-object).

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`, `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. A user outside the organization and a member without the role answer alike. Reading, minting, rotating and removing a link each take a write role in the organization that owns the collection. 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 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.
- `409`: The collection has no share link to rotate: none was minted, or it was removed. Nothing is minted; mint a link with `postCollectionShareLink` instead. 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.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# Rotating breaks every URL already handed out and returns a new token in the same
# call, so a link can be replaced without a window where none works. Reuse the
# same key on a retry, or the retry rotates again.
curl -s -X POST https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/share-link/rotate \
  -H "X-API-Key: pk_your_publishable_key" \
  -H "X-Session-Token: sess_your_session_token" \
  -H "Idempotency-Key: $(uuidgen)"
```

**TypeScript**

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

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

const { data } = await mountaya.studio.collections.postCollectionShareLinkRotate({ collection_id: "3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13" });

console.log(data);
```

**Python**

```python
import requests
import uuid

response = requests.post(
    "https://api.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/share-link/rotate",
    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": {
    "share_token": "share_4f9c2a7e15b83d06e4a91c7fb250d83a",
    "created_at": "2026-09-14T10:22:05Z"
  }
}
```

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