Digitraffic (Fintraffic) Compositions API

Returns compositions of trains

GitHub OpenAPI

Operations 4

GET /api/v1/compositions Returns all compositions that are newer than {version} #
GET /api/v1/compositions/{departure_date} Returns all compositions for trains run on {departure_date} #
GET /api/v1/compositions/{departure_date}/{train_number} Returns composition for a specific train #
GET /api/v1/compositions/history/{departure_date}/{train_number} Returns all composition versions for given train. #

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-compositions-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-compositions-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: rata.digitraffic.fi Compositions 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: compositions
  description: Returns compositions of trains
paths:
  /api/v1/compositions:
    get:
      tags:
      - compositions
      summary: Returns all compositions that are newer than {version}
      operationId: getCompositionsByVersion
      parameters:
      - name: version
        in: query
        description: version
        required: false
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Composition'
        '400':
          description: Bad Request
        '500':
          description: Internal Server Error
          content: {}
  /api/v1/compositions/{departure_date}:
    get:
      tags:
      - compositions
      summary: Returns all compositions for trains run on {departure_date}
      operationId: getCompositionsByDepartureDate
      parameters:
      - name: departure_date
        in: path
        required: true
        schema:
          type: string
          format: date
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Composition'
        '400':
          description: Bad Request
        '500':
          description: Internal Server Error
          content: {}
  /api/v1/compositions/{departure_date}/{train_number}:
    get:
      tags:
      - compositions
      summary: Returns composition for a specific train
      operationId: getCompositionByTrainNumberAndDepartureDate
      parameters:
      - name: departure_date
        in: path
        required: true
        schema:
          type: string
          format: date
      - name: train_number
        in: path
        required: true
        schema:
          type: integer
          format: int64
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/Composition'
        '400':
          description: Bad Request
        '500':
          description: Internal Server Error
          content: {}
  /api/v1/compositions/history/{departure_date}/{train_number}:
    get:
      tags:
      - compositions
      summary: Returns all composition versions for given train.
      operationId: getCompositionHistory
      parameters:
      - name: departure_date
        in: path
        description: Departure date
        required: true
        schema:
          type: string
          format: date
      - name: train_number
        in: path
        description: Train number
        required: true
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/History'
        '400':
          description: Bad Request
        '500':
          description: Internal Server Error
          content: {}
components:
  schemas:
    Locomotive:
      title: Locomotive
      type: object
      properties:
        location:
          type: integer
          description: Location of the locomotive in the train. 1=start of the train
          format: int32
          example: 1
        locomotiveType:
          type: string
          example: Sm3
        powerType:
          type: string
          example: S
        vehicleNumber:
          type: string
          example: 94102081010-2
      description: List of locomotives used on this leg
    History:
      title: History
      required:
      - id
      - json
      - version
      type: object
      properties:
        version:
          type: integer
          description: History version number
          format: int32
        id:
          $ref: '#/components/schemas/Version'
        json:
          type: object
          description: Content
    Version:
      required:
      - departureDate
      - fetchDate
      - trainNumber
      type: object
      properties:
        trainNumber:
          type: integer
          description: Train number
          format: int32
        departureDate:
          type: string
          description: Departure date
          format: date
        fetchDate:
          type: string
          description: Date when this version was fetched
          format: date-time
      description: History train identifier
    Wagon:
      title: Wagon
      type: object
      properties:
        wagonType:
          type: string
          example: Ed
        location:
          type: integer
          format: int32
          example: 1
        salesNumber:
          type: integer
          description: Wagon number in customer's ticket
          format: int32
          example: 1
        length:
          type: integer
          description: Wagon length in centimeters
          format: int32
          example: 2640
        playground:
          type: boolean
        pet:
          type: boolean
        catering:
          type: boolean
        video:
          type: boolean
        luggage:
          type: boolean
        smoking:
          type: boolean
        disabled:
          type: boolean
        vehicleNumber:
          type: string
          example: 94102081010-2
      description: List of wagons used on this leg
    JourneySection:
      title: JourneySection
      type: object
      properties:
        beginTimeTableRow:
          $ref: '#/components/schemas/CompositionTimeTableRow'
        endTimeTableRow:
          $ref: '#/components/schemas/CompositionTimeTableRow'
        locomotives:
          uniqueItems: true
          type: array
          description: List of locomotives used on this leg
          items:
            $ref: '#/components/schemas/Locomotive'
        wagons:
          uniqueItems: true
          type: array
          description: List of wagons used on this leg
          items:
            $ref: '#/components/schemas/Wagon'
        totalLength:
          type: integer
          description: Total length of the train with an accuracy of 1 m
          format: int32
        maximumSpeed:
          type: integer
          description: Maximum with an accuracy of 1 km/h
          format: int32
      description: Describes a leg where train's composition is in effect
    CompositionTimeTableRow:
      title: CompositionTimeTableRow
      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
        scheduledTime:
          type: string
          format: date-time
      description: Describes a point in a trains schedule where its composition changes
    Composition:
      title: Composition
      required:
      - departureDate
      - trainCategory
      - trainNumber
      - trainType
      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
        trainCategory:
          type: string
          example: Long-distance
        trainType:
          type: string
          example: IC
        version:
          type: integer
          description: When was this data last modified
          format: int64
          example: 1728555686000
        journeySections:
          uniqueItems: true
          type: array
          items:
            $ref: '#/components/schemas/JourneySection'
      description: Describes train's locomotives and wagons