Railway Transport for France API

Transportation / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

The SNCF Railway API provides access to French national rail data including train schedules, station information, and real-time disruptions. You need a free API key from the SNCF developer portal to authenticate. It is great for building travel planners focused on French rail journeys.

Beginner Tip

Request your free API key at digital.sncf.com. The API is built on Navitia, so the endpoint structure and authentication (HTTP Basic Auth with key as username) are the same.

Available Data

match scores and results
team standings
player statistics
schedule and fixtures
Use case: Integrate sncf public api data into web and mobile applications

Example Response

JSON Response
{
  "route": "Line 1",
  "origin": "Station A",
  "destination": "Station B",
  "departure": "08:30",
  "arrival": "09:15",
  "status": "On Time",
  "delays_min": 0
}

Field Reference

stop_areas List of train stations or stop areas matching the query, each with an ID and name
id Unique identifier for the stop area, used to request departures or arrivals
name Human-readable name of the station (e.g., "Paris Gare de Lyon")
coord Geographic coordinates (lat/lon) of the station
departures List of upcoming train departures from a stop, including destination and scheduled time

Implementation Example

Request
// ⚠️ Note: This URL may be a documentation page. Check official docs for actual API endpoint.
const url = "https://www.digital.sncf.com/startup/api";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

401 Unauthorized API key not passed correctly — SNCF API uses HTTP Basic Auth with the key as the username
Use curl -u YOUR_API_KEY: (with a colon and no password) or set the Authorization header as Basic base64(key:)
Unknown coverage or 404 The region identifier used is not valid for the SNCF dataset
Use coverage ID "sncf" for all French national rail queries
Rate limit exceeded Free tier has request limits that can be reached quickly during testing
Cache responses locally during development and check the rate limit headers in the API response

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Transportation
Difficulty Intermediate
Verified: 2026-04-04

Related Tags

Similar APIs

View All →