Train stations All docs

Train stations API Reference

4 routes. Base URL https://api.apifor.dev, authenticated with x-api-key. Failed calls are not charged. Overview, limits and sources are on the Train station API page.

GET/v1/train-stations1 credit

Rail, commuter, metro, light rail, high-speed and airport rail stations with operator, status, coordinates and region codes. 1 credit.

ParameterInTypeRules
qquerystringmax 100 chars · Search text, 2 to 100 characters
countryquerystringISO 3166-1 alpha-2 · ISO 3166-1 alpha-2, optional (default: all covered countries, ID rows first). Covered: ID, GB (NaPTAN + Wikidata) and MY, SG, TH, VN, PH, US, AU, IN, JP, CA, DE, FR, NL, NZ, KR, BR, MX, AE, SA (Wikidata); other codes return an empty page. province_id, regency_id and validation apply to ID rows only.
province_idquerystringProvince code, e.g. 32
regency_idquerystringRegency or city code, e.g. 32.73
typequerystringone of rail, commuter_rail, metro, light_rail, high_speed_rail, airport_rail · Station type
statusquerystringone of active, inactive · Station status
operatorquerystringmax 100 chars · Operator name, partial match
validationquerystringone of verified, partial · How the record was checked
pagequeryintegerdefault 1 · Page number
limitqueryinteger1 to 200 · default 50 · Results per page
GET/v1/train-stations
curl 'https://api.apifor.dev/v1/train-stations' \
  -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"
        }
      ]
    }
  }
}
  • 200Matching stations
  • 400Invalid parameters
  • 401Missing or invalid API key
  • 402Not enough credits
GET/v1/train-stations/nearby1 credit

Closest stations first, with distance in metres. Active stations only unless status=inactive or status=all. 1 credit.

ParameterInTypeRules
lat *querynumber-90 to 90 · Latitude
lng *querynumber-180 to 180 · Longitude
radiusqueryinteger1 to 100000 · Radius in metres
limitqueryinteger1 to 50 · default 10 · Max results
countryquerystringISO 3166-1 alpha-2 · ISO 3166-1 alpha-2, optional (default: all covered countries, ID rows first). Covered: ID, GB (NaPTAN + Wikidata) and MY, SG, TH, VN, PH, US, AU, IN, JP, CA, DE, FR, NL, NZ, KR, BR, MX, AE, SA (Wikidata); other codes return an empty page. province_id, regency_id and validation apply to ID rows only.
typequerystringone of rail, commuter_rail, metro, light_rail, high_speed_rail, airport_rail · Station type
statusquerystringone of active, inactive, all · active (default), inactive or all
GET/v1/train-stations/nearby
curl 'https://api.apifor.dev/v1/train-stations/nearby?lat=&lng=' \
  -H 'x-api-key: YOUR_API_KEY'
Example response · 200
{
  "success": true,
  "data": [
    {
      "id": "mri",
      "code": "MRI",
      "name": "Manggarai",
      "country": "ID",
      "type": "commuter_rail",
      "services": [
        "airport_rail",
        "commuter_rail"
      ],
      "operator": "KAI Commuter; LRT Jakarta",
      "operating_division": "Daop 1 Jakarta",
      "elevation_m": 13,
      "status": "active",
      "passenger_service": true,
      "province": "Daerah Khusus Ibukota Jakarta",
      "province_id": "31",
      "regency": "Kota Administrasi Jakarta Selatan",
      "regency_id": "31.74",
      "lat": -6.2101704,
      "lng": 106.849935,
      "validation": "verified",
      "coordinate_source": "osm",
      "distance_m": 503
    },
    {
      "id": "proklamasi",
      "code": null,
      "name": "Proklamasi",
      "country": "ID",
      "type": "light_rail",
      "services": [
        "light_rail"
      ],
      "operator": "LRT Jakarta",
      "operating_division": null,
      "elevation_m": null,
      "status": "active",
      "passenger_service": false,
      "province": "Daerah Khusus Ibukota Jakarta",
      "province_id": "31",
      "regency": "Kota Administrasi Jakarta Pusat",
      "regency_id": "31.71",
      "lat": -6.2021164,
      "lng": 106.8502137,
      "validation": "partial",
      "coordinate_source": "osm",
      "distance_m": 901
    }
  ],
  "meta": {
    "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"
        }
      ]
    }
  }
}
  • 200Stations by distance
  • 400Invalid parameters
  • 401Missing or invalid API key
  • 402Not enough credits
GET/v1/train-stations/{id}1 credit

Look up by id or station code (e.g. BD). Adds Wikidata id, validation notes and sources. 1 credit.

ParameterInTypeRules
id *pathstringStation id or code
GET/v1/train-stations/{id}
curl 'https://api.apifor.dev/v1/train-stations/BD' \
  -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",
    "wikidata": "Q2571158",
    "validation_notes": [
      "kode_dikonfirmasi_resmi",
      "cocok_resmi:kai_booking+kai_id"
    ],
    "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"
      }
    ]
  },
  "meta": {
    "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"
        }
      ]
    }
  }
}
  • 200The station
  • 400Invalid parameters
  • 401Missing or invalid API key
  • 402Not enough credits
  • 404Not found
GET/v1/train-stations/coverageFree

Countries this service covers, with sources, licences, row counts and country-only fields. Free (0 credits), still needs an API key. Price note: Free.

GET/v1/train-stations/coverage
curl 'https://api.apifor.dev/v1/train-stations/coverage' \
  -H 'x-api-key: YOUR_API_KEY'
Example response · 200
{
  "success": true,
  "data": {
    "service": "train-stations",
    "global": false,
    "country_param": "optional",
    "param_name": "country",
    "countries": [
      {
        "country": "ID",
        "market": null,
        "subdivision_levels": [
          "province",
          "regency"
        ],
        "rows": null,
        "updated_at": null,
        "sources": [
          {
            "name": "OpenStreetMap contributors",
            "url": "https://www.openstreetmap.org/copyright",
            "licence": "ODbL 1.0",
            "attribution": "© OpenStreetMap contributors"
          },
          {
            "name": "Wikidata",
            "url": "https://www.wikidata.org",
            "licence": "CC0",
            "attribution": null
          }
        ],
        "local_fields": [],
        "notes": null
      },
      {
        "country": "GB",
        "market": null,
        "subdivision_levels": [],
        "rows": 9707,
        "updated_at": "2026-11-30",
        "sources": [
          {
            "name": "DfT National Public Transport Access Nodes (NaPTAN)",
            "url": "https://beta-naptan.dft.gov.uk/download",
            "licence": "OGL v3.0",
            "attribution": "Contains public sector information licensed under the Open Government Licence v3.0."
          },
          {
            "name": "Wikidata (railway stations, Q55488 and subclasses)",
            "url": "https://www.wikidata.org",
            "licence": "CC0",
            "attribution": null
          }
        ],
        "local_fields": [
          "local.locality",
          "local.area"
        ],
        "notes": "NaPTAN rail stations (StopType RLY) plus metro and tram stations (MET entrances grouped by name); NaPTAN wins over Wikidata (a Wikidata s..."
      }
    ]
  }
}
  • 200Coverage

Error handling · Rate limits · Prices