TransportAPI Bus Information API

Real-time and scheduled bus departure and arrival data

OpenAPI Specification

transportapi-bus-information-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Transport Bus Information API
  description: TransportAPI is a managed data service provider for UK public transport, offering real-time and scheduled bus, rail, and multimodal transport data. The API provides journey planning, departure boards, performance analytics, and places lookup across Great Britain.
  version: v3.0.0
  contact:
    name: TransportAPI Support
    url: https://www.transportapi.com/contact/
  x-logo:
    url: https://www.transportapi.com/logo.png
servers:
- url: https://transportapi.com/v3/uk
  description: TransportAPI UK Production Server
security:
- AppIdAuth: []
tags:
- name: Bus Information
  description: Real-time and scheduled bus departure and arrival data
paths:
  /bus/stop/{atcocode}/live.json:
    get:
      operationId: getBusStopLiveDepartures
      summary: Get Bus Stop Live Departures
      description: Returns real-time departure information for buses at a specific stop, identified by its ATCO code.
      tags:
      - Bus Information
      parameters:
      - name: atcocode
        in: path
        required: true
        schema:
          type: string
        description: The ATCO code of the bus stop
      - name: group
        in: query
        required: false
        schema:
          type: string
          enum:
          - route
          - 'no'
          default: route
        description: How to group departures in the response
      - name: nextbuses
        in: query
        required: false
        schema:
          type: string
          enum:
          - 'yes'
          - 'no'
          default: 'yes'
        description: Whether to include real-time next bus predictions
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 5
        description: Maximum number of departures to return
      - name: app_id
        in: query
        required: false
        schema:
          type: string
        description: Application ID for authentication
      - name: app_key
        in: query
        required: false
        schema:
          type: string
        description: Application key for authentication
      responses:
        '200':
          description: Successful response with live bus departures
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BusLiveDeparturesResponse'
        '401':
          description: Unauthorized - invalid credentials
        '404':
          description: Bus stop not found
  /bus/stop/{atcocode}/timetable.json:
    get:
      operationId: getBusStopTimetable
      summary: Get Bus Stop Timetable
      description: Returns scheduled timetable for buses at a specific stop.
      tags:
      - Bus Information
      parameters:
      - name: atcocode
        in: path
        required: true
        schema:
          type: string
        description: The ATCO code of the bus stop
      - name: date
        in: query
        required: false
        schema:
          type: string
          format: date
        description: Date for timetable (YYYY-MM-DD, defaults to today)
      - name: app_id
        in: query
        required: false
        schema:
          type: string
      - name: app_key
        in: query
        required: false
        schema:
          type: string
      responses:
        '200':
          description: Successful response with bus timetable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BusTimetableResponse'
        '401':
          description: Unauthorized - invalid credentials
  /bus/route/{operator}/{line}/{direction}/{atcocode}/{date}/timetable.json:
    get:
      operationId: getBusRouteTimetable
      summary: Get Bus Route Timetable
      description: Returns the complete timetable for a specific bus route, including all stops and scheduled times.
      tags:
      - Bus Information
      parameters:
      - name: operator
        in: path
        required: true
        schema:
          type: string
        description: Bus operator code
      - name: line
        in: path
        required: true
        schema:
          type: string
        description: Bus line/route number
      - name: direction
        in: path
        required: true
        schema:
          type: string
          enum:
          - inbound
          - outbound
        description: Direction of travel
      - name: atcocode
        in: path
        required: true
        schema:
          type: string
        description: Starting stop ATCO code
      - name: date
        in: path
        required: true
        schema:
          type: string
          format: date
        description: Date for timetable (YYYY-MM-DD)
      - name: app_id
        in: query
        required: false
        schema:
          type: string
      - name: app_key
        in: query
        required: false
        schema:
          type: string
      responses:
        '200':
          description: Successful response with route timetable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BusRouteTimetableResponse'
components:
  schemas:
    BusLiveDeparturesResponse:
      type: object
      properties:
        atcocode:
          type: string
        bearing:
          type: string
        stop_name:
          type: string
        request_time:
          type: string
          format: date-time
        departures:
          type: object
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/BusDeparture'
    BusRouteTimetableResponse:
      type: object
      properties:
        operator:
          type: string
        line:
          type: string
        direction:
          type: string
        stops:
          type: array
          items:
            $ref: '#/components/schemas/TimetableStop'
    BusTimetableResponse:
      type: object
      properties:
        atcocode:
          type: string
        stop_name:
          type: string
        request_time:
          type: string
          format: date-time
        departures:
          type: array
          items:
            $ref: '#/components/schemas/BusDeparture'
    TimetableStop:
      type: object
      properties:
        atcocode:
          type: string
        name:
          type: string
        times:
          type: array
          items:
            type: string
    BusDeparture:
      type: object
      properties:
        mode:
          type: string
        line:
          type: string
        line_name:
          type: string
        direction:
          type: string
        operator:
          type: string
        operator_name:
          type: string
        date:
          type: string
        expected_departure_date:
          type: string
        aimed_departure_time:
          type: string
        expected_departure_time:
          type: string
        status:
          type: object
          properties:
            live:
              type: boolean
            delay:
              type: string
  securitySchemes:
    AppIdAuth:
      type: apiKey
      in: header
      name: X-App-Id
      description: Application ID header
    AppKeyAuth:
      type: apiKey
      in: header
      name: X-App-Key
      description: Application key header