SNCF Train Ticket and Connection Scraper
Pricing
from $1.50 / 1,000 trips
SNCF Train Ticket and Connection Scraper
Scrape live SNCF train connections, schedules, ticket prices, transfers, delays, and fares across France and Europe. Extract structured SNCF timetable data for travel apps, price monitoring, analytics, and AI agents.
Pricing
from $1.50 / 1,000 trips
Rating
5.0
(3)
Developer
Jindřich Bär
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
3 days ago
Last modified
Categories
Share
SNCF train tickets & connections scraper
Search SNCF Connect train journeys across France (TGV INOUI, OUIGO, Intercités, TER, and connecting services) and get back a structured dataset of routes, times, transfers, and live ticket prices — ready to plug into spreadsheets, databases, dashboards, or AI agents.
Pulls data straight from SNCF Connect (sncf-connect.com), so you get the same trains, schedules, and fares a passenger sees when booking.
What you can do with it
- Compare ticket prices between any two French stations in real time — Paris to Marseille, Lyon to Bordeaux, Lille to Nice, and every other route SNCF Connect covers.
- See fares by class — cheapest 2nd-class and 1st-class prices, plus the discount-card price when one is offered.
- Inspect each journey's legs — train type and number, transfer points, per-leg times.
- Monitor fares over time by scheduling the actor to run daily / hourly and writing results to your own datastore.
- Build a travel-planning assistant — feed the JSON output into an LLM agent that answers "what's the cheapest train from Paris to Marseille next Saturday morning".
Typical use cases: travel comparison sites, price-monitoring tools, business-trip planners, journalists covering transport, and AI agents that need a structured French rail-data source.
Input
| Field | Required | Default | Description |
|---|---|---|---|
from | yes | — | Departure station or city (e.g. "Paris", "Marseille Saint-Charles", "Lyon Part Dieu") |
to | yes | — | Destination station or city |
date | no | today | Departure date (date picker, ISO YYYY-MM-DD), Paris local time |
time | no | now | Departure time (HH:MM, 24-hour, Paris local time) |
adults | no | 1 | Number of adult passengers — prices are quoted for this group (1–9) |
maxResults | no | 20 | Maximum number of journeys to push to the dataset (1–100) |
Station and city names are matched against SNCF Connect's autocomplete; the actor picks the best matching station (or city) automatically.
Example input
{"from": "Marseille","to": "Paris","date": "2026-06-15","time": "08:00","adults": 1,"maxResults": 20}
Output
Each item in the dataset describes one proposed journey.
Example item
{"id": "51148c3f-fa2e-44f2-b24f-25b24672995e","from": "Marseille Saint-Charles","to": "PARIS - GARE DE LYON - HALL 1 & 2","departure": "2026-06-15T07:57:00+02:00","arrival": "2026-06-15T11:16:00+02:00","departureTime": "7:57 AM","arrivalTime": "11:16 AM","durationLabel": "3h 19min","transfers": 0,"transporter": "Direct OUIGO","priceAmount": 109,"priceCurrency": "EUR","priceLabel": "€109","priceWithDiscountCardAmount": null,"firstClassPriceAmount": null,"secondClassPriceAmount": 109,"legs": [{"line": "OUIGO","trainNumber": "7822","from": "Marseille Saint-Charles","to": "PARIS - GARE DE LYON - HALL 1 & 2","departure": "2026-06-15T07:57:00+02:00","arrival": "2026-06-15T11:16:00+02:00","departureTime": "7:57 AM","arrivalTime": "11:16 AM","durationLabel": "3h 19min"}]}
Field reference
| Field | Type | Description |
|---|---|---|
id | string | Identifier for the proposed journey |
from / to | string | Origin / destination station labels |
departure / arrival | ISO 8601 datetime | Scheduled times with Paris offset (e.g. +02:00 in summer); arrival rolls to a later day on overnight journeys |
departureTime / arrivalTime | string | Human-readable time labels as shown in the app (e.g. "7:57 AM") |
durationLabel | string | Total travel time (e.g. "3h 19min") |
transfers | integer | Number of transfers (0 = direct) |
transporter | string | Service summary (e.g. "Direct TGV INOUI", "1 connection") |
priceAmount | number or null | Cheapest 2nd-class fare for the requested passengers, in priceCurrency. Null when no bookable fare is shown |
priceCurrency | string or null | ISO 4217 ("EUR") |
priceLabel | string or null | Raw price label as shown in the app (e.g. "€109") |
priceWithDiscountCardAmount | number or null | Cheapest fare with a discount card applied, when offered |
firstClassPriceAmount / secondClassPriceAmount | number or null | Cheapest 1st- / 2nd-class fares, when shown |
legs[] | array | Per-leg breakdown: line (TGV INOUI, OUIGO, Intercités, TER…), train number, stations, times |
priceAmount is null on journeys that aren't currently bookable (sold out, or not yet on sale).
The journey is still returned with full timing and leg details — only the price is missing.
Pricing
Pay-per-event — one search-result event is charged for each journey pushed to the dataset. A query
with maxResults: 10 charges for at most ten events, regardless of how many requests the actor makes
under the hood.
Using the API
Trigger runs from your own code via the Apify API. With your Apify API token, a POST request runs
the actor synchronously and returns the dataset items:
curl -X POST "https://api.apify.com/v2/acts/jindrich.bar~sncf-train-ticket-scraper/run-sync-get-dataset-items?token=<APIFY_TOKEN>" \-H "Content-Type: application/json" \-d '{"from": "Marseille", "to": "Paris", "maxResults": 10}'
Or run asynchronously and poll for status / dataset items:
# Start a runcurl -X POST "https://api.apify.com/v2/acts/jindrich.bar~sncf-train-ticket-scraper/runs?token=<APIFY_TOKEN>" \-H "Content-Type: application/json" \-d '{"from": "Marseille", "to": "Paris"}'# When it's done, read the datasetcurl "https://api.apify.com/v2/datasets/<DATASET_ID>/items?token=<APIFY_TOKEN>"
Official client libraries are available for JavaScript / TypeScript, Python, and via the Apify REST API directly.
Scheduling
Run the actor on a cron schedule from the Schedules tab in the Apify console — daily, hourly, or any custom cron expression. Common patterns:
- Daily price snapshot at 09:00 — track fare changes for a fixed Paris → Marseille route and chart the trend over weeks.
- Hourly refresh for a launch week — keep a real-time price board for a route during a promotional campaign.
- Weekly market scan — compare a basket of intercity routes (
Paris↔Lyon,Paris↔Bordeaux,Lyon↔Marseille) for week-over-week price changes.
Schedules can fan out into multiple datasets, push to a webhook, or trigger downstream actors when the run finishes.
Use with AI Agents (Apify MCP)
This actor is exposed through the Apify Model Context Protocol (MCP) server, so any AI agent that speaks MCP — Claude, ChatGPT custom agents, OpenAI Agents SDK, Cursor, etc. — can call it directly to fetch live SNCF ticket prices and connection options.
Once the Apify MCP server is connected, the agent picks up the actor's input schema automatically. Typical prompts that work out of the box:
- "What's the cheapest train from Paris to Marseille tomorrow morning?"
- "Find me a direct TGV from Paris to Lyon on 2026-06-15."
- "How long does the train from Paris to Bordeaux take, and what does it cost?"
- "List the next five trains from Lyon to Marseille."
The agent fills the input, runs the actor, and reads the structured dataset items back — no scraping, no HTML parsing, no scheduling logic on the agent side.
Why this works well for agents
- Typed input schema — every field has a title, type, default, and validation rules, so an agent can call the actor without trial-and-error prompting.
- Typed output —
departure,arrival,transfers,priceAmountare numbers / ISO timestamps, ready to be diffed, sorted, or compared directly. - Predictable results — journeys come back in departure order with full leg breakdowns.
Troubleshooting & support
Most issues come from date/time formatting or sparsely-served routes. Try the fixes below before opening an issue.
Common problems
No results returned
- The departure date is in the past, or beyond the SNCF Connect booking horizon. Pick a date within the next few months.
- The route genuinely has no service on the requested day. Try shifting the date.
priceAmount is null on some / all journeys
- The journey isn't currently bookable (sold out, or not yet on sale). The connection is still returned with full timing and leg details — only the price is missing.
Fewer results than maxResults
- On sparsely-served routes or late departures, the timetable simply may not have enough matching trains after the requested time. Try an earlier departure time or a larger nearby station.
Invalid time error
datemust beYYYY-MM-DD(e.g.2026-06-15).timemust beHH:MMin 24-hour format (e.g.08:00, not8 AM). Both fields are optional — leave them empty to use "now".
Different prices than the SNCF Connect site shows in a browser
- The actor returns the cheapest available fare for the requested passengers. Loyalty discounts and promo codes that require a logged-in account aren't applied.
FAQs
Can I search by station ID instead of name?
from and to accept station or city names; the actor resolves them to the best-matching SNCF
station automatically.
Does it cover metro, trams, or buses? Mainline rail (TGV INOUI, OUIGO, Intercités, TER) and the connecting services SNCF Connect surfaces. Urban transit is largely out of scope. For long-distance buses, see the Flixbus actor below.
Can I get seat availability or book a ticket? No — the actor returns timetable and fare data only. Booking requires SNCF Connect's checkout flow.
Support
Open an issue on the actor's Issues tab in the Apify console. Include the full input JSON, the run ID (visible in the run URL), and the expected vs. actual output — that lets the maintainer pull the exact logs and reproduce the issue quickly.
Need a different data source?
If you're scraping connections across multiple operators, check our companion actors:
- ÖBB ticket scraper — Austrian railways timetable and ticket prices.
- Deutsche Bahn ticket scraper — German and European rail timetable and ticket prices.
- Trenitalia connection scraper — Italian rail timetable and ticket prices.
- Flixbus connection scraper — long-distance bus routes across Europe and the US.
All these actors emit a comparable schema (from, to, departure, arrival, price, leg-level
breakdown), so an aggregator agent can merge their outputs into a single multi-modal travel search.