# Itineraries

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

Routes as vector tiles, drawn from the published snapshot or, when a session token naming a member accompanies the key, from the key's own organization's drafts, so a map draws a whole set of them without fetching each one's geometry.

## The TileSpecification object

Rendering specification for a tile resource. Returned by every `/specification` endpoint and consumed once while a map is initializing: iterate `sources` and call `map.addSource()` for each, then iterate the `layers` inside each source and call `map.addLayer()` for each. The map library then fetches the `{z}/{x}/{y}` tiles automatically. A collection's specification also carries `bbox`, the extent of the itineraries its tiles draw, which is where to fit the camera once the sources are registered.

Served to a publishable key, every `zoom_min` and `zoom_max` in it is already narrowed to the organization's zoom-bounds safety rule, so a map that follows it asks only for tiles that rule serves. A layer's range is intersected with the bounds, and a layer whose range lies wholly outside them is left out, as is a source left with no layer. A source's own range is clamped into the bounds rather than intersected, so a source whose tiles stop below the bounds still reports a range inside them, and the tiles past its own ceiling are cut from their ancestors.

- `bbox` (array of number (double) | null): The extent of the itineraries this specification's tiles draw, as [west, south, east, north] in WGS 84 decimal degrees. This is the flat four-tuple every bounding box on every Mountaya surface uses. Exactly four numbers, longitude first in each pair, every longitude between -180 and 180.

  Of the two boxes the longitudes allow, read as written and read across the antimeridian, it is the narrower, the one as written when they are as wide. One across the antimeridian has west greater than east, as RFC 7946 section 5.2 writes such a box: itineraries near 179.8 and -179.9 degrees answer `[179.8, s, -179.9, n]`, a box 0.3 degrees wide, rather than the 359.7 degrees the same longitudes span as written. Any other box this answers has west at or below east, the minimum corner first. A map library that takes a box only with west below east, MapLibre's `fitBounds()` among them, is handed east plus 360 for one that crosses: `[179.8, s, 180.1, n]`.

  Fit the map's camera to it once the sources are registered, with MapLibre's `fitBounds()` for instance, so the map opens on every itinerary the tiles draw rather than on the `center` and `zoom` it was created with. When it is null there is nothing to fit to, and the map keeps its own camera.

  Carried by a collection's specification and by no other: every other specification leaves it out. On a collection's it is always present. 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`, each as it is drawn: under a publishable key alone, and under a key with a session token minted without `user_id`, the public ones of the key's organization, as last published; under a key with a session token naming a member, every one the key's organization owns, as its draft, or as last published when `surface=published` asks for the published snapshots; under a collection share token, every one the collection holds, as last published. Zones never count toward it, drawn or not. It is not clipped to the organization's geographic boundaries, so under a publishable key it can reach past them, where a tile is refused.

  Null when none of those itineraries is drawn: the collection holds none this credential is served, none it is served has a geometry yet, or `with_itineraries` resolves to off, which on a publishable-key request includes the organization's safety rule keeping collection itineraries off. Under a key, another organization's collection draws none, so its box is null.

- `sources` (array of TileSource, required): Map sources to register, in order. Each becomes one `map.addSource()` call and carries the render-layers to draw from it.
  - `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.

### An example TileSpecification

```json
{
  "sources": [
    {
      "id": "fc79978a-0e9c-4491-a5e4-b0de35a8b508",
      "type": "vector",
      "attribution": "<a href=\"https://mountaya.com/\" target=\"_blank\">&copy; Mountaya</a>",
      "tiles": [
        "https://tiles.mountaya.com/v1/zones/{z}/{x}/{y}"
      ],
      "zoom_min": 5,
      "zoom_max": 18,
      "layers": [
        {
          "id": "zones/fc79978a-0e9c-4491-a5e4-b0de35a8b508/fills",
          "key": "",
          "type": "fill",
          "source": "fc79978a-0e9c-4491-a5e4-b0de35a8b508",
          "source_layer": "fills",
          "zoom_min": 5,
          "zoom_max": 18,
          "layout": null,
          "paint": {
            "fill-color": [
              "match",
              [
                "get",
                "level"
              ],
              "info",
              "#1c7ed6",
              "warning",
              "#f59f00",
              "danger",
              "#f03e3e",
              "resolved",
              "#37b24d",
              "#1c7ed6"
            ],
            "fill-opacity": 0.3
          }
        }
      ]
    }
  ]
}
```

## Retrieve the tile specification for the organization's itineraries

### GET /v1/itineraries/specification

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

Returns the tile specification (sources and layers) for rendering the organization's itineraries on a MapLibre GL map. The response includes tile URLs, layer configuration, paint properties, and zoom range constraints needed to add itineraries as a vector source.

Itinerary tiles contain three source layers: `itinerary_lines` for segment line geometries, `itinerary_points` for point geometries and `itinerary_restrictions` for the restricted stretches of a segment, which no layer of this specification draws (see the tile route). The `itinerary_points` layer carries both true waypoints and the per-itinerary start and end markers, all rendered by a single symbol layer keyed on `section-icon-<icon>-<hex>`. Every feature exposes `icon` and `color`, with `icon = 'flag-start' | 'flag-end'` for endpoint markers. Endpoint marker features also carry an informational `marker_role` (`start` / `end`) that is absent on waypoints. The itineraries the tiles draw are the ones `getItineraries` lists for the same credential: the organization's public itineraries as last published under a key alone or with a session token minted without `user_id`; its public and private itineraries as drafts when a session token naming a member accompanies the key; and none under a share token.

A publishable key needs the `tiles` scope, or `publishing` on a request from a page on Mountaya's own domain. A share token carries its own authority and needs none.

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

**Response** `200`

Tile specification: the sources and render-layers to register before the map starts fetching these itineraries' `{z}/{x}/{y}` tiles.

- `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` (TileSpecification, required): Rendering specification for a tile resource. Returned by every `/specification` endpoint and consumed once while a map is initializing: iterate `sources` and call `map.addSource()` for each, then iterate the `layers` inside each source and call `map.addLayer()` for each. The map library then fetches the `{z}/{x}/{y}` tiles automatically. A collection's specification also carries `bbox`, the extent of the itineraries its tiles draw, which is where to fit the camera once the sources are registered.

  Served to a publishable key, every `zoom_min` and `zoom_max` in it is already narrowed to the organization's zoom-bounds safety rule, so a map that follows it asks only for tiles that rule serves. A layer's range is intersected with the bounds, and a layer whose range lies wholly outside them is left out, as is a source left with no layer. A source's own range is clamped into the bounds rather than intersected, so a source whose tiles stop below the bounds still reports a range inside them, and the tiles past its own ceiling are cut from their ancestors.

  See [the TileSpecification object](https://docs.mountaya.com/en/apis/tiles/reference/itineraries.md#tile-specification-object).

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

- `400`: Bad Request
- `401`: Unauthorized
- `402`: A publishable-key request from an organization whose entitlements do not grant the capability the request needs: `tiles`, or `publishing` on a request from a page on Mountaya's own domain. Both are granted by the organization's agreement with Mountaya, so this clears when the agreement changes rather than when the request does. No tile and no specification is served for it. The capability is checked before the key's scope, so a key that lacks the scope as well is answered this rather than a `403`. It is not a permissions failure and does not clear by changing the request. A share-token request is never answered with this status: a share link is never refused for a capability.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the scope the request needs (`tiles`, or `publishing` on a request from a page on Mountaya's own domain), or the request's page is not an allowed one: under a key, one outside the organization's allowed domains, and under a share token, any page not on Mountaya's own domain. A share token is otherwise never refused here: the specification describes layers rather than content, and is served to it as to any caller.
- `405`: The path takes `GET`, `HEAD`, which answers the headers a `GET` would with no body, and `OPTIONS` as a CORS preflight, and nothing else. Every route on this surface reads, so a write method is refused before the credential is even looked at, which is why this answers ahead of `401`. The `Allow` response header names the methods the path does take.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# The specification is JSON in the usual envelope: register everything under
# .data.sources, then the layers inside each source.
curl -s "https://tiles.mountaya.com/v1/itineraries/specification" \
  -H "X-API-Key: pk_your_publishable_key" | jq '.data.sources[] | {id, type, tiles, zoom_min, zoom_max}'
```

**TypeScript**

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

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

const { data } = await mountaya.tiles.getItinerariesSpecification();

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://tiles.mountaya.com/v1/itineraries/specification",
    headers={
        "X-API-Key": "pk_your_publishable_key",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "sources": [
      {
        "id": "fc79978a-0e9c-4491-a5e4-b0de35a8b508",
        "type": "vector",
        "attribution": "<a href=\"https://mountaya.com/\" target=\"_blank\">&copy; Mountaya</a>",
        "tiles": [
          "https://tiles.mountaya.com/v1/zones/{z}/{x}/{y}"
        ],
        "zoom_min": 5,
        "zoom_max": 18,
        "layers": [
          {
            "id": "zones/fc79978a-0e9c-4491-a5e4-b0de35a8b508/fills",
            "key": "",
            "type": "fill",
            "source": "fc79978a-0e9c-4491-a5e4-b0de35a8b508",
            "source_layer": "fills",
            "zoom_min": 5,
            "zoom_max": 18,
            "layout": null,
            "paint": {
              "fill-color": [
                "match",
                [
                  "get",
                  "level"
                ],
                "info",
                "#1c7ed6",
                "warning",
                "#f59f00",
                "danger",
                "#f03e3e",
                "resolved",
                "#37b24d",
                "#1c7ed6"
              ],
              "fill-opacity": 0.3
            }
          }
        ]
      }
    ]
  }
}
```

## Retrieve a vector tile of the organization's itineraries

### GET /v1/itineraries/{z}/{x}/{y}

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

Returns a vector tile of the organization's itineraries at the given zoom level, x, and y coordinates. The response is Mapbox Vector Tile (MVT) binary data. The itineraries it draws are the ones `getItineraries` lists for the same credential: the organization's public itineraries as last published under a key alone or with a session token minted without `user_id`; its public and private itineraries as drafts when a session token naming a member accompanies the key; and none under a share token, which is answered an empty tile. A publishable-key request for a tile outside the organization's zoom bounds or geographic boundaries is a `400`.

The optional `organization_id` names the studio scope the tile is drawn in. Under a publishable key or a share token it may name only the credential's own organization and changes nothing. From Mountaya's web application it chooses which itineraries are drawn: the person's own, which belong to no organization, when it is omitted, and the itineraries of an organization the person is a member of when it names one, never those of another space the person belongs to. A map that follows the layer catalog sends the value the catalog was served for, because the itinerary layer's URL template carries it.

Itinerary tiles are returned as vector data. They must be used as a `vector` source. Three source layers are exposed: `itinerary_lines` for segment geometries, `itinerary_points` for both true waypoints and the derived per-itinerary start and end markers, and `itinerary_restrictions` for the stretches of a segment that follow a way restricting who may pass. Every point feature carries `icon` and `color` so a single symbol layer keyed on `section-icon-<icon>-<hex>` covers waypoints (each waypoint's own `icon`) and the endpoint markers (`icon = 'flag-start' | 'flag-end'`). Endpoint marker features also carry an informational `marker_role` (`start` / `end`) that is absent on waypoints and can be used to disambiguate clicks; it is not needed for rendering.

`itinerary_restrictions` carries, from zoom 9, one line feature for each stretch of a segment's `road_access_info` that restricts who may pass: the segment's line cut between the stretch's two indexes, never across two of its lines. A feature carries `segment_id`, `itinerary_id` and `kind`, the most severe of the stretch's restrictions: `forbidden` for `no`, `private` for `private`, `permit` for `permit`, `service` for `service`, `local-access` for `destination`, `customers` and `delivery`, and `restricted` for `restricted`, `unknown` and any value this list does not name. A stretch whose restrictions are only `permissive`, `agricultural` or `forestry` has no kind and is not drawn. The specification declares no layer for it: a map that draws restricted stretches adds layers of its own over it, as `@mountaya/elements` does.

Details for consuming itineraries can be found in [the specification endpoint](https://docs.mountaya.com/en/apis/tiles/reference/itineraries.md#getItinerariesSpecification).

This route is consumed as a URL template rather than called directly. The matching specification endpoint returns it under `sources[].tiles` with the `{z}`, `{x}` and `{y}` placeholders intact, and a map library (MapLibre GL JS, Mapbox GL JS, or `@mountaya/elements`) expands and fetches them on its own schedule. The generated SDKs bind no method for it.

A publishable key needs the `tiles` scope, or `publishing` on a request from a page on Mountaya's own domain. A share token carries its own authority and needs none.

**Path parameters**

- `z` (integer (int32), in path, required): Zoom level. Higher values show more detail over a smaller area. On a publishable-key request for anything but the base map (a terrain's tiles, the tiles of the sources its style draws and the elevation raster's), the organization's zoom-bounds safety rule narrows the accepted range, and a `z` outside it is a 400 naming `z`, so a structurally valid value can still be refused. Each layer's `zoom_min` and `zoom_max` in the specification say where a map should ask for tiles; they are not a refusal. A specification served to a publishable key reports them already narrowed to that rule, so a map that follows it asks only for a `z` the rule accepts.

- `x` (integer (int32), in path, required): Tile column index at the given zoom level, from 0 to 2^z - 1 inclusive. An index at or past 2^z addresses no tile and is a `400` naming `x`, as a negative or non-integer one is, so an index computed wrongly is refused before anything is drawn or fetched for it.

- `y` (integer (int32), in path, required): Tile row index at the given zoom level, from 0 to 2^z - 1 inclusive. An index at or past 2^z addresses no tile and is a `400` naming `y`, as a negative or non-integer one is, so an index computed wrongly is refused before anything is drawn or fetched for it.

**Query parameters**

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

- `organization_id` (string (uuid), in query, optional): The studio scope the map draws in, named by the organization's identifier. A value that is not a UUID in its canonical form, or the nil UUID, is a `400` naming `organization_id`.

  Under a publishable key or a share token it may name only the credential's own organization: any other identifier is a `403`, whether or not it exists. It changes nothing but being echoed, so a request sending it is answered as one that omits it, and every URL template an answer returns under `sources[].tiles` for a layer that takes it carries the same `organization_id`.

  A request from Mountaya's web application, which carries the person's own session rather than a key or a share token, uses it to choose the scope it draws in. Omitted, the scope is the person's own space, which has no identifier of its own to send. Naming an organization the person is a member of makes that organization the scope. Any other identifier, an organization the person is not a member of or one that does not exist, is a `404`, so the parameter cannot be used to learn which organizations exist.

  What a scope draws depends on the layer. The overlays served under a key or a share token are the ones the organization's overlay allowlist admits. From Mountaya's web application, the person's own space draws the points of interest alone, and an organization draws every overlay when it holds Map Studio and the points of interest alone when it does not, an overlay outside the scope being a `403`. The itinerary and zone tiles draw what the scope holds: in the person's own space, their own itineraries and zones, which belong to no organization, and in an organization, its itineraries and zones, never those of another space the person belongs to.

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

**Response** `200` `application/x-protobuf`

Mapbox Vector Tile (MVT) binary for the requested `{z}/{x}/{y}` tile. Empty (zero-length) when no features fall inside the tile.

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

- `400`: Bad Request
- `401`: Unauthorized
- `402`: A publishable-key request from an organization whose entitlements do not grant the capability the request needs: `tiles`, or `publishing` on a request from a page on Mountaya's own domain. Both are granted by the organization's agreement with Mountaya, so this clears when the agreement changes rather than when the request does. No tile and no specification is served for it. The capability is checked before the key's scope, so a key that lacks the scope as well is answered this rather than a `403`. It is not a permissions failure and does not clear by changing the request. A share-token request is never answered with this status: a share link is never refused for a capability.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the scope the request needs (`tiles`, or `publishing` on a request from a page on Mountaya's own domain), or the request's page is not an allowed one: under a key, one outside the organization's allowed domains, and under a share token, any page not on Mountaya's own domain. So is an `organization_id` naming an organization other than the credential's own, whether or not it exists. A share token is otherwise never refused here: this aggregate answers it empty rather than refusing it.
- `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 or a share token an identifier other than the credential's own organization is a `403` instead, whether or not it exists. The tile coordinates are checked first, so a request failing them is a `400` whatever it names.
- `405`: The path takes `GET`, `HEAD`, which answers the headers a `GET` would with no body, and `OPTIONS` as a CORS preflight, and nothing else. Every route on this surface reads, so a write method is refused before the credential is even looked at, which is why this answers ahead of `401`. The `Allow` response header names the methods the path does take.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# The body is the tile's bytes, not JSON. A map library fetches these URLs
# itself and cannot set a header, so a browser sends ?publishable_key= instead.
curl -s "https://tiles.mountaya.com/v1/itineraries/12/2126/1458" \
  -H "X-API-Key: pk_your_publishable_key" -o tile.mvt
```

**TypeScript**

```typescript
// A map library requests each tile itself and cannot set a header, so the credential rides the query.
const tiles = `https://tiles.mountaya.com/v1/itineraries/{z}/{x}/{y}?publishable_key=${publishableKey}`;
```

**Python**

```python
import requests

response = requests.get(
    "https://tiles.mountaya.com/v1/itineraries/12/2126/1458",
    headers={
        "X-API-Key": "pk_your_publishable_key",
    },
    timeout=30,
)
response.raise_for_status()
with open("tile.mvt", "wb") as file:
    file.write(response.content)
```

## Retrieve the tile specification for a single itinerary

### GET /v1/itineraries/{itinerary_id}/specification

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

Returns the tile specification (sources and layers) for rendering a single itinerary on a MapLibre GL map. The response includes tile URLs, layer configuration, paint properties, and zoom range constraints needed to add the itinerary as a vector source.

Itinerary tiles contain three source layers: `itinerary_lines` for line geometries, `itinerary_points` for point geometries (waypoints and the per-itinerary endpoint markers), and `itinerary_restrictions` for the restricted stretches of a segment, which no layer of this specification draws (see the tile route).

A publishable key needs the `tiles` scope, or `publishing` on a request from a page on Mountaya's own domain. A share token carries its own authority and needs none.

**Path parameters**

- `itinerary_id` (string (uuid), in path, required): Identifier of the itinerary the operation acts on. An itinerary 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 itinerary ids exist.

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

**Response** `200`

Tile specification: the sources and render-layers to register before the map starts fetching this resource's `{z}/{x}/{y}` tiles.

- `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` (TileSpecification, required): Rendering specification for a tile resource. Returned by every `/specification` endpoint and consumed once while a map is initializing: iterate `sources` and call `map.addSource()` for each, then iterate the `layers` inside each source and call `map.addLayer()` for each. The map library then fetches the `{z}/{x}/{y}` tiles automatically. A collection's specification also carries `bbox`, the extent of the itineraries its tiles draw, which is where to fit the camera once the sources are registered.

  Served to a publishable key, every `zoom_min` and `zoom_max` in it is already narrowed to the organization's zoom-bounds safety rule, so a map that follows it asks only for tiles that rule serves. A layer's range is intersected with the bounds, and a layer whose range lies wholly outside them is left out, as is a source left with no layer. A source's own range is clamped into the bounds rather than intersected, so a source whose tiles stop below the bounds still reports a range inside them, and the tiles past its own ceiling are cut from their ancestors.

  See [the TileSpecification object](https://docs.mountaya.com/en/apis/tiles/reference/itineraries.md#tile-specification-object).

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

- `400`: Bad Request
- `401`: Unauthorized
- `402`: A publishable-key request from an organization whose entitlements do not grant the capability the request needs: `tiles`, or `publishing` on a request from a page on Mountaya's own domain. Both are granted by the organization's agreement with Mountaya, so this clears when the agreement changes rather than when the request does. No tile and no specification is served for it. The capability is checked before the key's scope, so a key that lacks the scope as well is answered this rather than a `403`. It is not a permissions failure and does not clear by changing the request. A share-token request is never answered with this status: a share link is never refused for a capability.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the scope the request needs (`tiles`, or `publishing` on a request from a page on Mountaya's own domain), or the request's page is not an allowed one: under a key, one outside the organization's allowed domains, and under a share token, any page not on Mountaya's own domain. A share token used outside its grant is not refused here: it is a `404`, exactly as a resource that does not exist is.
- `404`: No itinerary with that identifier is reachable: either none exists, or this credential does not reach it. The two answer alike, so this status cannot be used to learn which itinerary ids exist. So does an itinerary that has never been published, or has been taken down, or whose organization's agreement does not include Map Publishing, when this credential reads it as published rather than as its draft: the specification answers it as the itinerary's own read does, so it never describes tiles for an itinerary that read answers as absent.
- `405`: The path takes `GET`, `HEAD`, which answers the headers a `GET` would with no body, and `OPTIONS` as a CORS preflight, and nothing else. Every route on this surface reads, so a write method is refused before the credential is even looked at, which is why this answers ahead of `401`. The `Allow` response header names the methods the path does take.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# The specification is JSON in the usual envelope: register everything under
# .data.sources, then the layers inside each source.
curl -s "https://tiles.mountaya.com/v1/itineraries/0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21/specification" \
  -H "X-API-Key: pk_your_publishable_key" | jq '.data.sources[] | {id, type, tiles, zoom_min, zoom_max}'
```

**TypeScript**

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

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

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

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://tiles.mountaya.com/v1/itineraries/0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21/specification",
    headers={
        "X-API-Key": "pk_your_publishable_key",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["data"])
```

Response 200:

```json
{
  "data": {
    "sources": [
      {
        "id": "fc79978a-0e9c-4491-a5e4-b0de35a8b508",
        "type": "vector",
        "attribution": "<a href=\"https://mountaya.com/\" target=\"_blank\">&copy; Mountaya</a>",
        "tiles": [
          "https://tiles.mountaya.com/v1/zones/{z}/{x}/{y}"
        ],
        "zoom_min": 5,
        "zoom_max": 18,
        "layers": [
          {
            "id": "zones/fc79978a-0e9c-4491-a5e4-b0de35a8b508/fills",
            "key": "",
            "type": "fill",
            "source": "fc79978a-0e9c-4491-a5e4-b0de35a8b508",
            "source_layer": "fills",
            "zoom_min": 5,
            "zoom_max": 18,
            "layout": null,
            "paint": {
              "fill-color": [
                "match",
                [
                  "get",
                  "level"
                ],
                "info",
                "#1c7ed6",
                "warning",
                "#f59f00",
                "danger",
                "#f03e3e",
                "resolved",
                "#37b24d",
                "#1c7ed6"
              ],
              "fill-opacity": 0.3
            }
          }
        ]
      }
    ]
  }
}
```

## Retrieve a vector tile of a single itinerary

### GET /v1/itineraries/{itinerary_id}/{z}/{x}/{y}

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

Returns a vector tile for a single itinerary at the given zoom level, x, and y coordinates. The response is Mapbox Vector Tile (MVT) binary data.

Itinerary tiles contain three source layers: `itinerary_lines` for line geometries, `itinerary_points` for point geometries (waypoints and the per-itinerary endpoint markers), and `itinerary_restrictions` for the stretches of a segment that follow a way restricting who may pass. A publishable-key request for a tile outside the organization's zoom bounds is a `400`; this route is not held to the geographic boundaries.

`itinerary_restrictions` carries, from zoom 9, one line feature for each stretch of a segment's `road_access_info` that restricts who may pass: the segment's line cut between the stretch's two indexes, never across two of its lines. A feature carries `segment_id`, `itinerary_id` and `kind`, the most severe of the stretch's restrictions: `forbidden` for `no`, `private` for `private`, `permit` for `permit`, `service` for `service`, `local-access` for `destination`, `customers` and `delivery`, and `restricted` for `restricted`, `unknown` and any value this list does not name. A stretch whose restrictions are only `permissive`, `agricultural` or `forestry` has no kind and is not drawn. The specification declares no layer for it: a map that draws restricted stretches adds layers of its own over it, as `@mountaya/elements` does.

Details for consuming an itinerary tile can be found in [the specification endpoint](https://docs.mountaya.com/en/apis/tiles/reference/itineraries.md#getItinerarySpecification).

This route is consumed as a URL template rather than called directly. The matching specification endpoint returns it under `sources[].tiles` with the `{z}`, `{x}` and `{y}` placeholders intact, and a map library (MapLibre GL JS, Mapbox GL JS, or `@mountaya/elements`) expands and fetches them on its own schedule. The generated SDKs bind no method for it.

A publishable key needs the `tiles` scope, or `publishing` on a request from a page on Mountaya's own domain. A share token carries its own authority and needs none.

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

**Path parameters**

- `itinerary_id` (string (uuid), in path, required): Identifier of the itinerary the operation acts on. An itinerary 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 itinerary ids exist.

- `z` (integer (int32), in path, required): Zoom level. Higher values show more detail over a smaller area. On a publishable-key request for anything but the base map (a terrain's tiles, the tiles of the sources its style draws and the elevation raster's), the organization's zoom-bounds safety rule narrows the accepted range, and a `z` outside it is a 400 naming `z`, so a structurally valid value can still be refused. Each layer's `zoom_min` and `zoom_max` in the specification say where a map should ask for tiles; they are not a refusal. A specification served to a publishable key reports them already narrowed to that rule, so a map that follows it asks only for a `z` the rule accepts.

- `x` (integer (int32), in path, required): Tile column index at the given zoom level, from 0 to 2^z - 1 inclusive. An index at or past 2^z addresses no tile and is a `400` naming `x`, as a negative or non-integer one is, so an index computed wrongly is refused before anything is drawn or fetched for it.

- `y` (integer (int32), in path, required): Tile row index at the given zoom level, from 0 to 2^z - 1 inclusive. An index at or past 2^z addresses no tile and is a `400` naming `y`, as a negative or non-integer one is, so an index computed wrongly is refused before anything is drawn or fetched for it.

**Query parameters**

- `revision` (string, in query, optional): Opaque change-feed token from the collaboration event stream. It never changes what is drawn: the tile is always the latest content. It changes only how the response may be cached: a draft's response to a URL carrying a token may be kept for good when the tile was cut from the version of the itinerary's tiles the server holds, and is `private` otherwise, while a published snapshot's is cached as it would be without one (see the `Cache-Control` response header), and an itinerary's tokens only move forward, so every peer that asks for the same `?revision=<token>` URL after a change event asks for a URL no cache has seen before. Accepted syntax is a plain integer or an event stream id (two integers joined by a hyphen, e.g. `1720512345678-0`), at most 64 characters.

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

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

**Response** `200` `application/x-protobuf`

Mapbox Vector Tile (MVT) binary for the requested `{z}/{x}/{y}` tile. Empty (zero-length) when no features fall inside the tile. An itinerary this credential is served nothing of is the `404` below, never an empty tile.

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

- `400`: Bad Request
- `401`: Unauthorized
- `402`: A publishable-key request from an organization whose entitlements do not grant the capability the request needs: `tiles`, or `publishing` on a request from a page on Mountaya's own domain. Both are granted by the organization's agreement with Mountaya, so this clears when the agreement changes rather than when the request does. No tile and no specification is served for it. The capability is checked before the key's scope, so a key that lacks the scope as well is answered this rather than a `403`. It is not a permissions failure and does not clear by changing the request. A share-token request is never answered with this status: a share link is never refused for a capability.
- `403`: The credential is valid and this operation is not open to it: the key does not carry the scope the request needs (`tiles`, or `publishing` on a request from a page on Mountaya's own domain), or the request's page is not an allowed one: under a key, one outside the organization's allowed domains, and under a share token, any page not on Mountaya's own domain. A share token used outside its grant is not refused here: it is a `404`, exactly as a resource that does not exist is. A request that passes `surface=published` for a personal itinerary, one owned by no organization, is refused here as well: see the description above.
- `404`: No itinerary with that identifier is reachable: either none exists, or this credential does not reach it. The two answer alike, so this status cannot be used to learn which itinerary ids exist. So does an itinerary that has never been published, or has been taken down, or whose organization's agreement does not include Map Publishing, when this credential reads it as published rather than as its draft: the tile answers it as the itinerary's own read does. A personal itinerary is never published, so it answers here to every caller but the person whose itinerary it is, with or without `surface=published`.
- `405`: The path takes `GET`, `HEAD`, which answers the headers a `GET` would with no body, and `OPTIONS` as a CORS preflight, and nothing else. Every route on this surface reads, so a write method is refused before the credential is even looked at, which is why this answers ahead of `401`. The `Allow` response header names the methods the path does take.
- `429`: `TooManyRequests`, given in full at the end of this page.
- `500`: Internal Server Error
- `504`: Gateway Timeout

**cURL**

```bash
# The body is the tile's bytes, not JSON. A map library fetches these URLs
# itself and cannot set a header, so a browser sends ?publishable_key= instead.
curl -s "https://tiles.mountaya.com/v1/itineraries/0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21/12/2126/1458" \
  -H "X-API-Key: pk_your_publishable_key" -o tile.mvt
```

**TypeScript**

```typescript
// A map library requests each tile itself and cannot set a header, so the credential rides the query.
const tiles = `https://tiles.mountaya.com/v1/itineraries/0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21/{z}/{x}/{y}?publishable_key=${publishableKey}`;
```

**Python**

```python
import requests

response = requests.get(
    "https://tiles.mountaya.com/v1/itineraries/0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21/12/2126/1458",
    headers={
        "X-API-Key": "pk_your_publishable_key",
    },
    timeout=30,
)
response.raise_for_status()
with open("tile.mvt", "wb") as file:
    file.write(response.content)
```

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

- `TooManyRequests` (`429`): A bound the request's surface is held to is spent: for the organization's own clients and its hosted embed, the organization's per-minute limit or its monthly allowance, or, under a key sent without a session token or with one minted without `user_id`, the bound on the client's IP address, an IPv6 address counted by its `/64` prefix; for an Embedded Studio, the bound of the member its session names, or of its client IP address for a session minted without `user_id`, or its organization's; for a share link, the bound on the client's IP address or the bound of the organization that owns the link; for Mountaya's web application, the 6,000 a minute of the person signed in to it, which carries no rate-limit fields. Or the client's IP address has had 60 unknown share tokens refused within the minute, or 60 unknown publishable keys, a key refused again within seconds counted once, and the token or the key it sends was not resolved moments earlier. Every one carries `Retry-After`: for a per-minute bound, the seconds left in the minute; for a spent monthly allowance, the whole seconds until the organization's next billing period begins, until which every request of the organization's own clients and of its hosted embed, specifications included, is refused; for a share token or a publishable key refused because its address had 60 unknown ones refused, the seconds left in that minute. A share token or a publishable key resolved moments earlier is never refused that last way. `RateLimit-Policy` and `RateLimit` say which bound was spent, except on the refusal of an unknown share token or of an unknown publishable key, which no bound of the organization's counts: that answer carries no `RateLimit-Policy` or `RateLimit` field.
