Trenitalia Timetable Scraper - Solutions, Fares & Status
Pricing
from $1.69 / 1,000 journey rows
Trenitalia Timetable Scraper - Solutions, Fares & Status
Collect Trenitalia journey solutions and fares with seats left, live train status with stops, station boards and station ids as flat JSON. Four modes, six dataset views, scrapedAt and provenance on every row; no login or API key.
Pricing
from $1.69 / 1,000 journey rows
Rating
0.0
(0)
Developer
R.L.
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
10 hours ago
Last modified
Categories
Features
Share
Trenitalia Timetables Scraper - Solutions, Fares, Train Status, Station Boards
This Actor collects Trenitalia journey options, fares and seats left, live train running status, stop sequences, station departure and arrival boards, and station ids as flat JSON rows. One mode input selects the slice: search, trainStatus, stationBoard or stations. All four write to one dataset with six views and a recordType on every row: solution, fare, trainStatus, stop, board or station. In the recorded Milano Centrale to Roma Termini search for 2026-11-21, the fixture produced 5 solution rows and 7 fare rows; train 9611 produced 1 status row and 6 stop rows; the Milano Centrale boards held 34 departures and 47 arrivals. Rows come from Trenitalia's own Android BFF at https://app.lefrecce.it/Channels.Mobile.BFF/api/, recorded live on 2026-11-19, not from a rendered page. No Trenitalia account, login or API key is used. The Actor is read-only: it calls no cart, reservation or ticket purchase endpoint. Full field-by-field schemas: https://keyspace.dev/data-dictionaries/trenitalia/index.html
What can I collect from Trenitalia?
Four modes cover the data the anonymous timetable surface exposes. Each view returns only the columns its row kind fills.
mode | Input used | Dataset view / recordType | Main columns | Charge event |
|---|---|---|---|---|
search (default) | origin, destination, departureDate | solutions / solution, fares / fare | solutionId, searchId, origin, destination, departureTime, arrivalTime, duration, numberOfChanges, trainSummary, legCount, fareCount; serviceName, fareName, availableSeats, canRefund, canChange, canModify | solution-row, fare-row |
trainStatus | trainNumbers | trainStatuses / trainStatus, stops / stop | rideKey, departureDate, delay, runningStatus, lastTakeoverLocation, stopCount, reachedStops; sequence, location, platform, scheduledDeparture, actualDeparture, actualArrival | train-status-row, stop-row |
stationBoard | boardStation, boardDirection | boards / board | direction, boardStation, boardStationId, time, origin, destination, delay, scheduledPlatform, actualPlatform | board-row |
stations | stationQuery | stations / station | stationId, name, isCityAggregate, bus, bdo, query | station-row |
Every row also carries scrapedAt, the UTC delivery time stamped by the ledger, and provenance, the Actor build and row kind, for example local@local solution. A column another mode does not fill is absent from the row rather than null. Each of the six row kinds has its own billable event, named in the table.
What does one row contain?
The six views have 21, 19, 15, 15, 15 and 7 fields respectively. The counts below come from mapping the recorded BFF responses, not from a synthetic stub.
solution(21 columns). One journey option. All 5 recorded rows filled all 21 view columns: route, ISO departure and arrival with the API's+01:00offset,durationas the API formats it (3h 10min),numberOfChangesas Italian text (Diretto,1 Cambio,2 Cambi),status(SALEABLE),trainCategory(Frecciarossa),trainNumber,trainAcronym,trainSummary,legCount,fareCount,priceIsIndicativeand the upstream seat-map and grid flags.searchIdgroups the solutions of one query.fare(19 columns). One selected offer on a journey, emitted only whenincludeFaresis on. The recorded search produced 7 fare rows, all 7 withserviceName,fareName,availableSeatsand the refund and change flags filled.serviceId30005 is Standard on Frecciarossa, 170 is 2ª Classe Easy on Intercity and 286 is 2ª Classe Prenotazione. Fare families in that sample wereBASEandORDINARIA; theORDINARIArows hadcanRefund,canChangeandcanModifyall false. All 7 rows hadofferStatusNOT_SALEABLEandselectablefalse while their solution wasSALEABLE, so read both fields before treating a row as purchasable. A fare row repeats the journey'spriceandcurrencybecause the upstream offer details carry none of their own.trainStatus(15 columns). One dated run. The train 9611 response gaverideKey09611A,departureDate19/11/2026, origin Torino Porta Nuova, destination Napoli Centrale,delay+4 MIN,runningStatusBEHIND_SCHEDULE,lastTakeoverLocationNapoli Centrale,lastTakeoverTime19/11/2026 - 12:37,stopCount6 andreachedStops6.stop(15 columns). One stop in that run, withsequence1 to 6, stringlocationId(830001700at Milano Centrale),platform,trainOrientation(Executive in testa),stopStatusandreached. Five stops hadSTATION_EXCEEDEDand the last hadIN_STATION. At Milano Centrale the scheduled departure was 08:00 and the actual departure 08:02. The terminus at Napoli Centrale has no departure times, only arrival times.board(15 columns). One train on a station board. The Milano Centrale recordings held 34 departures and 47 arrivals.delayis the API's string (Partito +2 MIN,Non partito,Arrivato +43 MIN);scheduledPlatformandactualPlatformare separate so a platform change is visible.actualPlatformwas null on 24 of the 34 departure rows and 38 of the 47 arrival rows. On arrivals,originis the train's true starting station, not a neighbour of the board station.station(7 columns). One name match. The queryMilanoreturned 30 rows:830001650"Milano ( Tutte Le Stazioni )" first withisCityAggregatetrue, then830001700Milano Centrale and830001645Milano Porta Garibaldi. 27 of the 30 rows hadbdotrue and all 30 hadbusfalse.Roma Terminiresolved to numeric id830008409.
Time and date strings keep the source format. Solutions use ISO values such as 2026-11-21T08:00:00.000+01:00; a status endpoint returns 19/11/2026 while a trainKey carries 2026-11-19T06:50:00. In the 47-row arrivals board, 43 rows used the trainKey's date-only 2026-11-19T00:00:00 fallback and 4 carried the board's own full timestamp. time is always the time shown on the board, such as 19:35.
Which journeys and stations did the recorded runs cover?
The recorded Milano Centrale to Roma Termini search was run from 08:00 for travel on 2026-11-21. It returned five journeys with these lead trains:
| Departure | Train(s) | numberOfChanges | duration | legCount | Fare rows |
|---|---|---|---|---|---|
| 08:00 | FR 9611 Frecciarossa | Diretto | 3h 10min | 1 | 1 |
| 08:05 | IC 657 Intercity, RV 4133 Regionale Veloce via Pisa Centrale | 1 Cambio | 9h 43min | 2 | 2 |
| 08:10 | FR 9519 Frecciarossa | Diretto | 3h 39min | 1 | 1 |
| 08:16 | BU BUS L609A | 2 Cambi | 14h 19min | 3 | 2 |
| 08:30 | FR 9613 Frecciarossa | Diretto | 3h 11min | 1 | 1 |
Train 9611's status run covered six stops from Torino Porta Nuova to Napoli Centrale: Torino Porta Nuova, Torino Porta Susa, Milano Centrale, Bologna Centrale, Roma Termini and Napoli Centrale. The Milano Centrale departures board included FR 9663 to Napoli Centrale at 19:35 on platform 17, RE 25532 to Chiasso at 19:43 and ICN 35051 to Lecce at 19:45. Its arrivals board included FR 8824 from Lecce at 19:10 with Arrivato +43 MIN. Station ids used by these requests include 830001700 for Milano Centrale, 830008409 for Roma Termini and 830005043 for Bologna Centrale.
How does a search cover a whole day?
maxSolutions sets the day total, from 1 to 100, with a default of 5. Trenitalia serves only a forward window of about 10 journeys from departureTime, and caps a single call at 20, so the Actor walks successive windows from just past the last journey seen. It stops after collecting maxSolutions, when the day's schedule ends, at 40 windows, or when the delivery ledger stops. departureTime is a time of day in 24-hour HH:MM form, default 08:00.
service filters by all, frecce, intercity or regional; order has four values, sent to the API as departure, arrival, fastest and fare-based ordering. adults runs from 1 to 9 and children from 0 to 9; these change the quoted price context, not which journeys are listed. includeFares is on by default and adds one fare row for each selected offer: a 5-journey search with 2 offers each gives 5 solution rows and 10 fare rows. Turn it off for timetable-only runs.
How are live status, boards and limits handled?
trainStatus accepts up to 25 numbers in trainNumbers; duplicates are dropped before requests, and each number gets its own lookup because all those POSTs share one URL. A number can resolve to more than one dated run. Each run yields one trainStatus row and one stop row per stop, and the full trainKey is forwarded because sending only the rideKey returns empty stops. rideKey plus departureDate identifies a run.
stationBoard resolves boardStation against Trenitalia's station list, then reads either departures or arrivals. A board lists through-services: an arrival row's origin and destination describe the train's own endpoints, while boardStation names the station queried. stations does a substring match on stationQuery and returns city aggregates alongside physical stations; it finds exact names for the other modes.
maxItems defaults to 0, meaning no limit. It stops after that many rows have been delivered, counted by the ledger after de-duplication and across all row kinds of the run. A run also stops when it reaches the maximum total charge set on the run itself, and says so in its status message. maxConcurrency defaults to 5, maxRequestsPerCrawl to 0 (unlimited), maxRequestRetries to 5 and maxSessionRotations to 10; blocked status codes get a fresh session, proxy and device identity under the last of these budgets.
What happens when input, requests or rows fail?
Everything that can be checked is checked before the first network call. A missing origin, identical origin and destination, an impossible date such as 2026-02-30, a time such as 25:00, maxSolutions above 100, an unknown mode or more than 25 train numbers all end with a "Nothing to scrape" status message and no rows. An unresolved station name stops a search or board rather than guessing an id; stations returns no rows for a name that matches nothing; a train number with no run and an empty status payload deliver nothing.
The BFF answers HTTP 200 even for some refusals, so the Actor reads responseInfo.status from the body. UNAUTHORIZED and CLIENT_NOT_SUPPORTED are fatal; challenge pages and 401, 403 or 429 responses go through the retry and rotation path. Before a row is written or billed, the ledger removes duplicates (solutionId for solutions, solutionId plus offerId plus serviceId for fares, rideKey plus departureDate for runs), drops rows that resolve no entity and validates the row against the shipped dataset schema. Rows cut by maxItems or the run charge cap are not delivered. The input accepts an Apify Proxy or custom proxies; the recorded responses were fetched from a datacenter IP on 2026-11-19.
What do people ask before running this?
Do I need a Trenitalia account or API key?
No. The Actor calls the public mobile BFF anonymously with a generated Android device id.
Can it book a ticket, hold a seat or read my orders?
No. It is read-only, and full seat maps need a logged-in cart, which is out of scope. Seats left per class are in availableSeats on fare rows.
How do I get a whole day of departures instead of the next hour?
Set maxSolutions up to 100. The Actor walks successive time windows from departureTime until it has that many journeys or the day ends.
Why did one train number return two status rows?
The number resolved to more than one dated run. Use rideKey and departureDate to tell them apart.
What if a station name does not match?
A search or board run stops without delivering a row, rather than searching a guessed station id. Use stations with part of the name to find the spelling it needs.
How do I bound the size of a run?
Use maxItems for delivered rows and maxSolutions for journeys within a search. The run's own maximum charge is a second stop condition.
Can I schedule it?
Yes. It is an Apify Actor, so it can be started from the Console, the Apify API or a schedule with the same input fields.
Where are the full schemas and charge rates?
The 21 input fields, all six dataset views and the six row-level charge events are documented at https://keyspace.dev/data-dictionaries/trenitalia/index.html. Current rates are on this Actor's Pricing tab.
Where are the full input and output schemas?
The input reference covers 21 fields (mode, the four search fields, passenger counts, service and sort, maxSolutions, includeFares, trainNumbers, the two board fields, stationQuery, maxItems and the five advanced fields). The six dataset views hold 92 field definitions in total, and the output maps each view to its own dataset URL. All of them are documented here: https://keyspace.dev/data-dictionaries/trenitalia/index.html