🚃

Station & Railway API

Railway and station data API. Detailed data for 174 operators, 10,937 stations, and 622 lines, complete with latitude and longitude.

Running since 2015 Developer API train.teraren.com

Service Overview

The Station & Railway API is a free API service that provides data on railway stations and lines across Japan. Since its launch in 2015, it has been used in a wide range of fields, including real estate sites, travel expense systems, and local information apps.

Its extensive dataset of 174 railway operators, 622 lines, and 10,937 stations in Japan is completely free and unlimited. Latitude and longitude are included for every station, so integrating with distance calculations and map displays is easy.

In addition to searching by station or line name, you can also implement reverse lookups that find the nearest station from a latitude and longitude. It supports virtually any use case for railway data.

Why Is It Free?

Railways are vital social infrastructure in Japan, and station and line information is needed by many services. Yet comprehensive railway data APIs have tended to be expensive or come with strict usage limits.

Guided by our mission to “make people’s experiences simpler and more comfortable through technology,” Teraren decided to provide railway data that anyone can use freely. We offer it completely free so that developers can create innovative services built on railway data.

Data Scale and Coverage

Railway Operators (174)

  • JR companies: JR East, JR West, JR Central, JR Hokkaido, JR Kyushu, JR Shikoku
  • Major private railways: Tobu, Seibu, Keisei, Keio, Odakyu, Tokyu, Keikyu, Sotetsu, Meitetsu, Kintetsu, Nankai, Keihan, Hankyu, Hanshin, and more
  • Subways: Tokyo Metro, Toei Subway, Osaka Metro, Nagoya Municipal Subway, Fukuoka City Subway, and more
  • Regional railways: Third-sector railways, streetcars, monorails, and more

Line Data (622 Lines)

The following information is provided for each line:

  • Line name (official name and abbreviation)
  • Line color (HTML/HEX code)
  • Operator
  • Line type (conventional line, Shinkansen, subway, monorail, etc.)

Station Data (10,937 Stations)

The following information is provided for each station:

  • Station name (kanji, kana, and romaji)
  • Location (prefecture and city)
  • Latitude and longitude (WGS84)
  • Lines served
  • Station number (line code)

How to Use It

Search by Station Name

// JavaScript (Fetch API)
const stationName = '東京';

fetch(`https://train.teraren.com/stations.json?name=${encodeURIComponent(stationName)}`)
  .then(response => response.json())
  .then(data => {
    console.log(data);
    // [
    //   {
    //     "id": "1130101",
    //     "name": "東京",
    //     "kana": "とうきょう",
    //     "lat": 35.681236,
    //     "lon": 139.767125,
    //     "prefecture": "東京都",
    //     "lines": ["山手線", "中央線", "東海道線", ...]
    //   }
    // ]
  });

Get All Stations on a Line

const lineId = '11302'; // Yamanote Line ID

fetch(`https://train.teraren.com/lines/${lineId}/stations.json`)
  .then(response => response.json())
  .then(data => {
    console.log(data);
    // [
    //   { "name": "東京", "lat": 35.681236, "lon": 139.767125 },
    //   { "name": "有楽町", "lat": 35.675441, "lon": 139.763806 },
    //   { "name": "新橋", "lat": 35.665498, "lon": 139.758749 },
    //   ...
    // ]
  });

Find the Nearest Stations by Latitude and Longitude

const lat = 35.681236;
const lon = 139.767125;
const radius = 1000; // 1 km radius

fetch(`https://train.teraren.com/stations.json?lat=${lat}&lon=${lon}&radius=${radius}`)
  .then(response => response.json())
  .then(data => {
    console.log(data);
    // [
    //   {
    //     "name": "東京",
    //     "distance": 0,
    //     "lat": 35.681236,
    //     "lon": 139.767125
    //   },
    //   {
    //     "name": "京橋",
    //     "distance": 650,
    //     "lat": 35.679190,
    //     "lon": 139.770883
    //   },
    //   ...
    // ]
  });

Example for a Real Estate Site (React)

import { useState, useEffect } from 'react';

function NearestStation({ propertyLat, propertyLon }) {
  const [stations, setStations] = useState([]);
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    const fetchStations = async () => {
      const response = await fetch(
        `https://train.teraren.com/stations.json?lat=${propertyLat}&lon=${propertyLon}&radius=1000`
      );
      const data = await response.json();
      setStations(data.slice(0, 3)); // 3 nearest stations
      setLoading(false);
    };

    fetchStations();
  }, [propertyLat, propertyLon]);

  if (loading) return <div>Loading...</div>;

  return (
    <div>
      <h3>Nearest Stations</h3>
      <ul>
        {stations.map((station, index) => (
          <li key={index}>
            {station.name} Station, about {Math.ceil(station.distance / 80)} min walk
            ({station.distance}m)
          </li>
        ))}
      </ul>
    </div>
  );
}

Response Format

Successful Station Search (200 OK)

[
  {
    "id": "1130101",
    "name": "東京",
    "kana": "とうきょう",
    "romaji": "tokyo",
    "lat": 35.681236,
    "lon": 139.767125,
    "prefecture": "東京都",
    "city": "千代田区",
    "postal_code": "1000005",
    "lines": [
      {
        "name": "山手線",
        "operator": "JR東日本",
        "color": "#9ACD32"
      },
      {
        "name": "中央線",
        "operator": "JR東日本",
        "color": "#FF6600"
      }
    ]
  }
]

Successful Nearest-Station Search (200 OK)

[
  {
    "name": "東京",
    "distance": 120,
    "lat": 35.681236,
    "lon": 139.767125,
    "lines": ["山手線", "中央線", "東海道線"]
  }
]

Data Reliability and Updates

The Station & Railway API uses the following public data sources:

  • MLIT National Land Numerical Information: Base railway data
  • Official websites of each railway operator: Route maps, station lists, and station numbers
  • GSI Maps (Geospatial Information Authority of Japan): Verification of latitude and longitude accuracy

When new stations open or station names change, we usually update the data within one to two months. Major line openings (such as Shinkansen extensions) are handled sooner.

Performance and Infrastructure

  • Cloudflare Workers: Fast responses through edge computing
  • PostGIS: A geospatial database for highly accurate distance calculations
  • Index optimization: Fast searches across 10,937 stations

Nearest-station searches by latitude and longitude use PostGIS spatial indexes to find stations within a 1 km radius in a few tens of milliseconds.

Use Cases

Real Estate

  • Showing the nearest stations on property detail pages
  • Automatic calculation of walking time from stations
  • Search by railway line

Travel Expense Reimbursement

  • Autocomplete for station name input
  • Integration with route search APIs
  • Managing commuter pass sections

Local Information Services

  • Searching for restaurants and sightseeing spots around stations
  • Trade area analysis
  • Information on redevelopment around stations

Sightseeing Apps

  • Guidance to the nearest station for tourist attractions
  • Sightseeing routes starting from a station
  • Route map visualization

Troubleshooting

My search returns no results

  • Search by the station name itself, without the 駅 (“Station”) suffix (e.g., 東京駅 → 東京)
  • Former station names may not be searchable
  • Use fuzzy search to see a list of candidates

Latitude and longitude aren’t accurate

  • Coordinates are based on each station’s representative point (near the ticket gates)
  • At large stations, this may differ from the actual ticket gates by several tens of meters
  • If you need more precise location data, please contact us
  • Try increasing the search radius (radius)
  • When stations are very close together, multiple stations may be returned at the same distance

Comparison with Competing Services

ItemStation & Railway APIAPI Service AAPI Service B
PriceCompletely freeFrom ¥15,000/monthFree tier (10,000 requests/month)
Stations10,937About 9,000About 11,000
Lines622About 500About 650
Latitude/longitude○○×
Nearest-station search○○×
AuthenticationNot requiredAPI key requiredAPI key required

Roadmap

  • Station ridership data
  • Accessibility information (elevators and escalators)
  • Facilities around stations (convenience stores, ATMs, etc.)
  • Historical data on discontinued lines and closed stations
  • GraphQL support

We will keep expanding the service so it can help you build great services. We look forward to your requests and feedback.

Key Features

  • Covers 174 railway operators
  • Detailed data for 10,937 stations
  • Data for 622 lines
  • Includes latitude and longitude
  • JSON responses
  • Fuzzy search support
  • Route map data

Technical Details

API endpoint
https://train.teraren.com/stations.json
Tech stack
Cloudflare WorkersCloudflare KVTypeScriptPostGIS
Data source

National Land Numerical Information from the Ministry of Land, Infrastructure, Transport and Tourism (MLIT), and official data from each railway operator

Use Cases

💡

Nearest-station search for real estate sites

Find the stations nearest a property and display the station name, line name, and walking time. With latitude and longitude included, distance calculations are easy to implement.

🚀

Station name entry assistance for travel expense systems

Narrow down candidates as users type a station name. Line information comes back at the same time, making integration with route search seamless.

🎯

Spot search in local information apps

Ideal for building location-based services such as searching for spots around a station, trade area analysis, and sightseeing apps.

Frequently Asked Questions

Does it cover stations across Japan?

Yes. It covers nearly every station in Japan (10,937 stations), including JR, private railways, and subways.

How accurate is the latitude and longitude data?

Coordinates are based on each station's representative point (near the ticket gates), with an error margin of a few meters.

Is there data on discontinued lines and closed stations?

Currently, only stations and lines in operation are provided. We are considering adding data on discontinued lines in the future.

Can I get timetables or service status?

Currently, only basic station and line information is available. For timetables, please use each railway operator's official API.

When are new stations added?

New stations are usually added within one to two months of opening. Major new stations are handled sooner.

Try Station & Railway API Today

Free and unlimited to use. Give it a try.