GET/v1/trains/locations?keyword={keyword}&language={language}

Search train locations

Find stations and train locations by keyword.

Share

Find stations and train locations by keyword.

Authentication and headers

HeaderDescription
AuthorizationBearer <secret_key>. Keep the secret on the server and never write it to client logs.
X-Travelandz-Id<public_key>:<profile_code>, where the persisted profile code has the form dp_<12 alphanumeric>.
Content-Typeapplication/json for requests with a JSON body.

Request

Query: keyword is required and cannot be empty. language is optional and accepts en, es, or zh.

Request Params Schema

keyword
stringYes
Required search text; it cannot be empty.
language
enum
eneszh
No

Success response

Returns locations[] with id, name, country, country code, coordinates and language.

Response Body Schema

locations
arrayYes
locations[]id
stringYes
locations[]name
stringYes
locations[]countryCode
string
Format: 2-letter country code
Yes
locations[]country
stringYes
locations[]latitude
numberYes
locations[]longitude
numberYes
locations[]language
enum
eneszh
Yes

Errors

  • 400 for validation or unknown fields.
  • 401 or 403 for invalid API credentials.
  • 500 internal_communication_error or unknown_error for provider failures.

Usage notes

Use the returned location ids as origin and destination in journey searches.

cURL example

bash
bash
curl --request GET \
  --url "https://api.sandbox.travelandz.com/v1/trains/locations?keyword=Paris&language=en" \
  --header "Authorization: Bearer $TRAVELANDZ_SECRET_KEY" \
  --header "X-Travelandz-Id: $TRAVELANDZ_PUBLIC_KEY:$TRAVELANDZ_PROFILE_CODE"