# Quickstart

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

Fetch an overlay specification with your key, then draw its sources and layers on a MapLibre map.

Add Mountaya's hillshade to a MapLibre GL JS map you already run. You fetch the overlay's specification, then register the sources and layers it lists.

**Comes with an agreement:** [talk to us](https://mountaya.com/en/contact/) to start one.

> **A new organization draws no overlay yet**
>
> Your overlay allowlist starts empty, so every overlay answers `403 Forbidden` until Mountaya lists it as your agreement states. [Talk to us](https://mountaya.com/en/contact/) to add `hillshade`.

**1. Export your key**

Use a publishable key with the `tiles` scope, from **Organization → API keys** in the [Mountaya app](https://app.mountaya.com/api-keys).

```bash
export MOUNTAYA_PUBLISHABLE_KEY="pk_your_publishable_key"
```

**2. Fetch the overlay specification**

Each overlay describes the sources and layers to add, with their style already set.

**cURL**

```bash
curl https://tiles.mountaya.com/v1/overlays/hillshade/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 } = await mountaya.tiles.getOverlaySpecification({ overlay: "hillshade" });

for (const source of data.sources) {
  console.log(source.id, source.type, source.tiles);
}
```

**Python**

```python
import os
import requests

specification = requests.get(
    "https://tiles.mountaya.com/v1/overlays/hillshade/specification",
    headers={"X-API-Key": os.environ["MOUNTAYA_PUBLISHABLE_KEY"]},
    timeout=10,
).json()["data"]

for source in specification["sources"]:
    print(source["id"], source["type"], source["tiles"])
```

**Response**

```json
{
  "data": {
    "sources": [
      {
        "attribution": "<a href=\"https://www.maptiler.com/copyright/\" target=\"_blank\">&copy; MapTiler</a>",
        "id": "cb2e95b5-d2e0-404a-a22e-d1964e38ef39",
        "layers": [
          {
            "id": "overlay/58da3aaa-b470-4a3b-a689-7954ff6eebad",
            "key": "hillshade",
            "layout": null,
            "legend": {
              "locales": {
                "de": null,
                "en": {
                  "description": "The hillshade layer simulates the interaction of light with the terrain, where lighter areas indicate peaks and higher elevations, and darker areas represent valleys and lower terrain. The shading dynamically adjusts based on the timestamp control and the simulated light source angle, providing a more realistic 3D view of the landscape's topography."
                },
                "es": null,
                "fr": {
                  "description": "Le calque des zones d'ombre simule l'interaction de la lumière avec le terrain, où les zones plus claires indiquent les sommets et les hauteurs, tandis que les zones plus sombres représentent les vallées et les terrains plus bas. Les zones d'ombre s'ajustent dynamiquement en fonction du contrôle temporel des calques et de l'angle de la source lumineuse simulée, offrant ainsi une vue 3D plus réaliste du terrain."
                },
                "it": null,
                "ja": null,
                "zh": null
              }
            },
            "paint": {
              "hillshade-accent-color": "hsla(0, 0%, 100%, 0.0)",
              "hillshade-exaggeration": 1,
              "hillshade-highlight-color": "hsla(0, 0%, 100%, 0.0)",
              "hillshade-shadow-color": "hsla(130, 43%, 11%, 0.9)"
            },
            "source": "cb2e95b5-d2e0-404a-a22e-d1964e38ef39",
            "source_layer": "",
            "type": "hillshade",
            "zoom_max": 14,
            "zoom_min": 8
          }
        ],
        "size": 512,
        "tiles": [
          "https://tiles.mountaya.com/v1/overlays/hillshade/{z}/{x}/{y}"
        ],
        "type": "raster-dem",
        "zoom_max": 14,
        "zoom_min": 8
      }
    ]
  }
}
```

Hillshade has one `raster-dem` source, which holds elevation, and one `hillshade` layer drawn from it.

**3. Draw it on your map**

Add each source, then its layers, once the map has loaded. A map fetches tiles on its own and cannot send headers, so add your key to each tile URL as `publishable_key`.

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

map.on("load", async () => {
  const response = await fetch(
    "https://tiles.mountaya.com/v1/overlays/hillshade/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,
      ...(source.size ? { tileSize: source.size } : {}),
    });

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

Zoom in on the mountains: hillshade draws from its layer's `zoom_min`. To draw another overlay, change the slug in the specification URL.

- Credentials: a publishable key (`pk_…`) with the `tiles` scope, in `X-API-Key` or the `publishable_key` query parameter. Add a session token (`X-Session-Token` or `session_token`) when the organization enables the `require_session_token` safety rule; without one, a bare key is then `401`. A token minted without `user_id` satisfies the rule and draws what the key alone does. The header wins over the query parameter; a query parameter present without its prefix (`pk_`, `sess_`, `share_`) is `401`.
- The `tiles` scope opens the Tile API only while the organization's agreement includes the Tile API product. Until then the `tiles` box is unavailable when creating a key, and a request under the scope is `402`.
- The specification's `tiles` templates carry no credential. A renderer fetches them itself and cannot set headers, so append `publishable_key` (and `session_token` where required) to each. A template may already carry a query string (`organization_id`), so join with `&` when it has a `?`.
- Each source carries `id`, `type` (`vector`, `raster`, or `raster-dem`), `tiles`, `zoom_min`, `zoom_max`, `attribution`, `layers`, and `size` (256 or 512, `raster` and `raster-dem` only) for `tileSize`. Each layer carries `id`, `key`, `type`, `source`, `source_layer` (MapLibre's `source-layer`, empty for raster layers), `zoom_min`, `zoom_max`, `paint` and `layout` (each possibly null), an optional `filter`, and an optional `legend` with per-language descriptions.
- An overlay renders only once the organization's overlay allowlist admits it. The allowlist starts empty on a new organization, so every overlay is a `403` under your key until Mountaya lists its slug, or `*`, as your agreement states. `GET /v1/tile-layers` lists the overlays your key may draw.
- A weather or snow tile asked for more than 15 minutes from now is a `403` unless the organization's overlay time control allows it. See [the allowlist and the time control](https://docs.mountaya.com/en/apis/tiles/overlays.md#the-allowlist-and-the-time-control).
- For a forecast overlay such as `temperature-actual`, add a `timestamp` parameter (RFC 3339) to its tile URLs beside the key.
- The snippets target `maplibre-gl` running in your own application; the same code runs on Mapbox GL JS and the MapTiler SDK. See [integration](https://docs.mountaya.com/en/apis/tiles/integration.md).

## Next steps

- [Base maps](https://docs.mountaya.com/en/apis/tiles/base-maps.md): Draw a Mountaya base map under the overlay.
- [Overlays](https://docs.mountaya.com/en/apis/tiles/overlays.md): The catalog and the forecast time parameter.
- [Integration](https://docs.mountaya.com/en/apis/tiles/integration.md): Mapbox, MapTiler, and deck.gl.
