Discover/bahn.de API
live

bahn.de APIbahn.de

Search Deutsche Bahn train stations by name and find connections with live pricing, schedules, transfers, and leg-level stop data via the bahn.de API.

Endpoints
2
Updated
3mo ago
Try it
Max number of results to return
Partial or full name of the station (e.g. 'Berlin', 'Hamburg Hbf')
api.parse.bot/scraper/49ba8b8c-c4c8-4861-a1e8-3e46e71c6656/<endpoint>
Ready to send
Fill in the parameters and hit sign in to send to see live response data here.
Use it in your codegrab a free API key at signup
curl -X GET 'https://api.parse.bot/scraper/49ba8b8c-c4c8-4861-a1e8-3e46e71c6656/autocomplete_station?query=K%C3%B6ln' \
  -H 'X-API-Key: $PARSE_API_KEY'
All endpoints · 2 totalclick to expand

Search for train stations or locations by name. Returns station names, IDs, coordinates, and available transport products.

Input
ParamTypeDescription
limitintegerMax number of results to return
queryrequiredstringPartial or full name of the station (e.g. 'Berlin', 'Hamburg Hbf')
Response
{
  "type": "object",
  "fields": {
    "data": "array of station objects with id, extId, name, type, lat, lon, and products"
  },
  "sample": {
    "data": [
      {
        "id": "A=1@O=Berlin Hbf@X=13369549@Y=52525589@U=80@L=8011160@p=1778524813@i=U×008065969@",
        "lat": 52.524925,
        "lon": 13.369629,
        "name": "Berlin Hbf",
        "type": "ST",
        "extId": "8011160",
        "products": [
          "ICE",
          "EC_IC",
          "IR",
          "REGIONAL",
          "SBAHN",
          "BUS",
          "UBAHN",
          "TRAM"
        ]
      }
    ],
    "status": "success"
  }
}

About the bahn.de API

The bahn.de API exposes 2 endpoints covering Deutsche Bahn's station network and train connection search. The autocomplete_station endpoint resolves partial station names into structured records with coordinates and transport product flags, while search_connections returns full journey options between two stations including per-connection pricing, transfer counts, duration in seconds, and individual leg breakdowns with intermediate stops.

Station Search

The autocomplete_station endpoint accepts a query string — anything from a partial city name like Berl to a full station name like Hamburg Hbf — and returns an array of matching station objects. Each object includes a numeric id, an extId for external cross-referencing, a human-readable name, a type classification, geographic coordinates (lat, lon), and a products field that lists which transport modes (ICE, S-Bahn, regional rail, bus, etc.) serve that station. An optional limit parameter caps the result count.

Connection Search

The search_connections endpoint takes an origin and destination station name, a date in YYYY-MM-DD format, and a time in HH:MM format, then returns a list of available connections departing at or after that time. Each connection object carries departure and arrival timestamps, a human-readable duration, a durationSeconds integer useful for sorting or filtering programmatically, a transfers count, and a totalPrice field reflecting current DB fare data. The legs array inside each connection breaks the journey into individual segments, each with its own stop sequence.

Coverage and Data Shape

The optional class parameter accepts '1' (first class) or '2' (second class) and affects the totalPrice returned. Station names passed to search_connections follow the same naming conventions as results from autocomplete_station, so the two endpoints compose naturally: resolve an ambiguous name first, then pass the canonical name into the connection search. The API covers DB's domestic network; cross-border international routes may appear where DB operates them directly.

Common use cases
  • Display station autocomplete suggestions in a travel booking UI using name, lat, and lon fields.
  • Compare journey options by transfer count and totalPrice to surface the cheapest direct route.
  • Build a fare-monitoring tool that polls search_connections daily on a fixed route and tracks totalPrice changes.
  • Calculate exact journey durations in seconds using durationSeconds for logistics or scheduling applications.
  • Filter connections by class parameter to show first- vs. second-class pricing side by side.
  • Geocode Deutsche Bahn stations by extracting lat/lon from autocomplete_station results.
  • Identify which transport products (ICE, S-Bahn, regional) serve a given station using the products field.
Pricing & limitsSee full pricing →
TierPriceCredits/monthRate limit
Free$0/mo1005 req/min
Hobby$30/mo1,00020 req/min
Developer$100/mo5,000250 req/min

One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.

Frequently asked questions
Does Deutsche Bahn offer an official developer API?+
DB does operate an open data portal at data.deutschebahn.com with several public APIs covering timetables and station data. The bahn.de API on Parse targets the consumer bahn.de experience, which includes live pricing and connection search not uniformly available through the official open data endpoints.
What does search_connections return beyond departure and arrival times?+
Each connection object includes departure and arrival timestamps, a durationSeconds integer, a human-readable duration, a transfers count, and a totalPrice. The legs array breaks each journey into individual segments with their own stop sequences, so you can inspect intermediate stations on any leg.
Does the API return real-time delay or disruption information?+
The current endpoints return scheduled departure and arrival times along with pricing and leg data. Real-time delay or platform-change alerts are not exposed. You can fork this API on Parse and revise it to add a disruption or live-status endpoint if that data is needed.
Can I search connections by station ID rather than station name?+
The search_connections endpoint currently accepts station names for origin and destination parameters. The autocomplete_station endpoint does return id and extId fields per station, but passing those IDs directly into connection search is not currently supported. You can fork the API on Parse and revise it to add ID-based lookup.
Is there a way to retrieve earlier or later connections beyond the initial results?+
The search_connections endpoint returns connections from the specified date and time onward in a single response. Pagination or earlier/later navigation controls are not currently part of the response shape. You can fork the API on Parse and revise it to add offset or pagination parameters.
Page content last updated . Spec covers 2 endpoints from bahn.de.
Related APIs in TravelSee all →
opentable.ca API
Search and discover restaurants on OpenTable, view detailed information like menus and reviews, and check real-time dining availability across metro areas. Find top-rated restaurants in your location and instantly see which tables are open for your preferred date and time.
fandango.com API
Search for movies and retrieve nearby theater listings with showtimes by ZIP code and date, plus showtimes for a specific movie at nearby theaters.
data.lime.bike API
Access real-time availability data for Lime bikes and scooters, including station locations, vehicle status, system alerts, and geofencing zones across multiple cities. Monitor micromobility inventory and service information to find nearby vehicles or plan your trips effectively.
turo.com API
Search for peer-to-peer car rentals across Turo by location and dates to browse available vehicles with pricing, specifications, and real-time availability. Get detailed information on specific cars to compare features and make rental decisions.
reservation.pc.gc.ca API
Access real-time campground availability and reservation data from the Parks Canada booking system. Search locations, retrieve available campsites and cabins, filter by equipment type, and review operating date schedules across the national park network. Includes detailed resource metadata and map-based availability overviews.
bahn.com API
Search German train schedules and stations, find connections between destinations, and compare ticket prices across Deutsche Bahn routes. Get real-time station information and transit association details to plan your train journey efficiently.
united.com API
Search United Airlines flights, check real-time flight status, and view detailed seat maps to plan your perfect trip. Compare fare options and use airport autocomplete to quickly find your departure and arrival cities.
thetrainline.com API
Search UK train stations and find the cheapest fares across date ranges, then generate direct booking links to complete your purchase on Trainline.com. Get real-time journey information to compare prices and book your tickets in seconds.