Data and API

Everything you see on the map is available as open data, with no registration and no key.

Public API

A full guide with parameters, examples and terms is in the API for developers.

RouteWhat it returns
/api/v1/trainsTrains in service (GeoJSON), with the status of each source.
/api/v1/trains/{id}One train with its recent path (up to 80 positions) and, on long- and medium-distance services, its stops with scheduled and estimated times.
/api/v1/stations/{código}Trains in the next two hours at a station: those running, with an estimated time, and those that have not yet departed, according to today's timetable.
/api/v1/horario/numero/{número}?nucleo=Today's timetable for a train number (GTFS calendar): stops, times and whether Renfe lists it as cancelled.
/api/v1/puntualidad?dias=7Daily punctuality by line and product (last delay published for each train).
/api/v1/trains/numero/{número}?nucleo=The same detail, looked up by commercial number; nucleo tells Cercanías in different cities apart.
/api/v1/stationsStations (GeoJSON).
/api/v1/linesCercanías lines with their path and official colour (GeoJSON, simplified to ~15 m).
/api/v1/alertsActive Cercanías alerts.
/api/v1/cancellationsTrains cancelled according to Renfe.
/api/v1/statusSummary: trains, punctuality and health of the sources.
/api/v1/lineasLines with their own page: Cercanías, Rodalies, FGC and Metro Bilbao.
/api/v1/lines/{núcleo}/{línea}One line: stations in order, trains now and, for Renfe, alerts, cancellations and 30-day punctuality.
/api/v1/informe/{aaaa-mm}?nucleo=Monthly report on punctuality and cancellations.
/api/v1/historial/diasDays of the historical record that can be downloaded.
/api/v1/historial/{aaaa-mm-dd}.csv.gzA full day of the historical record (UTC time).
/api/v1/feeds/avisos.xmlCercanías alerts as RSS.
/api/v1/feeds/cancelaciones.xmlCancelled trains as RSS.
/api/docsInteractive documentation (OpenAPI).

Example: curl -s --compressed https://trenes.valfiguer.com/api/v1/trains

Each train carries reported_at (time of the position), age_s (age when the response was generated), stale and flags, which explain any correction applied. The response is regenerated every 15–20 s: querying more than once every 10 s does not give newer data.

Sources

We only use datasets officially published as open data: Renfe Data, FGC Dades Obertes and Metro Bilbao and Euskotren through MovEuskadi, all under the CC BY 4.0 licence. We do not reuse data from websites or apps that are not published as open data.

DataSourcePolled
High-speed / long- / medium-distance positionsgtfsrt.renfe.com/vehicle_positions_LD.jsonevery 15 s
Cercanías positionsgtfsrt.renfe.com/vehicle_positions.jsonevery 20 s
Delays and cancellationsgtfsrt.renfe.com/trip_updates(_LD).jsonevery 30 s
Cercanías alertsgtfsrt.renfe.com/alerts.jsonevery 60 s
Timetables (GTFS)ssl.renfe.com · Fichero_AV_LD y Fichero_CERevery 12 h
FGC positionsdadesobertes.fgc.cat · posicionament-dels-trensevery 20 s
FGC lines and stationsdadesobertes.fgc.cat · gtfs_routes, codigo-estacionesevery 24 h
Metro Bilbao positionsopendata.euskadi.eus · gtfsrt_metro_bilbao_vehicle_positions.pbevery 20 s
Metro Bilbao timetables (GTFS)opendata.euskadi.eus · gtfs_metro_bilbao.zipevery 24 h
Euskotren positions (only when up to date: if the feed stops, they are not shown)opendata.euskadi.eus · gtfsrt_euskotren_vehicle_positions.pbevery 20 s
Euskotren timetables and lines (GTFS)opendata.euskadi.eus · gtfs_euskotren.zipevery 24 h
Station accessibility (wheelchair_boarding)ssl.renfe.com · stops.txt de Fichero_AV_LD y Fichero_CERevery 12 h

Licence and attribution

You may reuse this data under the same CC BY 4.0 licence, citing: “Source: Renfe Data (data.renfe.com), CC BY 4.0. Data normalised by trenes.valfiguer.com (Valfiguer)”. Our normalisation corrects known defects in the sources and records them in flags; if you need the data exactly as Renfe publishes it, use the original URLs.

Historical record

We store every change of position, status or delay in compressed CSV files (columns: received_at, reported_at, train_id, source, trip_id, lat, lon, status, stop_id, delay_s, speed_kmh, flags). You can download each full day, in UTC, as a single .csv.gz. Inside, each hour starts with its own header row: skip it when it repeats. The current day is not offered until it ends. 90 days are kept.

CC BY 4.0 licence: you may use them for whatever you like, citing “Source: Renfe Data (data.renfe.com), CC BY 4.0. Data normalised by trenes.valfiguer.com (Valfiguer)”. Not every train is included: only those that publish their position.

Day (UTC)HoursSizeDownload
Sat, 31 Oct 20261 (incomplete)0 MB2026-10-31.csv.gz

If you need more days for research or a news story, write to us at info@valfiguer.com.