Discover/Lefrecce API
live

Lefrecce APIlefrecce.it ↗

Search live Trenitalia rail journeys and resolve station IDs via the lefrecce.it API. Get fares, departure times, changes, and train legs.

Endpoint health
verified 3h ago
search_stations
search_journeys
2/2 passing latest checkself-healing
Endpoints
2
Updated
4h ago

What is the Lefrecce API?

The lefrecce.it API provides 2 endpoints for querying Trenitalia's Italian rail network: use search_stations to resolve any city or station name to a numeric station ID, then pass that ID to search_journeys to retrieve live journey solutions — including departure and arrival times, duration, number of changes, individual train legs, and total fare for your passenger mix.

This call costs2 credits / call— charged only on success
Try it
Station name text to match, e.g. a city name or the start of a station name (one shape: 'Fiumicino').
→ api.parse.bot/scraper/def03973-366f-419a-a789-db6a0d1eca1b/<endpoint>
Ready to send
Fill in the parameters and hit sign in to send to see live response data here.
Call it over HTTPgrab a free API key at signup
curl -X GET 'https://api.parse.bot/scraper/def03973-366f-419a-a789-db6a0d1eca1b/search_stations?name=Firenze+S' \
  -H 'X-API-Key: $PARSE_API_KEY'
Python SDK · recommended

Typed, relational, agent-ready

A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.

  • Fully typed · autocompletes
  • Objects link to objects
  • Typed errors & pagination

Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:

uv add parse-sdk
uv run parse init
uv run parse add --marketplace lefrecce-it-api

uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.

"""Walkthrough: Trenitalia journey search — find stations, then search trains."""
from parse_apis.lefrecce_it_api import LeFrecceit, InputFormatInvalid

client = LeFrecceit()

# Find the origin station by name
origin = client.stations.search(name="Firenze", limit=5).first()
if origin is not None:
    print(f"Origin: {origin.name} (id={origin.station_id}, tz={origin.timezone})")

    # Find the destination station by name
    dest = client.stations.search(name="Roma", limit=5).first()
    if dest is not None:
        print(f"Destination: {dest.name} (id={dest.station_id})")

        # Search journeys between the two stations
        try:
            for journey in origin.search_journeys(
                destination_station_id=dest.station_id,
                date="2026-12-01",
                time="08:00",
                adults=2,
                limit=3,
            ):
                print(f"\n{journey.origin} → {journey.destination}")
                print(f"  Departs: {journey.departure_time}  Arrives: {journey.arrival_time}")
                print(f"  Duration: {journey.duration}, Changes: {journey.changes}")
                if journey.total_price is not None:
                    print(f"  Price: {journey.total_price.amount} {journey.total_price.currency}")
                for leg in journey.legs:
                    print(f"    {leg.origin} → {leg.destination} ({leg.train_category} {leg.train_number})")
        except InputFormatInvalid as e:
            print(f"Invalid input: {e.message}")

print("exercised: stations.search / search_journeys")
All endpoints · 2 totalmissing one? ·

Looks up Trenitalia stations whose name starts with or contains the given text, exactly as the site's station autocomplete does. Returns up to 10 matching stations with the numeric station_id that search_journeys accepts as origin_station_id / destination_station_id. One round trip; an empty stations array means the site found no match for that text.

Input
ParamTypeDescription
namerequiredstringStation name text to match, e.g. a city name or the start of a station name (one shape: 'Fiumicino').
Response
{
  "type": "object",
  "fields": {
    "query": "the name text that was searched",
    "stations": "array of matching stations: station_id (string, numeric id used by search_journeys), name, display_name, timezone (IANA), multistation (true when the id groups several stations)"
  },
  "sample": {
    "data": {
      "query": "Firenze S",
      "stations": [
        {
          "name": "Firenze S. M. Novella",
          "timezone": "Europe/Rome",
          "station_id": "830006421",
          "display_name": "Firenze S. M. Novella",
          "multistation": false
        },
        {
          "name": "Firenze S. Marco Vecchio",
          "timezone": "Europe/Rome",
          "station_id": "830006950",
          "display_name": "Firenze S. Marco Vecchio",
          "multistation": false
        }
      ]
    },
    "status": "success"
  }
}

About the Lefrecce API

Station Lookup

The search_stations endpoint accepts a partial or full station name string (e.g. "Roma" or "Fiumicino") and returns up to 10 matching stations. Each result includes a numeric station_id (the identifier search_journeys requires), a name, a display_name, and an IANA timezone. This mirrors the autocomplete behaviour on the booking site, so any query a user could type into the origin or destination field will resolve here.

Journey Search

The search_journeys endpoint takes origin_station_id and destination_station_id (both from search_stations), a travel date (ISO YYYY-MM-DD), and an optional earliest time (HH:MM, 24-hour Italian local time). Results are ordered by departure time and include ISO 8601 departure_time and arrival_time with UTC offset, a duration string, a solution_id, and an array of train legs. The total_price field covers the combined fare for the requested number of adults and children; at least one passenger must be specified.

Pagination and Filtering

Pagination is offset-based: supply offset and limit (capped at 50) to step through results. The has_more boolean indicates whether another page exists at offset + limit. Setting no_changes to true filters to direct services only — but if the route has no direct trains the response returns an empty journey array (the messages field may carry a site notice explaining why). The search_date and search_time fields in the response echo back the parameters you sent, which helps when managing concurrent requests.

Data Freshness and Coverage

Results come from Trenitalia's live availability feed, so fares and seat availability reflect real-time inventory at the moment of the request. The API covers domestic Italian Trenitalia services accessible through the lefrecce.it booking channel, including Frecciarossa, Frecciargento, Frecciabianca, and Intercity services.

Reliability & maintenanceVerified

The Lefrecce API is a managed, monitored endpoint for lefrecce.it — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when lefrecce.it changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.

This isn't an official lefrecce.it API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.

Last verified
3h ago
Latest check
2/2 endpoints passing
Maintenance
Monitored & self-healing
Will this API break when the source site changes?+
It's built not to. Every endpoint is health-checked on a schedule with automated test probes. When the source site changes and a check fails, the API is automatically queued for repair and re-verified — that's the self-healing layer. Each API page shows when its endpoints were last verified. And because marketplace APIs are shared, any fix reaches everyone using it.
Is this an official API from the source site?+
No — Parse APIs are independent, managed REST wrappers over publicly available data. That is the point: where a site has no official API (or only a limited one), Parse gives you a maintained, monitored endpoint for that data and keeps it working as the site changes — so you get a stable contract over a source that never promised one.
Can I fix or extend this API myself if I need a new endpoint or field?+
Yes — and you don't have to wait on us. This API was generated by the Parse agent, which stays attached. Describe the change in plain English ("add an endpoint that returns reviews", "fix the price field") in the revise box on the API page or via the revise_api MCP tool, and the agent rebuilds it against the live site in minutes. Contributing the change back to the public API is free.
What happens if I call an endpoint that has an issue?+
Errors are machine-readable: a bad call returns a clean status with the list of available endpoints and a repair hint, so an agent (or you) can recover or trigger a fix instead of failing silently. Confirmed failures feed the automatic repair queue.
Common use cases
  • Build a fare-comparison tool that checks total_price across multiple departure times for a given adult/child passenger count
  • Power a journey planner widget that resolves typed station names to station_ids and returns real-time schedules
  • Monitor ticket price changes on a specific route by polling search_journeys at regular intervals
  • Filter to direct trains only using no_changes=true to serve travellers who want single-leg trips
  • Paginate through a full day's departures using offset + limit to aggregate all available journey options
  • Feed arrival_time and departure_time data into a trip-itinerary builder that chains multiple rail legs
  • Alert users when new journey solutions appear on a given date by diffing solution_ids across polls
Pricing & limitsSee full pricing →
TierPriceCredits/monthRate limit
Free$0/mo2005 req/min
Hobby$30/mo1,00020 req/min
Developer$100/mo5,000100 req/min
Team$300/mo20,000300 req/min
Company$1,000/mo100,000500 req/min

Each endpoint has a fixed posted price per successful call — most fall between 1 and 10 credits — shown on this API's page before you run it. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.

Frequently asked questions
Does Trenitalia provide an official public developer API?+
Trenitalia does not publish an official public REST API for third-party developers. The lefrecce.it API on Parse is the structured way to access this journey and station data programmatically.
What does search_journeys return for each journey solution?+
Each entry in the journeys array includes a solution_id, origin, destination, departure_time and arrival_time (ISO 8601 with UTC offset), a duration string, the number of changes, an array of individual train legs, and a total_price that covers all passengers specified via adults and children.
Does the API return return tickets or only outbound journeys?+
The API currently returns one-way journey solutions for a single travel date. It covers search_journeys in one direction between an origin and destination. You can fork the API on Parse and revise it to add a return-journey search that runs both directions in one call.
How does pagination work, and how do I know if there are more results?+
Use the offset and limit parameters to page through results. limit is capped at 50. The response includes a has_more boolean: when true, at least one more page exists and you can fetch it by setting offset to your current offset + limit.
Does the API cover regional or Italo trains, or only Trenitalia Freccе and Intercity services?+
The API covers Trenitalia services available through the lefrecce.it booking channel — primarily Frecciarossa, Frecciargento, Frecciabianca, and Intercity trains. Italo (NTV) services and regional trains not sold through lefrecce.it are not included. You can fork the API on Parse and revise it to add an endpoint targeting a different booking source.
Page content last updated . Spec covers 2 endpoints from lefrecce.it.
Related APIs in TravelSee all →