TransCAPI Rail API

The Rail API from TransCAPI — 7 operation(s) for rail.

Operations 7

GET /v1/rail/fares.json Rail fares between two stations #
GET /v1/rail/railcards.json Railcards that rail fares can be priced with #
GET /v1/rail/routes.json Find rail routes by operator #
GET /v1/rail/routes/{route_id}.json A rail operator's services for a day #
GET /v1/rail/services/{trip_id}.json One train - every station it calls at, and when #
GET /v1/rail/station_timetables/{crs_code}.json Departures and arrivals for a rail station, with live running from National Rail #
GET /v1/rail/stations.json Find rail stations near a location or within a bounding box #

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/transcapi:transcapi-rail-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

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

transcapi-rail-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  contact:
    url: https://www.transcapi.com
  description: 'Public transport data for Great Britain (England, Scotland and Wales): stops and places, bus and rail departures and arrivals with live running, routes and services, live bus positions, disruptions and journey planning. Every departure says in `source` whether its time is live or timetabled. Data is official open data; attribution requirements are at https://www.transcapi.com/docs/data-sources.'
  termsOfService: https://www.transcapi.com/terms
  title: TransC Rail API
  version: 1.0.0
servers:
- description: Production
  url: https://api.transcapi.com
security:
- ApiKeyHeader: []
- ApiKeyQuery: []
tags:
- name: Rail
paths:
  /v1/rail/fares.json:
    get:
      description: 'Walk-up and Advance fares for one adult between two stations in Great Britain, from the Rail Delivery Group''s fares data: Anytime, Off-Peak, Super Off-Peak and Advance singles and returns, with the route each is valid on, its time restriction and validity. Advance fares are given as a range (`price` from the cheapest tier, `price_to` the dearest): the data has the prices but not how many seats are left at each. With `railcard`, prices are the railcard price and tickets the railcard can''t be used with are left out.'
      parameters:
      - description: Origin station CRS code
        e.g. SHF: null
        in: query
        name: from
        required: true
        schema:
          type: string
      - description: Destination station CRS code
        e.g. LDS: null
        in: query
        name: to
        required: true
        schema:
          type: string
      - description: Railcard code from /v1/rail/railcards.json, e.g. YNG for the 16-25 Railcard
        in: query
        name: railcard
        schema:
          type: string
      - in: query
        name: class
        schema:
          default: all
          enum:
          - standard
          - first
          - all
          type: string
      - in: query
        name: include_seasons
        schema:
          default: false
          type: boolean
      responses:
        '200':
          description: Fares
        '404':
          description: A station isn't in the fares data
      summary: Rail fares between two stations
      tags:
      - Rail
      operationId: getV1RailFaresJson
      x-operation-id-source: derived
  /v1/rail/railcards.json:
    get:
      responses:
        '200':
          description: Railcards
      summary: Railcards that rail fares can be priced with
      tags:
      - Rail
      operationId: getV1RailRailcardsJson
      x-operation-id-source: derived
  /v1/rail/routes.json:
    get:
      description: The rail schedule is built from the Network Rail CIF feed, which groups services by operator rather than by named line - so a rail route is one train operating company, and its `operator` field names it. Use /v1/rail/services/{trip_id}.json for an individual train.
      parameters:
      - description: Operator name or 2-letter ATOC code, e.g. "Northern" or "NT"
        in: query
        name: q
        schema:
          type: string
      - in: query
        name: operator
        schema:
          type: string
      - description: Only operators calling at this station
        in: query
        name: crs_code
        schema:
          type: string
      - in: query
        name: limit
        schema:
          default: 20
          type: integer
      - in: query
        name: page
        schema:
          default: 1
          type: integer
      responses:
        '200':
          description: List of routes
        '400':
          description: No search criterion given
      summary: Find rail routes by operator
      tags:
      - Rail
      operationId: getV1RailRoutesJson
      x-operation-id-source: derived
  /v1/rail/routes/{route_id}.json:
    get:
      description: Because a rail route is a whole operator, `timetable` here is every train that operator runs on the date - thousands for the largest ones - so it is paged, and `representative_stops` is one journey's calling points rather than anything resembling a line.
      parameters:
      - description: 2-letter ATOC code, e.g. NT for Northern
        in: path
        name: route_id
        required: true
        schema:
          type: string
      - description: Service date (default today, UK local)
        in: query
        name: date
        schema:
          format: date
          type: string
      - in: query
        name: limit
        schema:
          default: 50
          type: integer
      - in: query
        name: page
        schema:
          default: 1
          type: integer
      responses:
        '200':
          description: Route detail
        '404':
          description: Route not found
      summary: A rail operator's services for a day
      tags:
      - Rail
      operationId: getV1RailRoutes{routeId}Json
      x-operation-id-source: derived
  /v1/rail/services/{trip_id}.json:
    get:
      description: 'Answers "where does the 09:42 to Leeds stop?" for a single train. `trip_id` comes from the `trip_id` field of a station timetable or a route''s timetable. For a train running today, each call carries live running from National Rail''s Darwin: expected and actual times, status, and the platform at the next station.'
      parameters:
      - in: path
        name: trip_id
        required: true
        schema:
          type: string
      - description: Service date the times are for (default today, UK local)
        in: query
        name: date
        schema:
          format: date
          type: string
      - description: Merge live running from Darwin, for a train running today.
        in: query
        name: live
        schema:
          default: true
          type: boolean
      responses:
        '200':
          description: Service detail
        '404':
          description: Service not found
      summary: One train - every station it calls at, and when
      tags:
      - Rail
      operationId: getV1RailServices{tripId}Json
      x-operation-id-source: derived
  /v1/rail/station_timetables/{crs_code}.json:
    get:
      parameters:
      - description: 3-letter station CRS code, e.g. LDS for Leeds
        in: path
        name: crs_code
        required: true
        schema:
          type: string
      - description: ISO 8601 datetime to plan around (default now)
        in: query
        name: datetime
        schema:
          format: date-time
          type: string
      - description: Minutes from `datetime` to start the departure window
        in: query
        name: from_offset
        schema:
          default: 0
          type: integer
      - description: Minutes from `datetime` to end the departure window
        in: query
        name: to_offset
        schema:
          default: 60
          type: integer
      - in: query
        name: limit
        schema:
          default: 20
          type: integer
      - description: 'Which board to return. `arrivals` lists services by the time they reach this station, including those terminating here, which a departure board can never show.

          '
        in: query
        name: type
        schema:
          default: departures
          enum:
          - departures
          - arrivals
          - both
          type: string
      - description: 'Merge live running from National Rail''s Darwin: expected times, platforms, cancellations and delay reasons. Applies within two hours either side of now; further out the board is scheduled.

          '
        in: query
        name: live
        schema:
          default: true
          type: boolean
      responses:
        '200':
          description: Station timetable
        '404':
          description: Station not found
      summary: Departures and arrivals for a rail station, with live running from National Rail
      tags:
      - Rail
      operationId: getV1RailStationTimetables{crsCode}Json
      x-operation-id-source: derived
  /v1/rail/stations.json:
    get:
      parameters:
      - in: query
        name: lat
        schema:
          type: number
      - in: query
        name: lon
        schema:
          type: number
      - description: Search radius in metres (used with lat/lon)
        in: query
        name: radius
        schema:
          default: 5000
          type: integer
      - in: query
        name: min_lat
        schema:
          type: number
      - in: query
        name: min_lon
        schema:
          type: number
      - in: query
        name: max_lat
        schema:
          type: number
      - in: query
        name: max_lon
        schema:
          type: number
      - in: query
        name: limit
        schema:
          default: 20
          type: integer
      - in: query
        name: page
        schema:
          default: 1
          type: integer
      responses:
        '200':
          description: List of rail stations
      summary: Find rail stations near a location or within a bounding box
      tags:
      - Rail
      operationId: getV1RailStationsJson
      x-operation-id-source: derived
components:
  securitySchemes:
    ApiKeyHeader:
      in: header
      name: X-Api-Key
      type: apiKey
    ApiKeyQuery:
      in: query
      name: api_key
      type: apiKey