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 creditRail, commuter, metro, light rail, high-speed and airport rail stations with operator, status, coordinates and region codes. 1 credit.
| Parameter | In | Type | Rules |
|---|---|---|---|
| q | query | string | max 100 chars · Search text, 2 to 100 characters |
| country | query | string | ISO 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_id | query | string | Province code, e.g. 32 |
| regency_id | query | string | Regency or city code, e.g. 32.73 |
| type | query | string | one of rail, commuter_rail, metro, light_rail, high_speed_rail, airport_rail · Station type |
| status | query | string | one of active, inactive · Station status |
| operator | query | string | max 100 chars · Operator name, partial match |
| validation | query | string | one of verified, partial · How the record was checked |
| page | query | integer | default 1 · Page number |
| limit | query | integer | 1 to 200 · default 50 · Results per page |
curl 'https://api.apifor.dev/v1/train-stations' \
-H 'x-api-key: YOUR_API_KEY'{
"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 stations400Invalid parameters401Missing or invalid API key402Not enough credits
GET
/v1/train-stations/nearby1 creditClosest stations first, with distance in metres. Active stations only unless status=inactive or status=all. 1 credit.
| Parameter | In | Type | Rules |
|---|---|---|---|
| lat * | query | number | -90 to 90 · Latitude |
| lng * | query | number | -180 to 180 · Longitude |
| radius | query | integer | 1 to 100000 · Radius in metres |
| limit | query | integer | 1 to 50 · default 10 · Max results |
| country | query | string | ISO 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. |
| type | query | string | one of rail, commuter_rail, metro, light_rail, high_speed_rail, airport_rail · Station type |
| status | query | string | one of active, inactive, all · active (default), inactive or all |
curl 'https://api.apifor.dev/v1/train-stations/nearby?lat=&lng=' \
-H 'x-api-key: YOUR_API_KEY'{
"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 distance400Invalid parameters401Missing or invalid API key402Not enough credits
GET
/v1/train-stations/{id}1 creditLook up by id or station code (e.g. BD). Adds Wikidata id, validation notes and sources. 1 credit.
| Parameter | In | Type | Rules |
|---|---|---|---|
| id * | path | string | Station id or code |
curl 'https://api.apifor.dev/v1/train-stations/BD' \
-H 'x-api-key: YOUR_API_KEY'{
"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 station400Invalid parameters401Missing or invalid API key402Not enough credits404Not found
GET
/v1/train-stations/coverageFreeCountries this service covers, with sources, licences, row counts and country-only fields. Free (0 credits), still needs an API key. Price note: Free.
curl 'https://api.apifor.dev/v1/train-stations/coverage' \
-H 'x-api-key: YOUR_API_KEY'{
"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