Search, price, book and refund train journeys through the public Travelandz API.
Base path
All public train operations live under /v1/trains. The currently available provider is gdsprovider=0.
Authentication
Every request requires Authorization: Bearer <secret_key> and X-Travelandz-Id: <public_key>:<profile_code>. The persisted profile code has the form dp_<12 alphanumeric>; keep secrets server-side.
Protocol conventions
- JSON endpoints return
200 OKon a successful operation. - POST requests use
Content-Type: application/json. - Dates use
YYYY-MM-DDand amounts use{ amount, currency }. - Unknown body or query fields are rejected with
400. - Stream endpoints return newline-delimited JSON (NDJSON), not one JSON document.
Workflow
- Search locations, then use their ids to search journeys.
- Keep
journeyIdand request offers for the selected journey. - Keep one or more
offerIdvalues and create a pre-booking. - Use
bookingIdto inspect required fields and create the order. - Keep
orderIdand use refundable items before requesting a refund.
Endpoint catalog
| Method | Path | Purpose |
|---|---|---|
GET | /v1/trains/locations | Search train locations. |
POST | /v1/trains/journeys | Search journeys. |
POST | /v1/trains/journeys/stream | Stream journeys as NDJSON. |
POST | /v1/trains/journeys/:gdsprovider/:journeyId/offers | Get journey offers. |
POST | /v1/trains/journeys/:gdsprovider/:journeyId/offers/stream | Stream journey offers. |
POST | /v1/trains/book/:gdsprovider/prebook | Create a pre-booking. |
GET | /v1/trains/book/:gdsprovider/:bookingId/required-fields | Get required booking fields. |
POST | /v1/trains/book/:gdsprovider/:bookingId/order | Create and confirm an order. |
GET | /v1/trains/order/:gdsprovider/:orderId | Get an order and tickets. |
GET | /v1/trains/order/:gdsprovider/:orderId/refundable-items | List refundable items. |
POST | /v1/trains/order/:gdsprovider/:orderId/refund | Start a refund. |
GET | /v1/trains/order/:gdsprovider/:orderId/refund | Get refund status. |
Shared enums
| Field | Values |
|---|---|
passengers[].type | youth, adult, senior |
passengers[].title | mr, ms, mx |
identityDocument.type | passport |
transport | train, bus, ferry |
flexibility | non_flex, semi_flex, full_flex |
order.status | pending, confirmed, cancelled |
refund.state | success, pending, error |