Developer guide
PNR Status API Guide
Use a 10-digit PNR to retrieve booking and current passenger status, journey details, train information, and chart status. Send requests from your backend so your API key stays private.
GET /api/v1/pnr/:pnr
Get started
- Create a RailKit account and generate an API key in your dashboard.
- Set RAILKIT_API_KEY and PNR in your server environment. PNR must contain exactly 10 digits.
- Call the endpoint with the x-api-key header. Replace PNR with a valid booking number you are authorized to use.
SDK and REST examples
Every plan supports the Node.js SDK. Direct REST access requires Advance or Scale. See current plan limits.
Node.js SDK
Install with npm install railkit. Set the API key and journey inputs in your server environment before running the example.
import { configure, checkPNRStatus } from "railkit";
configure(process.env.RAILKIT_API_KEY);
const result = await checkPNRStatus(process.env.PNR);
if (result.success) {
console.log(result.data.chart?.status);
}REST API
Run from a server terminal. Set RAILKIT_API_KEY and replace the example inputs with your own.
export RAILKIT_API_KEY="your_api_key"
export PNR="your_10_digit_pnr"
curl "https://api.railkit.in/api/v1/pnr/$PNR" \
-H "x-api-key: $RAILKIT_API_KEY" \
-H "accept: application/json"Response example
{
"success": true,
"data": {
"pnr": "1234567890",
"train": { "number": "18021", "name": "Example Express" },
"journey": {
"source": { "code": "KGP", "name": "KHARAGPUR JN" },
"destination": { "code": "KUR", "name": "KHURDA ROAD JN" }
},
"chart": { "status": "Chart Not Prepared" },
"passengers": [{
"booking": { "status": "WL", "details": "WL/12" },
"current": { "status": "CNF", "details": "CNF/C1/30" }
}]
}
}- booking records original reservation status; current records latest reported allocation.
- Check success before reading data. Passenger fields may be absent or null until charting or allocation completes.
- Example response is illustrative; field availability depends on upstream railway data.
Data freshness
PNR status can change as the railway processes bookings and prepares charts. Recheck when users need an update; do not promise instant changes. The endpoint does not provide a guaranteed update interval.
Errors and recovery
- 400: PNR is malformed. Validate exactly 10 digits before sending.
- 401 or 403: API key is missing, invalid, or inactive. Check server configuration.
- 404: PNR has no available record. Confirm number before retrying.
- 429: Request limit reached. Back off and check plan usage; avoid rapid polling.
- 5xx or upstream failure: Retry later with bounded backoff and show last known result if available.