Spain Train Fares Scraper – Renfe, Avlo & Ouigo Prices avatar

Spain Train Fares Scraper – Renfe, Avlo & Ouigo Prices

Pricing

Pay per event

Go to Apify Store
Spain Train Fares Scraper – Renfe, Avlo & Ouigo Prices

Spain Train Fares Scraper – Renfe, Avlo & Ouigo Prices

Extract Renfe (AVE, Avlo, Alvia) and Ouigo train fares in Spain for any date range: departure, arrival, cheapest price, sold-out flag and booking link, plus the cheapest train of each day. Type city names, no station codes. $1 per 1,000 trains.

Pricing

Pay per event

Rating

0.0

(0)

Developer

Phantom Data

Phantom Data

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

4 days ago

Last modified

Security

Limited permissions

Share

Spain Train Fares Scraper — Renfe, Avlo & Ouigo cheapest prices

Get every high-speed train between two Spanish cities for a whole date range, with its cheapest fare, as clean JSON / CSV / Excel: Renfe (AVE, Avlo, Alvia, Avant, Intercity) and Ouigo, with departure and arrival time, duration, price, sold-out flag, direct/connection flag and a booking link. On top of that you get one "cheapest train of the day" row per route and day, so you can see at a glance which day is cheapest to travel.

  • Type city names ("Madrid -> Barcelona"), no station codes. 57 Spanish cities built in.
  • Up to 60 days and 20 routes per run. One click for the return direction.
  • Filters: max price, direct trains only, hide sold-out trains.
  • No login, no browser: one route × 7 days in about 1-3 minutes.
  • $1 per 1,000 trains. The "cheapest-only" mode costs $0.002 per route and day.

What can you use it for?

  • Find the cheapest day to travel Madrid ⇄ Barcelona, Valencia, Sevilla, Málaga, Alicante...
  • Price tracking / alerts: schedule the Actor daily and compare prices over time (Avlo and Ouigo prices move a lot).
  • Travel apps, bots and newsletters: feed a "cheap trains this week" Telegram channel, a comparison site or a spreadsheet.
  • Market research: compare Renfe, Avlo and Ouigo on price, timetable and availability per corridor.

Supported operators and cities

OperatorTrainsNotes
RenfeAVE, AVLO, ALVIA, AVANT, Intercity, MD, regionalAll Renfe products the booking site returns for the route. Connections are flagged direct: false.
Ouigo EspañaOUIGOBase fare (Essential) for 1 adult, without extras.
Iryo—Not supported (iryo.eu blocks automated clients).

Renfe and Ouigo: Madrid, Barcelona, Valencia, Alicante, Sevilla, Málaga, Córdoba, Zaragoza, Tarragona, Albacete, Cuenca, Segovia, Valladolid, Murcia, Elche.

Renfe only: Lleida, Girona, Figueres, Ciudad Real, Puertollano, Toledo, Guadalajara, Calatayud, Huesca, Castellón, Villena, Orihuela, Granada, Antequera, Jaén, Almería, Cádiz, Jerez, Huelva, Salamanca, Palencia, León, Zamora, Burgos, Ourense, Santiago de Compostela, A Coruña, Vigo, Oviedo, Gijón, Santander, Bilbao, Vitoria-Gasteiz, San Sebastián, Pamplona, Logroño, Badajoz, Mérida, Cáceres, Plasencia.

Cities with several stations (Madrid Atocha + Chamartín, Barcelona Sants + others, Valencia, Zaragoza, Segovia...) are searched as "all stations"; the exact station is in each row. Accents and case don't matter, and common alternatives work (Alacant, Donostia, Coruña, Seville...).

Quick start (under 1 minute)

  1. Click Try for free and write routes as city names, for example Madrid -> Barcelona. No station codes needed.
  2. Choose the first travel date and how many days to search. The pre-filled input is 1 day so your first run finishes in about 30 seconds; raise Number of days for a full price calendar.
  3. Click Start. Download JSON, CSV or Excel, or schedule it daily to track price changes.

Input

FieldDefaultWhat it does
routes["Madrid -> Barcelona"]One route per line, Origin -> Destination (also Madrid - Barcelona, Madrid to Barcelona).
includeReturnfalseAlso search each route in the other direction.
startDatetodayFirst travel date, YYYY-MM-DD.
days7Number of consecutive days (1-60).
endDate—Optional last travel date; replaces days.
operators["renfe", "ouigo"]Which operators to search.
maxPrice—Only trains at or below this price (EUR).
directOnlyfalseLeave out connections.
includeSoldOuttrueAlso output sold-out trains (price: null).
outputtrainsAndCheapesttrains, trainsAndCheapest or cheapestOnly.
maxItems2000Cost cap: stop after this many rows.
proxyConfigurationno proxyOptional Apify Proxy.

Example:

{
"routes": ["Madrid -> Barcelona", "Madrid -> Valencia"],
"includeReturn": true,
"startDate": "2026-12-18",
"days": 10,
"maxPrice": 40,
"output": "trainsAndCheapest"
}

Output

One row per train and day (recordType: "train"):

{
"recordType": "train",
"route": "Madrid → Barcelona",
"origin": "Madrid",
"destination": "Barcelona",
"date": "2026-11-04",
"weekday": "Wed",
"operator": "Ouigo",
"product": "OUIGO",
"trainNumber": "06471",
"departureTime": "06:22",
"arrivalTime": "09:45",
"durationMinutes": 203,
"departureStation": "Madrid - Puerta de Atocha - Almudena Grandes",
"arrivalStation": "Barcelona - Sants",
"price": 25.0,
"currency": "EUR",
"soldOut": false,
"direct": true,
"seatsLeft": null,
"bookingUrl": "https://ventas.ouigo.com/es-ES/_deeplink/journey-search?origin=MT1&destination=7171801&outboundDate=2026-11-04&...",
"scrapedAt": "2026-11-02T23:06:19+01:00"
}

And one row per route and day with the cheapest train (recordType: "cheapestPerDay"; counts refer to the trains that passed your filters - this example used maxPrice: 40):

{
"recordType": "cheapestPerDay",
"route": "Valencia → Madrid",
"date": "2026-12-05",
"weekday": "Sat",
"cheapestPrice": 17.0,
"currency": "EUR",
"cheapestOperator": "Ouigo",
"cheapestProduct": "OUIGO",
"cheapestTrainNumber": "06603",
"cheapestDepartureTime": "20:57",
"cheapestArrivalTime": "22:53",
"cheapestBookingUrl": "https://ventas.ouigo.com/...",
"minPriceByOperator": { "Ouigo": 17.0, "Renfe": 19.0 },
"minPriceByProduct": { "OUIGO": 17.0, "AVLO": 19.0, "AVE": 24.4 },
"trainsFound": 7,
"trainsWithSeats": 7,
"operatorsSearched": ["Ouigo", "Renfe"]
}

The dataset has two views in the Console: Trains and Cheapest per day. A short SUMMARY record (cheapest price per day and per route, and the status of each operator) is also saved in the run's key-value store.

Prices are the cheapest fare on sale for 1 adult, one way, in euros, at the moment of the run: Renfe's lowest fare for that train (e.g. Básico / Avlo base fare) and Ouigo's Essential fare without luggage extras. Prices change constantly; always confirm on the booking page.

Pricing

Pay per event, no monthly fee:

EventPrice
Train fare row$0.001
Cheapest-of-the-day row$0.002

Examples: Madrid → Barcelona, 7 days, both operators ≈ 170-210 trains + 7 daily rows ≈ $0.18-0.23. The same in cheapestOnly mode: $0.014. Daily tracking of 5 routes × 30 days in cheapestOnly mode: $0.30 per run.

Rows removed by your filters are not charged. maxItems and Apify's "maximum cost per run" are respected.

FAQ

How far ahead can I search? Up to 60 days per run. Renfe and Ouigo usually open sales a few months ahead; days that are not on sale yet simply return no trains.

How long does a run take? Ouigo is fast (2-3 s per route and day). Renfe answers cloud servers slowly, about 20-25 s per route and day, one request at a time (we keep the load on Renfe polite). Rough guide: 1 route × 7 days ≈ 3 min; 5 routes × 30 days ≈ 1 hour, so raise the run timeout for big searches, or split them into several runs.

Why is a train shown with price: null? It is sold out or has no fare on sale (soldOut: true). Turn off Include sold-out trains to hide them.

Is Iryo included? No. Iryo blocks automated requests and we don't work around that.

Renfe dates after 24 January 2027? Renfe sells trips from 25 January 2027 only on its new booking system, which this Actor does not read yet; those dates return Ouigo trains only.

Does it buy or reserve tickets? No. It only reads public prices, like an anonymous visitor of each operator's website. Use the booking link to buy.

It returned an error for Renfe/Ouigo. If an operator refuses the connection (HTTP 403 or a virtual waiting room), the run continues with the other operator and the reason is shown in the status message and in SUMMARY. Try again later or enable Apify Proxy (residential, Spain) in the Proxy field.

Limits

  • Renfe answers cloud servers slowly: expect about 20-25 seconds per route and day. Large searches (5 routes x 30 days) can take about an hour, so raise the run timeout or split them.
  • Iryo is not supported (it blocks automated clients).
  • Renfe dates after 24 January 2027 move to a new booking system that is not read yet; those dates return Ouigo trains only.
  • Prices are public fares for 1 adult without extras. The Actor does not book or reserve tickets.

The Actor reads public fares that Renfe and Ouigo show to any anonymous visitor of their websites. It collects public data only: no accounts, no personal data, no purchases. You are responsible for using the data in line with the operators' terms.

Use it from code (API)

Every Apify Actor is also an API. Replace <YOUR_API_TOKEN> with the token from your Apify account (Settings, API & Integrations).

JavaScript

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: '<YOUR_API_TOKEN>' });
const run = await client.actor('phantom-x64/spain-train-fares-scraper').call({
"routes": [
"Madrid -> Barcelona"
],
"days": 3
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);

Python

from apify_client import ApifyClient
client = ApifyClient('<YOUR_API_TOKEN>')
run = client.actor('phantom-x64/spain-train-fares-scraper').call(run_input={
"routes": [
"Madrid -> Barcelona"
],
"days": 3
})
items = client.dataset(run['defaultDatasetId']).list_items().items
print(items)

You can also start it from Make, Zapier, n8n or Google Sheets with the Apify integrations, schedule it, or call it as a tool from an AI agent through the Apify MCP server.

Support and feedback

Found a bug, need a new field or another source? Open an issue in the Issues tab of this Actor page. Reports with a run link are fixed fastest. If it saves you time, a short review on the Store page helps other people find it.

Keywords

Renfe API, Renfe scraper, Avlo prices, AVE prices, Ouigo España prices, cheap train tickets Spain, billetes de tren baratos, precios Renfe, Spain rail fares API, train price tracker, Madrid Barcelona train price, cheapest train Spain.