LibTrain Railway Open Data & Telemetry API
Unified REST JSON gateway aggregating ADIF, Renfe GTFS-RT, FGC, Euskotren, Metro and Light Rail telemetry across Spain with sub-second edge caching.
2. Quick Start
Fetch normalized live trains across Spain with a single HTTP GET request:
curl -s https://www.libtrain.com/api/v1/radar/vehicles | jq '.vehicles[:3]'
3. When to Use This API
- Live departure/arrival boards on web, kiosks, or mobile apps.
- Delay analytics, corridor punctuality monitoring, and passenger alerts.
- AI Railway Copilots & MCP agents needing grounded live RFIG/ADIF telemetry.
4. Endpoints & Live Explorer
Click any endpoint above to inspect live JSON response...
5. Authentication & Agent Registration
Public read endpoints work without tokens under standard rate limits. Authenticated partners & AI agents send a Bearer Sanctum token:
Authorization: Bearer lt_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
6. Real-Time with LibTrain Server
TrainIngestionService fuses Renfe GTFS-RT (LD & Cercanías), FGC OpenData, Euskotren, and LibTrain verified cab telemetry every 15–20 seconds with automatic deduplication.
7. Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | UNAUTHENTICATED | Missing or invalid Bearer token. |
404 | NOT_FOUND | Station code or train number not found. |
429 | RATE_LIMITED | Rate limit exceeded; respect Retry-After. |
503 | UPSTREAM_DEGRADED | Upstream agency feed temporarily unavailable. |
8. Rate Limits & Cache
Public radar endpoints allow 120 req/min per IP with shared server-side caching (15s live vehicles, 600s news/RSS) so upstream public agencies are never overloaded.
9. Agent Usage Files
AI Agents and LLM toolchains can consume structured discovery manifests directly:
GET /api/v1/radar/vehicles # Normalized telemetry schema GET /api/v1/radar/stats # Windowed fleet KPIs (live, 1d, 7d, 30d, all_time) GET /api/v1/radar/algorithms # Delay propagation & eco-cruising indices
10. Embed Station Board
Embed any ADIF station departure/arrival board on your website using our public radar tab parameter:
<iframe src="https://www.libtrain.com/radar-en-vivo?tab=board" width="100%" height="620" style="border:0;border-radius:14px;"></iframe>
11. Data, Attribution & Limits
Cartography © OpenStreetMap contributors & OpenRailwayMap. Official Spanish railway open data sourced from ADIF, Renfe Datos Abiertos, FGC Dades Obertes, and Open Data Euskadi.
12. Plans, Pricing & Terms of Use
Compare Free, Pro, Driver Cab and Enterprise plans with SLA and commercial API quotas on our official plans page.
View Plans & Pricing →13. AI Tokens & Models Adapted per Plan
| Plan | AI Model Tier | Monthly Token Quota |
|---|---|---|
| Free / Explorador | Gemini Flash-Lite | 50.000 tokens |
| Pro / Pasajero | Gemini Flash | 500.000 tokens |
| Maquinista / Empresa | Gemini Pro + RFIG Grounding | 2.500.000+ tokens |
14. Versions, Deprecation, Support & Help
API v1 is stable. Any breaking field deprecation is announced 90 days in advance via HTTP Deprecation headers and release notes.
15. Multiplatform Apps: Android, iOS, Windows, Linux, macOS
Available right now on Android and Web. Desktop (Windows, Linux, macOS) and iOS builds are in active rollout.