1. Services
  2. Train stations

Train station API

Rail, commuter, metro, light rail, high-speed and airport rail stations with operator, coordinates and station codes. Search them, look one up by code or find the closest ones to a point.

GET /v1/train-stations1 creditAbout $0.001

Try it

GET/v1/train-stations
curl 'https://api.apifor.dev/v1/train-stations?q=bandung&type=rail' \
  -H 'x-api-key: YOUR_API_KEY'
Example response · 200
{
  "success": true,
  "data": [
    {
      "id": "bd",
      "code": "BD",
      "name": "Bandung",
      "country": "ID",
      "type": "rail",
      "services": [
        "rail"
      ],
      "operator": "KAI",
      "operating_division": "Daop 2 Bandung",
      "elevation_m": 709,
      "status": "active",
      "passenger_service": true,
      "province": "Jawa Barat",
      "province_id": "32",
      "regency": "Kota Bandung",
      "regency_id": "32.73",
      "lat": -6.914258,
      "lng": 107.6021243,
      "validation": "verified",
      "coordinate_source": "osm"
    },
    {
      "id": "bdg",
      "code": "BDG",
      "name": "Bandung Gudang",
      "country": "ID",
      "type": "rail",
      "services": [
        "rail"
      ],
      "operator": null,
      "operating_division": "Daop 2 Bandung",
      "elevation_m": 709,
      "status": "inactive",
      "passenger_service": false,
      "province": "Jawa Barat",
      "province_id": "32",
      "regency": "Kota Bandung",
      "regency_id": "32.73",
      "lat": -6.913889,
      "lng": 107.592018,
      "validation": "partial",
      "coordinate_source": "wikidata"
    }
  ],
  "meta": {
    "total": 3,
    "page": 1,
    "per_page": 2,
    "total_pages": 2,
    "coverage": [
      "ID"
    ],
    "attribution": {
      "source": "© OpenStreetMap contributors; Wikidata; Wikipedia",
      "license": "ODbL 1.0 (includes OpenStreetMap data); Wikidata CC0; Wikipedia CC BY-SA 4.0",
      "license_url": "https://opendatacommons.org/licenses/odbl/1-0/",
      "source_url": "https://www.openstreetmap.org/copyright",
      "attribution_page": "https://www.openstreetmap.org/copyright",
      "notice": "Modified: merged from open sources and cross-checked against operator passenger station lists (not copied). Compiled by API Indonesia, se...",
      "sources": [
        {
          "name": "OpenStreetMap (railway=station/halt)",
          "url": "https://www.openstreetmap.org/copyright",
          "licence": "ODbL 1.0",
          "used_for": "coordinates, code, operator, type"
        },
        {
          "name": "Wikidata (P296 station code)",
          "url": "https://www.wikidata.org",
          "licence": "CC0",
          "used_for": "code, elevation, coordinates"
        }
      ]
    }
  }
}

A real response from our OpenAPI file, with long lists and strings shortened.

Endpoints and price

EndpointCreditsAbout
GET /v1/train-stations1 credit$0.001
GET /v1/train-stations/nearby1 credit$0.001
GET /v1/train-stations/{id}1 credit$0.001
GET /v1/train-stations/coverage (Free)Free$0

USD at Starter pack prices ($5 for 5,000 credits). Calls that fail before work starts are refunded.

Coverage today

Australia, Brazil, Canada, France, Germany, India, Indonesia, Japan, Malaysia, Mexico, Netherlands, New Zealand, Philippines, Saudi Arabia, Singapore, South Korea, Thailand, United Arab Emirates, United Kingdom, United States and Vietnam.

Leave country out to get every covered country, or pass one to narrow it.

Sources, row counts and country-only fields per country: GET /v1/train-stations/coverage, free with your API key. How coverage works

Limits

  • Where there is no national source, stations come from Wikidata, so coverage follows how complete Wikidata is.
  • Countries outside the coverage list return an empty page.
  • Names, operators and division names stay as published.
  • Nearby search reaches up to 100 km.

Questions

Does a station list every kind of train that stops there?

Yes. services lists each type, so an interchange shows both commuter_rail and airport_rail.

Can I use it commercially?

Yes. Licences differ by source (ODbL, OGL, CC0). Keep the attribution that comes with each response.

Related services

All services