# Japan Train Route & Fare Finder (`superslowsloth/japan-train-route-fare-finder`) Actor

Station-to-station train routes anywhere in Japan, JR and Shinkansen included - duration, fare, transfers and every leg with platforms.

- **URL**: https://apify.com/superslowsloth/japan-train-route-fare-finder.md
- **Developed by:** [Superslow Sloth](https://apify.com/superslowsloth) (community)
- **Categories:** Travel, AI, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.70 / 1,000 route option returneds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Japan Train Route & Fare Finder

One station-to-station lookup for Japan, answered in one run: how do I get from
A to B, how long does it take, and what does it cost. JR, Shinkansen, private
railways, subways, limited express services, highway buses and the walking legs
in between are all covered, nationwide.

Ask for 東京 → 新大阪 and you get the のぞみ: departs 10:00, arrives 12:30, 150
minutes, 13,870 円 (8,910 円 base fare + 4,960 円 Shinkansen fee), zero
transfers, 552.6 km, calling at 品川, 新横浜, 名古屋 and 京都, leaving from
platform 16 and arriving on platform 22.

Up to three route options come back per search, each as one dataset item.

### Input

| Field | Notes |
|---|---|
| `origin`, `destination` | Station names **in Japanese** - kanji or kana both work (`東京`, `とうきょう`, `東京駅`). |
| `datetime` | ISO-8601 **only**, e.g. `2026-09-01T10:00`. No timezone means Japan time. Empty means now. Anything else is rejected before the run is charged. |
| `searchType` | `depart` (leave at that time) or `arrive` (be there by that time). |
| `preference` | `fastest`, `cheapest`, or `fewest_transfers`. Decides which route is `rank` 1. |
| `maxRoutes` | 1-3. The source offers no more than three. |
| `via` | Optional stations to route through, in order, in Japanese. At most three; a fourth is dropped. A via station really does divert the route — 東京 → 新大阪 is 13,870 円 / 552.6 km direct, and 19,780 円 / 708.7 km via 金沢. |
| `useShinkansen`, `useLimitedExpress`, `useHighwayBus`, `useLocalBus` | Turn classes of service off to price the journey without them. |
| `includeRomaji` | Adds romaji station names. Off by default - see below. |

### Output

One item per route option.

| Field | Notes |
|---|---|
| `rank` | 1 is the best route under your `preference`. |
| `departure_time`, `arrival_time` | `HH:MM`, Japan time, on the requested date. |
| `duration_minutes` | Door to door, including transfer waits and walking. |
| `riding_minutes` | Time actually aboard a vehicle. |
| `transfers` | Number of changes. Walking between two stations is not counted as a transfer. |
| `total_fare_jpy` | The whole trip in yen, IC-card fare where one applies. |
| `base_fare_jpy` | The 乗車券 portion. |
| `express_fare_jpy` | The 特別料金 portion - Shinkansen and limited-express supplements. |
| `seat_fees` | Each supplement itemised, e.g. `[{"label_ja": "自由席", "fare_jpy": 4960}]`. |
| `distance_km` | Rail distance for the itinerary. |
| `is_fastest`, `is_cheapest`, `is_fewest_transfers` | The source's own badges on this route. |
| `legs[]` | The journey in order. |
| `legs[].line_ja` | e.g. `ＪＲ新幹線のぞみ251号`, `東武日光線`, `徒歩`. |
| `legs[].destination_ja` | The train's final destination, e.g. `新大阪行`. |
| `legs[].is_walk` | `true` for a walking leg. |
| `legs[].from_station_ja`, `legs[].to_station_ja` | Endpoints of this leg. |
| `legs[].departure_time`, `legs[].arrival_time` | `HH:MM`. |
| `legs[].departure_platform`, `legs[].arrival_platform` | Platform number as printed. |
| `legs[].stops[]` | Intermediate stops with their times. |
| `resolved_origin_ja`, `resolved_destination_ja` | The stations the source actually matched. Read these. |
| `query_origin`, `query_destination`, `search_type`, `preference`, `search_datetime_jst` | Your request, echoed back. |
| `source_url` | The exact page these numbers came from, so any figure can be rechecked by hand. |

### Station names must be Japanese

The source matches Japanese only, and it does not fail when it cannot match:
it silently picks a different station and returns a perfectly valid itinerary
for it. `Tokyo` resolves to **あいの里教育大**, in Hokkaido, and the run then
reports an eleven-hour journey that is entirely real and entirely not what you
asked for.

Two things guard against that. `resolved_origin_ja` and `resolved_destination_ja`
on every item say which stations the numbers describe, and the run log carries a
warning whenever they differ from what you sent. Compare them before trusting a
result.

Kana works, so `とうきょう` and `しんおおさか` are both fine if kanji is
inconvenient.

### Romaji

`includeRomaji` fills `legs[].from_station_romaji` and `legs[].to_station_romaji`
with Hepburn romaji - `Tokyo`, `Shin'osaka`, `Hatchobori`. These are
transliterated from the kana reading each station publishes on its own page, not
guessed from the kanji, which is why the option costs one extra request per
distinct station and is off by default.

With `includeRomaji` off, both fields are `null`. Intermediate stops in
`legs[].stops[]` are never romanised: the source gives no reading for them.

### What this source does not give

Stated rather than guessed. A missing value is always `null`, never `0` and
never an empty string, because a zero in a fare column reads as a measurement.

- **No reserved-seat fare when a cheaper seat class exists.** `express_fare_jpy`
  and `seat_fees` report what the source quotes for the itinerary, which for
  Shinkansen searches is usually the 自由席 (non-reserved) supplement.
  東京 → 新大阪 comes back as 13,870 円; a 指定席 reserved seat on the same train
  costs a few hundred yen more.
- **No per-leg fare.** Fares are quoted per fare section, and a section can span
  several legs, so splitting them across legs would be invention. The route-level
  totals and `seat_fees` are the real breakdown.
- **No seat availability, no booking, no ticket purchase.** This is a timetable
  and fare lookup.
- **No live delay or disruption data.** Times are scheduled times.
- **No romaji for line names.** `line_ja` is Japanese only.
- **No coordinates and no station codes** beyond the source's internal ids.
- **Platform is often absent** on private railways and on arrival at smaller
  stations. It is `null` there, not an empty string.
- **At most three routes per search**, and no pagination past them.
- **At most three `via` stations.** The source will accept more, but the schema
  promises three, so a fourth is dropped rather than silently honoured.
- **Dates outside the published timetable return nothing.** Japanese timetables
  are published roughly a month ahead; a search far in the future fails rather
  than guessing.

### Pricing

Pay per event. You are charged for starting the run and for each route option
returned. A search that matches no route returns nothing and is charged only the
start fee.

# Actor input Schema

## `origin` (type: `string`):

Departure station, in Japanese kanji or kana, e.g. 東京 or とうきょう. Romaji is not matched by the source and will silently return a different station - see the README.

## `destination` (type: `string`):

Arrival station, in Japanese kanji or kana, e.g. 新大阪 or しんおおさか.

## `datetime` (type: `string`):

ISO-8601 only, e.g. 2026-09-01T10:00. Plain language such as "next tuesday" is rejected before the run is charged. A value with no timezone is read as Japan time. Leave empty for right now.

## `searchType` (type: `string`):

Whether the date and time above is when you want to leave or when you need to be there.

## `preference` (type: `string`):

Which route the source should put first: the earliest arrival, the lowest fare, or the fewest transfers.

## `maxRoutes` (type: `integer`):

How many route options to return. The source offers at most 3 per search.

## `via` (type: `array`):

Optional stations the route must pass through, in order. In Japanese, like the origin and destination. At most three; any beyond the third are dropped.

## `useShinkansen` (type: `boolean`):

Turn off to price the journey on ordinary trains only. Off makes Tokyo to Shin-Osaka a nine-hour trip.

## `useLimitedExpress` (type: `boolean`):

Paid limited-express services such as 特急きぬがわ or the Narita Express.

## `useHighwayBus` (type: `boolean`):

Long-distance buses. Often the cheapest option and much slower.

## `useLocalBus` (type: `boolean`):

Local city buses, used to reach stations off the rail network.

## `includeRomaji` (type: `boolean`):

Fetch each station's own kana reading and transliterate it to Hepburn romaji. Costs one extra request per distinct station, so it is off by default.

## `proxyConfiguration` (type: `object`):

Optional. The source served 12 back-to-back searches from a datacenter address with no block, so a proxy is not required.

## Actor input object example

```json
{
  "origin": "東京",
  "destination": "新大阪",
  "searchType": "depart",
  "preference": "fastest",
  "maxRoutes": 3,
  "useShinkansen": true,
  "useLimitedExpress": true,
  "useHighwayBus": true,
  "useLocalBus": true,
  "includeRomaji": false
}
```

# Actor output Schema

## `routes` (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 = {
    "origin": "東京",
    "destination": "新大阪"
};

// Run the Actor and wait for it to finish
const run = await client.actor("superslowsloth/japan-train-route-fare-finder").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 = {
    "origin": "東京",
    "destination": "新大阪",
}

# Run the Actor and wait for it to finish
run = client.actor("superslowsloth/japan-train-route-fare-finder").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 '{
  "origin": "東京",
  "destination": "新大阪"
}' |
apify call superslowsloth/japan-train-route-fare-finder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,superslowsloth/japan-train-route-fare-finder"
        }
    }
}

```

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/FjxdTwrnBwvjDSBe0/builds/0AXB7O1PNnCYBVwKf/openapi.json
