post
/api/v2/traffic/harsh-eventsPython SDK method:
client.traffic.harsh_events_per_segment(params).run()Start harsh events per segment job
Creates a job to generate a harsh events per segment analysis. Returns harsh driving event counts (braking, acceleration, cornering) per road segment for the supplied date/time range and vehicle filters.
Altitude Help Center — getHarshEventsPerSegmentRequest Body
Analysis parameters.
application/json: object
| Name | Type | Input Shape | Values | Description | Value Required |
|---|---|---|---|---|---|
dateFrom | string | - | - | First date of the analysis range, formatted as yyyy-mm-dd. A minimum span of 5 days is required after applying daysOfWeek filters. | Y |
dateTo | string | - | - | Last date of the analysis range, formatted as yyyy-mm-dd. | Y |
daysOfWeek | array<integer (int64)> | - | - | Days of the week to include (1=Sunday … 7=Saturday). An empty array includes all days. | N |
excludeLocalRoads | boolean | - | - | When true, local road categories (residential, living_street, service, unclassified, road) are excluded from results. Only applied when roadTypes is omitted or empty. | N |
isDirectional | boolean | - | - | When true, one record is returned per direction of travel; when false, results are averaged across both directions. | Y |
isMetric | boolean | - | - | When true, segment lengths are returned in kilometres; when false, in miles. Defaults to the isMetric setting on the authenticated user's profile when omitted. | N |
magnitudeBins | array<number (double)> | - | - | Upper bounds (inclusive, m/s²) of harsh event magnitude bins. The lowest bin starts at 0; the final bin extends to +inf. For example [2.32, 3.54] creates bins (0,2.32], (2.32,3.54], (3.54,+inf). | N |
magnitudeMax | number (double) | - | - | Maximum magnitude (m/s²) for a harsh event to be included. Must be > 0 and ≥ magnitudeMin. Defaults to +inf when omitted. | N |
magnitudeMin | number (double) | - | - | Minimum magnitude (m/s²) for a harsh event to be included. Must be ≥ 0. Defaults to 0 when omitted. | N |
roadTypes | array<RoadType> | - | living_street, motorway, motorway_link, primary, primary_link, residential, road, secondary, secondary_link, service, tertiary, tertiary_link, trunk, trunk_link, unclassified | OSM road types to include. An empty array returns results for all road types. When set, excludeLocalRoads is ignored. | N |
vehicleClassIds | array<string> | - | - | Vehicle class filter IDs from GET /api/v2/filters/vehicle-classes. IDs must use the scheme_vehicleClassIndex_categoryIndex format and share one scheme. An empty array includes all vehicle classes. | N |
vehicleClassSchemeId | integer | - | - | Vehicle classification scheme, from 1 through 5. Defaults to 2 (FHWA/GVWR) when omitted. | N |
vehicleClasses | array<object> | vehicleType: string; weightClass: string | - | Vehicle class filters. Use an empty array to include all vehicle classes. | N |
zoneIds | array<string> | - | - | Encoded zone ID strings. Provide exactly one of zoneIds or zones (not both). | N |
zones | array<object> | code: string; iso_3166_2: string; type: string | - | Zone objects with code, type, and iso_3166_2. Provide exactly one of zones or zoneIds (not both). | N |
Examples
County harsh events request
Translated from the v1 getHarshEventsPerSegment sample.
{
"dateFrom": "2026-01-01",
"dateTo": "2026-01-07",
"isDirectional": true,
"isMetric": false,
"roadTypes": [
"motorway"
],
"zones": [
{
"code": "32003",
"iso_3166_2": "US-NV",
"type": "County"
}
]
}Success Responses
202 response: object
Job accepted and queued for processing. Poll the location header URL to check status.
| Name | Type | Description |
|---|---|---|
error | object | Details about why the job failed (RFC 7807 format), or null if it succeeded. |
id | string | Unique job identifier. |
links | object | Navigation URLs for polling and result retrieval. |
status | string | Current job lifecycle state: PENDING, QUEUED, RUNNING, DONE, FAILED, CANCELED, or NOT_FOUND. |
Response Errors
| HTTP Status Code | Reason |
|---|---|
| 400 | The request body or parameters are invalid. |
| 401 | Authentication is required or the provided credentials are invalid. |
| 403 | The authenticated user lacks permission to perform this operation. |
| 409 | The operation conflicts with the current state of the resource. |
| 422 | The request is syntactically valid but semantically cannot be processed. |
| 429 | The request rate limit has been exceeded. |
| 500 | An unexpected server error occurred. |