Incident Details
Important note
This is the new and improved version (5) of the Incident Details endpoint. We highly recommend that you use this new version 5 rather than the old version 4, which we marked as deprecated.
Purpose
The Incident Details service provides information on traffic incidents which are inside a given bounding box or whose geometry intersects with it. The freshness of data is based on the provided Traffic Model ID (t
). The data obtained from this service can be used as standalone or as an extension to other Traffic Incident services.
In the second case, the same Traffic Model ID should be used when calling all services in order to grant synchronization of data between APIs. Apart from present incident data, it is possible to get information about planned future incidents.
Run this endpoint
You can easily run this and other endpoints. Go to the TomTom API Explorer page and follow the directions.
Request data
HTTPS method: GET
- Constants and parameters enclosed in curly brackets { } must be replaced with their values.
- Please see the following Request parameters section with tables of required and optional parameters and their values. The generic request format is as follows.
URL format
https://{baseURL}/traffic/services/{versionNumber}/incidentDetails?key={Your_Api_Key}&bbox={bbox}&fields={fields}&language={language}&t={t}&categoryFilter={categoryFilter}&timeValidityFilter={timeValidityFilter}
https://{baseURL}/traffic/services/{versionNumber}/incidentDetails?key={Your_Api_Key}&ids={ids}&fields={fields}&language={language}&t={t}&categoryFilter={categoryFilter}&timeValidityFilter={timeValidityFilter}
Example
https://api.tomtom.com/traffic/services/5/incidentDetails?key={Your_Api_Key}&bbox=4.8854592519716675,52.36934334773164,4.897883244144765,52.37496348620152&fields={incidents{type,geometry{type,coordinates},properties{iconCategory}}}&language=en-GB&t=1111&timeValidityFilter=present
https://api.tomtom.com/traffic/services/5/incidentDetails?key={Your_Api_Key}&ids=4819f7d0a15db3d9b0c3cd9203be7ba5&fields={incidents{type,geometry{type,coordinates},properties{iconCategory}}}&language=en-GB&t=1111&timeValidityFilter=present
curl command format
curl 'https://api.tomtom.com/traffic/services/5/incidentDetails?key={Your_Api_Key}&bbox=4.8854592519716675,52.36934334773164,4.897883244144765,52.37496348620152&fields={incidents{type,geometry{type,coordinates},properties{iconCategory}}}&language=en-GB&t=1111&timeValidityFilter=present'
curl 'https://api.tomtom.com/traffic/services/5/incidentDetails?key={Your_Api_Key}&ids=4819f7d0a15db3d9b0c3cd9203be7ba5&fields={incidents{type,geometry{type,coordinates},properties{iconCategory}}}&language=en-GB&t=1111&timeValidityFilter=present'
Example with category filter
https://api.tomtom.com/traffic/services/5/incidentDetails?key={Your_Api_Key}&bbox=4.8854592519716675,52.36934334773164,4.897883244144765,52.37496348620152&fields={incidents{type,geometry{type,coordinates},properties{iconCategory}}}&language=en-GB&t=1111&categoryFilter=Accident&timeValidityFilter=present
curl command with category filter
curl 'https://api.tomtom.com/traffic/services/5/incidentDetails?key={Your_Api_Key}&bbox=4.8854592519716675,52.36934334773164,4.897883244144765,52.37496348620152&fields={incidents{type,geometry{type,coordinates},properties{iconCategory}}}&language=en-GB&t=1111&categoryFilter=Accident&timeValidityFilter=present'
HTTPS method POST
- Constants and parameters enclosed in curly brackets { } must be replaced with their values.
- The maximum number of incidents IDs in a single
POST
request is 100. - Please see the following Request parameters section with the tables of required and optional parameters and their values. The generic request format is as follows.
URL format
https://{baseURL}/traffic/services/{versionNumber}/incidentDetails?key={Your_Api_Key}&fields={fields}&language={language}&t={t}&categoryFilter={categoryFilter}&timeValidityFilter={timeValidityFilter}
Example
https://api.tomtom.com/traffic/services/5/incidentDetails?key={Your_Api_Key}&fields={incidents{type,geometry{type,coordinates},properties{iconCategory}}}&language=en-GB&t=1111&timeValidityFilter=present
curl command format
1curl -X POST 'https://api.tomtom.com/traffic/services/5/incidentDetails?key={Your_Api_Key}&fields={incidents{type,geometry{type,coordinates},properties{iconCategory}}}&language=en-GB&t=1111&timeValidityFilter=present -d '{2 "ids": [3 "4819f7d0a15db3d9b0c3cd9203be7ba5"4 ]5}'
Request parameters
The following table describes all of the parameters that can be used in a request.
- Parameters and values are case-sensitive.
- Required parameters must be used or the call will fail.
- Optional parameters may be used.
Required parameters | Description |
---|---|
| The base URL for calling the API.
|
| The service version number. |
| The corners of the area to report on, expressed in the EPSG:4326 projection. These are two longitude-latitude pairs describing the corners of the bounding box. The first pair is for the lower-left corner and the second pair for the upper-right corner. All values should be separated by a comma. The maximum area of a bounding box is 10,000 km 2.
Values: |
| Comma separated list of incidents IDs. The maximum number of incidents
IDs is 5 for
Note: Incidents IDs are available from the result of a previous query with the 'bbox' parameter. |
| The authorization key for access to the API. |
Optional parameters | Description |
---|---|
| The fields to be included in the response, nested as in the response
schema. In order to obtain all data, it is necessary to place the whole
object in the query. get Default value
get Value with all available fields
|
| The language code for the output language. Affects the
|
| The Traffic Model ID is the reference value for the state of traffic at
a particular time. It is updated every minute, and is valid for two
minutes before it times out. See the
HTTP response headers section and
Traffic Model ID page for more
information. |
| This filter allows the choice of types of incidents and future incidents
to be included in the response. Filtering takes into account the main
icon category of the incident. Both value types can be used: numeric and
descriptive strings. Multiple values are supported and should be
separated by a comma.
|
| This filter allows the choice of incidents based on their occurrence in
time. Multiple values are supported and they should be separated by a
comma.
|
POST request body
Follow the request body schema in order to prepare a valid POST
request.
Request schema
An exclamation mark !
means that the field is not nullable. For example:
String!
- is non-nullable[String!]
- list of non-null objects[String]!
- list cannot be null, but it can contain null values
1{2 ids: [String!]!3}
Request headers
The following table lists HTTP request headers of particular interest to clients of the Traffic API Incident Details endpoint. Note: There are no required headers in this endpoint.
Optional headers | Description |
---|---|
Contains the content encoding (usually a compression algorithm), that
the client is able to understand.
It is strongly recommended using this header in order to limit
bandwidth usage. | |
Tracking-ID | Specifies an identifier for the request. It can be used to trace a call.
The value must match the regular expression
|
Response data
Successful response
For a single request, the Traffic API Incident Details endpoint returns its response body in JSON format. The fields that appear in the JSON response depend on the value of the fields
request parameter.
Response schema
The exclamation mark !
means that a particular field cannot be equal to null
, for example:
Point!
- value cannot be equal to null[Point!]
- array of non-null objects[Point]!
- array cannot be null, but it can contain null values
Notice: The definition of type Query
varies from the request method (and from the query parameter used in the GET
request). For the GET
method with the bbox
query parameter, the mentioned type is defined as follows.
1type Query {2 incidents : [Incident!]!3}
In the response for the GET
method with the ids
query parameter or POST
, the non-existing incidents for specific incident IDs will be present as null
. In that case, Query
type is defined as follows.
1type Query {2 incidents : [Incident]!3}
The rest of the scheme is the same for each variant.
Common part of response scheme
1type Incident {2 type: GeojsonFeatureType!3 geometry : GeojsonGeometry!4 properties: IncidentProperties!5}
1type IncidentProperties {2 id : String!3 iconCategory : Int!4 magnitudeOfDelay : Int!5 events : [Event!]!6 startTime : String7 endTime : String8 from : String9 to : String10 length : Float!11 delay : Int12 roadNumbers : [String!]!13 timeValidity : TimeValidity!14 probabilityOfOccurrence : ProbabilityOfOccurrence!15 numberOfReports : Int16 lastReportTime : String17 tmc : Tmc18 aci : Aci19}2021type Event {22 description : String!23 code : Int!24 iconCategory : Int!25}2627union GeojsonGeometry = GeojsonPoint | GeojsonLinestring2829type GeojsonPoint {30 type : GeojsonPointType!31 coordinates : [Float!]!32}3334type GeojsonLinestring {35 type : GeojsonLinestringType!36 coordinates : [[Float!]!]!37}3839enum GeojsonLinestringType {40 LineString41}4243enum GeojsonPointType {44 Point45}4647enum GeojsonFeatureType {48 Feature49}5051type Aci {52 probabilityOfOccurrence : ProbabilityOfOccurrence!53 numberOfReports : Int!54 lastReportTime : String!55}5657enum ProbabilityOfOccurrence {58 certain59 probable60 risk_of61 improbable62}6364type Tmc {65 countryCode: String!66 tableNumber: String!67 tableVersion: String!68 direction: Direction!69 points [TmcPoint!]!70}7172enum Direction {73 positive74 negative75}7677type TmcPoint {78 location : Int!79 offset: Int80}8182enum TimeValidity {83 present84 future85}
Response field structure
The following table describes JSON element fields that can appear in a response.
Structure of the root object
Field | Description |
---|---|
| Incidents which belong or intersect with the given bounding box. |
Structure of the Incident object
Field | Description |
---|---|
| The value is set as |
| A
GeoJSON
feature of type |
| The properties of a particular incident. |
Structure of the IncidentProperties object
Field | Description |
---|---|
| The ID of the traffic incident, common among Traffic Incident API services where it is available. |
| The main icon category associated with this incident. This is an icon
category associated with the first event in the
|
| The magnitude of delay associated with an incident. The values meaning:
|
| The list of events describing the details of the incident in the
language requested. Traffic incident can be described with more than one
|
| Start time of the incident, if available. The date is described in the ISO8601 format. |
| End time of the incident, if available. The date is described in the ISO8601 format. |
| The name of the location where the traffic due to the incident starts. |
| The name of the location where the traffic due to the incident ends. |
| The length of the incident in meters. |
| The delay in seconds caused by the incident (except road closures). It is calculated against free-flow travel time (the travel time when the traffic is minimal, e.g., night traffic). |
| The road number(s) affected by the incident. |
| Enumeration string describing if the incident occurrence is now or in the future. |
| TMC (Traffic Message Channel) data of the traffic incident, needed to determine its location. |
| Enumeration string specifying the likelihood of the occurring incident.
|
| The number of reports given by actual end-users. |
| The date in ISO8601 format, when the last time the incident was reported. Gives the user confidence that the incident is fresh. |
| The Community Attributes (ACI). |
Structure of the Event object
Field | Description |
---|---|
| The description of the event (being part of incident) in the requested language. |
| The predefined alert code, describing the event (part of incident). |
| The icon category associated with the event. The icon category from the
first |
Structure of the ACI object
Field | Description |
---|---|
| Enumeration string specifying the likelihood of the occurring incident.
|
| The number of reports given by actual end-users. |
| The date in ISO8601 format, when the last time the incident was reported. Gives the user confidence that the incident is fresh. |
1{2 "incidents": [3 {4 "type": "Feature",5 "properties": {6 "iconCategory": 87 },8 "geometry": {9 "type": "LineString",10 "coordinates": [11 [4.8905266414, 52.3725919469],12 [4.8905306647, 52.372535656],13 [4.8905360291, 52.3724806443],14 [4.8905387113, 52.3724028603],15 [4.8905440757, 52.3723505607],16 [4.8905467579, 52.3722754886],17 [4.8905574868, 52.3721722195],18 [4.8905762622, 52.3719066767],19 [4.8905963788, 52.371663905],20 [4.8905936966, 52.371524454],21 [4.8905749211, 52.3714278871],22 [4.8905440757, 52.3713393544],23 [4.8905065248, 52.3712669418],24 [4.8904555628, 52.3711703743],25 [4.8904166708, 52.3711100387],26 [4.8903268168, 52.3709759593],27 [4.8901725898, 52.370765372],28 [4.8900062928, 52.370581651],29 [4.8899472842, 52.3705320104]30 ]31 }32 }33 ]34}
1{2 "incidents" : [3 {4 "type" : "Feature",5 "properties" : {6 "id":"4819f7d0a15db3d9b0c3cd9203be7ba5",7 "iconCategory" : 8,8 "magnitudeOfDelay" : 4,9 "startTime" : "2021-02-02T15:37:00Z",10 "endTime" : "2021-04-30T22:00:00Z",11 "from" : "Paleisstraat",12 "to" : "Rosmarijnsteeg",13 "length" : 238.553,14 "delay" : 0,15 "roadNumbers" : [],16 "timeValidity" : "present",17 "events" : [18 {19 "code" : 401,20 "description" : "Closed",21 "iconCategory" : 822 }23 ],24 "aci" : null,25 "tmc" : null26 "probabilityOfOccurrence" : "certain",27 "numberOfReports" : "null",28 "lastReportTime" : "null29 },30 "geometry" : {31 "type" : "LineString",32 "coordinates" : [[4.8905266414,52.3725919469],[4.8905306647,52.3725356560],[4.8905360291,52.3724806443],[4.8905387113,52.3724028603],[4.8905440757,52.3723505607],[4.8905467579,52.3722754886],[4.8905574868,52.3721722195],[4.8905762622,52.3719066767],[4.8905963788,52.3716639050],[4.8905936966,52.3715244540],[4.8905749211,52.3714278871],[4.8905440757,52.3713393544],[4.8905065248,52.3712669418],[4.8904555628,52.3711703743],[4.8904166708,52.3711100387],[4.8903268168,52.3709759593],[4.8901725898,52.3707653720],[4.8900062928,52.3705816510],[4.8899472842,52.3705320104]]33 }34 }35 ]36}
Error response
If there is an error in the supplied parameters or any other internal problem, an error response is generated in the requested format. If the contentType
parameter could not be parsed, XML will be returned.
Error response field structure
Field | Description |
---|---|
| Main object of the error response. |
| One of a server-defined set of error codes. |
| A human-readable description of the error code. |
1{2 "detailedError ": {3 "code": "INVALID_REQUEST",4 "message": "Unknown field in fields=incidents.properties.last"5 }6}
HTTP response codes
Code | Meaning & possible causes |
---|---|
| OK |
| Bad request, usually due to a malformed syntax or incorrect format of the Traffic Model ID. |
| Forbidden: The supplied API Key is not valid for this request. |
| Method Not Allowed: The provided HTTP request method is known by the server, but is not supported by the target resource. |
| Too Many Requests: Too many requests were sent in a given amount of time for the supplied API Key. |
| Internal Server Error |
HTTP response headers
The following table lists HTTP response headers of particular interest to clients of the Traffic API Incident Details endpoint.
Header | Description |
---|---|
Indicates that cross-origin resource sharing (CORS) is allowed. | |
Lists the set of supported HTTP methods. The header is sent in case a
| |
Indicates which encodings were applied to the response body. | |
Contains information about the size of the response body. | |
Indicates the media type of the resource returned. | |
Contains the date and time when the message was originated. | |
TrafficModelID | Contains the reference value for the state of traffic at a particular
time. If the request contains a valid Traffic Model ID, its value is
replicated here. If the request does not contain a Traffic Model ID, or
it contains outdated data, then the most recent one is returned. |
Tracking-ID | An identifier for the request. If the Tracking-ID header was specified
in the request, it is replicated in the response. Otherwise, it is
generated automatically by the service. For details check
RFC 4122. It is only meant to be used for support and does not involve tracking
of you or your users in any form. |