Traffic API
POST Traffic Incidents
The Traffic Incidents request returns a structured list of traffic incidents for a specified bounding box in JSON or XML formats, e.g., road construction, traffic collisions.
Resource URL
Resource Information
Response Formats | JSON, XML |
Authentication | Yes (Requires Key) |
Rate Limited | Yes |
Request Parameters
Request Parameter | Description | Required |
---|---|---|
key | The API Key, which is needed to make requests to MapQuest services. | yes |
inFormat | Specifies the format of the request. If this parameter is not supplied, the input format is assumed to be JSON-formatted text.
inFormat=xml | no, defaults to json |
outFormat | Specifies the format of the response. Must be one of the following, if supplied:
outFormat=xml | no, defaults to json |
callback | A JavaScript function name. The JSON-formatted response will be wrapped in a call to the supplied callback function name to provide JSONP functionality. This functionality might be needed to do cross-site scripting. See the Wikipedia.org entry for JSON for more details. Example: Callback callback=incidentsResult | no |
Body Parameters
Request Parameter | Description | Required |
---|---|---|
boundingBox | The area in which to search for incidents. Example: boundingBox=39.95,-105.25,39.52,-104.71 | yes |
filters | A list of incident types to return. Possible values are:
filters=incidents,congestion | no, defaults to incidents,construction |
Response Object
lat | Latitude of the incident. |
lng | Longitude of the incident. |
type | Incident type. Values are:
|
severity | The incident severity. Values range from 0-4 with 4 indicating the highest severity. |
eventCode | The incident event code. These are standard Alert-C event codes. |
impacting | Indicates if the incident is impacting traffic. |
startTime | The start time (ISO 8601 Combined Date and Time format) of the incident. |
endTime | The end time (ISO 8601 Combined Date and Time format) of the incident. |
shortDesc | A short description of the incident. |
fullDesc | A full description of the incident. |
iconURL | URL for an icon to use for displaying the incident. |
distance | Optional (0 if not sent from traffic provider). The length of the road extent (in miles) affected by the incident. |
delayFromTypical | Optional (0 if not sent from traffic provider). The delay (minutes) from typical conditions. This is the increase in travel time across the road extent affected by the incident relative to the travel time under average conditions for the given day of the week and time. |
delayFromFreeFlow | Optional (0 if not sent from traffic provider). The delay (minutes) from typical conditions. This is the increase in travel time across the road extent affected by the incident relative to the travel time under free-flowing conditions. |
tmcs | Optional. List of Traffic Message Channel ids located at the incident. |
Example Request
POST https://www.mapquestapi.com/traffic/v2/incidents?key=KEY&inFormat=json&outFormat=json
Example Request Body
JSON
{
"boundingBox": {
"ul": {
"lat": 39.950960,
"lng": -105.259451
},
"lr": {
"lat": 39.528562,
"lng": -104.710135
}
},
"filters": [
"construction",
"incidents"
]
}
XML
<traffic>
<boundingBox>
<ul>
<latLng>
<lat>39.950960</lat>
<lng>-105.259451</lng>
</latLng>
</ul>
<lr>
<latLng>
<lat>39.528562</lat>
<lng>-104.710135</lng>
</latLng>
</lr>
</boundingBox>
<filters>
<filter>construction,incidents</filter>
</filters>
</traffic>
Example Response
JSON
{
"incidents": [
{
"fullDesc": "One lane closed due to maintenance work on California Street Eastbound between 18th Street and 19th Street.",
"lng": -104.9886,
"severity": 2,
"shortDesc": "California Street E/B : Lane closed between 18th Street and 19th Street ",
"endTime": "2013-08-02T01:59:00",
"type": 1,
"id": "330627538",
"startTime": "2013-02-04T19:00:00",
"impacting": true,
"tmcs": [],
"eventCode": 0,
"iconURL": "https://api.mqcdn.com/mqtraffic/const_mod.png",
"lat": 39.7481
}
],
"mqURL": "https://www.mapquest.com/maps?traffic=1&latitude=39.73976&longitude=-104.9848",
"info": {
"copyright": {
"text": "2023 MapQuest, Inc.",
"imageUrl": "https://api.mqcdn.com/res/mqlogo.gif",
"imageAltText": "2023 MapQuest, Inc."
},
"statuscode": 0,
"messages": []
}
}
XML
<IncidentsResponse>
<Incidents>
<Incident>
<id>5376488</id>
<type>4</type>
<severity>2</severity>
<eventCode>401</eventCode>
<lat>39.7505</lat>
<lng>-105.216789</lng>
<startTime>2016-12-04T07:30:00</startTime>
<endTime>2016-12-05T00:31:00</endTime>
<shortDesc>
Washington Ave: road closed from 10th St to 18th St
</shortDesc>
<fullDesc>
Road closed on Washington Ave both ways from 10th St to 18th St. Golden Candle Light Walk.
</fullDesc>
<delayFromTypical>0.0</delayFromTypical>
<delayFromFreeFlow>0.18000000715255737</delayFromFreeFlow>
<distance>1.2</distance>
<iconURL>https://api.mqcdn.com/mqtraffic/incid_mod.png</iconURL>
</Incident>
</Incidents>
<info>
<statusCode>0</statusCode>
<messages/>
<copyright>
<imageUrl>https://api.mqcdn.com/res/mqlogo.gif</imageUrl>
<imageAltText>© 2023 MapQuest, Inc.</imageAltText>
<text>© 2023 MapQuest, Inc.</text>
</copyright>
</info>
</IncidentsResponse>