Deutsche Bahn API

Deutsche Bahn API

This API will help you to search for stations within the Deutsche Bahn Network. Check for segments and fares.

API description

About the API:

The Deutsche Bahn API is an API provided by Deutsche Bahn, the German national railway company, that allows developers to access real-time on the company's train services. This data can include information on train schedules, ticket prices, and travel times.

 

What this API receives and what your API provides (input/output)?

You can call an endpoint to check the available stations and their IDs from a certain city. With that ID, you can later call the other endpoint that will require the departure and arrival ID. 

You can filter by departure time and it will deliver the segments of the trip and the possible cost of that journey. 

Also, this API will provide the Deutsche Ban URL for you to acquire the ticket. 

 

What are the most common uses cases of this API?

  1. Travel planning and booking: The API can be used to build applications that allow users to plan and book train travel. This could include features such as searching for trains between two stations, viewing train schedules and ticket prices, and purchasing tickets.

  2. Train schedule and ticketing information: The API can be used to integrate train schedule and ticketing information into websites or other applications. This could include features such as displaying real-time train arrival and departure times or showing the availability and prices of different ticket types.

  3. Integrating with other transportation services: The API could be used to integrate train services with other forms of transportation, such as buses or ride-sharing services. This could allow users to plan and book multi-modal journeys, or to compare the cost and convenience of different travel options.

 

Are there any limitations to your plans?

Besides the number of API calls per month, there are no other limitations. 

API Documentation

Endpoints


This Endpoint will allow you to check all the available stations and their IDs, searching by city name. 



                                                                            
GET https://zylalabs.com/api/847/deutsche+bahn+api/621/get+stations+ids
                                                                            
                                                                        

Get Stations IDs - Endpoint Features
Object Description
query [Required] The name of the city to lookup.
Test Endpoint

API EXAMPLE RESPONSE

       
                                                                                                        
                                                                                                                                                                                                                            [{"id":"008011160","name":"Berlin Hbf"},{"id":"008011201","name":"BER Berlin Brandenburg Airport"},{"id":"008096003","name":"BERLIN"},{"id":"008011113","name":"Berlin Südkreuz"},{"id":"008010404","name":"Berlin-Spandau"},{"id":"008010255","name":"Berlin Ostbahnhof"},{"id":"008011102","name":"Berlin Gesundbrunnen"},{"id":"008011155","name":"Berlin Alexanderplatz"},{"id":"008011306","name":"Berlin Friedrichstraße"},{"id":"008010036","name":"Berlin-Lichtenberg"},{"id":"008010406","name":"Berlin Zoologischer Garten"},{"id":"008011167","name":"Berlin Jungfernheide"}]
                                                                                                                                                                                                                    
                                                                                                    

Get Stations IDs - CODE SNIPPETS


curl --location --request GET 'https://zylalabs.com/api/847/deutsche+bahn+api/621/get+stations+ids?query=berlin' --header 'Authorization: Bearer YOUR_API_KEY' 

    

This endpoint will allow you to find trips between two destinations. 

You will be receiving the trip segments and fare of that trip. Also you will be receiving the Deutsche Bahn link to make the ticket purchase. 



                                                                            
GET https://zylalabs.com/api/847/deutsche+bahn+api/622/search+trips
                                                                            
                                                                        

Search Trips - Endpoint Features
Object Description
from_id [Required] Departure id
to_id [Required] Arrival id
date [Required] Travel date in format DD.MM.YYYY
time [Required] Travel Time TIME (24-HOUR HH:MM)
passenger0_age [Required] Age of the passenger
Test Endpoint

API EXAMPLE RESPONSE

       
                                                                                                        
                                                                                                                                                                                                                            {"headers":{"response_time":3118,"response_timestamp":"2022-12-29T18:33:48.353Z","api":"bahn_app","response_id":21822830},"journeys":[{"dep_offset":"2023-01-02T08:58:00.000","dep_name":"Flughafen BER - Terminal 1-2","arr_offset":"2023-01-02T09:29:00.000","arr_name":"Berlin Alexanderplatz (S)","duration":"00:31","changeovers":2,"deeplink":"https://reiseauskunft.bahn.de/bin/query.exe/dn?K=2&SS=8011201&ZS=8089001&T=202301020858&E=U&M=D&RT.1=E&E.1=0&VH=T%248011201%248011162%24202301020858%24202301020915%24FEX19818%24%C2%A7T%248089028%248089001%24202301020921%24202301020929%24S%207%24","segments":[{"dep_offset":"2023-01-02T08:58:00.000","dep_name":"Flughafen BER - Terminal 1-2","dep_platform":"1","arr_offset":"2023-01-02T09:15:00.000","arr_name":"Berlin Ostkreuz","arr_platform":"14","product":"FEX19818"},{"dep_offset":"2023-01-02T09:15:00.000","dep_name":"Berlin Ostkreuz","dep_platform":"n/a","arr_offset":"2023-01-02T09:20:00.000","arr_name":"Berlin Ostkreuz (S)","arr_platform":"n/a","product":"Walk"},{"dep_offset":"2023-01-02T09:21:00.000","dep_name":"Berlin Ostkreuz (S)","dep_platform":"6","arr_offset":"2023-01-02T09:29:00.000","arr_name":"Berlin Alexanderplatz (S)","arr_platform":"4","product":"S 7"}],"fares":[{"name":"Price not available","price_in_cents":"n/a"}]},{"dep_offset":"2023-01-02T09:13:00.000","dep_name":"Flughafen BER - Terminal 1-2","arr_offset":"2023-01-02T09:41:00.000","arr_name":"Berlin Alexanderplatz","duration":"00:28","changeovers":0,"deeplink":"https://reiseauskunft.bahn.de/bin/query.exe/dn?K=2&SS=8011201&ZS=8011155&T=202301020913&E=U&M=D&RT.1=E&E.1=0&VH=T%248011201%248011155%24202301020913%24202301020941%24RB%2018148%24","segments":[{"dep_offset":"2023-01-02T09:13:00.000","dep_name":"Flughafen BER - Terminal 1-2","dep_platform":"3 D-G","arr_offset":"2023-01-02T09:41:00.000","arr_name":"Berlin Alexanderplatz","arr_platform":"2","product":"RB 18148"}],"fares":[{"name":"Price not available","price_in_cents":"n/a"}]},{"dep_offset":"2023-01-02T09:28:00.000","dep_name":"Flughafen BER - Terminal 1-2","arr_offset":"2023-01-02T09:59:00.000","arr_name":"Berlin Alexanderplatz (S)","duration":"00:31","changeovers":2,"deeplink":"https://reiseauskunft.bahn.de/bin/query.exe/dn?K=2&SS=8011201&ZS=8089001&T=202301020928&E=U&M=D&RT.1=E&E.1=0&VH=T%248011201%248011162%24202301020928%24202301020945%24FEX19820%24%C2%A7T%248089028%248089001%24202301020951%24202301020959%24S%207%24","segments":[{"dep_offset":"2023-01-02T09:28:00.000","dep_name":"Flughafen BER - Terminal 1-2","dep_platform":"1","arr_offset":"2023-01-02T09:45:00.000","arr_name":"Berlin Ostkreuz","arr_platform":"14","product":"FEX19820"},{"dep_offset":"2023-01-02T09:45:00.000","dep_name":"Berlin Ostkreuz","dep_platform":"n/a","arr_offset":"2023-01-02T09:50:00.000","arr_name":"Berlin Ostkreuz (S)","arr_platform":"n/a","product":"Walk"},{"dep_offset":"2023-01-02T09:51:00.000","dep_name":"Berlin Ostkreuz (S)","dep_platform":"6","arr_offset":"2023-01-02T09:59:00.000","arr_name":"Berlin Alexanderplatz (S)","arr_platform":"4","product":"S 7"}],"fares":[{"name":"Price not available","price_in_cents":"n/a"}]}]}
                                                                                                                                                                                                                    
                                                                                                    

Search Trips - CODE SNIPPETS


curl --location --request GET 'https://zylalabs.com/api/847/deutsche+bahn+api/622/search+trips?from_id=008011201&to_id=008011155&date=02.01.2023&time=09:00&passenger0_age=30' --header 'Authorization: Bearer YOUR_API_KEY' 

    

API Access Key & Authentication

After signing up, every developer is assigned a personal API access key, a unique combination of letters and digits provided to access to our API endpoint. To authenticate with the Deutsche Bahn API REST API, simply include your bearer token in the Authorization header.

Headers

Header Description
Authorization [Required] Should be Bearer access_key. See "Your API Access Key" above when you are subscribed.


Simple Transparent Pricing

No long term commitments. One click upgrade/downgrade or cancellation. No questions asked.

🚀 Enterprise
Starts at $10,000/Year

  • Custom Volume
  • Dedicated account manager
  • Service-level agreement (SLA)

Customer favorite features

  • ✔︎ Only Pay for Successful Requests
  • ✔︎ Free 7-Day Trial
  • ✔︎ Multi-Language Support
  • ✔︎ One API Key, All APIs.
  • ✔︎ Intuitive Dashboard
  • ✔︎ Comprehensive Error Handling
  • ✔︎ Developer-Friendly Docs
  • ✔︎ Postman Integration
  • ✔︎ Secure HTTPS Connections
  • ✔︎ Reliable Uptime

Zyla API Hub is, in other words, an API MarketPlace. An all-in-one solution for your developing needs. You will be accessing our extended list of APIs with only your user. Also, you won't need to worry about storing API keys, only one API key for all our products is needed.

Prices are listed in USD. We accept all major debit and credit cards. Our payment system uses the latest security technology and is powered by Stripe, one of the world’s most reliable payment companies. If you have any trouble with paying by card, just contact us at [email protected]

Sometimes depending on the bank's fraud protection settings, a bank will decline the validation charge we make when we attempt to be sure a card is valid. We recommend first contacting your bank to see if they are blocking our charges. If more help is needed, please contact [email protected] and our team will investigate further

Prices are based on a recurring monthly subscription depending on the plan selected — plus overage fees applied when a developer exceeds a plan’s quota limits. In this example, you'll see the base plan amount as well as a quota limit of API requests. Be sure to notice the overage fee because you will be charged for each additional request.

Zyla API Hub works on a recurring monthly subscription system. Your billing cycle will start the day you purchase one of the paid plans, and it will renew the same day of the next month. So be aware to cancel your subscription beforehand if you want to avoid future charges.

Just go to the pricing page of that API and select the plan that you want to upgrade to. You will only be charged the full amount of that plan, but you will be enjoying the features that the plan offers right away.

Yes, absolutely. If you want to cancel your plan, simply go to your account and cancel on the Billing page. Upgrades, downgrades, and cancellations are immediate.

You can contact us through our chat channel to receive immediate assistance. We are always online from 9 am to 6 pm (GMT+1). If you reach us after that time, we will be in contact when we are back. Also you can contact us via email to [email protected]

 Service Level
100%
 Response Time
2,944ms

Category:


Tags:


Related APIs