# GTFS Transit Fare Tables (`saffo/transit-fare-tables`) Actor

Public-transit fares from any GTFS feed as one clean row per fare, with prices, currencies, zone and station names, media, rider categories and transfer rules resolved.

- **URL**: https://apify.com/saffo/transit-fare-tables.md
- **Developed by:** [Saffo](https://apify.com/saffo) (community)
- **Categories:** Travel, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.40 / 1,000 fare rows

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
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 Fares from GTFS Feeds: one joined row per fare

Public-transit fares from any GTFS feed as one clean row per fare, with prices, currencies, zone and station names, media, rider categories and transfer rules resolved.

### What it does

The actor reads transit fares from the GTFS static feeds that transit agencies publish for developers and turns the fare files into one flat row per fare. Each row has the price and currency next to readable origin and destination names (station names for zone fares, area names for v2 fares), the route or fare network, the fare medium, the rider category, the transfer allowance and the feed version it came from. Both fare models of the standard, GTFS-Fares v1 (`fare_attributes.txt` and `fare_rules.txt`) and GTFS-Fares v2 (`fare_products.txt`, `fare_leg_rules.txt` and friends), come out in the same shape. The actor reads only the fare and lookup files of each zip through HTTP byte-range requests, so a large feed costs a few hundred kilobytes of download instead of the whole file. The fares are exactly as published in the feed at the time of the run.

### Who it is for

- Transit and mobility analysts who compare fare levels between systems without writing a GTFS parser.
- Fare-equity researchers who need youth, senior and reduced prices next to the full fare.
- Trip-cost and journey-planner developers, travel apps and AI agents that answer "how much is the fare from A to B".

### How to use it

1. Open the actor on [Apify Store](https://apify.com/saffo/transit-fare-tables) and go to its Input tab.
2. Fill in `feedUrls`; every other field has a default (see Input below).
3. Click **Start**. The run ends at the limits below, or earlier at the "Maximum cost per run" you set.
4. When the run ends, open the Output tab: view the results as a table, or export them as JSON, CSV or Excel.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `feedUrls` | array | required | Direct http(s) URLs of GTFS static feed zip files, one per transit system (at most 20). Agencies list them on their developer or open-data pages. |
| `maxItems` | integer | `1000` | Stop after this many fare rows in total across all feeds. At most 10000 per run. |
| `includeRiderCategories` | boolean | `false` | Also output one row per rider category price (youth, senior, reduced) when the feed lists them. |
| `maxFeedSizeMb` | integer | `300` | Largest zip the actor downloads in full when the server ignores HTTP Range requests; larger feeds are skipped. |

Example input:

```json
{
  "feedUrls": [
    "https://www.bart.gov/dev/schedules/google_transit.zip"
  ],
  "maxItems": 5
}
```

Feed URLs: agencies list the address of their GTFS static zip on their developer or open-data page (often called "GTFS", "schedule data" or "developer resources"). Use the direct link to the `.zip` file.

### Output

Each result is one dataset item:

| Field | Type | Description |
|---|---|---|
| `url` | string | Web address of the item: its own page, or the page it was read from. |
| `title` | string | Title of the item as shown on the page. |
| `price` | number or null | Price as a number, in `currency`; null when the page shows none. |
| `currency` | string or null | ISO 4217 currency code of `price`, for example USD. |
| `fareModel` | string | GTFS fare model the row comes from: gtfs-fares-v1 (fare_attributes and fare_rules) or gtfs-fares-v2 (fare_products and fare_leg_rules). |
| `fareId` | string | Feed identifier of the fare: fare_id in v1 or fare_product_id in v2. |
| `riderCategory` | string or null | Name of the rider category the price applies to (for example youth or senior); null for the default fare. |
| `paymentTiming` | string or null | When the fare is paid in v1 feeds: on-board or before-boarding; null in v2 rows. |
| `fareMedia` | object or null | Fare medium the v2 price applies to; null for v1 rows and v2 products without a medium. |
| `agency` | object or null | Transit agency that sells the fare; null when a multi-agency feed does not say which one. |
| `route` | object or null | Route the v1 fare is limited to; null when the fare applies to every route. |
| `network` | object or null | Fare network of a v2 leg rule; null for v1 rows and for rules that apply to any network. |
| `origin` | object or null | Fare zone (v1) or area (v2) where the trip starts; null means any origin. |
| `destination` | object or null | Fare zone (v1) or area (v2) where the trip ends; null means any destination. |
| `containsZoneId` | string or null | v1 contains_id, a zone the trip must pass through for this fare; null when not set. |
| `legGroupId` | string or null | v2 leg_group_id of the leg rule; null for v1 rows and for products sold outside leg rules (passes). |
| `timeframeGroupId` | string or null | v2 from_timeframe_group_id that limits when the fare applies; null when it applies at all times. |
| `transfers` | object | Transfer allowance included in the fare. |
| `feed` | object | Version metadata of the feed the fare was read from. |
| `fetchedAt` | string | When the page was read (ISO 8601, UTC). |

Example output (real items from a test run):

```json
[
  {
    "url": "https://www.bart.gov/dev/schedules/google_transit.zip",
    "title": "Bay Area Rapid Transit South San Francisco → South San Francisco",
    "price": 7.55,
    "currency": "USD",
    "fareModel": "gtfs-fares-v1",
    "fareId": "1",
    "riderCategory": null,
    "paymentTiming": "before-boarding",
    "fareMedia": null,
    "agency": {
      "id": "BART",
      "name": "Bay Area Rapid Transit",
      "fareUrl": null
    },
    "route": null,
    "network": null,
    "origin": {
      "id": "SSAN",
      "name": "South San Francisco",
      "stopCount": 2
    },
    "destination": {
      "id": "SSAN",
      "name": "South San Francisco",
      "stopCount": 2
    },
    "containsZoneId": null,
    "legGroupId": null,
    "timeframeGroupId": null,
    "transfers": {
      "maxTransfers": null,
      "unlimited": true,
      "durationSeconds": null
    },
    "feed": {
      "publisher": "Bay Area Rapid Transit",
      "version": "72",
      "startDate": "2026-01-12",
      "endDate": "2026-08-30"
    },
    "fetchedAt": "2026-11-17T09:47:43.253Z"
  },
  {
    "url": "https://www.bart.gov/dev/schedules/google_transit.zip",
    "title": "Bay Area Rapid Transit South San Francisco → San Bruno",
    "price": 4.25,
    "currency": "USD",
    "fareModel": "gtfs-fares-v1",
    "fareId": "2",
    "riderCategory": null,
    "paymentTiming": "before-boarding",
    "fareMedia": null,
    "agency": {
      "id": "BART",
      "name": "Bay Area Rapid Transit",
      "fareUrl": null
    },
    "route": null,
    "network": null,
    "origin": {
      "id": "SSAN",
      "name": "South San Francisco",
      "stopCount": 2
    },
    "destination": {
      "id": "SBRN",
      "name": "San Bruno",
      "stopCount": 2
    },
    "containsZoneId": null,
    "legGroupId": null,
    "timeframeGroupId": null,
    "transfers": {
      "maxTransfers": null,
      "unlimited": true,
      "durationSeconds": null
    },
    "feed": {
      "publisher": "Bay Area Rapid Transit",
      "version": "72",
      "startDate": "2026-01-12",
      "endDate": "2026-08-30"
    },
    "fetchedAt": "2026-11-17T09:47:43.253Z"
  }
]
```

A v2 row from the MBTA feed (Local Bus one-way fare on a CharlieCard, read from the November 2026 feed) looks like this:

```json
{
  "url": "https://cdn.mbta.com/MBTA_GTFS.zip",
  "title": "Local Bus one-way fare",
  "price": 1.7,
  "currency": "USD",
  "fareModel": "gtfs-fares-v2",
  "fareId": "prod_local_bus_smartcard",
  "riderCategory": null,
  "paymentTiming": null,
  "fareMedia": { "id": "charliecard", "name": "CharlieCard", "type": "transit-card" },
  "agency": { "id": "1", "name": "MBTA", "fareUrl": "https://www.mbta.com/fares" },
  "route": null,
  "network": { "id": "local_bus", "name": null },
  "origin": { "id": "area_route_354_downtown", "name": "Route 354 - Downtown", "stopCount": 3 },
  "destination": { "id": "area_route_354_outside_downtown", "name": "Route 354 - Outside Downtown", "stopCount": 86 },
  "containsZoneId": null,
  "legGroupId": "leg_local_bus_smartcard",
  "timeframeGroupId": null,
  "transfers": { "maxTransfers": 1, "unlimited": false, "durationSeconds": 7200 },
  "feed": { "publisher": "MBTA", "version": "Fall 2026, 2026-11-13T21:35:28+00:00, version D", "startDate": "2026-11-06", "endDate": "2026-12-12" },
  "fetchedAt": "2026-11-17T09:44:50.075Z"
}
```

Download the dataset as JSON, CSV or Excel, or read it through the Apify API.

### Pricing

Pay per event: a small fee per run plus a fee per result saved. Platform usage is included in these prices.

| Event | When it is charged | Free plan | Bronze plan | Silver plan | Gold plan | Platinum plan | Diamond plan |
|---|---|---|---|---|---|---|---|
| Run started (`run-started`) | Flat fee once per run; covers starting the run and reading the feed directories. | $0.025 | $0.02 | $0.018 | $0.016 | $0.016 | $0.016 |
| Fare row (`fare-row`) | One resolved fare row saved to the dataset. | $0.0037 | $0.003 | $0.0027 | $0.0024 | $0.0024 | $0.0024 |

Example (lowest plan price): a run that saves 100 results costs $0.016 + 100 × $0.0024 = **$0.256**. That is $2.40 per 1,000 results plus $0.016 per run. You pay only for results saved to the dataset; set "Maximum cost per run" in the run options and the actor stops there.

Worked examples: the full BART table of 2,500 origin-destination fares costs $0.02 + 2,500 × $0.003 = $7.52; a run that stops at 500 fare rows costs $0.02 + 500 × $0.003 = $1.52. A feed without fare files saves no rows, so it costs only the run fee.

### Limits

- One run saves at most 10,000 results and loads at most 20 pages. Larger jobs: split the start URLs over several runs.

- Default memory 512 MB; no proxy.

- When a limit is reached, the run ends normally and keeps every result saved so far; the status message says which limit it was.

- Each feed counts as one page, so one run reads up to 20 feeds; duplicate URLs are read once.

- Feeds without fare files (`fare_attributes.txt` or `fare_products.txt`) return no rows; many agencies publish schedules only.

- When a server ignores byte-range requests, the actor downloads the whole zip to a temporary file, up to `maxFeedSizeMb`; larger feeds are skipped.

- The actor obeys each feed host's robots.txt and skips a feed whose path it disallows. Feeds that need a login are not supported.

- Rows from feeds on transitchicago.com are never returned: the CTA Developer License does not allow selling CTA data as a stand-alone product.

- Fares are as published by the agency in its feed, not live ticket prices, and may be out of date when the agency has not updated its feed. The actor makes no guarantee about their accuracy.

- The actor is not affiliated with or endorsed by BART, MBTA, MassDOT, CTA or any other transit agency. Each feed's data licence governs how you may reuse its data. MBTA data is provided by the Massachusetts Department of Transportation under the MassDOT Developers License Agreement.

### Use with AI agents

AI agents can call this actor as a tool through the Apify MCP server. Add it to an MCP client (Claude Desktop, Cursor, VS Code and others):

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com/?tools=saffo/transit-fare-tables"
    }
  }
}
```

Or call it over HTTP and get the results in the response:

```sh
curl -X POST "https://api.apify.com/v2/acts/saffo~transit-fare-tables/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
  -d '{"feedUrls":["https://www.bart.gov/dev/schedules/google_transit.zip"],"maxItems":5}'
```

An agent asked for the fare between two stations calls the actor with the agency's feed URL and a `maxItems` that covers the table, then filters the rows by `origin.name` and `destination.name`.

### FAQ

#### How much does it cost?

You pay per event: from $0.0024 per fare row plus $0.016 per run. The Pricing section lists the price on every Apify plan. Platform usage is included, and the run stops at the maximum cost per run you set.

#### Can I use it from an AI agent or my own code?

Yes. Add it to any MCP client through the Apify MCP server, or call the Apify API; the examples under Use with AI agents show both. Results come back as JSON.

#### How many results can one run return?

Up to 10,000 results from at most 20 pages. For more, split the input over several runs.

#### Does it collect personal data?

No. It saves only the fields listed under Output and leaves out names, e-mail addresses, phone numbers and profiles of private persons.

#### Why do some feeds return no rows?

The agency publishes no fare files in its GTFS feed. Fares are optional in GTFS, and many feeds carry only stops, routes and timetables. The run log names every feed that was skipped and why.

#### What is the difference between v1 and v2 rows?

v1 rows (`gtfs-fares-v1`) are zone fares: a price for a trip from one fare zone to another, optionally limited to a route, with the payment timing and transfer allowance. v2 rows (`gtfs-fares-v2`) are fare products tied to leg rules: a price per network, area pair, fare medium and time frame, with transfers read from the transfer rules. Both use the same fields; the ones a model does not have are null.

#### Are the youth and senior prices included?

Only when you turn on `includeRiderCategories` and the feed lists rider-category prices. Each base fare is then followed by one row per category, with the category name in `riderCategory`.

### Related actors

More actors by the same author on Apify Store:

- [Brand Ownership Lookup: Parent Company & Ultimate Owner](https://apify.com/saffo/brand-ownership-lookup): For each brand, product or company name, returns the owning company, the chain up to the ultimate parent with its LEI and stock tickers, and its major institutional shareholders, all from Wikidata.
- [Google Play Developer Portfolio Tracker](https://apify.com/saffo/play-developer-portfolio): Every app a Google Play developer page lists, with rating, installs, price, monetisation, release and update dates and its change since the last run, one row per app.
- [Google Play Ratings by Country](https://apify.com/saffo/play-ratings-by-country): Compares the star rating Google Play shows in each country for the apps you list, with star shares, price, spread and change since the last run, one report per app. Not affiliated with Google.

### Support

Open an issue on the actor's Issues tab.

### Changelog

#### 0.1 (2026-11-17)

- First release: fare rows from GTFS static feeds for both fare models (GTFS-Fares v1 and v2) in one output shape, with zone, area and station names, fare media, networks, rider-category prices and transfer allowances; only the fare and lookup files are read, through HTTP byte-range requests.

# Changelog

This Actor's version history is a separate document: https://apify.com/saffo/transit-fare-tables/changelog.md

# Actor input Schema

## `feedUrls` (type: `array`):

Direct http(s) URLs of GTFS static feed zip files, one per transit system (at most 20). Agencies list them on their developer or open-data pages.

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

Stop after this many fare rows in total across all feeds. At most 10000 per run.

## `includeRiderCategories` (type: `boolean`):

Also output one row per rider category price (youth, senior, reduced) when the feed lists them.

## `maxFeedSizeMb` (type: `integer`):

Largest zip the actor downloads in full when the server ignores HTTP Range requests; larger feeds are skipped.

## Actor input object example

```json
{
  "feedUrls": [
    "https://www.bart.gov/dev/schedules/google_transit.zip"
  ],
  "maxItems": 1000,
  "includeRiderCategories": false,
  "maxFeedSizeMb": 300
}
```

# Actor output Schema

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

No description

# 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 = {
    "feedUrls": [
        "https://www.bart.gov/dev/schedules/google_transit.zip"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("saffo/transit-fare-tables").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 = { "feedUrls": ["https://www.bart.gov/dev/schedules/google_transit.zip"] }

# Run the Actor and wait for it to finish
run = client.actor("saffo/transit-fare-tables").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 '{
  "feedUrls": [
    "https://www.bart.gov/dev/schedules/google_transit.zip"
  ]
}' |
apify call saffo/transit-fare-tables --silent --output-dataset

```

## MCP server setup

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

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/9A9bqsEFe0uiPyoyF/builds/mo5ewO3iTcr5hnfLQ/openapi.json
