Trenitalia Timetable Scraper - Solutions, Fares & Status avatar

Trenitalia Timetable Scraper - Solutions, Fares & Status

Pricing

from $1.69 / 1,000 journey rows

Go to Apify Store
Trenitalia Timetable Scraper - Solutions, Fares & Status

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.

R.L.

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

10 hours ago

Last modified

Categories

Features

Limited permissions

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.

modeInput usedDataset view / recordTypeMain columnsCharge event
search (default)origin, destination, departureDatesolutions / solution, fares / faresolutionId, searchId, origin, destination, departureTime, arrivalTime, duration, numberOfChanges, trainSummary, legCount, fareCount; serviceName, fareName, availableSeats, canRefund, canChange, canModifysolution-row, fare-row
trainStatustrainNumberstrainStatuses / trainStatus, stops / stoprideKey, departureDate, delay, runningStatus, lastTakeoverLocation, stopCount, reachedStops; sequence, location, platform, scheduledDeparture, actualDeparture, actualArrivaltrain-status-row, stop-row
stationBoardboardStation, boardDirectionboards / boarddirection, boardStation, boardStationId, time, origin, destination, delay, scheduledPlatform, actualPlatformboard-row
stationsstationQuerystations / stationstationId, name, isCityAggregate, bus, bdo, querystation-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:00 offset, duration as the API formats it (3h 10min), numberOfChanges as Italian text (Diretto, 1 Cambio, 2 Cambi), status (SALEABLE), trainCategory (Frecciarossa), trainNumber, trainAcronym, trainSummary, legCount, fareCount, priceIsIndicative and the upstream seat-map and grid flags. searchId groups the solutions of one query.
  • fare (19 columns). One selected offer on a journey, emitted only when includeFares is on. The recorded search produced 7 fare rows, all 7 with serviceName, fareName, availableSeats and the refund and change flags filled. serviceId 30005 is Standard on Frecciarossa, 170 is 2ª Classe Easy on Intercity and 286 is 2ª Classe Prenotazione. Fare families in that sample were BASE and ORDINARIA; the ORDINARIA rows had canRefund, canChange and canModify all false. All 7 rows had offerStatus NOT_SALEABLE and selectable false while their solution was SALEABLE, so read both fields before treating a row as purchasable. A fare row repeats the journey's price and currency because the upstream offer details carry none of their own.
  • trainStatus (15 columns). One dated run. The train 9611 response gave rideKey 09611A, departureDate 19/11/2026, origin Torino Porta Nuova, destination Napoli Centrale, delay +4 MIN, runningStatus BEHIND_SCHEDULE, lastTakeoverLocation Napoli Centrale, lastTakeoverTime 19/11/2026 - 12:37, stopCount 6 and reachedStops 6.
  • stop (15 columns). One stop in that run, with sequence 1 to 6, string locationId (830001700 at Milano Centrale), platform, trainOrientation (Executive in testa), stopStatus and reached. Five stops had STATION_EXCEEDED and the last had IN_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. delay is the API's string (Partito +2 MIN, Non partito, Arrivato +43 MIN); scheduledPlatform and actualPlatform are separate so a platform change is visible. actualPlatform was null on 24 of the 34 departure rows and 38 of the 47 arrival rows. On arrivals, origin is the train's true starting station, not a neighbour of the board station.
  • station (7 columns). One name match. The query Milano returned 30 rows: 830001650 "Milano ( Tutte Le Stazioni )" first with isCityAggregate true, then 830001700 Milano Centrale and 830001645 Milano Porta Garibaldi. 27 of the 30 rows had bdo true and all 30 had bus false. Roma Termini resolved to numeric id 830008409.

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:

DepartureTrain(s)numberOfChangesdurationlegCountFare rows
08:00FR 9611 FrecciarossaDiretto3h 10min11
08:05IC 657 Intercity, RV 4133 Regionale Veloce via Pisa Centrale1 Cambio9h 43min22
08:10FR 9519 FrecciarossaDiretto3h 39min11
08:16BU BUS L609A2 Cambi14h 19min32
08:30FR 9613 FrecciarossaDiretto3h 11min11

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