# Your content as tiles

> Canonical URL: https://docs.mountaya.com/en/apis/tiles/your-content/
> Last updated: 2026-11-27
> Rules for agents: https://docs.mountaya.com/llms.txt#rules-for-agents

Draw your own itineraries, collections, and zones as vector tiles, published or as drafts, and open them with share links.

Draw the itineraries, collections, and zones you made in Mountaya on your own map. It works like an overlay: fetch a specification, then add its sources and layers.

The samples read a publishable key with the `tiles` scope from `MOUNTAYA_PUBLISHABLE_KEY`. Replace the ids with your own.

## Draw one itinerary

Fetch the specification of one itinerary, here the Tour du Mont-Blanc.

**cURL**

```bash
curl https://tiles.mountaya.com/v1/itineraries/0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21/specification \
  -H "X-API-Key: $MOUNTAYA_PUBLISHABLE_KEY"
```

**TypeScript**

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

const mountaya = new Mountaya({
  credential: { publishableKey: process.env.MOUNTAYA_PUBLISHABLE_KEY ?? "" },
});

const { data: tour } = await mountaya.tiles.getItinerarySpecification({
  itinerary_id: "0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21",
});

for (const layer of tour.sources.flatMap((source) => source.layers)) {
  console.log(layer.id, layer.type);
}
```

**Python**

```python
import os
import requests

tour = requests.get(
    "https://tiles.mountaya.com/v1/itineraries/0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21/specification",
    headers={"X-API-Key": os.environ["MOUNTAYA_PUBLISHABLE_KEY"]},
    timeout=10,
).json()["data"]

for source in tour["sources"]:
    for layer in source["layers"]:
        print(layer["id"], layer["type"])
```

**Response**

```json
{
  "data": {
    "sources": [
      {
        "attribution": "<a href=\"https://mountaya.com/\" target=\"_blank\">&copy; Mountaya</a>",
        "id": "0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21",
        "layers": [
          {
            "id": "itineraries/0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21/lines-casing",
            "key": "",
            "layout": {
              "line-cap": "round",
              "line-join": "round"
            },
            "paint": {
              "line-color": "#ffffff",
              "line-opacity": 0.9,
              "line-width": ["interpolate", ["linear"], ["zoom"], 7, 4, 10, 4, 13, 5, 16, 7]
            },
            "source": "0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21",
            "source_layer": "itinerary_lines",
            "type": "line",
            "zoom_max": 18,
            "zoom_min": 8
          },
          {
            "filter": ["!=", ["get", "dashed"], true],
            "id": "itineraries/0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21/lines",
            "key": "",
            "layout": {
              "line-cap": "round",
              "line-join": "round"
            },
            "paint": {
              "line-color": ["coalesce", ["get", "color"], "#1c7ed6"],
              "line-width": ["interpolate", ["linear"], ["zoom"], 7, 2, 10, 2, 13, 3, 16, 5]
            },
            "source": "0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21",
            "source_layer": "itinerary_lines",
            "type": "line",
            "zoom_max": 18,
            "zoom_min": 8
          },
          {
            "filter": ["==", ["get", "dashed"], true],
            "id": "itineraries/0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21/lines-dashed",
            "key": "",
            "layout": {
              "line-cap": "round",
              "line-join": "round"
            },
            "paint": {
              "line-color": ["coalesce", ["get", "color"], "#1c7ed6"],
              "line-dasharray": [2, 2],
              "line-width": ["interpolate", ["linear"], ["zoom"], 7, 2, 10, 2, 13, 3, 16, 5]
            },
            "source": "0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21",
            "source_layer": "itinerary_lines",
            "type": "line",
            "zoom_max": 18,
            "zoom_min": 8
          },
          {
            "id": "itineraries/0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21/points",
            "key": "",
            "layout": {
              "icon-allow-overlap": true,
              "icon-anchor": "center",
              "icon-image": [
                "concat",
                "section-icon-",
                ["coalesce", ["get", "icon"], "map-pin"],
                "-",
                ["downcase", ["slice", ["coalesce", ["get", "color"], "#3b82f6"], 1]]
              ],
              "icon-size": 0.7
            },
            "paint": null,
            "source": "0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21",
            "source_layer": "itinerary_points",
            "type": "symbol",
            "zoom_max": 18,
            "zoom_min": 9
          }
        ],
        "tiles": [
          "https://tiles.mountaya.com/v1/itineraries/0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21/{z}/{x}/{y}"
        ],
        "type": "vector",
        "zoom_max": 18,
        "zoom_min": 8
      }
    ]
  }
}
```

The itinerary is one vector source with four layers: a white casing, the line, its dashed parts, and the waypoints. Add them as for an overlay, passing each layer's `filter`:

```js
const KEY = "pk_your_publishable_key";
const withKey = (url) => `${url}${url.includes("?") ? "&" : "?"}publishable_key=${KEY}`;

const response = await fetch(
  "https://tiles.mountaya.com/v1/itineraries/0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21/specification",
  { headers: { "X-API-Key": KEY } },
);
const { data } = await response.json();

for (const source of data.sources) {
  map.addSource(source.id, {
    type: source.type,
    tiles: source.tiles.map(withKey),
    minzoom: source.zoom_min,
    maxzoom: source.zoom_max,
    attribution: source.attribution,
  });

  for (const layer of source.layers) {
    map.addLayer({
      id: layer.id,
      type: layer.type,
      source: source.id,
      "source-layer": layer.source_layer,
      ...(layer.filter ? { filter: layer.filter } : {}),
      minzoom: layer.zoom_min,
      maxzoom: layer.zoom_max,
      paint: layer.paint ?? {},
      layout: layer.layout ?? {},
    });
  }
}
```

The waypoint layer names icons that your map's style does not hold. Register them when your map asks for a missing image, or leave the `symbol` layer out.

From zoom 9, the zoom the waypoints appear at, the tiles also carry the restricted stretches of each route, the parts that follow a way restricting who may pass, in the `itinerary_restrictions` source layer. No layer of the specification draws them: add one of your own over the line, keyed on each stretch's `kind`, to show a hiker where a way is private or closed.

- Specification endpoints for your own content, each answering `{"data": {"sources": [...]}}` in the same shape as an overlay's:

  - `GET /v1/itineraries/{itinerary_id}/specification`: one itinerary.
  - `GET /v1/itineraries/specification`: the organization's itineraries, in one source drawn from `/v1/itineraries/{z}/{x}/{y}`.
  - `GET /v1/collections/{collection_id}/specification`: one collection's zones and itineraries, plus `bbox`.
  - `GET /v1/zones/specification`: the organization's zones, drawn from `/v1/zones/{z}/{x}/{y}`. A zone has no tile of its own: the zones tile draws your organization's zones, and a collection's tile the zones filed in it.
- `@mountaya/client` binds `getItinerarySpecification`, `getItinerariesSpecification`, `getCollectionSpecification` and `getZonesSpecification` on `mountaya.tiles`. Tile routes are consumed as templates; no SDK method binds them.
- Itinerary tiles are vector tiles (`application/x-protobuf`) with three source layers: `itinerary_lines` (segment lines; a `dashed` property drives the dashed layer, a `color` property the line color), `itinerary_points` (waypoints and the per-itinerary start and end markers) and `itinerary_restrictions` (below). Every point feature carries `icon` and `color`; endpoint markers carry `icon` `flag-start` or `flag-end` and an informational `marker_role` (`start` or `end`) that waypoints lack.
- `itinerary_restrictions` carries, from zoom 9, one line feature per restricted stretch of a segment's `road_access_info`, with `segment_id`, `itinerary_id` and `kind`: the most severe of `forbidden`, `private`, `permit`, `service`, `local-access` and `restricted`. A `permissive`, `agricultural` or `forestry` stretch has no feature. No specification declares a layer for it, so a map draws it with a layer of its own; the Mountaya app draws diagonal stripes and a warning icon per kind. `@mountaya/elements` exports the source-layer name (`ITINERARY_RESTRICTION_SOURCE_LAYER`), the kinds (`ROAD_ACCESS_KINDS`) and the grouping of raw values into a kind (`roadAccessKindOf`).
- The `points` symbol layer's `icon-image` resolves to `section-icon-<icon>-<six lowercase hex digits>`, an image no style sprite holds. MapLibre logs a missing image and draws nothing (no throw, no error event). Register each image on demand (MapLibre 5: the `styleimagemissing` event and `map.addImage`; MapLibre 6: `map.setMissingStyleImageResolver`). `@mountaya/elements` exports `waypointIconImageId(icon, color)` and `WAYPOINT_ICON_PREFIX` (`section-icon-`) to build and match these ids.
- Pass a layer's `filter` to `addLayer` when present: without it the solid and dashed line layers both draw every line.
- Every identifier in a path or query is a UUID in canonical form (36 characters, four hyphens, either case). Any other spelling, or the nil UUID, is `400` naming the parameter. An itinerary or collection this credential does not reach is `404`, as is one that does not exist.
- Itinerary and zone layers declare zoom 5 to 18 at most; a specification served to a publishable key narrows every range to the organization's zoom bounds. A publishable-key request for a tile outside the zoom bounds or geographic boundaries is `400`.
- `Cache-Control`: `public, max-age=300` when the answer is cut from published snapshots of public content (a key alone, or with a token minted without `user_id`); `private` when a member's token brings drafts and private content in. A collection's specification is always `private`. Every response varies on `Origin`, `X-API-Key`, `X-Session-Token` and `X-Share-Token`.
- The aggregate tiles (`/v1/itineraries/{z}/{x}/{y}`, `/v1/zones/{z}/{x}/{y}`) take an optional `organization_id`, the studio scope they are drawn in. Under a publishable key or a share token it may name only your own organization and changes nothing; any other identifier is `403`, whether or not it exists.
- The layer catalog (`GET /v1/tile-layers`) asked with `organization_id` returns the itinerary and zone templates carrying it, as it does the overlays'. A map built from the catalog sends it on with every tile request. The aggregate specifications take no `organization_id`.
- From the Mountaya app the parameter picks the space drawn: the person's own itineraries and zones when it is omitted, an organization's when it names one they belong to. Any other organization is `404`, and those tiles are always `private`.
- The id in the samples is the canonical placeholder; the response was read from a published itinerary of a test organization, its id replaced by the placeholder.

## Published or draft

What a tile draws depends on the credential your map sends:

| Your map sends | It draws |
| --- | --- |
| A publishable key | What you published. The organization-wide tiles hold public content only. |
| A key and a session token for a member | The drafts, private content included |
| A key, a member's token, and `surface=published` | What you published |
| A share token | The one itinerary or collection it opens, as published |

A map for the public sends the key alone. A map for your team adds a member's session token to see work in progress.

- The Tile API also serves your own itineraries, zones and collections, and under a session token naming a member those tiles render the **draft** unless you ask otherwise, private zones and zones never published included. A member's map left on the default therefore shows work in progress. A publishable key alone, or with a token minted without `user_id`, draws the published snapshot whatever you ask, and only public zones, as last published. Add `surface=published` to read the published snapshot instead.
- A session token naming a user whose invitation is still pending, or a member removed since the token was minted, draws what the key alone does. Membership is checked again on every request.
- Read tiers, by what the request carries:

  - A share token: the aggregate tiles (`/v1/itineraries/{z}/{x}/{y}`, `/v1/zones/{z}/{x}/{y}`) answer empty, while their specifications are served as to any caller; a single-resource tile draws the itinerary or collection the token names, and under a collection token each itinerary and zone that collection contains; published content.
  - A publishable key alone: aggregate tiles draw your organization's public itineraries and zones; a single-resource tile draws your organization's itinerary or collection, public or private, plus another organization's public itinerary or collection; published content.
  - A key and a session token naming a member: aggregate tiles draw your organization's itineraries and zones, public or private; single-resource tiles as above; your organization's draft, another organization's published snapshot.
  - A key and a session token minted without `user_id`, or naming an invitee or a removed member: as a key alone.
- No credential draws another organization's draft: its public itinerary is drawn as last published, and one never published draws nothing, its tile and specification answering `404`.
- A collection tile draws the members of the collection the same credential could list, not every member it holds. Another organization's public collection is reachable and its specification served, but its tile draws nothing.
- An organization whose agreement does not include Map Publishing has its published content withdrawn rather than refused: its tiles drawn from published snapshots are empty, and a share token for one of its itineraries or collections is `401`.
- `surface=published` reads the published snapshot rather than the draft. `published` is the only accepted value: the parameter only ever narrows what you are served, so there is no `draft` spelling, and an unrecognized value is rejected with `400` rather than ignored. A read of one itinerary or zone refuses it with `403` when it is personal (owned by no organization) to the person whose it is. These endpoints accept it:

```text
https://tiles.mountaya.com/v1/itineraries/{itinerary_id}/{z}/{x}/{y}
https://tiles.mountaya.com/v1/itineraries/{z}/{x}/{y}
https://tiles.mountaya.com/v1/collections/{collection_id}/{z}/{x}/{y}
https://tiles.mountaya.com/v1/zones/{z}/{x}/{y}
https://tiles.mountaya.com/v1/collections/{collection_id}/specification
```

- Ask for a collection's specification with the `surface` its tiles are asked for with, so its `bbox` agrees with what they draw. Overlays have no draft, so the overlay endpoints ignore `surface`. See [core concepts](https://docs.mountaya.com/en/concepts.md) for the draft and published model.
- With a member's token, the map must send the session token on every tile request: append `session_token` beside `publishable_key`. A session token lasts at most five minutes, so a long-lived map refreshes its tile URLs with a new token.

## Share links

A share link opens one itinerary or collection to anyone who holds it, in Mountaya's own viewer. Its token (`share_…`) also opens that resource's tiles, but only from Mountaya's pages or from a server: a request from your own web page is refused. On your own map, send your publishable key.

Create and rotate share links with the [Map Studio API](https://docs.mountaya.com/en/apis/map-studio/sharing.md).

- A share token is sent in `X-Share-Token` or the `share_token` query parameter (the header wins). A request carrying a key and a share token is read under the key. A `share_token` present without the `share_` prefix is `401`; an empty one counts as absent.
- A share token carries its own authority and needs no scope. It draws only the itinerary or collection it names (and a collection token, each itinerary and zone that collection contains), as last published. Aggregate tiles answer empty under it.
- Under a share token, a request whose `Origin` or `Referer` names a page must be on Mountaya's own domain, otherwise `403` (`FORBIDDEN`); a request with neither header, as a server sends, is not domain-checked. A share token therefore cannot draw tiles on a third-party web page: measured, the same tile answered `200` with no `Origin` and `403` with `Origin: https://example.com`.
- A share token is held to the organization's overlay allowlist and time control, as a key is.
- Share-link tiles are recorded as `share` usage under the organization that owns the link and never counted toward its limits or allowance; they are held to 600 a minute per client IP address and 60,000 a minute per organization that owns the link.
- A share token whose organization's agreement does not include Map Publishing is `401`.

## Collections and zones

A collection's specification also carries `bbox`, the extent of its itineraries. Fit your map to it once the sources are added.

**cURL**

```bash
curl -s https://tiles.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/specification \
  -H "X-API-Key: $MOUNTAYA_PUBLISHABLE_KEY" | jq '.data.bbox'
```

**TypeScript**

```typescript
const { data: collection } = await mountaya.tiles.getCollectionSpecification({
  collection_id: "3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13",
});

console.log(collection.bbox);
```

**Python**

```python
collection = requests.get(
    "https://tiles.mountaya.com/v1/collections/3f1b9c42-8a6e-4d55-9f1a-2c7e5b0d4a13/specification",
    headers={"X-API-Key": os.environ["MOUNTAYA_PUBLISHABLE_KEY"]},
    timeout=10,
).json()["data"]

print(collection["bbox"])
```

**Response**

```json
[
  6.72422,
  45.82115,
  6.79898,
  45.89152
]
```

Pass it to `map.fitBounds()`. A collection draws its zones and itineraries together. To draw all your organization's zones, use `GET /v1/zones/specification`.

- `bbox` is `[west, south, east, north]` in WGS 84, carried by a collection's specification only. It spans every line and point of the collection's itineraries that its tiles draw for the same credential, the same `surface` and the same resolved `with_itineraries`; zones never count toward it, and it is not clipped to the organization's geographic boundaries. It is null when no itinerary is drawn (none served, none with geometry, or `with_itineraries` off), and then the camera stays put.
- A `bbox` crossing the antimeridian has west greater than east (RFC 7946); MapLibre's `fitBounds()` takes east plus 360 for such a box.
- The collection specification and tiles take `with_zones` and `with_itineraries` toggles. The declared layers are narrowed by the resolved toggles, whatever the credential; on a publishable-key request the toggles are clamped to the organization's safety rules. They are not narrowed by what the credential may see: the tile draws only the members the credential could list.
- Zone layers are painted by zone `level` (`info`, `warning`, `danger`, `resolved`); itinerary layers take a per-feature `color`, falling back to the last argument of the `coalesce` in `paint`.
- Your-content tiles count as any tile: one request per tile served toward the per-minute limit and the monthly allowance under a key. See [what is counted](https://docs.mountaya.com/en/apis/tiles.md#what-is-counted).

## Next steps

- [Integration](https://docs.mountaya.com/en/apis/tiles/integration.md): The same pattern for Mapbox, MapTiler, and deck.gl.
- [Map Studio API](https://docs.mountaya.com/en/apis/map-studio.md): Create and publish the itineraries these tiles draw.
