canonical: https://jentic.com/apis/dbfahrplanapi/dbfahrplan

# DB Fahrplan API

The DB Fahrplan API is Deutsche Bahn's open timetable interface for the German rail network and connecting European services. The four endpoints cover the canonical journey-planning flow: resolve a station name to a stop ID, retrieve a board of upcoming departures or arrivals at that stop, and pull the detail view for a specific journey. Authentication is a single authKey query parameter. Travel apps, expense tools, and AI travel agents use it to surface live train timetables without operating a dedicated rail-data feed.

## For AI agents

Resolve German rail station names, pull live departure and arrival boards, and fetch journey detail records from Deutsche Bahn's timetable API.

## Scope

Does not handle ticket purchase, fare calculation, or seat reservation - use for German rail station resolution, live departure/arrival boards, and journey detail lookups only.

## Capabilities

- Resolve a station name to a stop ID via GET /location.name
- Retrieve upcoming departures at a stop via GET /departureBoard
- Retrieve upcoming arrivals at a stop via GET /arrivalBoard
- Pull the full journey detail for a train via GET /journeyDetail
- Drive travel apps, expense tools, and rail dashboards with live German rail data
- Power AI travel agents that need to confirm specific train times for a German journey

## Use cases

### Travel App Train Lookup

Travel and ticketing apps call DB Fahrplan to surface live train times for users planning journeys across Germany. The flow starts with GET /location.name to convert a station name into a stop ID, then GET /departureBoard to render a board of next trains. Most apps integrate this in a couple of days.

Example prompt: Resolve 'Berlin Hauptbahnhof' to a stop ID via GET /location.name, then call GET /departureBoard for the next 60 minutes and return the next 5 trains

### Expense Reconciliation

Travel-expense platforms use GET /journeyDetail to pull canonical Deutsche Bahn route detail (origin, destination, departure time, train number) and reconcile employee-submitted train tickets against the actual scheduled service. This catches typos and date errors before reimbursement and keeps audit logs accurate.

Example prompt: Given an ICE train number and date, call GET /journeyDetail to confirm origin, destination, and departure time match a submitted expense

### Station Display Board

Public information displays in offices, hotels, and retail premises near major German stations call GET /departureBoard and GET /arrivalBoard on a polling schedule to surface a live train board for visitors. The simple authKey query parameter keeps the integration trivial to deploy on signage hardware.

Example prompt: Poll GET /departureBoard for stop ID 8011160 (Berlin Hbf) every 60 seconds and render the next 12 trains

### AI Travel Agent

AI travel agents booking or advising on German rail journeys call DB Fahrplan through Jentic to confirm specific train times, validate platform numbers, and resolve station names mentioned in user messages. Jentic isolates the authKey in its vault, so the agent only handles stop IDs and timestamps.

Example prompt: Given the user query 'next ICE from Berlin to Munich', resolve both stations via GET /location.name, then return the next direct ICE departure with platform and arrival time

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /location.name | Resolve a station name to a Deutsche Bahn stop ID |
| GET | /departureBoard | Live upcoming departures at a stop |
| GET | /arrivalBoard | Live upcoming arrivals at a stop |
| GET | /journeyDetail | Detail for a specific train journey |

## Key resources

- **location.name** — Resolve a station name to a Deutsche Bahn stop ID
- **departureBoard** — Live list of upcoming departures at a stop
- **arrivalBoard** — Live list of upcoming arrivals at a stop
- **journeyDetail** — Full route detail for a specific train journey

## Why Jentic

- **Setup:** Wiring the DB Fahrplan API by hand means learning that its authKey rides as a query parameter, then chaining the station name resolution to the departure or arrival board yourself while keeping the key out of logged URLs. Through Jentic you install once, import the DB Fahrplan API from the API Directory, store the authKey once, and your agent calls it.
- **Permission scoping:** DB Fahrplan carries the station and query in the request parameters rather than as a resource id in the URL path, so limit the agent to the operations it needs, such as resolving a station name and reading a departure board. Every operation here is a read-only GET, so no write or booking path is reachable.
- **Credential handling:** Your DB Fahrplan authKey is stored once, encrypted, by your own Jentic One instance and injected as the query parameter at execution time. It never enters the agent's prompt, logs, or the request URLs recorded in logs.
- **Discovery method:** Agents search Jentic by intent such as 'find the next train from a German station' or 'resolve a station name', and Jentic returns the matching DB Fahrplan operations with their input schemas so the agent runs the resolve-then-board flow without browsing the DB Open Data portal.

## Related APIs

- **Transport for London** — TfL exposes live London transport data with a similar arrivals/departures shape but for London modes.
- **Transit** — Transit aggregates real-time public transport data across many cities globally.
- **HERE Maps** — HERE provides geocoding and routing for the legs around a train journey (taxi, walk, drive).

## FAQ

### What authentication does the DB Fahrplan API use?

DB Fahrplan uses an API key passed as the authKey query parameter on every request. Through Jentic, the authKey is stored encrypted in your Jentic One instance, so AI travel agents never handle the raw secret in URLs.

### Can I get live German train times with the DB Fahrplan API?

Yes. GET /departureBoard and GET /arrivalBoard return live upcoming departures and arrivals at a Deutsche Bahn stop. Resolve the stop ID first via GET /location.name.

### What are the rate limits for the DB Fahrplan API?

Deutsche Bahn does not publish hard per-key rate limits in this spec; the open API portal asks integrators to be considerate with polling cadence. For high-frequency display boards, contact DB Open Data for a partnership-grade key.

### How do I look up the next train between two stations through Jentic?

Search Jentic for 'find departures from a German rail station', load the GET /departureBoard operation, and execute it with the resolved stop ID. Resolve the station name to an ID first via GET /location.name. Jentic injects the authKey automatically.

### Does the DB Fahrplan API include ticket prices or booking?

No. This is a timetable and journey detail surface only - for fares, ticket purchase, and seat reservation, use a separate Deutsche Bahn product such as the bahn.de buchung flow.

### Does the DB Fahrplan API cover services outside Germany?

It covers the German rail network and integrated cross-border services (e.g. ICE to Switzerland, France, Austria) where Deutsche Bahn carries the timetable. Pure foreign-operator services are not covered.

### Can I limit what my agent is allowed to do with the DB Fahrplan API?

Yes. Jentic One is self-hosted, so you run your own instance and your own rules decide which DB Fahrplan operations the agent may call and which credentials it may use. You can allow only the operations a task needs, such as resolving a station name with GET /location.name and reading a board with GET /departureBoard or GET /arrivalBoard, while withholding GET /journeyDetail. Every DB Fahrplan operation is a read-only GET with the station and query carried as request parameters rather than as a path id, so no write or booking path is reachable in the first place.
