GET

/stations/{code}/trains

Get API key

Lists trains that depart this station or arrive at it.

Request

curl "https://api.traindekho.live/v1/stations/NDLS/trains?direction=from" \
  -H "X-API-Key: YOUR_API_KEY"
NameInRequiredDescription
codepathyesStation code.
directionqueryyesfrom lists departing trains. to lists arriving trains.

Responses

200

Trains calling at the station in the requested direction.

{
  "station": {
    "code": "NDLS",
    "name": "New Delhi"
  },
  "direction": "from",
  "trains": [
    {
      "train_no": "12952",
      "name": "Mumbai Rajdhani",
      "arrival_time": null,
      "departure_time": "16:55",
      "day_offset": 0
    }
  ]
}
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."
  }
}
404

The train or station does not exist.

{
  "error": {
    "code": "NOT_FOUND",
    "message": "Not found."
  }
}
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."
  }
}