# Transit Journey Planner & Timetables: Bus, Metro, Rail (`tacps126/transit-timetables`) Actor

Public transport for ~2,900 cities and operators from their official timetables: journeys from A to B with changes and walking, next departures at a stop, stops near a point and every route. Bus, metro, rail, tram and ferry feeds merged per city.

- **URL**: https://apify.com/tacps126/transit-timetables.md
- **Developed by:** [Tapaswai Choudhary](https://apify.com/tacps126) (community)
- **Categories:** Travel, Developer tools, Automation
- **Security:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.40 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Transit Journey Planner & Timetables: Bus, Metro, Rail

Public transport for **~2,900 cities and operators** worldwide, from their official timetables: **journeys from A to B** with changes and walking, the **next departures** at any stop, **stops near a point** with the lines that serve them, and **every route** with its operator. Give two places as coordinates and the Actor finds the city's timetables itself; one journey can use a city's buses and metro together.

**Built for** travel and mobility apps, real-estate and location analysts (how far is it by transit?), commute and logistics planners, researchers and city planners, and AI agents that need transit answers.

### What you can get

| Mode | One row is |
|---|---|
| **Journeys** | A trip option: depart, arrive, minutes, changes, walking minutes, lines, and each leg (walk or ride: line, mode, direction, stops, times) |
| **Departures** | A vehicle leaving a stop: time, minutes from now, line, mode, direction, platform |
| **Stops** | A stop: name, code, position, distance from your point, modes and lines serving it, wheelchair boarding |
| **Routes** | A line: name, mode, colour, operator, number of trips, first and last stop |
| **Feeds** | A city or operator timetable in the catalog: provider, place, coverage area, licence |

### Why this Actor

- **Worldwide coverage.** Bus, metro, rail, tram and ferry timetables from ~2,900 operators: North America, Europe, Japan, Australia, India (Bengaluru, Mumbai, Hyderabad, Chennai, Pune, Ahmedabad...), Singapore, Jakarta and more.
- **Real journey planning.** Up to 6 changes, walking between nearby stops, overnight services, options leaving one after another.
- **Multimodal.** Several operators of one city are merged, so a journey can change from bus to metro.
- **Answers in milliseconds** once the timetable is loaded; in Standby mode it stays loaded between requests.
- **Local time.** Dates and times are in the city's own time zone; leave them empty for "now".
- **For AI agents.** Callable as an MCP tool.

### How to use it

Journeys across Bengaluru at 08:30 (the timetable is found from the coordinates):

```json
{ "from": "12.9767,77.5713", "to": "12.9352,77.6245", "time": "08:30" }
```

Next metro departures at a Hyderabad station:

```json
{ "mode": "departures", "feeds": ["hyderabad metro"], "stops": ["Ameerpet"], "windowMinutes": 30 }
```

Stops within 500 m of an address, with the lines serving them:

```json
{ "mode": "stops", "from": "19.0760,72.8777", "maxWalkMeters": 500 }
```

Find a city's timetables:

```json
{ "mode": "feeds", "feeds": ["chennai"] }
```

### Pricing

**$3 per 1,000 results** plus a small start fee per run. On the Apify free plan a run returns up to 100 results.

### Good to know

- Times come from the published timetables, not live vehicle positions; delays and cancellations are not included.
- Each row carries the feeds it came from with their licence link; check the licence before republishing the data.
- Your city missing? Give its GTFS link in **GTFS links**, or **contact tacps126@gmail.com**.

# Actor input Schema

## `mode` (type: `string`):

Journeys plan trips with changes and walking; departures list what leaves a stop next.

## `from` (type: `string`):

lat,lon (e.g. 12.9767,77.5713) or a stop name. Also used to find the city's feeds when none are named.

## `to` (type: `string`):

lat,lon or a stop name.

## `date` (type: `string`):

YYYY-MM-DD. Empty = today where the transit runs.

## `time` (type: `string`):

HH:MM, local time. Empty = now where the transit runs.

## `journeys` (type: `integer`):

How many departures to plan, one after another.

## `maxTransfers` (type: `integer`):

Most changes between vehicles in one journey.

## `maxWalkMeters` (type: `integer`):

Longest walk to the first stop and from the last one; also the radius for stops near a point.

## `modes` (type: `array`):

Only these kinds of transport. Empty = all.

## `stops` (type: `array`):

Stop names, stop ids or codes, or lat,lon, for departures.

## `windowMinutes` (type: `integer`):

Departures mode: how far ahead to look.

## `search` (type: `string`):

Stops and routes: only those whose name contains this.

## `feeds` (type: `array`):

Catalog ids (mdb-2595) or search words ("bmtc", "mumbai bus", "sbb"). Empty = every city feed covering From. Several are merged so journeys can change between them.

## `country` (type: `string`):

Two-letter code to narrow the feed search, e.g. IN, US, DE.

## `gtfsUrls` (type: `array`):

Direct links to GTFS ZIP files, for timetables the catalog doesn't list.

## `maxItems` (type: `integer`):

Most results returned.

## `debug` (type: `boolean`):

Save extra diagnostics with the run (for support requests).

## Actor input object example

```json
{
  "mode": "journeys",
  "from": "12.9767,77.5713",
  "to": "12.9352,77.6245",
  "time": "08:30",
  "journeys": 3,
  "maxTransfers": 3,
  "maxWalkMeters": 800,
  "windowMinutes": 60,
  "maxItems": 200,
  "debug": false
}
```

# Actor output Schema

## `results` (type: `string`):

The produced items (default dataset items).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "from": "12.9767,77.5713",
    "to": "12.9352,77.6245",
    "time": "08:30"
};

// Run the Actor and wait for it to finish
const run = await client.actor("tacps126/transit-timetables").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "from": "12.9767,77.5713",
    "to": "12.9352,77.6245",
    "time": "08:30",
}

# Run the Actor and wait for it to finish
run = client.actor("tacps126/transit-timetables").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "from": "12.9767,77.5713",
  "to": "12.9352,77.6245",
  "time": "08:30"
}' |
apify call tacps126/transit-timetables --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tacps126/transit-timetables"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ZLINC4adMEm92ZiYV/builds/Km3WCpnAo6S70rhUe/openapi.json
