# Places

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

Geocode text, reverse-geocode a point, list points of interest, and search places and your own content.

Four queries find things on the map. `geocode` turns text into places, `reverseGeocode` names a point, and `pois` lists points of interest. `search` looks across all of them, trails, and your own itineraries at once.

## Set up

Every sample on this page reuses this setup. It mints a session token with your secret key, so run it on your server.

**cURL**

```bash
export MOUNTAYA_PUBLISHABLE_KEY="pk_your_publishable_key"
export MOUNTAYA_DATA_TOKEN=$(curl -s -X POST https://api.mountaya.com/v1/sessions \
  -H "X-API-Key: $MOUNTAYA_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"publishable_key\": \"$MOUNTAYA_PUBLISHABLE_KEY\"}" | jq -r .data.token)
```

**TypeScript**

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

const publishableKey = process.env.MOUNTAYA_PUBLISHABLE_KEY ?? "";
const secretKey = process.env.MOUNTAYA_SECRET_KEY ?? "";

const server = new Mountaya({ credential: { secretKey } });
const { data: session } = await new MountayaAdmin(server).sessions.postSession({
  body: { publishable_key: publishableKey },
});

const mountaya = new Mountaya({
  credential: { publishableKey, sessionToken: session.token },
});
```

**Python**

```python
import os
import requests

session = requests.post(
    "https://api.mountaya.com/v1/sessions",
    headers={"X-API-Key": os.environ["MOUNTAYA_SECRET_KEY"]},
    json={"publishable_key": os.environ["MOUNTAYA_PUBLISHABLE_KEY"]},
    timeout=10,
).json()["data"]
```

A session token lasts five minutes, so mint a new one when it expires.

## Geocode

Turn text into named places. `focus` ranks places near Chamonix first.

**cURL**

```bash
curl https://data.mountaya.com/graphql \
  -H "X-API-Key: $MOUNTAYA_PUBLISHABLE_KEY" \
  -H "X-Session-Token: $MOUNTAYA_DATA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query Geocode($input: GeocodeInput!) { geocode(input: $input) { count places { name label layer point } } }",
    "variables": {
      "input": { "query": "Chamonix", "limit": 3, "focus": [6.8712, 45.9231] }
    }
  }'
```

**TypeScript**

```typescript
const geocoded = await mountaya.data.geocode(
  { query: "Chamonix", limit: 3, focus: [6.8712, 45.9231] },
  { select: { count: true, places: { name: true, label: true, layer: true, point: true } } },
);

console.log(geocoded.places[0]?.name, geocoded.places[0]?.point);
```

**Python**

```python
query = """
query Geocode($input: GeocodeInput!) {
  geocode(input: $input) { count places { name label layer point } }
}
"""

result = requests.post(
    "https://data.mountaya.com/graphql",
    headers={
        "X-API-Key": os.environ["MOUNTAYA_PUBLISHABLE_KEY"],
        "X-Session-Token": session["token"],
    },
    json={
        "query": query,
        "variables": {"input": {"query": "Chamonix", "limit": 3, "focus": [6.8712, 45.9231]}},
    },
    timeout=30,
).json()

if "errors" in result:
    raise RuntimeError(result["errors"])
first = result["data"]["geocode"]["places"][0]
print(first["name"], first["point"])
```

**Response**

```json
{
  "data": {
    "geocode": {
      "count": 3,
      "places": [
        {
          "name": "Chamonix-Mont-Blanc",
          "label": "Auvergne-Rhône-Alpes, France",
          "layer": "CITY",
          "point": [6.8700009, 45.9230969]
        },
        {
          "name": "Chamonix",
          "label": "Magland, Auvergne-Rhône-Alpes, France",
          "layer": "DISTRICT",
          "point": [6.6117818, 46.0295495]
        },
        {
          "name": "Chamonix",
          "label": "La Route Blanche, Chamonix-Mont-Blanc, Auvergne-Rhône-Alpes, France",
          "layer": "HOUSE",
          "point": [6.8602734, 45.9098844]
        }
      ]
    }
  }
}
```

Places come back by relevance. Pass `layers` to keep only some kinds of place, such as `CITY` or `NATURAL`.

| Layer | Scope |
| --- | --- |
| `COUNTRY` | Country-level administrative boundary. |
| `REGION` | Region or state within a country. |
| `COUNTY` | County or department within a region. |
| `CITY` | City, town, or village. |
| `DISTRICT` | District or neighborhood within a city. |
| `POSTCODE` | Postal code area. |
| `STREET` | Street or road. |
| `HOUSE` | House or building address. |
| `POI` | Point of interest. |
| `NATURAL` | Natural feature such as a mountain, lake, or forest. |

Layers are ordered from the coarsest scope (`COUNTRY`) to the finest (`HOUSE`, `NATURAL`). Pass a subset to a geocode query to restrict the result granularity.

- `geocode(input: GeocodeInput!)` takes `query` (required) plus `limit`, `focus`, `bbox`, `layers`, `categories` and `language`.
- `query`: 1 to 200 characters after trimming, such as `Chamonix` or `Mont Blanc`. A refused value is `VALIDATION_FAILED` at `["input", "query"]`.
- `limit`: 1 to 50, default 10.
- `focus`: `[longitude, latitude]` that biases ranking toward nearby results. `bbox`: `[minLon, minLat, maxLon, maxLat]` that restricts the search area.
- `layers` and `categories` (a boolean-per-category filter such as `populatedPlace`, `naturalFeature`, `amenity`) filter the places returned for `limit`, so they can leave fewer than `limit`, or none. `POSTCODE` does not narrow the search. Raise `limit` when a narrow filter leaves too few. Every layer and every category is allowed when omitted.
- `language`: biases result names. Only `EN` and `FR` are localized; any other language reads English. Defaults to English.
- An enum value in the variables must match the schema's case (`CITY`, not `city`): another case is refused as a whole with `GRAPHQL_VALIDATION_FAILED` at `["variable", "input", "layers", 0]`, `data` null, under `200`. `LOCALITY` is not a `GeocodeLayer`.
- `GeocodeResult` carries `count` (the length of `places`, at most `limit`) and `places`, ordered by relevance.
- Each `Place` has a localized `name`, a single-line `label` built from city, region and country, its `layer` and `category`, a `point` centroid, `bounds` when the extent is known, and `country`, `countryName`, `region`, `county`, `city`, `postcode`, `street`, `houseNumber`, and an `osm` reference (`id`, `type`, `key`, `value`).
- A lookup the geocoder itself refuses is `VALIDATION_FAILED` at `["input"]`, with the geocoder's own message in English whatever `Accept-Language` asks. Any other geocoder failure is `INTERNAL_ERROR`.

## Reverse geocode

Name the places at a coordinate. This one asks which village sits at the Argentière point.

**cURL**

```bash
curl https://data.mountaya.com/graphql \
  -H "X-API-Key: $MOUNTAYA_PUBLISHABLE_KEY" \
  -H "X-Session-Token: $MOUNTAYA_DATA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query ReverseGeocode($input: ReverseGeocodeInput!) { reverseGeocode(input: $input) { places { name label layer } } }",
    "variables": {
      "input": {
        "point": [6.9271, 45.9822],
        "radiusMeters": 1000,
        "limit": 2,
        "layers": ["CITY", "DISTRICT"]
      }
    }
  }'
```

**TypeScript**

```typescript
const nearby = await mountaya.data.reverseGeocode(
  { point: [6.9271, 45.9822], radiusMeters: 1000, limit: 2, layers: ["CITY", "DISTRICT"] },
  { select: { places: { name: true, label: true, layer: true } } },
);

console.log(nearby.places[0]?.name);
```

**Python**

```python
query = """
query ReverseGeocode($input: ReverseGeocodeInput!) {
  reverseGeocode(input: $input) { places { name label layer } }
}
"""

result = requests.post(
    "https://data.mountaya.com/graphql",
    headers={
        "X-API-Key": os.environ["MOUNTAYA_PUBLISHABLE_KEY"],
        "X-Session-Token": session["token"],
    },
    json={
        "query": query,
        "variables": {
            "input": {
                "point": [6.9271, 45.9822],
                "radiusMeters": 1000,
                "limit": 2,
                "layers": ["CITY", "DISTRICT"],
            }
        },
    },
    timeout=30,
).json()

if "errors" in result:
    raise RuntimeError(result["errors"])
print(result["data"]["reverseGeocode"]["places"][0]["name"])
```

**Response**

```json
{
  "data": {
    "reverseGeocode": {
      "places": [
        {
          "name": "Argentière",
          "label": "Chamonix-Mont-Blanc, Auvergne-Rhône-Alpes, France",
          "layer": "DISTRICT"
        },
        {
          "name": "Les Arberons",
          "label": "Chamonix-Mont-Blanc, Auvergne-Rhône-Alpes, France",
          "layer": "DISTRICT"
        }
      ]
    }
  }
}
```

Places come back nearest first. Without `layers`, the nearest match is often a street or a building.

- `reverseGeocode(input: ReverseGeocodeInput!)` takes `point` (required, `[longitude, latitude]`), `radiusMeters` (1 to 5000, default 500), `limit` (1 to 50, default 1), and the same `layers` and `language` as `geocode`.
- `ReverseGeocodeResult` echoes `point`, carries `count`, and returns `places` of the same `Place` shape, ordered by proximity, then relevance.
- `layers` filters the places returned for `limit`, so a narrow filter can leave fewer than `limit`, or none.
- Measured: at `[6.8712, 45.9231]` with no `layers` and the default radius, the first place is the street `Rue de la Tour`.

## Points of interest

List points of interest by category inside an area. This finds huts in the Chamonix valley.

**cURL**

```bash
curl https://data.mountaya.com/graphql \
  -H "X-API-Key: $MOUNTAYA_PUBLISHABLE_KEY" \
  -H "X-Session-Token: $MOUNTAYA_DATA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query Pois($input: PoisInput!) { pois(input: $input) { count pois { name category point } } }",
    "variables": {
      "input": { "categories": ["HUT"], "bbox": [6.80, 45.85, 6.95, 45.95], "limit": 3 }
    }
  }'
```

**TypeScript**

```typescript
const huts = await mountaya.data.pois(
  { categories: ["HUT"], bbox: [6.8, 45.85, 6.95, 45.95], limit: 3 },
  { select: { count: true, pois: { name: true, category: true, point: true } } },
);

for (const hut of huts.pois) {
  console.log(hut.name, hut.point);
}
```

**Python**

```python
query = """
query Pois($input: PoisInput!) {
  pois(input: $input) { count pois { name category point } }
}
"""

result = requests.post(
    "https://data.mountaya.com/graphql",
    headers={
        "X-API-Key": os.environ["MOUNTAYA_PUBLISHABLE_KEY"],
        "X-Session-Token": session["token"],
    },
    json={
        "query": query,
        "variables": {
            "input": {"categories": ["HUT"], "bbox": [6.80, 45.85, 6.95, 45.95], "limit": 3}
        },
    },
    timeout=30,
).json()

if "errors" in result:
    raise RuntimeError(result["errors"])
for hut in result["data"]["pois"]["pois"]:
    print(hut["name"], hut["point"])
```

**Response**

```json
{
  "data": {
    "pois": {
      "count": 3,
      "pois": [
        {
          "name": "Refuge de L'Envers des Aiguilles",
          "category": "HUT",
          "point": [6.9275357, 45.8999866]
        },
        {
          "name": "Cabane des Rognes",
          "category": "HUT",
          "point": [6.809093799999999, 45.8633697]
        },
        {
          "name": "Cabane de la Tour-Rouge",
          "category": "HUT",
          "point": [6.9244758, 45.9045504]
        }
      ]
    }
  }
}
```

To list what lies along a route instead, send the route's line as `buffered.geometry` with a `bufferMeters` distance. Each point then carries its `distanceMeters` from the line.

| Category | Description |
| --- | --- |
| `HUT` | Mountain hut or refuge providing shelter and meals. |
| `PEAK` | Mountain summit or peak. |
| `PASS` | Mountain pass or col between valleys. |
| `VIEWPOINT` | Scenic viewpoint or panorama spot. |
| `PARKING` | Parking area for vehicles, often at a trailhead. |
| `WATER_SOURCE` | Drinkable water source such as a spring or fountain. |
| `CAFE` | Cafe or coffee shop. |
| `RESTAURANT` | Restaurant serving meals. |
| `SUPERMARKET` | Supermarket or grocery store. |
| `PHARMACY` | Pharmacy or chemist. |
| `TOILETS` | Public toilets. |
| `CAMPSITE` | Campsite or camping pitch. |
| `SHELTER` | Bivouac shelter or emergency refuge with no staff. |
| `CABLE_CAR` | Cable car, gondola, or chairlift station. |
| `BUS_STATION` | Bus station or major bus stop. |
| `TRAIN_STATION` | Train station. |
| `AIRPORT` | Airport or airfield. |
| `ACCOMMODATION` | Hotel, hostel, guest house, or chalet. |
| `CARAVAN_SITE` | Caravan or camper site. |
| `HOSPITAL` | Hospital. |

- `pois(input: PoisInput!)` takes a required `categories` list (1 to 20), a `limit` (1 to 50, default 50), `language`, and at most one search area: a `bbox`, or a `buffered` area built from a GeoJSON `geometry` plus a `bufferMeters` distance (1 to 5000). Both are optional and mutually exclusive. With neither, the categories are looked up with no geographic filter, and `[0, 0, 0, 0]` or an empty `bbox` counts as none; sending both is a `VALIDATION_FAILED` at `["input", "bbox"]`.
- `PoisResult` carries `count` and `pois`. Each `POI` includes `name`, `category`, `point`, optional `elevation` in meters above sea level (often null), selected OSM `tags` (`key`, `value`), and admin context (`country`, `countryName`, `region`, `city`) when resolved.
- `distanceMeters` is set only when a buffered area was used: the straight distance to the geometry's nearest edge, and `0` for a POI inside a `Polygon`.
- A query the geocoder itself refuses is `VALIDATION_FAILED` at `["input"]`, and its message is the geocoder's own, in English whatever `Accept-Language` asks for, as on `geocode` and `reverseGeocode`.

## Search

Run one query across several sources at once. This looks for the Tour du Mont-Blanc among places and among your own itineraries.

**cURL**

```bash
curl https://data.mountaya.com/graphql \
  -H "X-API-Key: $MOUNTAYA_PUBLISHABLE_KEY" \
  -H "X-Session-Token: $MOUNTAYA_DATA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query Search($input: SearchInput!) { search(input: $input) { places { count places { name label } } itineraries { count itineraries { id name } } errors { target code message } } }",
    "variables": {
      "input": {
        "query": "Tour du Mont-Blanc",
        "limit": 2,
        "focus": [6.8712, 45.9231],
        "targets": { "places": true, "itineraries": true }
      }
    }
  }'
```

**TypeScript**

```typescript
const found = await mountaya.data.search(
  {
    query: "Tour du Mont-Blanc",
    limit: 2,
    focus: [6.8712, 45.9231],
    targets: { places: true, itineraries: true },
  },
  {
    select: {
      places: { count: true, places: { name: true, label: true } },
      itineraries: { count: true, itineraries: { id: true, name: true } },
      errors: { target: true, code: true, message: true },
    },
  },
);

console.log(found.itineraries?.itineraries[0]?.id);
```

**Python**

```python
query = """
query Search($input: SearchInput!) {
  search(input: $input) {
    places { count places { name label } }
    itineraries { count itineraries { id name } }
    errors { target code message }
  }
}
"""

result = requests.post(
    "https://data.mountaya.com/graphql",
    headers={
        "X-API-Key": os.environ["MOUNTAYA_PUBLISHABLE_KEY"],
        "X-Session-Token": session["token"],
    },
    json={
        "query": query,
        "variables": {
            "input": {
                "query": "Tour du Mont-Blanc",
                "limit": 2,
                "focus": [6.8712, 45.9231],
                "targets": {"places": True, "itineraries": True},
            }
        },
    },
    timeout=30,
).json()

if "errors" in result:
    raise RuntimeError(result["errors"])
print(result["data"]["search"]["itineraries"]["itineraries"][0]["id"])
```

**Response**

```json
{
  "data": {
    "search": {
      "places": {
        "count": 2,
        "places": [
          {
            "name": "Tour du Mont-Blanc",
            "label": "Route de Bionnassay, Saint-Gervais-les-Bains, Auvergne-Rhône-Alpes, France"
          },
          {
            "name": "tour du mont-blanc",
            "label": "Voie Romaine, Les Contamines-Montjoie, Auvergne-Rhône-Alpes, France"
          }
        ]
      },
      "itineraries": {
        "count": 1,
        "itineraries": [
          {
            "id": "0b6d1a4e-6d3f-4f7a-9c2e-1f0a5b8c3d21",
            "name": "Docs Tour du Mont-Blanc"
          }
        ]
      },
      "errors": []
    }
  }
}
```

Turn on only the targets you need: `places`, `pois`, `ways`, `itineraries`, `collections`, or `zones`. Each hit is a reference, so read an itinerary in full with [`itinerary`](https://docs.mountaya.com/en/apis/data/itineraries.md#itinerary).

If one target fails, its section is `null` and `errors` says why, while the others still answer.

- `search(input: SearchInput!)` takes `query` and `targets` (required), plus `limit`, `focus`, `bbox`, `language`, `activity`, `pois` (a category list mirroring the `pois` input), and `categories` (mirroring `geocode`).
- `query`: at most 200 characters after trimming. Every target except `pois` needs at least one character once trimmed; the `pois` target accepts an empty query and lists POIs of the requested categories.
- `targets`: per-target flags, each defaulting to `false`: set at least one of `places`, `pois`, `ways`, `itineraries`, `collections`, `zones` to `true`.
- `limit`: per-target maximum, 1 to 50, default 8. The cap applies to each enabled target, so a response can hold up to `limit` times the number of enabled targets. A value outside the range is refused by every enabled target, each in its own `errors` entry.
- `focus` and `bbox` bias and restrict the `places`, `pois` and `ways` targets. A malformed `focus` or `bbox` fails the whole request. `[0, 0, 0, 0]` as `bbox` counts as none.
- `language` localizes names of the `places`, `pois` and `ways` targets (only `EN` and `FR`; anything else reads English). The `itineraries`, `collections` and `zones` targets return names as written.
- `activity` filters and ranks the `ways` target: a way the activity cannot use is dropped. An opt-in routing-graph check for `ways` verifies each way as `analyzeGeometry` would, and materially increases latency.
- A feature found by more than one of `places`, `pois` and `ways` is returned once, in `ways` first, then `pois`.
- Each enabled target runs concurrently and degrades gracefully: a failed target leaves its section `null` and reports an entry in `errors`, while the others still return. When every target you enabled fails, a single one included, the field fails as a whole instead: no result and one error, coded `VALIDATION_FAILED` where every target refused the input and `INTERNAL_ERROR` otherwise, and the request counts toward neither the monthly allowance nor an invoice.
- `SearchResult` echoes `query`, `language` and `targets`, then carries one section per enabled target (`null` when disabled or failed), and `errors`: one `SearchTargetError` (`target`, `code`, `message`) per failed branch while at least one enabled branch succeeded.
- Owned-entity targets list your key's own organization's entities only, never another organization's or a personal one. Owned-entity targets return only entities the calling credential may view: under a session token minted without `user_id`, what a publishable key alone lists, your organization's public itineraries and zones currently published, each as last published, and public collections; under one naming a member, its private and unpublished ones too, an itinerary or a zone as its draft. The token Mountaya's MCP server holds lists as a member's does.
- Every hit is a reference rather than the entity's contents. An `itineraries` hit carries `id`, `name`, `description`, `distance`, `ascent`, `activitySlug`, `start`, `bounds`, `isPrivate`, `organizationId`, `score`, `matchedField`. A `zones` hit carries `id`, `name`, `description`, `level`, `mode`, `point`, `bounds`, `isPrivate`, `organizationId`, `score`, `matchedField`.
- A `collections` hit (`CollectionSearchResult`) carries `id`, `name`, `description` (the empty string rather than null when there is none, matching the Map Studio API resource); `count` with `itineraries` and `zones` totals, mirroring `CollectionCount` on the Map Studio API field for field; `bounds`, the aggregated extent of its itineraries and zones, null when not computed; `isPrivate` and `organizationId` (the root organization stands in for a personal collection); `score` and `matchedField`.
- `score` orders one section of one response and nothing more: two ranking passes feed it on different scales, so it is not comparable across responses, across targets, or against a threshold. `matchedField` is null when neither the name nor the description matched.
- Read a collection's itineraries in full through the [Map Studio API](https://docs.mountaya.com/en/apis/map-studio.md), or one itinerary through [`itinerary`](https://docs.mountaya.com/en/apis/data/itineraries.md#itinerary).
- The itinerary id in the sample response is the canonical placeholder; your own itinerary ids differ.

## Next steps

- [Itineraries](https://docs.mountaya.com/en/apis/data/itineraries.md): Read an itinerary you found, or download it as a file.
- [Routing](https://docs.mountaya.com/en/apis/data/routing.md): Route between the places you found.
