# Base maps

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

Draw a Mountaya base map in MapLibre: pick a terrain from the catalog, hand its style to the map, and add 3D elevation.

A Mountaya base map is a complete map style: topography, labels, and icons. Pick a terrain from the catalog, then hand its style address to your map.

The samples read a publishable key with the `tiles` scope from `MOUNTAYA_PUBLISHABLE_KEY`.

## List the terrains

The layer catalog names each terrain with a style address for its light and dark versions, plus the elevation source.

**cURL**

```bash
curl -s https://tiles.mountaya.com/v1/tile-layers \
  -H "X-API-Key: $MOUNTAYA_PUBLISHABLE_KEY" \
  | jq '{terrains: [.data.terrains[] | {slug, style: .variants.light.style.url}], elevation: .data.elevation.url}'
```

**TypeScript**

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

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

const { data: catalog } = await mountaya.tiles.getTileLayers();

for (const terrain of catalog.terrains) {
  console.log(terrain.slug, terrain.variants.light.style.url);
}
console.log(catalog.elevation.url);
```

**Python**

```python
import os
import requests

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

for terrain in catalog["terrains"]:
    print(terrain["slug"], terrain["variants"]["light"]["style"]["url"])
print(catalog["elevation"]["url"])
```

**Response**

```json
{
  "terrains": [
    {
      "slug": "topo",
      "style": "https://tiles.mountaya.com/v1/terrains/topo/light/style"
    },
    {
      "slug": "winter",
      "style": "https://tiles.mountaya.com/v1/terrains/winter/light/style"
    },
    {
      "slug": "satellite",
      "style": "https://tiles.mountaya.com/v1/terrains/satellite/light/style"
    }
  ],
  "elevation": "https://tiles.mountaya.com/v1/elevation/tiles.json"
}
```

Each terrain also carries a localized name under `locales`, for a terrain picker.

## Draw the base map

Pass the style address to MapLibre. The map fetches the style's tiles, icons, and fonts on its own and cannot send headers, so `transformRequest` adds your key to every request it makes to the Tile API.

```js
import { Map } from "maplibre-gl";

const KEY = "pk_your_publishable_key";

const map = new Map({
  container: "map",
  style: "https://tiles.mountaya.com/v1/terrains/topo/light/style",
  center: [6.8712, 45.9231],
  zoom: 11,
  pitch: 60,
  transformRequest: (url) =>
    url.startsWith("https://tiles.mountaya.com/")
      ? { url: `${url}${url.includes("?") ? "&" : "?"}publishable_key=${KEY}` }
      : { url },
});

// Optional: 3D relief from the elevation source in the catalog.
map.on("load", () => {
  map.addSource("mountaya-elevation", {
    type: "raster-dem",
    url: "https://tiles.mountaya.com/v1/elevation/tiles.json",
    tileSize: 512,
  });
  map.setTerrain({ source: "mountaya-elevation", exaggeration: 1.2 });
});
```

The `load` handler turns the map into 3D terrain: leave it out for a flat map. To switch terrain or theme, call `map.setStyle()` with another address from the catalog. Overlays draw on top: see the [quickstart](https://docs.mountaya.com/en/apis/tiles/quickstart.md).

- Catalog: `GET https://tiles.mountaya.com/v1/tile-layers`, under the `tiles` scope (or a share token). It answers `terrains`, `elevation`, `overlays`, `itineraries` and `zones`. Under a key or a share token, `overlays` lists only the overlays the organization's allowlist admits. Read addresses from the catalog rather than writing them.
- A terrain: `id`, `slug` (`topo`, `winter`, `satellite`), `locales` (per-language `name`, null where missing), and `variants.light` and `variants.dark`, each with `style.url` (`/v1/terrains/{terrain}/{variant}/style`) and `tiles` (`size` 512 and `url`, the rendition's TileJSON at `/v1/terrains/{terrain}/{variant}/tiles.json`).
- `elevation`: `id`, `tile_size` (512) and `url`, the elevation raster's TileJSON (`/v1/elevation/tiles.json`), a `raster-dem` source whose tiles are `/v1/elevation/{z}/{x}/{y}`. Read `encoding` from the TileJSON when it names one; MapLibre's default is `mapbox`.
- The style document is a complete map in the MapLibre Style Specification, answered unwrapped (no `data` envelope). Every address in it (its sources' `tiles`, `sprite`, `glyphs`) points at the Tile API under the same terrain and rendition, so the whole map is drawn under the credential you send, and no answer carries a credential of Mountaya's. A source with no address, such as the provider's attribution-only source, is passed as the provider wrote it.
- A renderer cannot set headers on the requests a style triggers, so the credential rides the query string of each request to `https://tiles.mountaya.com/`: `publishable_key`, plus `session_token` when the organization requires one, or `share_token`. Use `transformRequest` (MapLibre, Mapbox GL JS, the MapTiler SDK) to append it to every such request and leave other hosts alone.
- The style, the TileJSON documents, and every tile, sprite and glyph take the credentials an overlay tile takes: a key with the `tiles` scope (or `publishing` from a page on Mountaya's own domain), with a session token where the organization requires one, or a share token. A base map is the same for every caller, so a session token changes nothing about what is drawn. Every terrain the catalog lists is served to every credential; a slug the catalog does not list is `404`.
- Base-map requests are recorded under the resource type `terrain` and never counted toward the per-minute limit or the monthly allowance, on any surface, so a spent allowance never refuses them. One bound holds them instead: 6,000 a minute per client IP address, policy `"address"`, and a request past it is `429` with `Retry-After`. The organization's zoom bounds and geographic boundaries do not apply to them.

## Next steps

- [Overlays](https://docs.mountaya.com/en/apis/tiles/overlays.md): Hillshade, weather, slope, and snow on top of the base map.
- [Integration](https://docs.mountaya.com/en/apis/tiles/integration.md): Mapbox GL JS, the MapTiler SDK, and deck.gl.
