trenitalia.com APItrenitalia.com ↗
Access real-time Trenitalia train status, delays, station departure/arrival boards, ticket search, and traffic alerts via 8 structured API endpoints.
curl -X GET 'https://api.parse.bot/scraper/0bea8d74-c4a1-467d-8b53-8e860a100320/get_station_autocomplete?query=Roma' \ -H 'X-API-Key: $PARSE_API_KEY'
Autocomplete station name search for real-time data (ViaggiaTreno). Returns stations matching the given prefix with their IDs for use in other endpoints.
| Param | Type | Description |
|---|---|---|
| queryrequired | string | Station name prefix to search (e.g. 'Roma', 'Milano', 'Napoli') |
{
"type": "object",
"fields": {
"data": "array of station objects with id, label, nomeBreve, nomeLungo",
"status": "string, always 'success'"
},
"sample": {
"data": [
{
"id": "S08409",
"label": "Roma",
"nomeBreve": "ROMA TERMINI",
"nomeLungo": "ROMA TERMINI"
},
{
"id": "S08217",
"label": "Roma",
"nomeBreve": "ROMA TIBURTINA",
"nomeLungo": "ROMA TIBURTINA"
}
],
"status": "success"
}
}About the trenitalia.com API
The Trenitalia API exposes 8 endpoints covering live train status, station boards, ticket availability, and network alerts across Italy's rail network. Use get_train_status to retrieve a train's current delay in minutes, its full stop itinerary, and origin/destination data, or call search_trains to query fares and schedules between any two stations by their 9-digit location IDs.
Station and Train Lookup
Two autocomplete endpoints handle identifier resolution before you query live data. get_station_autocomplete accepts a station name prefix and returns objects with id, nomeBreve, and nomeLungo fields — the id values (e.g. S08409 for Roma Termini) feed get_station_departures and get_station_arrivals. For ticket searches you need a different ID format: get_location_search returns 9-digit numeric IDs such as 830008409, along with displayName, multistation, and centroidId, which are required by search_trains. get_train_autocomplete resolves a train number to an origin_id and timestamp in milliseconds, both needed for precise status lookups.
Real-Time Train and Station Data
get_train_status returns a full picture of a running train: ritardo (delay in minutes), origine, destinazione, numeroTreno, and a fermate array listing each stop with its own timing and status. If you omit origin_id and timestamp, the endpoint auto-resolves them using the train number. Station boards are split into two endpoints: get_station_departures returns compOrarioPartenza, destinazione, ritardo, and categoriaDescrizione per train; get_station_arrivals mirrors that structure with origine and compOrarioArrivo.
Ticket Search and Traffic Alerts
search_trains takes an origin_id, destination_id, optional departure_time in ISO format (YYYY-MM-DDTHH:MM:SS.mmm), and optional passenger counts for adults and children. The response includes a searchId, cartId, and a solutions array with pricing, duration, and available service classes per train. get_traffic_info requires no parameters and returns current network disruption alerts with title, date, and content fields in Italian, sourced from the Infotraffico service.
- Display a live departure board for any Italian station using
get_station_departureswith real-timeritardodelay data. - Build a train delay tracker that polls
get_train_statusforritardoandfermatestop-by-stop timing. - Integrate fare comparison into a travel app by querying
search_trainswith adult/child counts and a departure time. - Alert commuters to active service disruptions by surfacing
get_traffic_infoalerts filtered by title or date. - Resolve arbitrary station names to IDs programmatically using
get_station_autocompletebefore querying boards. - Look up whether a specific train number is currently running via
get_train_autocompletebefore fetching its status. - Power an arrival notification service by monitoring
get_station_arrivalsfor a targetorigineand expectedcompOrarioArrivo.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 250 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does Trenitalia offer an official developer API?+
What does `get_train_status` return, and do I always need to supply `origin_id` and `timestamp`?+
ritardo (delay in minutes), origine, destinazione, numeroTreno, and a fermate array of stops with individual timing data. Both origin_id and timestamp are optional — if you omit them, the endpoint resolves them automatically from the train number using the autocomplete lookup. Supply them explicitly when you want to target a specific scheduled departure.Does the API cover international trains or only domestic Italian routes?+
Does the API support searching trains for a past date or historical schedule data?+
get_station_departures, get_station_arrivals) return departures and arrivals around the current time and do not accept a date parameter. search_trains accepts a future departure_time. Historical schedule data and past departure boards are not currently covered. You can fork this API on Parse and revise it to add the missing historical endpoint if that surface becomes accessible.Are ticket prices returned in `search_trains` responses, and which passenger types are supported?+
solutions array in the search_trains response includes pricing alongside duration and service class details per train. Passenger counts are configurable via the adults and children integer parameters. Senior, loyalty, or regional discount fares beyond the adult/child split are not exposed as separate parameters in the current endpoint.