BYTETOOLS

ViaggiaTreno (Italy) API

Free Italian railway API with no key: search stations, look up live train status, delays and platform information across the Trenitalia network. Tested example included.

No API key requiredFree tier

Endpoint tested and returned HTTP 200 on 2026-08-21

What is the ViaggiaTreno (Italy) API?

ViaggiaTreno is the public JSON interface behind Italy's national rail information service. It requires no key and covers station search, live departure and arrival boards, train status with current delay, and the stop-by-stop progress of any service on the network.

This is the operator's own endpoint — the one viaggiatreno.it uses to render its pages — rather than a third-party scrape, which makes it as current as the official site. It has never been formally documented for external use, so the conventions have been worked out by the community, and they are idiosyncratic in ways that are worth knowing before you start.

The station identifiers are the first hurdle: they look like `S08409` and you get them from `cercaStazione/{prefix}`, which does a prefix search on the name. The second is that the live status endpoints want a departure-station code and an origin timestamp in milliseconds alongside the train number, because the same number runs daily and Trenitalia identifies a specific run by where and when it started. The third is that this host is plain HTTP with no TLS, so the response cannot be trusted for anything security-sensitive and browsers on HTTPS pages will block it as mixed content.

Quick facts

Base URL
http://www.viaggiatreno.it/infomobilita/resteasy/viaggiatreno
Authentication
No key or account. It is Trenitalia's own public endpoint, undocumented for third-party use and offered without any stability guarantee.
Rate limit
No published quota. It is a production service for the operator's website, so keep request volumes modest.
Pricing
Free.
CORS
Not enabled — call it from your server
Official docs
Read the docs

How to use the ViaggiaTreno (Italy) API

Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.

1. Search Italian stations by name prefix

GET http://www.viaggiatreno.it/infomobilita/resteasy/viaggiatreno/cercaStazione/ROMA

curl
curl 'http://www.viaggiatreno.it/infomobilita/resteasy/viaggiatreno/cercaStazione/ROMA'
JavaScript (fetch)
const res = await fetch("http://www.viaggiatreno.it/infomobilita/resteasy/viaggiatreno/cercaStazione/ROMA");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("http://www.viaggiatreno.it/infomobilita/resteasy/viaggiatreno/cercaStazione/ROMA", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200 (truncated)
[
  {
    "nomeLungo": "ROMA TERMINI",
    "nomeBreve": "ROMA TERMINI",
    "label": "Roma",
    "id": "S08409"
  },
  {
    "nomeLungo": "ROMA ANAGNINA",
    "nomeBreve": "Roma Anagnina",
    "label": "Roma",
    "id": "S08050"
  },
  {
    "nomeLungo": "ROMA AURELIA",
    "nomeBreve": "Roma Aurelia",
    "label": "Roma",
    "id": "S08025"
  },
  {
    "nomeLungo": "ROMA BALDUINA",
    "nomeBreve": "Roma Balduina",
    "label": "Roma",
    "id": "S08327"
  },
  {
    "nomeLungo": "ROMA CASILINA",
    "nomeBreve": "ROMA CASILINA",
    "label": "Roma",
    "id": "S08674"
  },
  {
    "nomeLungo": "ROMA MONTE MARIO",
    "nomeBreve": "Roma Monte Mario",
    "label": "Roma",
    "id": "S08322"
  },
  {
    "nomeLungo": "ROMA NOMENTANA LL",
    "nomeBreve": "Roma Nom. L.L.",
    "label": "Roma",
    "id": "S08236"
  },
  {
    "nomeLungo": "ROMA NOMENTANA LM",
    "nomeBreve": "Roma Noment. LM",
    "label": "Roma",
    "id": "S08232"
  },
  {
    "nomeLungo": "ROMA OSTIENSE",
    "nomeBreve": "ROMA OSTIENSE",
    "label": "Roma",
    "id": "S08406"
  },
  {
    "nomeLungo": "ROMA PRENESTINA",
    "nomeBreve": "ROMA PRENESTINA",
    "label": "Roma",
    "id": "S08500"
  },
  {
    "nomeLungo": "ROMA S.FILIPPO NERI",
    "nomeBreve": "Rm S.Filippo N.",
    "label": "Rm",
    "id": "S08325"
  },
  {
    "nomeLungo": "ROMA S.PIETRO",
    "nomeBreve": "ROMA S.PIETRO",
    "label": "Roma",
    "id": "S08323"
  },
  {
    "nomeLungo": "ROMA TIBURTINA",
    "nomeBreve": "ROMA TIBURTINA",
    "label": "Roma",
    "id": "S08217"
  },
  {
    "nomeLungo": "ROMA TRASTEVERE",
    "nomeBre

Parameters

ParameterTypeRequiredDescription
cercaStazionepathRequired`/cercaStazione/{prefix}` searches station names by prefix and returns their codes. ROMA
andamentoTrenopathOptional`/andamentoTreno/{stationCode}/{trainNumber}/{originTimestampMs}` returns a train's live progress. S08409/9600/1787299200000
partenzepathOptional`/partenze/{stationCode}/{datetime}` returns the departure board for a station. S08409
arrivipathOptional`/arrivi/{stationCode}/{datetime}` returns the arrival board. S08409
cercaNumeroTrenopathOptional`/cercaNumeroTreno/{number}` resolves a train number to its origin station and timestamp. 9600

Response fields

nomeLungostring
Full station name in upper case, for example "ROMA TERMINI".
nomeBrevestring
Short display name, mixed case — usually the better field for a user interface.
labelstring
Grouping label, typically the city, which is what the station belongs to rather than its own name.
idstring
Station code in the form `S08409`. This is the identifier every other endpoint requires.
(andamentoTreno) ritardointeger
Current delay in minutes. Negative means running early.
(andamentoTreno) fermatearray
Stop-by-stop progress with scheduled and actual times and platform assignments.
(partenze) compNumeroTreno, destinazione, binarioProgrammatoPartenzaDescrizionestring
Train number, destination and scheduled departure platform on a departure board.

What you can build with the ViaggiaTreno (Italy) API

  • Build a departure board for an Italian station
  • Track a Trenitalia service and its current delay
  • Alert a passenger to a platform change before departure
  • Search Italian station names and resolve them to codes
  • Analyse punctuality on a route by sampling train status over time

Common errors and how to fix them

Empty response body with HTTP 200

The station code or train number does not exist, or the required timestamp is missing.

Fix: ViaggiaTreno signals failure by returning nothing rather than an error object. Treat an empty body as a not-found.

Mixed content blocked in the browser

The host is plain HTTP with no TLS.

Fix: Proxy through your own HTTPS server. A browser on a secure page will refuse the request outright.

Train status needs three parameters

The same number runs every day, so a run is identified by number plus origin station plus origin timestamp.

Fix: Call `cercaNumeroTreno/{number}` first — it returns the origin code and timestamp you need for `andamentoTreno`.

Station search returns unrelated cities

`cercaStazione` matches on prefix across the whole network.

Fix: Search the full city name rather than two letters, and read the `label` field to check which city a result belongs to.

ViaggiaTreno (Italy) API — frequently asked questions

Is the ViaggiaTreno API free?

Yes, free with no key or account. It is Trenitalia's own public endpoint, used by its website, but it has never been formally documented for third-party use and carries no stability guarantee.

How do I find a station code?

Use `cercaStazione/{prefix}` with the start of the station name. It returns matching stations with codes in the form `S08409`, which every other endpoint requires.

Why does a train lookup need a timestamp?

Because train numbers repeat daily. Trenitalia identifies a specific run by its number, its origin station and the millisecond timestamp of that origin departure, which `cercaNumeroTreno` will give you.

Is it available over HTTPS?

No. The host serves plain HTTP only, so browsers on secure pages block it as mixed content and the response cannot be authenticated. Route it through your own HTTPS proxy.

Tools that pair with this API

ViaggiaTreno (Italy) is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.