Travel
Bahn Germany logo

Bahn Germany API

bahn.com

Deutsche Bahn - train connection search and station name resolution.

Actions
2
Category
Travel
Login
Not required
Output
JSON

Call the Bahn Germany API

Submit a task, then poll the job until it settles. This example runs act_bahn_de_journey_search_results.

curl -X POST https://api.anakin.io/v1/wire/task \
  -H "X-API-Key: $ANAKIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "action_id": "act_bahn_de_journey_search_results",
    "params": {
      "origin_halt_id": "A=1@O=Berlin Hbf@X=13369549@Y=52525589@U=80@L=8011160@p=1779908603@i=U×008065969@",
      "destination_halt_id": "A=1@O=Munich Central (München Hbf)@X=11558339@Y=48140229@U=80@L=8000261@p=1779908603@i=U×008020347@",
      "travel_date": "2026-06-01T13:37:00"
    }
  }'

2 actions on bahn.com

Read

  • Station Autocomplete

    act_bahn_de_station_autocompleteread1 credit / call

    Resolves a station name to matching stations with IDs, names, and coordinates.

    search_query
    string · required
    station_type
    string
    result_limit
    integer

Write

Write actions change state on bahn.com and run as the account you connect.

  • Journey Search Results

    act_bahn_de_journey_search_resultswrite2 credits / call

    Returns train connections between two stations for a date with times, names, and segments.

    origin_halt_id
    string · required
    destination_halt_id
    string · required
    travel_date
    string · required
    travel_class
    string
    passenger_type
    string
    discount_type
    string
    discount_class
    string
    passenger_count
    integer

Bahn Germany API questions

Is there an API for Bahn Germany?
Bahn Germany does not offer a public data API for this, but Anakin Wire provides 2 maintained endpoints for bahn.com. You call Anakin's REST API with an action ID and parameters and get structured JSON back; Anakin handles the browser, proxies, anti-bot, and parsing.
How do I scrape Bahn Germany data?
POST to https://api.anakin.io/v1/wire/task with your API key, the action ID, and its parameters, then poll GET /v1/wire/jobs/{id} until the job settles. There is nothing to install and no scraper to maintain — when bahn.com changes its markup, Anakin updates the action.
Do I need a Bahn Germany account?
No. Every Bahn Germany action listed here runs anonymously — no account and no credentials required.
What does the Bahn Germany API cost?
Usage-based credits, charged per call and refunded automatically when a job fails. New accounts start with 300 free credits and no card. See anakin.io/pricing for the current rates.

More Travel APIs

All Travel sites