openapi: 3.0.0
info:
  title: Wsdot Travel Times API
  version: 1.0.0
  description: Wsdot Travel Times API - Washington State Department of Transportation APIs
servers:
  - url: https://www.wsdot.wa.gov/traffic/api/traveltimes/traveltimesrest.svc
    description: Production server
components:
  schemas:
    RoadwayLocation:
      type: object
      properties:
        Description:
          type: string
          nullable: true
          description: Human-readable description of the roadway location, such as interchange names or cross streets.
        Direction:
          type: string
          nullable: true
          description: 'Traffic direction designation: N, S, B, NB, or SB, indicating which side of the highway is affected.'
        Latitude:
          type: number
          description: Latitude of the roadway location in decimal degrees.
        Longitude:
          type: number
          description: Longitude of the roadway location in decimal degrees.
        MilePost:
          type: number
          description: Milepost marker along the highway corridor, with 0 indicating route terminus.
        RoadName:
          type: string
          nullable: true
          description: Highway or route designation code, such as '005' for I-5 or '090' for I-90.
      required:
        - Description
        - Direction
        - Latitude
        - Longitude
        - MilePost
        - RoadName
      description: Roadway location information including route, milepost, coordinates, and direction.
    FetchTravelTimeByIdOutput:
      type: object
      properties:
        AverageTime:
          type: number
          description: Average travel time to complete the route in minutes based on historical data.
        CurrentTime:
          type: number
          description: Current estimated travel time to complete the route in minutes based on real-time conditions.
        Description:
          type: string
          nullable: true
          description: Human-readable description of the travel time route.
        Distance:
          type: number
          description: Total route distance from start to end point in miles.
        EndPoint:
          type: object
          nullable: true
          properties:
            Description:
              type: string
              nullable: true
              description: Human-readable description of the roadway location, such as interchange names or cross streets.
            Direction:
              type: string
              nullable: true
              description: 'Traffic direction designation: N, S, B, NB, or SB, indicating which side of the highway is affected.'
            Latitude:
              type: number
              description: Latitude of the roadway location in decimal degrees.
            Longitude:
              type: number
              description: Longitude of the roadway location in decimal degrees.
            MilePost:
              type: number
              description: Milepost marker along the highway corridor, with 0 indicating route terminus.
            RoadName:
              type: string
              nullable: true
              description: Highway or route designation code, such as '005' for I-5 or '090' for I-90.
          required:
            - Description
            - Direction
            - Latitude
            - Longitude
            - MilePost
            - RoadName
          description: Roadway location where the travel time route ends.
        Name:
          type: string
          nullable: true
          description: Display name of the travel time route.
        StartPoint:
          type: object
          nullable: true
          properties:
            Description:
              type: string
              nullable: true
              description: Human-readable description of the roadway location, such as interchange names or cross streets.
            Direction:
              type: string
              nullable: true
              description: 'Traffic direction designation: N, S, B, NB, or SB, indicating which side of the highway is affected.'
            Latitude:
              type: number
              description: Latitude of the roadway location in decimal degrees.
            Longitude:
              type: number
              description: Longitude of the roadway location in decimal degrees.
            MilePost:
              type: number
              description: Milepost marker along the highway corridor, with 0 indicating route terminus.
            RoadName:
              type: string
              nullable: true
              description: Highway or route designation code, such as '005' for I-5 or '090' for I-90.
          required:
            - Description
            - Direction
            - Latitude
            - Longitude
            - MilePost
            - RoadName
          description: Roadway location where the travel time route begins.
        TimeUpdated:
          type: string
          description: UTC datetime when the travel time data was last updated.
          format: date-time
        TravelTimeID:
          type: number
          description: Numeric ID of the travel time route.
      required:
        - AverageTime
        - CurrentTime
        - Description
        - Distance
        - EndPoint
        - Name
        - StartPoint
        - TimeUpdated
        - TravelTimeID
      description: Travel time route information including current and average travel times, route distance, start/end point locations, and update timestamp.
  parameters: {}
paths:
  /getTravelTimesAsJson:
    get:
      summary: List travel time data for all available routes.
      operationId: fetchTravelTimes
      tags:
        - travel-time-routes
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import { fetchTravelTimes } from 'ws-dottie/wsdot-travel-times/core';

            const data = await fetchTravelTimes({
              fetchMode: 'native',
              validate: true
            });

            console.log(data);
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    AverageTime:
                      type: number
                      description: Average travel time to complete the route in minutes based on historical data.
                    CurrentTime:
                      type: number
                      description: Current estimated travel time to complete the route in minutes based on real-time conditions.
                    Description:
                      type: string
                      nullable: true
                      description: Human-readable description of the travel time route.
                    Distance:
                      type: number
                      description: Total route distance from start to end point in miles.
                    EndPoint:
                      type: object
                      nullable: true
                      properties:
                        Description:
                          type: string
                          nullable: true
                          description: Human-readable description of the roadway location, such as interchange names or cross streets.
                        Direction:
                          type: string
                          nullable: true
                          description: 'Traffic direction designation: N, S, B, NB, or SB, indicating which side of the highway is affected.'
                        Latitude:
                          type: number
                          description: Latitude of the roadway location in decimal degrees.
                        Longitude:
                          type: number
                          description: Longitude of the roadway location in decimal degrees.
                        MilePost:
                          type: number
                          description: Milepost marker along the highway corridor, with 0 indicating route terminus.
                        RoadName:
                          type: string
                          nullable: true
                          description: Highway or route designation code, such as '005' for I-5 or '090' for I-90.
                      required:
                        - Description
                        - Direction
                        - Latitude
                        - Longitude
                        - MilePost
                        - RoadName
                      description: Roadway location where the travel time route ends.
                    Name:
                      type: string
                      nullable: true
                      description: Display name of the travel time route.
                    StartPoint:
                      type: object
                      nullable: true
                      properties:
                        Description:
                          type: string
                          nullable: true
                          description: Human-readable description of the roadway location, such as interchange names or cross streets.
                        Direction:
                          type: string
                          nullable: true
                          description: 'Traffic direction designation: N, S, B, NB, or SB, indicating which side of the highway is affected.'
                        Latitude:
                          type: number
                          description: Latitude of the roadway location in decimal degrees.
                        Longitude:
                          type: number
                          description: Longitude of the roadway location in decimal degrees.
                        MilePost:
                          type: number
                          description: Milepost marker along the highway corridor, with 0 indicating route terminus.
                        RoadName:
                          type: string
                          nullable: true
                          description: Highway or route designation code, such as '005' for I-5 or '090' for I-90.
                      required:
                        - Description
                        - Direction
                        - Latitude
                        - Longitude
                        - MilePost
                        - RoadName
                      description: Roadway location where the travel time route begins.
                    TimeUpdated:
                      type: string
                      description: UTC datetime when the travel time data was last updated.
                      format: date-time
                    TravelTimeID:
                      type: number
                      description: Numeric ID of the travel time route.
                  required:
                    - AverageTime
                    - CurrentTime
                    - Description
                    - Distance
                    - EndPoint
                    - Name
                    - StartPoint
                    - TimeUpdated
                    - TravelTimeID
                  description: Travel time route information including current and average travel times, route distance, start/end point locations, and update timestamp.
              examples:
                sampleResponse:
                  summary: Sample response
                  description: Example of a successful response from the API (showing first item of 163 total)
                  value:
                    - AverageTime: 26
                      CurrentTime: 26
                      Description: Everett to Downtown Seattle using HOV lanes
                      Distance: 26.72
                      EndPoint:
                        Description: I-5 @ University St in Seattle
                        Direction: S
                        Latitude: 47.609294
                        Longitude: -122.331759
                        MilePost: 165.83
                        RoadName: '005'
                      Name: Everett-Seattle HOV
                      StartPoint:
                        Description: I-5 @ 41st St in Everett
                        Direction: S
                        Latitude: 47.964146
                        Longitude: -122.199237
                        MilePost: 192.55
                        RoadName: '005'
                      TimeUpdated: '2025-11-15T17:40:00.000Z'
                      TravelTimeID: 2
  /getTravelTimeAsJson?TravelTimeID={TravelTimeID}:
    get:
      summary: Get travel time data for a specific route by ID.
      operationId: fetchTravelTimeById
      tags:
        - travel-time-routes
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import { fetchTravelTimeById } from 'ws-dottie/wsdot-travel-times/core';

            const data = await fetchTravelTimeById({
              params: {
                "TravelTimeID": 1
              },
              fetchMode: 'native',
              validate: true
            });

            console.log(data);
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FetchTravelTimeByIdOutput'
              examples:
                sampleResponse:
                  summary: Sample response
                  description: Example of a successful response from the API
                  value:
                    AverageTime: 27
                    CurrentTime: 26
                    Description: Everett to Downtown Seattle
                    Distance: 26.72
                    EndPoint:
                      Description: I-5 @ University St in Seattle
                      Direction: S
                      Latitude: 47.609294
                      Longitude: -122.331759
                      MilePost: 165.83
                      RoadName: '005'
                    Name: Everett-Seattle
                    StartPoint:
                      Description: I-5 @ 41st St in Everett
                      Direction: S
                      Latitude: 47.964146
                      Longitude: -122.199237
                      MilePost: 192.55
                      RoadName: '005'
                    TimeUpdated: '2025-11-15T17:40:00.000Z'
                    TravelTimeID: 1
tags:
  - name: travel-time-routes
    description: Current and average travel times for major Washington State highway routes.
    x-description: Travel time data for routes in Seattle, Tacoma, and Snoqualmie Pass areas, including distance, start/end points, and comparison of current vs. average times.
    x-cacheStrategy: STATIC
    x-useCases:
      - Plan travel routes and estimate arrival times.
      - Compare current conditions against historical averages to identify delays.
      - Optimize departure times based on real-time traffic conditions.
    x-updateFrequency: 5m
