Search Stations
GET
GET /v1/stations/search?q=&limit=Description
Find stations by partial name or code. Returns matching station records with coordinates and the result count.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
q | QUERY | string | YES | Query param — partial station name or code, e.g. delhi. |
limit | QUERY | number | NO | Query param — maximum number of results to return. |
Code Example
javascript
const res = await fetch(
"https://railway-engine.apkscope.workers.dev/v1/stations/search?q=delhi&limit=5",
{ headers: { "x-api-key": "YOUR_KEY" } },
);
const { status, data, error } = await res.json();
if (status === "SUCCESS") {
console.log(data.count, "matches");
for (const station of data.results) {
console.log(station.code, station.name, station.zone);
}
} else {
console.error(status, error?.code, error?.message);
}Notes
Errors: 400 INVALID_REQUEST (missing or too-short q), 404 NOT_FOUND when nothing matches, 429 RATE_LIMITED. Each result uses the same shape as GET /v1/station/:code.
Response Example