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.
| Route | What it returns |
|---|---|
/api/v1/trains | Trains 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=7 | Daily 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/stations | Stations (GeoJSON). |
/api/v1/lines | Cercanías lines with their path and official colour (GeoJSON, simplified to ~15 m). |
/api/v1/alerts | Active Cercanías alerts. |
/api/v1/cancellations | Trains cancelled according to Renfe. |
/api/v1/status | Summary: trains, punctuality and health of the sources. |
/api/v1/lineas | Lines 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/dias | Days of the historical record that can be downloaded. |
/api/v1/historial/{aaaa-mm-dd}.csv.gz | A full day of the historical record (UTC time). |
/api/v1/feeds/avisos.xml | Cercanías alerts as RSS. |
/api/v1/feeds/cancelaciones.xml | Cancelled trains as RSS. |
/api/docs | Interactive 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.
| Data | Source | Polled |
|---|---|---|
| High-speed / long- / medium-distance positions | gtfsrt.renfe.com/vehicle_positions_LD.json | every 15 s |
| Cercanías positions | gtfsrt.renfe.com/vehicle_positions.json | every 20 s |
| Delays and cancellations | gtfsrt.renfe.com/trip_updates(_LD).json | every 30 s |
| Cercanías alerts | gtfsrt.renfe.com/alerts.json | every 60 s |
| Timetables (GTFS) | ssl.renfe.com · Fichero_AV_LD y Fichero_CER | every 12 h |
| FGC positions | dadesobertes.fgc.cat · posicionament-dels-trens | every 20 s |
| FGC lines and stations | dadesobertes.fgc.cat · gtfs_routes, codigo-estaciones | every 24 h |
| Metro Bilbao positions | opendata.euskadi.eus · gtfsrt_metro_bilbao_vehicle_positions.pb | every 20 s |
| Metro Bilbao timetables (GTFS) | opendata.euskadi.eus · gtfs_metro_bilbao.zip | every 24 h |
| Euskotren positions (only when up to date: if the feed stops, they are not shown) | opendata.euskadi.eus · gtfsrt_euskotren_vehicle_positions.pb | every 20 s |
| Euskotren timetables and lines (GTFS) | opendata.euskadi.eus · gtfs_euskotren.zip | every 24 h |
| Station accessibility (wheelchair_boarding) | ssl.renfe.com · stops.txt de Fichero_AV_LD y Fichero_CER | every 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) | Hours | Size | Download |
|---|---|---|---|
| Sat, 31 Oct 2026 | 1 (incomplete) | 0 MB | 2026-10-31.csv.gz |
If you need more days for research or a news story, write to us at info@valfiguer.com.