Quickstart
This guide runs your first Data API query end to end. You authenticate with your key pair, send a directions request between two waypoints, and read the route it returns: total distance, duration, a one-line summary, the GeoJSON geometry, and an elevation profile. Set aside about five minutes. If you have not created keys yet, start with the platform quickstart and authentication guides, then come back here.
1
Every Data API request needs two headers: your publishable key with the data scope in X-API-Key, and a session token in X-Session-Token. Mint a token from your key pair by calling POST /v1/sessions with your secret key. Tokens are valid for 5 minutes, so mint one just before you query.
A successful call returns 201 Created with the token and its expiry:
2
directions computes a route between an ordered list of waypoints for a given activity. Pass the activity slug and at least two [longitude, latitude] waypoints, then select the response fields you want back. Here we route from Chamonix to Saint-Gervais on foot.
3
directions returns a routes array. Each DirectionsRoute carries the total distance in meters, the duration in seconds, a one-line summary, the route geometry as a GeoJSON LineString (coordinates are [longitude, latitude, altitude]), an elevation summary, and a surface and way type analysis.
Because the Data API is GraphQL, a failed query still returns 200 OK and reports problems in an errors array. Inspect errors on every response, not just the HTTP status. See the error envelope for the full shape.
Prefer to explore interactively? Open this query in the playground and run it against the live schema.
4
directions is one of several queries. Reach for suggestions to generate routes that hit a target distance, isochrones for reachable area, matrix for travel-time grids, the places queries for geocoding and POIs, and analyzeGeometry to classify an existing line. Browse them all in the playground or read the routing, places, and analysis guides.