Overview
transport.rest offers a unified API designed to simplify access to public transportation data. Its primary function is to abstract the complexities of various local transit data sources into a single, consistent interface. This approach allows developers to query for real-time departures, plan journeys between stops, and retrieve detailed information about public transport networks without needing to integrate with multiple, disparate city-specific APIs. The service was established in 2013 with a focus on open-source principles and community contributions.
The API is particularly suited for applications that do not require enterprise-grade scaling or extensive commercial support. Open-source projects, independent developers creating personal travel applications, academic researchers analyzing urban mobility patterns, and teams building proof-of-concept demonstrations often find transport.rest a viable option. Its free tier for non-commercial use, albeit with limitations on request volume, enables these types of projects to get started without immediate financial investment. Developers note its clear documentation and practical code examples, which enhance the initial development experience.
Core functionalities include retrieving real-time departure boards for specific stops, calculating optimal public transport routes between two points, and searching for stops by name or geographical coordinates. The API aggregates data from numerous public transit operators, aiming to provide a comprehensive view across different urban areas. While it strives for broad coverage, specific data availability can vary by region and individual transport provider; developers should consult the transport.rest documentation for covered regions to confirm local service availability. This approach to public transit data access contrasts with more geographically constrained or single-operator APIs, offering a broader scope for multi-city applications.
The platform is built on principles that prioritize ease of integration for developers. It offers a RESTful interface, which is a common pattern for web service APIs, allowing interaction using standard HTTP methods. This design choice contributes to its accessibility for developers familiar with web technologies. The API's dedication to simplifying complex data sources into a cohesive format makes it a practical tool for rapid prototyping and development in the public transit domain. For example, a developer could quickly build a tool to show the next bus departures at a specific stop for a personal travel app.
Key features
- Public Transport API: A unified interface for accessing public transit data across various providers and cities.
- Real-time Data: Provides current departure times and service updates where available from underlying data sources.
- Departure Boards: Ability to query upcoming departures from specific public transport stops, including delays and platform information.
- Journey Planning: Calculates routes and connections between two points using public transport options, offering alternatives and estimated travel times.
- Stop Search: Allows searching for public transport stops by name, location, or ID.
- Unified Data Model: Aims to present diverse transit data in a consistent JSON format regardless of the original data source.
Pricing
As of May 2026, transport.rest operates a tiered pricing model with a strong emphasis on non-commercial use.
| Use Case | Details | Request Limits | Cost |
|---|---|---|---|
| Non-commercial / Personal | For open-source projects, personal applications, academic research, and proof-of-concepts. | Limited requests per minute/day. Specific limits are not publicly detailed and may vary. | Free |
| Commercial Use | For businesses, commercial products, or applications generating revenue. | Determined by custom licensing agreements. | Contact for licensing |
For detailed terms regarding commercial licensing and specific non-commercial request limits, users are advised to consult the transport.rest official documentation or contact their support directly. The free tier is intended to support the developer community and foster innovation in public transit applications, as detailed in their project philosophy.
Common integrations
transport.rest is designed to be consumed by client-side applications or backend services, with a focus on JavaScript environments due to its existing SDK.
- JavaScript Frontends: Easily integrated into web applications built with frameworks like React, Vue, or Angular using the provided transport.rest JavaScript client for fetching real-time data and planning journeys.
- Node.js Backends: Can be used in server-side Node.js applications to power APIs, data processing, or scheduled tasks that require public transit information.
- Mobile Applications: Developers can integrate the API into native or cross-platform mobile apps (e.g., using React Native or Flutter) by making HTTP requests.
- OpenStreetMap Data Providers: Often used in conjunction with mapping libraries or data from projects like OpenStreetMap for mapping public transport routes, providing a visual component to the journey data.
Alternatives
- Moovit API: Offers public transit data, journey planning, and real-time arrivals, often used by larger organizations for commercial applications seeking broader global coverage.
- Google Maps Platform: Provides comprehensive mapping and location services, including public transit directions, with extensive global data and robust infrastructure for commercial use cases.
- TransitLand: An open data platform for public transit, offering GTFS feeds and an API to access transit data from numerous operators globally, often favored by data analysts and researchers.
Getting started
To begin using transport.rest, you can make direct HTTP requests or use the provided JavaScript client library. The following example demonstrates fetching departures from a specific public transport stop using Node.js and the node-fetch library.
const fetch = require('node-fetch');
const stopId = '900000010001'; // Example: Berlin Hauptbahnhof (S+U)
const when = new Date();
when.setHours(when.getHours() + 1); // Get departures for one hour from now
const url = `https://v5.bvg.transport.rest/stops/${stopId}/departures?when=${when.toISOString()}`;
async function getDepartures() {
try {
const response = await fetch(url, {
headers: {
'User-Agent': 'apispine-example-app'
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log(`Departures from stop ID ${stopId}:`);
data.slice(0, 5).forEach(dep => {
console.log(` ${dep.line.name} to ${dep.direction || 'Unknown direction'} at ${new Date(dep.when).toLocaleTimeString()}`);
});
} catch (error) {
console.error('Error fetching departures:', error);
}
}
getDepartures();
This code snippet fetches the next five departures from the specified Berlin Hauptbahnhof stop. It constructs a URL for the /stops/{id}/departures endpoint, adding a when parameter to filter departures. The User-Agent header is included as good practice for API requests. The response, parsed as JSON, contains an array of departure objects, each detailing the line, direction, and scheduled departure time. Developers should replace stopId with a relevant identifier for their target location. For more detailed API usage, including journey planning and stop searching, refer to the transport.rest API reference.