Overview
Transport for Czech Republic (PID) offers a comprehensive set of data and APIs designed for developers and organizations to integrate public transport information into various applications. The service provides access to schedules, real-time vehicle positions, and other operational data for the integrated public transport system of Prague and Central Bohemia. This includes data from buses, trams, metro, and suburban trains, making it suitable for developing a wide array of transport-related solutions.
The primary offerings include General Transit Feed Specification (GTFS) data, which covers static schedule information, and GTFS-Realtime (GTFS-RT) feeds for dynamic updates such as vehicle positions, service alerts, and trip updates Google's GTFS-RT specification. These standardized formats facilitate interoperability with existing mapping and transport applications. In addition to the feeds, PID provides a dedicated HTTP API that allows programmatic access to specific data points, such as departures from particular stops, detailed connection information, and stop locations, as described in their PID API documentation.
The PID API is particularly well-suited for applications that require real-time passenger information systems, such as mobile apps displaying live departure boards or predicted arrival times. It also supports the creation of advanced wayfinding applications that incorporate public transport options, and tools for transport analytics that leverage historical and real-time operational data. Technical buyers might consider the PID API for integrating public transport insights into smart city initiatives, logistical planning, or tourism applications. Access is managed through an API key request system, providing a generous free tier for most standard use cases, with custom agreements available for high-volume or commercial deployments PID data and API page.
The developer experience is supported by documentation that outlines the structure of the GTFS and GTFS-RT feeds, along with examples for utilizing the HTTP API. This approach aims to lower the barrier to entry for developers familiar with standard transit data formats, enabling them to quickly build and deploy applications that enhance public transport accessibility and user experience within the Czech Republic.
Key features
- GTFS Static Data Feed: Provides comprehensive static schedule data including routes, stops, timetables, and agencies for offline and planning applications PID data feed access.
- GTFS-Realtime (GTFS-RT) Feed: Delivers real-time updates on vehicle positions, trip updates (delays, cancellations), and service alerts, enabling dynamic passenger information systems PID real-time data.
- HTTP API for Departures: Programmatic interface to query real-time departure information from specific stops, including predicted times and vehicle details PID API documentation.
- HTTP API for Stops and Connections: Allows developers to retrieve detailed information about stops, their locations, and available connections between different transport lines.
- Extensive Coverage: Data covers the integrated public transport system of Prague and the Central Bohemian Region, encompassing various modes of transport.
- Developer Portal: Centralized access to documentation, API key requests, and support resources for integrating PID data into applications PID integration resources.
Pricing
Transport for Czech Republic (PID) operates on a tiered access model, primarily offering free access for standard use cases. Custom agreements are available for high-volume or commercial applications.
| Use Case | Access Level | Details | As Of |
|---|---|---|---|
| Standard Development | Free | Generous free access via API key request for most non-commercial and application prototyping. | 2026-05-28 |
| High-Volume Commercial | Custom Agreement | Tailored agreements for applications requiring significant data volume, commercial redistribution, or advanced support. | 2026-05-28 |
For specific terms regarding commercial use or high data consumption, developers are advised to contact PID directly through their official data and API portal.
Common integrations
- Mapping Services: Integration with mapping platforms like Google Maps Platform for displaying public transport routes and real-time vehicle positions Google Maps Platform documentation.
- Mobile Applications: Used in native iOS and Android applications for journey planning, real-time departures, and service alerts.
- Smart City Platforms: Incorporating transport data into broader urban management and information systems.
- Data Analytics Tools: Feeding GTFS and GTFS-RT data into analytics platforms for transport pattern analysis, performance monitoring, and optimization.
- Wayfinding Kiosks: Powering public information displays at transport hubs and tourist locations.
Alternatives
- General Transit Feed Specification (GTFS) Data (Global): Many cities and regions worldwide provide their own GTFS feeds, such as GTFS data providers listed by Google, offering similar data structures for specific localities.
- OpenTripPlanner API: An open-source multi-modal trip planner that can consume GTFS data and provide routing services, often used by transit agencies.
- Transit App API: A platform that aggregates public transit data from numerous cities globally, offering APIs for developers.
- National Public Transport APIs (Country Specific): For example, Deutsche Bahn (Germany) or Transport for London (UK) offer their own API suites for their respective networks.
Getting started
To begin using the Transport for Czech Republic (PID) API, you will typically request an API key and then access the data feeds. The following Python example demonstrates how to fetch data from a hypothetical GTFS-RT feed URL, parse it, and display some basic information. This example assumes you have an API key and a valid GTFS-RT feed URL.
import requests
from google.transit import gtfs_realtime_pb2
# Replace with your actual API key and GTFS-RT feed URL
API_KEY = "YOUR_API_KEY_HERE"
GTFS_RT_FEED_URL = "https://api.pid.cz/gtfsrt/feed?apiKey=" + API_KEY # Example URL structure
def get_realtime_data():
try:
response = requests.get(GTFS_RT_FEED_URL)
response.raise_for_status() # Raises an HTTPError for bad responses (4xx or 5xx)
feed = gtfs_realtime_pb2.FeedMessage()
feed.ParseFromString(response.content)
print(f"Successfully fetched GTFS-RT feed with {len(feed.entity)} entities.\n")
for entity in feed.entity[:5]: # Print details for the first 5 entities
if entity.HasField('trip_update'):
trip_update = entity.trip_update
print(f"Trip ID: {trip_update.trip.trip_id}")
print(f"Route ID: {trip_update.trip.route_id}")
for stop_time_update in trip_update.stop_time_update:
arrival_time = stop_time_update.arrival.time if stop_time_update.HasField('arrival') and stop_time_update.arrival.HasField('time') else 'N/A'
departure_time = stop_time_update.departure.time if stop_time_update.HasField('departure') and stop_time_update.departure.HasField('time') else 'N/A'
print(f" Stop ID: {stop_time_update.stop_id}, Arrival: {arrival_time}, Departure: {departure_time}")
elif entity.HasField('vehicle'):
vehicle = entity.vehicle
print(f"Vehicle ID: {vehicle.vehicle.id}, Trip ID: {vehicle.trip.trip_id}, Stop ID: {vehicle.stop_id}")
print(f" Latitude: {vehicle.position.latitude}, Longitude: {vehicle.position.longitude}\n")
elif entity.HasField('alert'):
alert = entity.alert
print(f"Alert: {alert.header_text.translation[0].text}\n")
except requests.exceptions.RequestException as e:
print(f"Error fetching data: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
if __name__ == "__main__":
# Ensure you have the 'requests' and 'gtfs-realtime-bindings' libraries installed:
# pip install requests gtfs-realtime-bindings
get_realtime_data()
Before running this code, ensure you have obtained an API key from the Transport for Czech Republic developer portal and substituted it into the API_KEY variable. You will also need to install the requests and gtfs-realtime-bindings Python libraries.