European rail content is fragmented across national operators (SNCF, DB, Renfe, Trenitalia, Eurostar, etc.) with no single open API covering all; primary aggregation options include Trainline Partner API, Distribusion, and Rail Europe API — each with different carrier coverage.
Authenticate and search by POSTing origin and destination station codes (UIC codes or the aggregator's internal station ids), travel date, passenger types, and optionally a specific departure time range.
Inspect each fare in the results for: carrier_code, service_class, flexibility (refundable/non-refundable/exchangeable), comfort_class, and whether seat reservation is included or mandatory.
For cross-border journeys (e.g. Paris→Barcelona), results may combine segments from multiple carriers — verify each segment's carrier and whether the ticket is a single through-ticket or separate tickets requiring re-validation.
Create a booking by POSTing the selected fare offer id plus passenger details (name, date of birth, loyalty card numbers if applicable); store both the aggregator booking reference and the carrier's own booking code.
Issue the ticket: many rail aggregators require a separate 'confirm' or 'ticket issuance' call after booking; the ticket document (PDF or barcode) is only generated after this step.
Known gotchas
Rail fare availability windows vary by carrier — some European operators open sales 90 days in advance, others only 60 days; a search returning no results may simply mean the travel date is outside the booking window, not that the route does not exist.
Advance purchase rail fares are often non-refundable and non-exchangeable — they look cheap but carry high change costs; always surface the flexibility terms alongside the price.
Station codes (UIC, CRS, SNCF internal codes) are not standardized across aggregators — a station may have a different code in each system; maintain a mapping table and validate it when onboarding a new API.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp