Bahnhöfe
Bahnhöfe finden und ihre Stammdaten lesen. Jeder Bahnhof hat eine EVA-Nummer, die alle anderen Endpunkte als station_id nehmen.
Objekte
Objekt Bahnhof
| Feld | Typ | Beschreibung |
|---|---|---|
id | string | EVA-Nummer (7 Ziffern, bei manchen Haltestellen 6). Für alle anderen Endpunkte die station_id. |
name | string | Name wie bei der DB |
ds100? | ?string | Betriebsstellenkürzel (Ril 100), z. B. BLS |
location? | ?object | { lat, lon } in WGS84 |
related? | string[] | IDs von Teilbahnhöfen, die zum selben Bahnhof gehören (z. B. Berlin Hbf tief und S-Bahn) |
{
"id": "8011160",
"name": "Berlin Hbf",
"ds100": "BLS",
"location": {
"lat": 52.525592,
"lon": 13.369545
},
"related": [
"8089021",
"8089522",
"8098160"
]
}Objekt Gleis
| Feld | Typ | Beschreibung |
|---|---|---|
platform | string | Gleisbezeichnung, wie sie am Bahnsteig steht |
lines | string[] | Linien bzw. Gattungen, die dort halten |
view | string | sbahn (S-Bahn-Berlin-Anzeiger) oder db (DB-Anzeiger): so zeigt der Zugzielanzeiger dieses Gleis |
{
"platform": "3",
"lines": [
"S3",
"S5",
"S7",
"S9"
],
"view": "sbahn"
}Bahnhöfe suchen
/v1/stationsEimer standardSucht nach Namen. Bahnhöfe in Berlin und Brandenburg kommen zuerst, Hauptbahnhöfe vor anderen. Höchstens 10 Treffer.
Query-Parameter
| Feld | Typ | Beschreibung |
|---|---|---|
queryPflicht | string | Suchbegriff, mindestens 2 Zeichen |
Antwort
Liste von Bahnhof (nur id und name)
[
{
"id": "8089028",
"name": "Berlin Ostkreuz"
},
{
"id": "8011113",
"name": "Berlin Südkreuz"
}
]Beispiel
curl "https://developer.bahnhoftafel.de/v1/stations?query=Ostkreuz" \
-H "Authorization: Bearer $BT_SCHLUESSEL"const antwort = await fetch("https://developer.bahnhoftafel.de/v1/stations?query=Ostkreuz", {
method: "GET",
headers: { Authorization: `Bearer ${process.env.BT_SCHLUESSEL}`, },
});
const daten = await antwort.json();import os, requests
antwort = requests.get(
"https://developer.bahnhoftafel.de/v1/stations?query=Ostkreuz",
headers={"Authorization": f"Bearer {os.environ['BT_SCHLUESSEL']}"},
timeout=30,
)
daten = antwort.json()Alle Bahnhöfe
/v1/stations/allEimer standard, 5 MarkenAlle 10.256 Bahnhöfe und Haltestellen der DB mit Kürzel und Lage, seitenweise nach id sortiert. Für die nächste Seite after auf die letzte id setzen.
Kostet 5 Marken im Eimer standard. Die Liste ändert sich selten, einmal am Tag laden reicht.
Query-Parameter
| Feld | Typ | Beschreibung |
|---|---|---|
after | string | Nur Bahnhöfe mit größerer id (Blättern) |
limit | integer | Einträge je SeiteStandard: 5001 bis 1000 |
Antwort
Objekt { total, stations: Bahnhof[], next }. next ist der Wert für after oder null am Ende
Beispiel
curl "https://developer.bahnhoftafel.de/v1/stations/all" \
-H "Authorization: Bearer $BT_SCHLUESSEL"const antwort = await fetch("https://developer.bahnhoftafel.de/v1/stations/all", {
method: "GET",
headers: { Authorization: `Bearer ${process.env.BT_SCHLUESSEL}`, },
});
const daten = await antwort.json();import os, requests
antwort = requests.get(
"https://developer.bahnhoftafel.de/v1/stations/all",
headers={"Authorization": f"Bearer {os.environ['BT_SCHLUESSEL']}"},
timeout=30,
)
daten = antwort.json()Bahnhöfe in der Nähe
/v1/stations/nearbyEimer standardBahnhöfe im Umkreis eines Punktes, die nächsten zuerst.
Query-Parameter
| Feld | Typ | Beschreibung |
|---|---|---|
latPflicht | number | Breitengrad47 bis 56 |
lonPflicht | number | Längengrad5 bis 16 |
radius | integer | Umkreis in MeternStandard: 2000100 bis 20000 |
limit | integer | HöchstzahlStandard: 101 bis 50 |
Antwort
Liste von Bahnhof mit zusätzlichem Feld distance (Meter)
[
{
"id": "8011160",
"name": "Berlin Hbf",
"ds100": "BLS",
"location": {
"lat": 52.525592,
"lon": 13.369545
},
"distance": 412
}
]Beispiel
curl "https://developer.bahnhoftafel.de/v1/stations/nearby?lat=52.5219&lon=13.4132" \
-H "Authorization: Bearer $BT_SCHLUESSEL"const antwort = await fetch("https://developer.bahnhoftafel.de/v1/stations/nearby?lat=52.5219&lon=13.4132", {
method: "GET",
headers: { Authorization: `Bearer ${process.env.BT_SCHLUESSEL}`, },
});
const daten = await antwort.json();import os, requests
antwort = requests.get(
"https://developer.bahnhoftafel.de/v1/stations/nearby?lat=52.5219&lon=13.4132",
headers={"Authorization": f"Bearer {os.environ['BT_SCHLUESSEL']}"},
timeout=30,
)
daten = antwort.json()Bahnhof abrufen
/v1/stations/{station_id}Eimer standardStammdaten eines Bahnhofs: Name, Kürzel, Lage und zugehörige Teilbahnhöfe.
Pfad-Parameter
| Feld | Typ | Beschreibung |
|---|---|---|
station_idPflicht | string | EVA-Nummer |
Antwort
Beispiel
curl "https://developer.bahnhoftafel.de/v1/stations/8011160" \
-H "Authorization: Bearer $BT_SCHLUESSEL"const antwort = await fetch("https://developer.bahnhoftafel.de/v1/stations/8011160", {
method: "GET",
headers: { Authorization: `Bearer ${process.env.BT_SCHLUESSEL}`, },
});
const daten = await antwort.json();import os, requests
antwort = requests.get(
"https://developer.bahnhoftafel.de/v1/stations/8011160",
headers={"Authorization": f"Bearer {os.environ['BT_SCHLUESSEL']}"},
timeout=30,
)
daten = antwort.json()Gleise eines Bahnhofs
/v1/stations/{station_id}/platformsEimer standardAlle Gleise mit den Linien, die dort halten. Für S-Bahn-Gleise in Berlin aus dem VBB, sonst aus dem Fahrplan der DB.
Pfad-Parameter
| Feld | Typ | Beschreibung |
|---|---|---|
station_idPflicht | string | EVA-Nummer |
Antwort
Objekt { station, platforms: Gleis[] }
Beispiel
curl "https://developer.bahnhoftafel.de/v1/stations/8011160/platforms" \
-H "Authorization: Bearer $BT_SCHLUESSEL"const antwort = await fetch("https://developer.bahnhoftafel.de/v1/stations/8011160/platforms", {
method: "GET",
headers: { Authorization: `Bearer ${process.env.BT_SCHLUESSEL}`, },
});
const daten = await antwort.json();import os, requests
antwort = requests.get(
"https://developer.bahnhoftafel.de/v1/stations/8011160/platforms",
headers={"Authorization": f"Bearer {os.environ['BT_SCHLUESSEL']}"},
timeout=30,
)
daten = antwort.json()