# SNCF Scraper - French Train Schedules & Prices (`studio-amba/sncf-scraper`) Actor

Scrape train schedules, prices, and availability from SNCF Connect (sncf-connect.com). Extract TGV, TER, and Intercites routes across France and Europe. No login required.

- **URL**: https://apify.com/studio-amba/sncf-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, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

### How to scrape SNCF data

**SNCF Scraper** extracts train schedules, ticket prices, availability, and journey details from [SNCF Connect](https://www.sncf-connect.com) — the official booking platform of France's national railway operator. With 40 million monthly visits, SNCF Connect is the primary source for French domestic and European train travel data.

This Actor uses Playwright to navigate the SNCF Connect search interface, extract TGV INOUI, TER, Intercites, and OUIGO train results, and return structured data ready for analysis, price monitoring, or integration with your travel platform. **No login or cookies required.**

### Why use SNCF Scraper?

- **Price monitoring** — Track ticket prices across routes and dates to find the best deals or monitor fare trends over time.
- **Travel research** — Compare routes, durations, and train types (TGV, TER, OUIGO) for any French destination.
- **Market intelligence** — Collect structured pricing data for competitive analysis in the travel industry.
- **Availability tracking** — Monitor seat availability for popular routes and get alerts when seats open up.
- **Carbon footprint analysis** — Extract CO2 emission data for eco-conscious travel planning.
- **API access** — Get SNCF train data via Apify API, webhooks, or scheduled runs. Integrate with Zapier, Make, Google Sheets, or your own applications.

### What data can you extract from SNCF Connect?

| Field | Description |
|---|---|
| origin | Departure station or city |
| destination | Arrival station or city |
| departureTime | Departure time (HH:mm) |
| arrivalTime | Arrival time (HH:mm) |
| duration | Total travel time (e.g., 1h 56min) |
| trainType | Service type (TGV INOUI, TER, OUIGO, Intercites) |
| price | Ticket price in EUR |
| currency | Currency code (EUR) |
| travelClass | Seat class (1st, 2nd) |
| availableSeats | Availability status |
| carrier | Operating company (SNCF, Trenitalia, etc.) |
| co2Emission | Carbon footprint per journey |
| changes | Number of transfers |
| url | Source URL |
| scrapedAt | Timestamp of extraction |

### How to use SNCF Scraper

1. Go to the SNCF Scraper [input page](https://console.apify.com/actors/sncf-scraper/input).
2. Enter your **origin** city (e.g., Paris) and **destination** city (e.g., Lyon).
3. Optionally set a **departure date** in YYYY-MM-DD format. If left empty, defaults to 14 days from today.
4. Set the number of **passengers** (default: 1).
5. Configure **max results** to limit the number of train results returned.
6. Click **Start** and wait for the run to complete.
7. Download your data from the **Dataset** tab in JSON, CSV, Excel, or HTML format.

### Input parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| origin | string | Paris | Departure city name |
| destination | string | Lyon | Arrival city name |
| departureDate | string | 14 days from today | Travel date (YYYY-MM-DD) |
| passengers | integer | 1 | Number of adult passengers (1-9) |
| maxResults | integer | 50 | Maximum results to return |
| proxyConfiguration | object | Residential FR | Proxy settings (residential recommended) |

#### Example input

```json
{
    "origin": "Paris",
    "destination": "Marseille",
    "departureDate": "2026-07-15",
    "passengers": 2,
    "maxResults": 30
}
````

### Output example

```json
{
    "origin": "Paris",
    "destination": "Lyon",
    "departureTime": "07:23",
    "arrivalTime": "09:19",
    "duration": "1h 56min",
    "trainType": "TGV INOUI",
    "price": 29.0,
    "currency": "EUR",
    "travelClass": "2nd",
    "availableSeats": "Available",
    "carrier": "SNCF",
    "co2Emission": "2.4 kg",
    "changes": 0,
    "url": "https://www.sncf-connect.com/app/home/search",
    "scrapedAt": "2026-06-09T10:30:00.000Z"
}
```

### How much does it cost to scrape SNCF Connect?

A typical run searching one route returns 10-30 train results and costs approximately **$0.10-0.25** in Apify platform credits, depending on proxy usage and whether results load quickly. The Actor uses Playwright (browser-based) which consumes more compute than HTTP-only scrapers, but this is necessary because SNCF Connect is a React single-page application.

To keep costs down:

- Set `maxResults` to only what you need.
- Use a specific date rather than leaving it to default.
- Schedule runs during off-peak hours for faster loading.

### Supported routes

SNCF Connect covers all French domestic rail routes and many European connections:

- **High-speed (TGV INOUI)** — Paris-Lyon, Paris-Marseille, Paris-Bordeaux, Paris-Strasbourg, Paris-Lille, Paris-Nantes, Paris-Rennes, Paris-Montpellier, and more.
- **Budget (OUIGO)** — Low-cost TGV services on major routes.
- **Regional (TER)** — Local and regional connections across all French regions.
- **Intercites** — Medium-distance routes not served by TGV.
- **International** — Paris-Brussels, Paris-London (Eurostar), Paris-Geneva, Paris-Milan, and other cross-border services.

### Tips for best results

- **Use residential proxies** — SNCF Connect uses DataDome anti-bot protection. Residential proxies with FR country code provide the best success rate.
- **Set realistic dates** — SNCF typically shows results for dates up to 3-4 months in advance. Past dates or dates too far in the future will return no results.
- **French city names work best** — While the Actor handles English city names, using French names (e.g., "Marseille" instead of "Marseilles") improves autocomplete matching.
- **Run during business hours (CET)** — SNCF Connect tends to respond faster during European daytime hours.

### Integrations

Connect SNCF Scraper to your workflow with:

- **Apify API** — Call programmatically from any language.
- **Webhooks** — Get notified when a run completes.
- **Scheduled runs** — Monitor prices daily or weekly.
- **Zapier / Make** — No-code integration with 5000+ apps.
- **Google Sheets** — Export results directly to a spreadsheet.

### FAQ

#### Is it legal to scrape SNCF Connect?

This Actor extracts publicly available train schedule and pricing information that any visitor can see on sncf-connect.com. No login, authentication, or account is required. Always ensure your use case complies with applicable laws and SNCF Connect's terms of service.

#### Why did my run return zero results?

SNCF Connect uses DataDome anti-bot protection which may block requests. Make sure you are using residential proxies with FR country code. Also verify that your origin and destination city names are valid and your departure date is in the future.

#### Can I scrape multiple routes in one run?

Currently the Actor searches one route per run. To scrape multiple routes, trigger separate runs with different origin/destination combinations using the Apify API or scheduler.

#### How often is pricing data updated?

SNCF updates prices dynamically based on demand. For accurate price tracking, schedule runs at consistent times (e.g., daily at 8:00 AM CET).

### Support and feedback

If you encounter issues or have feature requests, please open an issue in the [Issues tab](https://console.apify.com/actors/sncf-scraper/issues). For custom scraping solutions, reach out via the Actor's page on the Apify Store.

# Actor input Schema

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

Departure city name (e.g., Paris, Lyon, Marseille, Bordeaux, Lille).

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

Arrival city name (e.g., Lyon, Paris, Marseille, Bordeaux, Strasbourg).

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

Travel date in YYYY-MM-DD format. Defaults to 14 days from today if not set.

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

Number of adult passengers.

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

Maximum number of train results to return.

## `sncfApiKey` (type: `string`):

Free API key from SNCF Open Data (https://numerique.sncf.com/startup/api/token-developpeur/). Provides 5,000 requests/day with detailed train types, CO2 data, and connections. Without this key, the scraper falls back to page scraping via Bright Data.

## `brightDataApiKey` (type: `string`):

Bright Data API key for Web Unlocker (bypasses DataDome anti-bot). Falls back to BRIGHT\_DATA\_API\_KEY environment variable. Only needed if no SNCF API key is provided.

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

Proxy settings. Only needed if no SNCF API key is provided (fallback to timetable page scraping). Residential FR proxies recommended.

## Actor input object example

```json
{
  "origin": "Paris",
  "destination": "Lyon",
  "passengers": 1,
  "maxResults": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "FR"
  }
}
```

# 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": "Paris",
    "destination": "Lyon",
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "FR"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("studio-amba/sncf-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": "Paris",
    "destination": "Lyon",
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "FR",
    },
}

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

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": "Paris",
  "destination": "Lyon",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "FR"
  }
}' |
apify call studio-amba/sncf-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=studio-amba/sncf-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "SNCF Scraper - French Train Schedules & Prices",
        "description": "Scrape train schedules, prices, and availability from SNCF Connect (sncf-connect.com). Extract TGV, TER, and Intercites routes across France and Europe. No login required.",
        "version": "0.1",
        "x-build-id": "PA7h61xw0AHb0nIUB"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/studio-amba~sncf-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-studio-amba-sncf-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/studio-amba~sncf-scraper/runs": {
            "post": {
                "operationId": "runs-sync-studio-amba-sncf-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/studio-amba~sncf-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-studio-amba-sncf-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "origin": {
                        "title": "Origin City",
                        "type": "string",
                        "description": "Departure city name (e.g., Paris, Lyon, Marseille, Bordeaux, Lille).",
                        "default": "Paris"
                    },
                    "destination": {
                        "title": "Destination City",
                        "type": "string",
                        "description": "Arrival city name (e.g., Lyon, Paris, Marseille, Bordeaux, Strasbourg).",
                        "default": "Lyon"
                    },
                    "departureDate": {
                        "title": "Departure Date",
                        "type": "string",
                        "description": "Travel date in YYYY-MM-DD format. Defaults to 14 days from today if not set."
                    },
                    "passengers": {
                        "title": "Passengers",
                        "minimum": 1,
                        "maximum": 9,
                        "type": "integer",
                        "description": "Number of adult passengers.",
                        "default": 1
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of train results to return.",
                        "default": 50
                    },
                    "sncfApiKey": {
                        "title": "SNCF API Key",
                        "type": "string",
                        "description": "Free API key from SNCF Open Data (https://numerique.sncf.com/startup/api/token-developpeur/). Provides 5,000 requests/day with detailed train types, CO2 data, and connections. Without this key, the scraper falls back to page scraping via Bright Data."
                    },
                    "brightDataApiKey": {
                        "title": "Bright Data API Key",
                        "type": "string",
                        "description": "Bright Data API key for Web Unlocker (bypasses DataDome anti-bot). Falls back to BRIGHT_DATA_API_KEY environment variable. Only needed if no SNCF API key is provided."
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Proxy settings. Only needed if no SNCF API key is provided (fallback to timetable page scraping). Residential FR proxies recommended."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
