---
title: "Train station API | APIFor"
description: "Rail, commuter, metro, light rail, high-speed and airport rail stations with operator, coordinates and station codes. 1 credit per call, REST and MCP, one API key."
canonical: "https://apifor.dev/services/train-stations/"
---

1. [Services](https://apifor.dev/services/)
2. [Train stations](https://apifor.dev/services/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-stations 1 credit About $0.001

[Get a free API key](https://app.apifor.dev/register) [Endpoint reference](https://apifor.dev/docs/reference/train-stations/)

## Try it

GET /v1/train-stations

```bash
curl 'https://api.apifor.dev/v1/train-stations?q=bandung&type=rail' \
  -H 'x-api-key: YOUR_API_KEY'
```

Example response · 200

```json
{
  "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

| Endpoint | Credits | About |
| --- | --- | --- |
| GET `/v1/train-stations` | 1 credit | $0.001 |
| GET `/v1/train-stations/nearby` | 1 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`](https://apifor.dev/docs/reference/train-stations/#get-train-stations-coverage), free with your API key. [How coverage works](https://apifor.dev/docs/coverage/)

## 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.

## Sources and licences

- **[OpenStreetMap contributors](https://www.openstreetmap.org/copyright)**: ODbL 1.0
- **[Wikidata](https://www.wikidata.org)**: CC0
- **[Wikipedia](https://id.wikipedia.org/wiki/Daftar_stasiun_kereta_api_di_Indonesia)**: CC BY-SA 4.0
- **[DfT NaPTAN](https://beta-naptan.dft.gov.uk/download)**: OGL v3.0

### Attribution

- © OpenStreetMap contributors
- Contains public sector information licensed under the Open Government Licence v3.0.

## Also on MCP

Connect `https://mcp.apifor.dev/mcp` and your agent gets a tool for this service, billed the same way.

[MCP setup](https://apifor.dev/docs/mcp/)

## 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](https://apifor.dev/services/)

- [Administrative boundaries API](https://apifor.dev/services/boundaries/)
- [Places (POI) API](https://apifor.dev/services/places/)
- [Bus terminal API](https://apifor.dev/services/bus-terminals/)
- [Toll road API](https://apifor.dev/services/toll-roads/)
- [School directory API](https://apifor.dev/services/schools/)
- [Hospital directory API](https://apifor.dev/services/hospitals/)
- [Vehicle registrations API](https://apifor.dev/services/vehicle-registrations/)
