Tankerkoenig API

Transportation / API Key Intermediate HTTPS CORS
Varies by plan (check documentation)

Overview

Tankerkoenig provides real-time gas and diesel fuel prices from German petrol stations, updated every few minutes. An API key is required and can be obtained for free by registering with a German postal address. It is a great resource for building fuel price comparison tools or route cost calculators in Germany.

💡

Beginner Tip

You must register with a German address to receive an API key. Once you have it, the /list.php endpoint lets you search stations by GPS coordinates and radius to get current prices.

Available Data

Tankerkoenig 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

stations List of petrol stations within the specified radius, sorted by the requested sort field
id Unique identifier for the petrol station, used to query detailed or historical price data
e5 Current price per liter for Super E5 petrol in euros (false if not available)
e10 Current price per liter for Super E10 petrol in euros (false if not available)
diesel Current price per liter for diesel in euros (false if not available)
dist Distance in kilometers from the queried coordinates to this station

Implementation Example

const url = "https://creativecommons.tankerkoenig.de/swagger/";
// 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

403 Forbidden or apikey missing error API key not included in the request
Add your API key as the apikey query parameter in every request
Empty station list No stations found within the specified radius
Increase the rad parameter (radius in km) or verify that lat/lng coordinates are within Germany
Price shown as false or null The station has not reported prices in the last polling cycle
Filter out stations where petrol/diesel/e5/e10 fields are false before displaying results to users

Matrix Score Breakdown

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

Partially tested on Apr 5, 2026

Technical Specifications

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

Similar APIs

View All →