Digitraffic (Fintraffic) Live Trains API

Returns trains that have been recently active

GitHub OpenAPI

Operations 3

GET /api/v1/live-trains Returns active trains that are newer than {version} #
GET /api/v1/live-trains/station/{station} Returns trains that travel trough {station} #
GET /api/v1/live-trains/station/{departure_station}/{arrival_station} Return trains that run from {arrival_station} to {departure_station} #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/digitraffic-fi:digitraffic-fi-live-trains-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

digitraffic-fi-live-trains-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: rata.digitraffic.fi Live Trains API
  version: '1.0'
  description: 'OpenAPI document


    Digitraffic is a service operated by Fintraffic, offering real time traffic information. Currently the service covers *road, marine and rail* traffic. More information can be found at the Digitraffic website


    The service has a public Google-group rail.digitraffic.fi for communication between developers, service administrators and Fintraffic. The discussion in the forum is mostly in Finnish, but you''re welcome to communicate in English too.


    ### General notes of the API

    * Many Digitraffic APIs use the GeoJSON format. The definition of GeoJSON can be found at https://tools.ietf.org/html/rfc7946.

    * For dates and times, the ISO 8601 format is used with "Zulu" zero offset from UTC unless otherwise specified (i.e., "yyyy-mm-ddThh:mm:ss[.mmm]Z"). E.g. 2019-11-01T06:30:00Z.'
  termsOfService: https://www.digitraffic.fi/en/terms-of-service/
  contact:
    name: Digitraffic / Fintraffic
    url: https://www.digitraffic.fi/
  license:
    name: Creative Commons 4.0 BY
    url: https://creativecommons.org/licenses/by/4.0/
servers:
- url: https://rata.digitraffic.fi
tags:
- name: live-trains
  description: Returns trains that have been recently active
paths:
  /api/v1/live-trains:
    get:
      tags:
      - live-trains
      summary: Returns active trains that are newer than {version}
      operationId: getLiveTrainsByVersion
      parameters:
      - name: version
        in: query
        description: version
        required: false
        schema:
          type: integer
          format: int64
          default: 0
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Train'
        '400':
          description: Bad Request
        '500':
          description: Internal Server Error
          content: {}
  /api/v1/live-trains/station/{station}:
    get:
      tags:
      - live-trains
      summary: Returns trains that travel trough {station}
      operationId: getStationsTrains
      parameters:
      - name: station
        in: path
        description: station
        required: true
        schema:
          type: string
      - name: version
        in: query
        description: version
        required: false
        schema:
          type: integer
          format: int64
          default: 0
      - name: arrived_trains
        in: query
        description: arrived_trains
        required: false
        schema:
          type: integer
          format: int32
          default: 5
      - name: arriving_trains
        in: query
        description: arriving_trains
        required: false
        schema:
          type: integer
          format: int32
          default: 5
      - name: departed_trains
        in: query
        description: departed_trains
        required: false
        schema:
          type: integer
          format: int32
          default: 5
      - name: departing_trains
        in: query
        description: departing_trains
        required: false
        schema:
          type: integer
          format: int32
          default: 5
      - name: minutes_before_departure
        in: query
        description: Minutes before departure - all time limit parameters must be set for filtering to work
        required: false
        schema:
          type: integer
          format: int32
      - name: minutes_after_departure
        in: query
        description: Minutes after departure - all time limit parameters must be set for filtering to work
        required: false
        schema:
          type: integer
          format: int32
      - name: minutes_before_arrival
        in: query
        description: Minutes before arrival - all time limit parameters must be set for filtering to work
        required: false
        schema:
          type: integer
          format: int32
      - name: minutes_after_arrival
        in: query
        description: Minutes after arrival - all time limit parameters must be set for filtering to work
        required: false
        schema:
          type: integer
          format: int32
      - name: include_nonstopping
        in: query
        description: include_nonstopping
        required: false
        schema:
          type: boolean
          default: false
      - name: train_categories
        in: query
        description: train_categories
        required: false
        schema:
          type: array
          items:
            type: string
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Train'
        '400':
          description: Bad Request
        '500':
          description: Internal Server Error
          content: {}
  /api/v1/live-trains/station/{departure_station}/{arrival_station}:
    get:
      tags:
      - live-trains
      summary: Return trains that run from {arrival_station} to {departure_station}
      operationId: getTrainsFromDepartureToArrivalStation
      parameters:
      - name: departure_station
        in: path
        description: departure_station
        required: true
        schema:
          type: string
      - name: arrival_station
        in: path
        description: arrival_station
        required: true
        schema:
          type: string
      - name: departure_date
        in: query
        description: departure_date
        required: false
        schema:
          type: string
          format: date
      - name: include_nonstopping
        in: query
        description: include_nonstopping
        required: false
        schema:
          type: boolean
          default: false
      - name: startDate
        in: query
        description: startDate
        required: false
        schema:
          type: string
          format: date-time
      - name: endDate
        in: query
        description: endDate
        required: false
        schema:
          type: string
          format: date-time
      - name: limit
        in: query
        description: limit
        required: false
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Train'
        '400':
          description: Bad Request
        '500':
          description: Internal Server Error
          content: {}
components:
  schemas:
    TrainReady:
      title: TrainReady
      type: object
      properties:
        source:
          type: string
          description: How was the permission given
          enum:
          - PHONE
          - LIIKE
          - UNKNOWN
          - KUPLA
        accepted:
          type: boolean
          description: Was the permission given
        timestamp:
          type: string
          description: When was the permission given
          format: date-time
      description: Operator has to ask permission (=TrainReady) to leave certain stations
    Cause:
      title: Cause
      required:
      - categoryCode
      - categoryName
      - validFrom
      type: object
      properties:
        passengerTerm:
          $ref: '#/components/schemas/PassengerTerm'
        categoryCode:
          type: string
          description: Official code
          example: E
        categoryName:
          type: string
          description: Official name
          example: Etuajassakulku
        validFrom:
          type: string
          description: Start date when this category code is used
          format: date
        validTo:
          type: string
          description: End date when this code is used. Empty means category is used until further notice
          format: date
        id:
          type: integer
          format: int32
        detailedCategoryCode:
          type: string
          example: E2
        detailedCategoryName:
          type: string
          example: Ajo- tai pysähdysajan alitus
        thirdCategoryCode:
          type: string
          example: E103
        thirdCategoryName:
          type: string
          example: Valmistuminen etuajassa
        description:
          type: string
          description: Detailed description
          example: Jos kyseessä ei ole kääntyvä juna ja se on valmis lähtemään etuajassa. Esim. vaihtotöitä on selkeästi suunniteltua vähemmän.
        categoryCodeId:
          type: integer
          format: int32
        detailedCategoryCodeId:
          type: integer
          format: int32
        thirdCategoryCodeId:
          type: integer
          format: int32
      description: Details why a train is not on schedule. Train-responses only have ids and codes populated.
    Train:
      required:
      - departureDate
      - trainNumber
      type: object
      properties:
        trainNumber:
          type: integer
          description: Identifies the train inside a single departure date
          format: int64
          example: 1
        departureDate:
          type: string
          description: Date of the train's first departure
          format: date
          example: '2017-12-01'
        operatorUICCode:
          type: integer
          description: Official UIC code of the operator
          format: int32
          example: 10
        operatorShortCode:
          type: string
          description: Short code of the operator
          example: vr
        trainType:
          type: string
          example: IC
        trainCategory:
          type: string
          example: Long-distance
        commuterLineID:
          type: string
          example: Z
        runningCurrently:
          type: boolean
          description: Is the train running currently or does it have actual times
        cancelled:
          type: boolean
          description: Is the train wholly cancelled
        deleted:
          type: boolean
          description: Is the train deleted which means cancelled 10 days before its departure date
        version:
          type: integer
          description: When was train last modified
          format: int64
        timetableType:
          type: string
          description: Is the train ADHOC or REGULAR. REGULAR trains are run for example every monday, ADHOC trains are one-time trains
          enum:
          - REGULAR
          - ADHOC
        timetableAcceptanceDate:
          type: string
          description: When was this train accepted to run on Finnish railways by the FTA
          format: date-time
        timeTableRows:
          type: array
          items:
            $ref: '#/components/schemas/TimeTableRow'
    PassengerTerm:
      title: PassengerTerm
      type: object
      properties:
        fi:
          type: string
          description: Finnish passenger friendly term for the code
        en:
          type: string
          description: English passenger friendly term for the code
        sv:
          type: string
          description: Swedish passenger friendly term for the code
    TimeTableRow:
      title: TimeTableRow
      required:
      - scheduledTime
      - type
      type: object
      properties:
        stationShortCode:
          type: string
          example: HKI
        stationUICCode:
          type: integer
          format: int32
          example: 1
        countryCode:
          type: string
          example: FI
        type:
          type: string
          enum:
          - ARRIVAL
          - DEPARTURE
        trainStopping:
          type: boolean
          description: Does the train actual stop on the station
        commercialStop:
          type:
          - boolean
          - 'null'
          description: Is the stop 'commercial' ie. loading/unloading of passengers or cargo
        cancelled:
          type: boolean
          description: Is the schedule part cancelled
        scheduledTime:
          type: string
          description: Scheduled time for departure/arrival of the train
          format: date-time
        estimateSource:
          type: string
          description: Source for the estimate
          example: LIIKE_USER
          enum:
          - LIIKE_USER
          - MIKU_USER
          - LIIKE_AUTOMATIC
          - UNKNOWN
          - COMBOCALC
        unknownDelay:
          type:
          - boolean
          - 'null'
          description: Set if the train is delayed, but it is impossible to estimate for how long
        unknownTrack:
          type:
          - boolean
          - 'null'
          description: Set if the track is not known
        actualTime:
          type:
          - string
          - 'null'
          description: Actual time when train departured or arrived on the station
          format: date-time
        differenceInMinutes:
          type: integer
          description: Difference between schedule and actual time in minutes
          format: int64
          example: 5
        causes:
          uniqueItems: true
          type: array
          items:
            $ref: '#/components/schemas/Cause'
        stopSector:
          type:
          - string
          - 'null'
        commercialTrack:
          type: string
          description: Track where the train stops
          example: '1'
        liveEstimateTime:
          type: string
          description: Estimated time for departure/arrival of the train
          format: date-time
        trainReady:
          $ref: '#/components/schemas/TrainReady'
      description: A part of train's schedule