GET

/trains/{train_no}

Get API key

Returns the public identity and schedule summary for one train.

Request

curl "https://api.traindekho.live/v1/trains/12951" \
  -H "X-API-Key: YOUR_API_KEY"
NameInRequiredDescription
train_nopathyesTrain number, four or five digits.

Responses

200

Train details.

{
  "train_no": "12951",
  "name": "Mumbai Rajdhani",
  "type": "RAJ",
  "origin": {
    "code": "MMCT",
    "name": "Mumbai Central"
  },
  "destination": {
    "code": "NDLS",
    "name": "New Delhi"
  },
  "days_of_run": {
    "sun": false,
    "mon": true,
    "tue": true,
    "wed": true,
    "thu": true,
    "fri": true,
    "sat": true
  },
  "classes": [
    "1A",
    "2A",
    "3A"
  ],
  "duration_minutes": 980,
  "distance_km": 1384,
  "stop_count": 8
}
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."
  }
}