Route vacancy scan

Rank every route train by chart vacancy and hopping coverage.

GET /v1/charts/vacant-berths/route-scan

Scope charts:read · Credits 25 · Plans Scale and Enterprise

Resolves station names or codes, scans route trains with bounded concurrency, scores each option, and returns plain-language recommendations.

Authentication

Send your key in the X-RailCore-Key header. This operation requires the charts:read scope. See the authentication guide.

Request parameters

NameInTypeRequiredDescription
fromquerystringRequiredBoarding station code or name. Fuzzy station-name matching is supported.
toquerystringRequiredDestination station code or name.
datequerystring(date)RequiredJourney date in YYYY-MM-DD format.
quotaquerystringOptionalReservation quota.
max_trainsqueryintegerOptionalMaximum trains fanned out for a full scan. Other trains remain visible as skipped.
min_scorequerynumberOptionalDrop returned matches below this score.
only_runningquerybooleanOptionalInclude only trains scheduled to run on the requested date.
only_chart_preparedquerybooleanOptionalInclude only trains with at least one prepared chart.
sort_byquerystringOptionalOrder matches by departure, latest departure, duration, score, or chart readiness.
include_detailquerybooleanOptionalInclude full hopping_detail for every scanned train.
train_typesquerystringOptionalComma-separated train-type allow list.
avoid_train_typesquerystringOptionalComma-separated train-type deny list. Deny wins over allow.
max_hopsqueryintegerOptionalMaximum hopping chain length per train.
prefer_berthquerystringOptionalPreferred berth codes or aliases, comma-separated.
avoid_berthquerystringOptionalBerth codes or aliases to avoid. Avoid wins on conflicts.
prefer_classquerystringOptionalPreferred travel classes, comma-separated.
avoid_classquerystringOptionalClasses to skip entirely, comma-separated.
include_farequerybooleanOptionalAdd fare lookups to direct and hopping options.
include_alternate_boardingquerybooleanOptionalEvaluate nearby boarding points on the same train.
strategiesquerystringOptionalComma-separated strategy list: min_hops, min_seat_changes, cheapest, or all.
alternate_boarding_modequerystringOptionallightweight reuses fetched data; extended performs fresh candidate lookups.
alternate_boarding_max_candidatesqueryintegerOptionalMaximum extended-mode candidates.
include_cross_classquerybooleanOptionalBuild one plan that can switch travel classes between hops.

Code examples

Base URL https://ir.railcore.tech/v1. Keep the key in an environment variable and call from a trusted server-side environment.

cURL

curl -sS -X GET \
  -H "X-RailCore-Key: $RAILCORE_KEY" \
  "https://ir.railcore.tech/v1/charts/vacant-berths/route-scan?from=Bhusaval&to=Ahmedabad&date=2026-08-27&quota=GN&max_trains=8&min_score=50&only_running=true&only_chart_prepared=false&sort_by=score&include_detail=true&train_types=SF%2CRAJDHANI%2CVANDE_BHARAT&avoid_train_types=PASSENGER%2CMEMU%2CDEMU&max_hops=6&prefer_berth=LB%2CSLB&avoid_berth=UB%2CSUB&prefer_class=3A%2C2A&avoid_class=1A&include_fare=false&include_alternate_boarding=false&strategies=min_hops%2Ccheapest&alternate_boarding_mode=lightweight&alternate_boarding_max_candidates=3&include_cross_class=false"

JavaScript

const response = await fetch("https://ir.railcore.tech/v1/charts/vacant-berths/route-scan?from=Bhusaval&to=Ahmedabad&date=2026-08-27&quota=GN&max_trains=8&min_score=50&only_running=true&only_chart_prepared=false&sort_by=score&include_detail=true&train_types=SF%2CRAJDHANI%2CVANDE_BHARAT&avoid_train_types=PASSENGER%2CMEMU%2CDEMU&max_hops=6&prefer_berth=LB%2CSLB&avoid_berth=UB%2CSUB&prefer_class=3A%2C2A&avoid_class=1A&include_fare=false&include_alternate_boarding=false&strategies=min_hops%2Ccheapest&alternate_boarding_mode=lightweight&alternate_boarding_max_candidates=3&include_cross_class=false", {
  method: "GET",
  headers: {
    "X-RailCore-Key": process.env.RAILCORE_KEY,
  },
});

const body = await response.json();
console.log(response.status, body);

Python

import os
import requests

response = requests.request(
    "GET",
    "https://ir.railcore.tech/v1/charts/vacant-berths/route-scan?from=Bhusaval&to=Ahmedabad&date=2026-08-27&quota=GN&max_trains=8&min_score=50&only_running=true&only_chart_prepared=false&sort_by=score&include_detail=true&train_types=SF%2CRAJDHANI%2CVANDE_BHARAT&avoid_train_types=PASSENGER%2CMEMU%2CDEMU&max_hops=6&prefer_berth=LB%2CSLB&avoid_berth=UB%2CSUB&prefer_class=3A%2C2A&avoid_class=1A&include_fare=false&include_alternate_boarding=false&strategies=min_hops%2Ccheapest&alternate_boarding_mode=lightweight&alternate_boarding_max_candidates=3&include_cross_class=false",
    headers={"X-RailCore-Key": os.environ["RAILCORE_KEY"]},
    timeout=20,
)
print(response.status_code, response.json())

Rate limits and credits

This call costs 25 credits and is available on Scale and Enterprise. Per-minute and daily budgets, and the headers reporting remaining quota, are documented in rate limits and credits and billing.

Response fields

FieldTypeDescription
from / toResolvedStationCanonical station match, input, confidence, and alternates.
journey_date / quotastringApplied search context.
route_summaryobjectRoute totals, scanned counts, coverage counts, and the best result.
matches[].train_number / train_name / train_typestringTrain identity.
matches[].departure_time / arrival_time / duration_minutesstring / integerSegment schedule.
matches[].runs_on_date / chart_preparedbooleanEligibility and chart state.
matches[].recommendation / urgency_hintstring | nullDisplay-ready booking guidance.
matches[].score / score_breakdowninteger / object0 to 100 ranking and auditable components.
matches[].classes_summaryClassSummary[]Compact direct and hopping coverage per class.
matches[].hopping_detailVacantBerthsHoppingResponse | nullFull analysis when include_detail is true.
matches[].scan_status / scan_status_reasonstring | nullOK, chart state, upstream failure, or skip reason.
_metaobjectPartial failures, filters, cap decisions, sort, preferences, and upstream summary.

Example response

{
  "success": true,
  "data": {
    "from": {
      "station_code": "BSL",
      "station_name": "Bhusaval Jn",
      "resolved_from": "name",
      "input": "Bhusaval",
      "confidence": 0.98,
      "alternates": []
    },
    "to": {
      "station_code": "ADI",
      "station_name": "Ahmedabad Jn",
      "resolved_from": "name",
      "input": "Ahmedabad",
      "confidence": 0.99,
      "alternates": []
    },
    "journey_date": "2026-08-27",
    "quota": "GN",
    "route_summary": {
      "total_trains_on_route": 12,
      "trains_running_on_date": 10,
      "trains_scanned": 8,
      "trains_with_direct_vacancy": 2,
      "trains_with_hopping_coverage": 4,
      "best_train_number": "12656",
      "best_recommendation": "Direct berth available in 3A",
      "best_score": 92
    },
    "matches": [
      {
        "train_number": "12656",
        "train_name": "Navjeevan SF Express",
        "departure_time": "10:25",
        "arrival_time": "18:00",
        "duration_minutes": 455,
        "runs_on_date": true,
        "chart_prepared": true,
        "recommendation": "Direct berth available in 3A",
        "urgency_hint": "Chart 2 prepared. Vacancy is authoritative.",
        "score": 92,
        "classes_summary": [
          {
            "class_code": "3A",
            "direct_available": true,
            "direct_berth_count": 4
          }
        ],
        "hopping_detail": null,
        "scan_status": "OK",
        "scan_status_reason": null
      }
    ],
    "_meta": {
      "trains_dispatched": 8,
      "partial_failures": [],
      "sort_by": "score"
    }
  },
  "meta": {
    "api_version": "v1",
    "request_id": "req_01J5Z7Y8N2K4M6P8R0T2V4X6Z8",
    "trace_id": "trc_01J5Z7Y8N2K4M6P8R0T2V4X6Z9",
    "timestamp": "2026-08-20T17:12:23.305Z",
    "freshness": {
      "mode": "live",
      "retrieved_at": "2026-08-20T17:12:23.305Z",
      "sources": [
        {
          "confidence": "high"
        }
      ]
    }
  }
}

Errors

StatusCodeDescriptionRetry
404STATION_NOT_FOUNDA station input could not be resolved above the confidence threshold.Not retryable
400VALIDATION_ERRORA required field is missing or invalid.Not retryable
401MISSING_API_KEY / INVALID_API_KEYThe credential is absent, unknown, disabled, or expired.Not retryable
403SCOPE_MISSING / PLAN_ENDPOINT_DISABLEDThe key lacks the required scope or plan entitlement.Not retryable
402CREDITS_EXHAUSTEDThe account balance cannot cover this operation.Not retryable
429RATE_LIMITEDMinute or daily request budget is exhausted. Honor Retry-After.Retryable
410API_VERSION_SUNSETThis API version has reached its announced sunset date. Migrate to a supported major version.Not retryable
502UPSTREAM_UNAVAILABLELive data could not be retrieved. Retry with backoff.Retryable
504UPSTREAM_TIMEOUTThe live-data request exceeded its deadline. Retry with backoff.Retryable
503METERING_UNAVAILABLECredit settlement is temporarily unavailable and no data was returned.Retryable

Related Charts endpoints

All RailCore Indian Railways API endpoints · Quickstart · Rate limits