GraphHopper API

⭐ Beginner's Pick Transportation / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

GraphHopper is a routing API that calculates optimized A-to-B directions with turn-by-turn instructions for driving, cycling, and walking. It supports multiple transport profiles and can handle route optimization for multiple waypoints. A free tier is available with a generous daily quota, making it great for learning and small projects.

💡

Beginner Tip

Get a free API key at https://www.graphhopper.com/ and use the /route endpoint with point parameters in "lat,lon" format. The free tier allows 500 requests per day, which is plenty for experimentation.

Available Data

GraphHopper data via REST API
JSON-formatted response data
Requires API key authentication

Example Response

JSON Response
{
  "route": "Line 1",
  "origin": "Station A",
  "destination": "Station B",
  "departure": "08:30",
  "arrival": "09:15",
  "status": "On Time",
  "delays_min": 0
}

Field Reference

paths[].distance Total route distance in meters.
paths[].time Estimated travel time in milliseconds.
paths[].points GeoJSON LineString or encoded polyline of the full route geometry.
paths[].instructions Array of turn-by-turn instructions with text, distance, and sign values for navigation.
paths[].legs Individual route segments when multiple waypoints are provided, each with their own distance and time.
info.took Server-side processing time in milliseconds for performance monitoring.

Implementation Example

const url = "https://docs.graphhopper.com/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

400 Bad Request: Point not found Coordinates are in the ocean, a restricted area, or outside the coverage region
Verify your lat,lon coordinates are on a road-accessible location. Use Google Maps to confirm coordinates before passing them to the API.
401 Unauthorized Missing or invalid API key
Sign up at https://www.graphhopper.com/ for a free API key and add it as the "key" query parameter in every request.
429 Too Many Requests Daily request quota exceeded on the free tier
Implement client-side caching for repeated route queries or upgrade to a paid GraphHopper plan for higher limits.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Transportation
Difficulty Intermediate
Verified: 2026-04-07

Similar APIs

View All →