ws-dottie
Version:
Your friendly TypeScript companion for Washington State transportation APIs - WSDOT and WSF data with smart caching and React Query integration
406 lines • 15.2 kB
JSON
{
"openapi": "3.0.0",
"info": {
"title": "Wsdot Traffic Flow API",
"version": "1.0.0",
"description": "Wsdot Traffic Flow API - Washington State Department of Transportation APIs"
},
"servers": [
{
"url": "https://www.wsdot.wa.gov/traffic/api/trafficflow/trafficflowrest.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."
},
"FetchTrafficFlowByIdOutput": {
"type": "object",
"properties": {
"FlowDataID": {
"type": "number",
"description": "Numeric ID of the traffic flow station."
},
"FlowReadingValue": {
"anyOf": [
{
"type": "number",
"enum": [
0
]
},
{
"type": "number",
"enum": [
1
]
},
{
"type": "number",
"enum": [
2
]
},
{
"type": "number",
"enum": [
3
]
},
{
"type": "number",
"enum": [
4
]
},
{
"type": "number",
"enum": [
5
]
}
],
"description": "Code indicating traffic flow condition: 0 = Unknown, 1 = WideOpen, 2 = Moderate, 3 = Heavy, 4 = StopAndGo, 5 = NoData."
},
"FlowStationLocation": {
"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 information for the traffic flow station."
},
"Region": {
"type": "string",
"nullable": true,
"description": "WSDOT region that maintains the traffic flow station."
},
"StationName": {
"type": "string",
"nullable": true,
"description": "Station identifier code combining route, direction, and milepost."
},
"Time": {
"type": "string",
"description": "UTC datetime when the traffic flow reading was taken.",
"format": "date-time"
}
},
"required": [
"FlowDataID",
"FlowReadingValue",
"FlowStationLocation",
"Region",
"StationName",
"Time"
],
"description": "Real-time traffic flow data from a sensor station, including flow condition, location, region, and measurement timestamp."
}
},
"parameters": {}
},
"paths": {
"/getTrafficFlowsAsJson": {
"get": {
"summary": "List current traffic flow conditions for all stations statewide.",
"operationId": "fetchTrafficFlows",
"tags": [
"flow-data"
],
"x-codeSamples": [
{
"lang": "JavaScript",
"source": "import { fetchTrafficFlows } from 'ws-dottie/wsdot-traffic-flow/core';\n\nconst data = await fetchTrafficFlows({\n fetchMode: 'native',\n validate: true\n});\n\nconsole.log(data);"
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"FlowDataID": {
"type": "number",
"description": "Numeric ID of the traffic flow station."
},
"FlowReadingValue": {
"anyOf": [
{
"type": "number",
"enum": [
0
]
},
{
"type": "number",
"enum": [
1
]
},
{
"type": "number",
"enum": [
2
]
},
{
"type": "number",
"enum": [
3
]
},
{
"type": "number",
"enum": [
4
]
},
{
"type": "number",
"enum": [
5
]
}
],
"description": "Code indicating traffic flow condition: 0 = Unknown, 1 = WideOpen, 2 = Moderate, 3 = Heavy, 4 = StopAndGo, 5 = NoData."
},
"FlowStationLocation": {
"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 information for the traffic flow station."
},
"Region": {
"type": "string",
"nullable": true,
"description": "WSDOT region that maintains the traffic flow station."
},
"StationName": {
"type": "string",
"nullable": true,
"description": "Station identifier code combining route, direction, and milepost."
},
"Time": {
"type": "string",
"description": "UTC datetime when the traffic flow reading was taken.",
"format": "date-time"
}
},
"required": [
"FlowDataID",
"FlowReadingValue",
"FlowStationLocation",
"Region",
"StationName",
"Time"
],
"description": "Real-time traffic flow data from a sensor station, including flow condition, location, region, and measurement timestamp."
}
},
"examples": {
"sampleResponse": {
"summary": "Sample response",
"description": "Example of a successful response from the API (showing first item of 1462 total)",
"value": [
{
"FlowDataID": 2482,
"FlowReadingValue": 1,
"FlowStationLocation": {
"Description": "Homeacres Rd",
"Direction": "EB",
"Latitude": 47.978415632,
"Longitude": -122.174701738,
"MilePost": 0.68,
"RoadName": "002"
},
"Region": "Northwest",
"StationName": "002es00068",
"Time": "2025-11-15T17:43:22.000Z"
}
]
}
}
}
}
}
}
}
},
"/getTrafficFlowAsJson?FlowDataID={FlowDataID}": {
"get": {
"summary": "Get current traffic flow condition for a specific station by ID.",
"operationId": "fetchTrafficFlowById",
"tags": [
"flow-data"
],
"x-codeSamples": [
{
"lang": "JavaScript",
"source": "import { fetchTrafficFlowById } from 'ws-dottie/wsdot-traffic-flow/core';\n\nconst data = await fetchTrafficFlowById({\n params: {\n \"FlowDataID\": 2482\n },\n fetchMode: 'native',\n validate: true\n});\n\nconsole.log(data);"
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FetchTrafficFlowByIdOutput"
},
"examples": {
"sampleResponse": {
"summary": "Sample response",
"description": "Example of a successful response from the API",
"value": {
"FlowDataID": 2482,
"FlowReadingValue": 1,
"FlowStationLocation": {
"Description": "Homeacres Rd",
"Direction": "EB",
"Latitude": 47.978415632,
"Longitude": -122.174701738,
"MilePost": 0.68,
"RoadName": "002"
},
"Region": "Northwest",
"StationName": "002es00068",
"Time": "2025-11-15T17:43:22.000Z"
}
}
}
}
}
}
}
}
}
},
"tags": [
{
"name": "flow-data",
"description": "Real-time traffic flow conditions from sensor stations across Washington state.",
"x-description": "Current traffic flow readings, station locations, and timestamps for traffic monitoring and congestion detection.",
"x-cacheStrategy": "FREQUENT",
"x-useCases": [
"Monitor real-time traffic flow conditions across Washington highways.",
"Detect congestion and traffic patterns for route planning.",
"Display current traffic status in traveler information systems."
],
"x-updateFrequency": "90s"
}
]
}