# Zones

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

Zones as vector tiles, carrying each zone's name, severity and validity window, which a client labels and styles them by.

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

### GET /v1/zones/specification

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

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

Zone tiles carry one source-layer, `fills`, holding each zone's polygon, color-coded by severity level (info, warning, danger, resolved): one feature for each of its polygons, clipped exactly to a window from two tiles' width before the tile's square to one past it, so a feature may extend past the square and is not the zone's whole outline. A zone stored before outlines were checked on write is approximated where it passes through that window many times until Mountaya has checked it, shortly after the release, and for good when its outline breaks a rule a write now holds it to: a valid polygon of at most 10,000 positions that no meridian or parallel crosses more than 512 times.

A zone drawn from its draft carries its `id`, `name`, `level`, `mode`, `is_private`, `revision` and `created_by` as properties, and its `organization_id`, `description`, `start_at` and `end_at` when it has them: a personal zone, owned by no organization, carries no `organization_id`. A zone drawn from its publication carries what a published itinerary does: its `id`, `name`, `level` and `mode`, and its `description`, `start_at` and `end_at` when the publication has them, never who made it, which organization holds it, its privacy or its revision. The two bounds are Unix seconds, so a style can filter on a zone's validity window. The zones the tiles draw are the ones `getZones` lists for the same credential: the organization's public zones as last published under a key alone or with a session token minted without `user_id`; its public and private zones 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 the zones `{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/zones/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.getZonesSpecification();

console.log(data);
```

**Python**

```python
import requests

response = requests.get(
    "https://tiles.mountaya.com/v1/zones/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 zones

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

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

Returns a vector tile for zones at the given zoom level, x, and y coordinates. The response is Mapbox Vector Tile (MVT) binary data. The zones it draws are the ones `getZones` lists for the same credential: the organization's public zones as last published under a key alone or with a session token minted without `user_id`; its public and private zones as drafts when a session token naming a member accompanies the key, unless `surface=published` asks for the published snapshots; and none under a share token, which is answered an empty tile. A collection holding a zone adds nothing to this aggregate. A collection's zones are drawn by [the collection tile endpoint](https://docs.mountaya.com/en/apis/tiles/reference/collections.md#getCollectionTile) with `with_zones=true`, which renders a single collection in isolation, and only for a credential that could list them. There is no tile of one zone alone. 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 zones are drawn: the person's own, which belong to no organization, when it is omitted, and the zones 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 zone layer's URL template carries it.

Zone tiles are returned as vector data. They must be used as a `vector` source. The tile carries one source-layer, `fills`, holding each zone's polygon. A zone is one feature for each of its polygons. A feature's geometry is that polygon clipped exactly to a window around the tile, however intricate it is, from two tiles' width before its square to one tile's width past it, -8192 to 8191 in the tile's 4,096-unit coordinates, so it may extend past the tile's square and is not the zone's whole outline. Draw it clipped to the tile, as a map library does, and take a zone's outline from the zone itself, never from a tile. A zone stored before outlines were checked on write is checked by Mountaya shortly after the release; until it has been, and for good when its outline breaks a rule a write now holds it to (a valid polygon, at most 10,000 positions, no meridian or parallel crossing it more than 512 times, which a zone computed from a source was not held to), it is carried as it is stored and approximated where it passes through that window many times. The work of one tile is bounded: a tile whose zones take longer than that to draw is the `504` of a spent budget.

A zone drawn from its draft carries its `id`, `name`, `level`, `mode`, `is_private`, `revision` and `created_by` as properties, and its `organization_id`, `description`, `start_at` and `end_at` when it has them: a personal zone, owned by no organization, carries no `organization_id`. A zone drawn from its publication carries what a published itinerary does: its `id`, `name`, `level` and `mode`, and its `description`, `start_at` and `end_at` when the publication has them, never who made it, which organization holds it, its privacy or its revision. The two bounds are Unix seconds, so a style can filter on a zone's validity window.

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

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.

- `timestamp` (string (date-time), in query, optional): Selects the instant the tile is drawn for. When absent, the time filter is disabled and EVERY zone is returned whatever its validity window, which is the usual choice for a client that styles out-of-window zones itself. When present, only zones active at that instant are returned, the instant being rounded down to the hour, in UTC, first.

  The window it accepts is 3 days into the past and 6 days into the future, measured from the moment the request arrives. It is relative rather than fixed, which is why it is stated here and not as a `minimum` and `maximum`: a value outside it is a 400 naming `timestamp`.

  It only affects time-bound zones. Permanent zones are returned either way.

- `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 and the `timestamp` 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= and
# ?session_token= instead. With a session naming a member the zones are
# drawn as drafts; the key alone draws the published public ones.
curl -s "https://tiles.mountaya.com/v1/zones/12/2126/1458" \
  -H "X-API-Key: pk_your_publishable_key" -H "X-Session-Token: sess_your_session_token" -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/zones/{z}/{x}/{y}?publishable_key=${publishableKey}&session_token=${sessionToken}`;
```

**Python**

```python
import requests

response = requests.get(
    "https://tiles.mountaya.com/v1/zones/12/2126/1458",
    headers={
        "X-API-Key": "pk_your_publishable_key",
        "X-Session-Token": "sess_your_session_token",
    },
    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.
