Quickstart
Route a hike from Chamonix to Argentière with the Data API. You need a Mountaya account and two keys.
1
Get your keys
In the Mountaya app, open Organization → API keys and create two keys:
- a publishable key (
pk_…) with thedatascope, and - a secret key (
sk_…), which stays on your server.
Export them where your code runs:
No account yet? Create an account and keys takes two minutes.
2
Mint a session token
Every Data API request carries a session token. Your server mints it with the secret key.
Response
The token lasts five minutes. Mint a fresh one when it expires.
3
Query directions
Send the publishable key and the token with a directions query. Coordinates are [longitude, latitude].
Response
Distances are in meters and durations in seconds. A failed query still answers 200 OK, with an errors array: check it on every response.