GET

/stations/nearby

Get API key

Returns stations inside a radius of a point, highest weight first.

Request

curl "https://api.traindekho.live/v1/stations/nearby?lat=28.6139&lon=77.209&radius_km=25" \
  -H "X-API-Key: YOUR_API_KEY"
NameInRequiredDescription
latqueryyesLatitude, from -90 to 90.
lonqueryyesLongitude, from -180 to 180.
radius_kmquerynoSearch radius in kilometres, from 1 to 100. Defaults to 25.
limitquerynoMaximum results, from 1 to 25. Defaults to 10.

Responses

200

Stations inside the radius, highest weight first.

{
  "stations": [
    {
      "station": {
        "code": "NDLS",
        "name": "New Delhi",
        "lat": 28.643,
        "lon": 77.219,
        "weight": 100
      },
      "distance_km": 3.4
    }
  ]
}
400

A path or query value is missing or has the wrong format.

{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "Request is invalid."
  }
}
401

The API key is missing, unknown, expired, or revoked.

{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Authentication is required."
  }
}
403

The credential is valid and does not include this API.

{
  "error": {
    "code": "FORBIDDEN",
    "message": "You do not have access to this API."
  }
}
429

The caller exceeded a rate limit or a quota. Wait for Retry-After seconds before retrying.

{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "API request limit exceeded"
  }
}
500

The request could not be completed.

{
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "The request could not be completed."
  }
}