Get started
Data API

Places

Places

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.

export MOUNTAYA_PUBLISHABLE_KEY="pk_your_publishable_key"
export MOUNTAYA_SESSION_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)

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 https://data.mountaya.com/graphql \
  -H "X-API-Key: $MOUNTAYA_PUBLISHABLE_KEY" \
  -H "X-Session-Token: $MOUNTAYA_SESSION_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] }
    }
  }'
Response
{
  "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.

LayerScope
COUNTRYCountry-level administrative boundary.
REGIONRegion or state within a country.
COUNTYCounty or department within a region.
CITYCity, town, or village.
DISTRICTDistrict or neighborhood within a city.
POSTCODEPostal code area.
STREETStreet or road.
HOUSEHouse or building address.
POIPoint of interest.
NATURALNatural 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.

Reverse geocode

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

curl https://data.mountaya.com/graphql \
  -H "X-API-Key: $MOUNTAYA_PUBLISHABLE_KEY" \
  -H "X-Session-Token: $MOUNTAYA_SESSION_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"]
      }
    }
  }'
Response
{
  "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.

Points of interest

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

curl https://data.mountaya.com/graphql \
  -H "X-API-Key: $MOUNTAYA_PUBLISHABLE_KEY" \
  -H "X-Session-Token: $MOUNTAYA_SESSION_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 }
    }
  }'
Response
{
  "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.

CategoryDescription
HUTMountain hut or refuge providing shelter and meals.
PEAKMountain summit or peak.
PASSMountain pass or col between valleys.
VIEWPOINTScenic viewpoint or panorama spot.
PARKINGParking area for vehicles, often at a trailhead.
WATER_SOURCEDrinkable water source such as a spring or fountain.
CAFECafe or coffee shop.
RESTAURANTRestaurant serving meals.
SUPERMARKETSupermarket or grocery store.
PHARMACYPharmacy or chemist.
TOILETSPublic toilets.
CAMPSITECampsite or camping pitch.
SHELTERBivouac shelter or emergency refuge with no staff.
CABLE_CARCable car, gondola, or chairlift station.
BUS_STATIONBus station or major bus stop.
TRAIN_STATIONTrain station.
AIRPORTAirport or airfield.
ACCOMMODATIONHotel, hostel, guest house, or chalet.
CARAVAN_SITECaravan or camper site.
HOSPITALHospital.

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

curl https://data.mountaya.com/graphql \
  -H "X-API-Key: $MOUNTAYA_PUBLISHABLE_KEY" \
  -H "X-Session-Token: $MOUNTAYA_SESSION_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 }
      }
    }
  }'
Response
{
  "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.

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

Next steps

Last updated