# Trenitalia Scraper — Train Prices & Schedules (`studio-amba/trenitalia-scraper`) Actor

Scrape Trenitalia train schedules, prices, and availability. Search Italian rail routes to get Frecciarossa, Frecciargento, Frecciabianca, Intercity, and Regionale train times, fares by class, and duration. Covers all major Italian stations. No login or cookies required.

- **URL**: https://apify.com/studio-amba/trenitalia-scraper.md
- **Developed by:** [Studio Amba](https://apify.com/studio-amba) (community)
- **Categories:** Travel
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 result scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### What does Trenitalia Scraper do?

**Trenitalia Scraper** extracts train schedules, ticket prices, availability, and service details from [Trenitalia](https://www.trenitalia.com), Italy's national railway operator. Search any Italian rail route and get structured data for Frecciarossa, Frecciargento, Frecciabianca, Intercity, and Regionale trains — including departure/arrival times, journey duration, prices by service class, and fare types.

No login, cookies, or Trenitalia account required. The actor runs on the [Apify platform](https://apify.com), giving you API access, scheduling, webhooks, and integrations with tools like Zapier, Make, Google Sheets, and Slack.

### Why use Trenitalia Scraper?

- **Price monitoring** — Track fare changes on popular routes like Roma-Milano, Firenze-Napoli, or Venezia-Bologna. Set up scheduled runs to catch the cheapest tickets.
- **Travel aggregation** — Build travel comparison tools or dashboards that include Italian rail data alongside flights and buses.
- **Research and analytics** — Analyze pricing patterns, route frequency, and train type distribution across the Italian rail network.
- **Business intelligence** — Hotels, tour operators, and travel agencies can use train schedule data to plan packages and inform customers.

### How to scrape Trenitalia data

1. Go to the [Trenitalia Scraper](https://apify.com/studio-amba/trenitalia-scraper) page on Apify Store.
2. Click **Try for free** to open the actor in Apify Console.
3. Enter your **origin** and **destination** station names (e.g. "Roma Termini" and "Milano Centrale").
4. Optionally set a **departure date** (YYYY-MM-DD format). If omitted, it defaults to 14 days from today.
5. Click **Start** and wait for the run to complete.
6. Download your data as JSON, CSV, Excel, or connect it to your app via the Apify API.

### Input

| Field | Type | Description | Default |
|-------|------|-------------|---------|
| `origin` | string | Departure station name | Roma Termini |
| `destination` | string | Arrival station name | Milano Centrale |
| `departureDate` | string | Travel date (YYYY-MM-DD) | 14 days from now |
| `passengers` | integer | Number of adult passengers (1-9) | 1 |
| `frecceOnly` | boolean | Only return high-speed Frecce trains | false |
| `maxResults` | integer | Maximum results to return | 50 |
| `proxyConfiguration` | object | Proxy settings (residential recommended) | Apify Proxy |

#### Example input

```json
{
    "origin": "Roma Termini",
    "destination": "Milano Centrale",
    "departureDate": "2026-07-15",
    "passengers": 1,
    "frecceOnly": false,
    "maxResults": 50
}
```

The actor automatically resolves station names to Trenitalia station IDs. You can use full station names like "Roma Termini" or city names like "Firenze" — the actor picks the best match.

### Output

The actor stores results in a dataset. Each item represents one train service with a specific fare/class combination. You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

#### Example output

```json
{
    "origin": "Roma Termini",
    "destination": "Milano Centrale",
    "departureTime": "2026-07-15T09:00:00.000+02:00",
    "arrivalTime": "2026-07-15T11:55:00.000+02:00",
    "duration": "2h 55m",
    "trainType": "Frecciarossa",
    "trainNumber": "9612",
    "price": 49.90,
    "currency": "EUR",
    "serviceClass": "Standard",
    "offerName": "Economy",
    "available": true,
    "carrier": "Trenitalia",
    "changes": 0,
    "url": "https://www.trenitalia.com/en.html#Roma%20Termini-to-Milano%20Centrale",
    "scrapedAt": "2026-07-01T12:00:00.000Z"
}
```

### Data fields

| Field | Type | Description |
|-------|------|-------------|
| `origin` | string | Departure station name |
| `destination` | string | Arrival station name |
| `departureTime` | string | Departure date/time (ISO 8601) |
| `arrivalTime` | string | Arrival date/time (ISO 8601) |
| `duration` | string | Journey duration (e.g. "2h 55m") |
| `trainType` | string | Train category: Frecciarossa, Frecciargento, Frecciabianca, Intercity, Regionale, etc. |
| `trainNumber` | string | Train service number |
| `price` | number | Ticket price in EUR (null if unavailable) |
| `currency` | string | Currency code (EUR) |
| `serviceClass` | string | Service class: Standard, Premium, Business, Executive |
| `offerName` | string | Fare type: Economy, Base, Flex, etc. |
| `available` | boolean | Whether tickets can be purchased |
| `carrier` | string | Train operator (Trenitalia) |
| `changes` | integer | Number of train changes (0 = direct) |
| `url` | string | Search URL on Trenitalia |
| `scrapedAt` | string | Timestamp when data was collected |

### How much does it cost to scrape Trenitalia?

A typical run searching one route returns 30-100 results (depending on available trains and classes). It costs $0.02 per run plus $0.002 per result — about $0.08-$0.22 per search.

For scheduled monitoring (e.g. checking Roma-Milano prices daily), expect to spend around $2-7 per month depending on how many routes you track.

### Tips

- **Use specific station names** for best results: "Roma Termini", "Milano Centrale", "Firenze Santa Maria Novella", "Napoli Centrale", "Venezia Santa Lucia".
- **Set `frecceOnly: true`** if you only want high-speed trains — this filters out Regionale and Intercity services.
- **Use residential proxies** for reliable results. The default Apify Proxy works, but residential proxies avoid rate limiting.
- **Schedule runs** to track price changes over time. Trenitalia fares fluctuate significantly — Economy fares on Frecciarossa can range from 19.90 to 89.90 EUR.
- **Combine with other transport actors** to build a complete Italian travel comparison: pair with flight scrapers, bus scrapers, or other European rail actors.

### Supported train types

| Type | Speed | Description |
|------|-------|-------------|
| Frecciarossa | Up to 300 km/h | Flagship high-speed, Roma-Milano in 2h 55m |
| Frecciargento | Up to 250 km/h | High-speed tilting trains, serves Venice, Verona, Lecce |
| Frecciabianca | Up to 200 km/h | Fast trains on non-high-speed lines |
| Intercity | Standard | Long-distance, stops at more stations |
| Regionale | Standard | Regional services, all stops |

### FAQ and support

**Is it legal to scrape Trenitalia?** This actor accesses publicly available train schedule and pricing information — the same data you see when searching on trenitalia.com. No login or authentication is required.

**Why are some prices null?** When a fare class is sold out or not available for a route, the price is returned as null and `available` is set to false.

**Can I search international routes?** The actor focuses on Italian domestic routes. For cross-border trains (e.g. to France, Switzerland, Austria), try searching from border stations like Milano Centrale or Venezia Santa Lucia.

**Results look empty?** Make sure your station names are spelled correctly. Try common names like "Roma Termini" or "Napoli Centrale". If the date is in the past or too far in the future, Trenitalia may not return results.

For bugs or feature requests, open an issue in the [Issues tab](https://apify.com/studio-amba/trenitalia-scraper/issues). For custom scraping solutions, contact us through the Apify platform.

# Actor input Schema

## `origin` (type: `string`):

Departure city or station name (e.g. 'Roma Termini', 'Milano Centrale', 'Firenze', 'Napoli', 'Venezia'). The actor resolves the name to a station ID automatically.

## `destination` (type: `string`):

Arrival city or station name (e.g. 'Milano Centrale', 'Roma Termini', 'Torino', 'Bologna'). The actor resolves the name to a station ID automatically.

## `departureDate` (type: `string`):

Travel date in YYYY-MM-DD format (e.g. '2026-07-15'). Defaults to 14 days from now if not provided.

## `passengers` (type: `integer`):

Number of adult passengers (1-9).

## `frecceOnly` (type: `boolean`):

Only return Frecce high-speed trains (Frecciarossa, Frecciargento, Frecciabianca). Excludes Regionale and Intercity.

## `maxResults` (type: `integer`):

Maximum number of train solutions to return.

## `proxyConfiguration` (type: `object`):

Proxy settings. Residential proxies recommended to avoid rate limiting.

## Actor input object example

```json
{
  "origin": "Roma Termini",
  "destination": "Milano Centrale",
  "passengers": 1,
  "frecceOnly": false,
  "maxResults": 10,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "IT"
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "origin": "Roma Termini",
    "destination": "Milano Centrale",
    "maxResults": 10,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "IT"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("studio-amba/trenitalia-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "origin": "Roma Termini",
    "destination": "Milano Centrale",
    "maxResults": 10,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "IT",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("studio-amba/trenitalia-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "origin": "Roma Termini",
  "destination": "Milano Centrale",
  "maxResults": 10,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "IT"
  }
}' |
apify call studio-amba/trenitalia-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,studio-amba/trenitalia-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/bLwRYJV89AmrV5EHq/builds/CMMksEo06rkpnIKZq/openapi.json
