CIIFragments Studio is CII-accredited: recover up to 20% of your software development spendLearn more

API integration for SNCF & transport

We build your SNCF connector

We wire api.sncf.com into your field or expense tool: nearest station, next train, impact of a disruption. Without sending the user to SNCF Connect, and without burning the quota before noon.

  • Senior product team
  • public-data connectors in production
  • from scoping to monitoring
In short

What does the SNCF API provide and when should you integrate it into an application?

The SNCF API gives real-time access to French train schedules, itineraries and next departures: TGV, TER, Intercités, Transilien and international connections. You integrate it in corporate mobility applications to display train journey options for a given date, in business travel management tools to suggest available routes, or in logistics platforms to plan deliveries around rail schedules. Access is free within the daily quota limits.

Use cases

What our clients build on the SNCF API

01

Next train in a field tool

Departure station = the technician's nearest station. The trip is no longer copied from the consumer app.

02

Station autocomplete in an HRIS

Expenses, works council, travel management: a return proposal, no more a stale timetable in a spreadsheet.

03

Delay alert on a trip already booked

Careful polling of roster trips. The SNCF API documents no webhook: we do not poll a home page 5,000 times.

04

Île-de-France journey, switch to PRIM

As soon as there is metro or IDFM RER, this is no longer api.sncf.com. We wire PRIM, not a train Navitia stretched by guesswork.

For you

What it changes in your business travel

Engineering in service of a measurable outcome: the next train in the tool, a quota that lasts until evening.

The official API, not a scrape

With a valid token, schedules answer. We do not rebuild a journey on a consumer website.

Quota lasts until evening

An unlimited station field burns the daily allowance. Cache and server-side calls: the service stays available.

Transilien is not real time

Showing real-time Transilien is a product lie. TGV / TER yes; Transilien, theoretical only.

Trains only, not full MaaS

No metro, no bus. For multimodal France, we wire the right sources (open data, PRIM in Île-de-France).

Method

How we ship your SNCF connector

01

Scoping

Train-only or multimodal, autocomplete volume, Île-de-France or not. We size the quota before writing a line.

02

Development

Token in a server secret, debounce, short cache on /places, a daily counter, scheduled vs real-time distinction.

03

Acceptance testing

Replay on your real stations, Transilien vs TGV, testing the 5,000 cut-off, testing HTTPS (the FAQ still mixes HTTP).

04

Monitoring

Alert at 80% of quota, 401, latency. You know a widget is dead before the field calls back.

The API

What the SNCF API allows

Station autocomplete
Search from a string. This is the call that burns the quota if you forget debounce. A short cache is mandatory.
Next departures and arrivals
The « next train » widget of a field tool. A cache of a few tens of seconds, not a refresh on every pixel.
Train journey planning
Station to station or city to city, window D-1 / D / D+23. Inner-Paris connections: approximate durations.
Timetables
Scheduled line times. Useful for a works council; not enough for Transilien real time, which does not exist here.
Glossary

The vocabulary of the SNCF API

Navitia
The engine (Hove / Kisio) behind api.sncf.com. Generic docs live on doc.navitia.io: every example URL must be rewritten to api.sncf.com, or auth breaks.
Developer token
Sign-up on numerique.sncf.com. HTTP Basic, username = token, empty password, or the token in the URL. Without it, 401 no token.
5,000 / day
Free quota per reuser. Official example: 5,000 requests in 12 hours, blocked 12 hours. Autocomplete without debounce is a quota suicide.
Scheduled Transilien
TGV, Intercités, TER, Lyria, Eurostar: scheduled + real time. Transilien: scheduled only. Showing « real time » on Transilien is false.
PRIM
Île-de-France Mobilités, prim.iledefrance-mobilites.fr. A second Navitia, Mobilité licence, its own quota. A Paris door-to-door trip is not an SNCF call.
D-1 / D / D+23
Documented time window. You do not build a six-month history on this API. For nationwide scheduled offer, GTFS from transport.data.gouv.fr holds volume better.
Good to know

The real constraints of the SNCF API

01

5,000 calls, then cut-off until midnight

This is not a polite 429: access is blocked for the rest of the day. Architecture: cache, proxy, an application token, a counter, a circuit breaker before the SNCF block.

02

No metro, no bus

SNCF trains only. The query api ratp points to PRIM or transport.data.gouv.fr, not to api.sncf.com. A France MaaS is not an SNCF connector.

03

Two Navitia in Île-de-France

api.sncf.com (trains) and PRIM (IDFM network). SNCF inner-Paris connections are approximate durations. We do not sell a Paris door-to-door on the SNCF API.

04

The token has no place in the browser

Quota per reuser, guaranteed leak, volume explosion. Server calls, HTTPS (the FAQ still mixes HTTP), accepted terms.

SNCF or PRIM

SNCF API or PRIM Île-de-France Mobilités?

Two Navitia, two licences, two quotas. The right choice depends on the network, not on the train logo.

CriterionSNCF APISNCF trainsPRIM IDFMÎle-de-France
Hostapi.sncf.com/v1prim.iledefrance-mobilites.fr
NetworkTGV, TER, Intercités, Lyria, EurostarIDFM network, including metro / RER
Transilien / RATPScheduled Transilien, no metroÎle-de-France passenger coverage
Free quota5,000 / day, then cut-offPRIM account, its own quota
LicenceSNCF termsMobilité licence
WindowD-1 / D / D+23Depends on the PRIM offer
The right caseFrance train travelÎle-de-France door-to-door

For nationwide scheduled offer, we also ingest GTFS from transport.data.gouv.fr and keep SNCF Navitia for train real time. That is a scoping call.

Our expertise

What we measure on an SNCF integration

15 d
first next-train widget in production
5,000
daily ceiling our counter respects
80%
alert threshold before the SNCF cut-off
4
senior developers on the project

We combine SNCF with

The stack around train times on our projects.

  • Node.js
  • Redis
  • PostgreSQL
  • n8n
  • TypeScript
FAQ

SNCF integration: your questions

Request a developer token on numerique.sncf.com, call it with HTTP Basic (username = token, empty password) on https://api.sncf.com/v1, never from the browser. Debounce and a short cache on /places, a cache of a few tens of seconds on departures, a daily counter toward 5,000 with an alert at 80% and an application circuit breaker. Distinguish scheduled and real time, mark Transilien as scheduled. If the need is multimodal France, ingest GTFS from transport.data.gouv.fr; if it is Île-de-France door-to-door, switch to PRIM.

Yes, within 5,000 requests a day per reuser. Beyond that, access is cut for the rest of the day (official example: 5,000 in 12 hours, blocked 12 hours). A premium plan exists on quote. 99.8% of responses are claimed under 3 seconds. Free is not unlimited: a widget on a high-traffic home page is not a 5,000/day case. We size the quota at scoping: user count, debounce, cache, and a premium plan if needed.

No. SNCF trains only. No RATP metro, no buses, no coaches. In Île-de-France, the official passenger planner is PRIM Île-de-France Mobilités. Offer data (GTFS, NeTEx) and many local real-time APIs go through transport.data.gouv.fr. A « all France transport » product is not an api.sncf.com connector. An « all France transport » product combines GTFS, PRIM and SNCF; it is not a single Navitia client.

Access is blocked until the end of the day, not merely slowed. Hence an application counter, an alert at 80%, a circuit breaker before the SNCF block, and a fallback UX (last cached timetable, a « times not refreshed » message). Without that, the service vanishes at 2 p.m. on a busy Tuesday, and nobody understands why. The fallback UX (last cached timetable, an honest message) is specified at scoping, not on the day the quota trips.

Free access is enough for a well-scoped internal autocomplete. The cost is the connector: secret, cache, counter, scheduled flag, optionally PRIM or GTFS on top. A next-train widget on a field tool is a short job. A high-traffic works-council planner, or a France MaaS, is another project, with a premium plan or other sources. We scope the volume and give a firm estimate before we start. Debounce and a daily counter are in the first delivery, not a later patch.

An SNCF integration project?

Let's talk. 30 minutes to scope the need, check whether it is SNCF, PRIM or GTFS, and tell you frankly what is feasible.

Discuss my SNCF & transport project
Discuss my SNCF & transport project