LH (Line Haul) Monitoring - Incidents API
Authentication: All endpoints require OAuth.
Table of Contents
1. Query Incident Types
Introduction
The Incident Types API provides the list of incident types that can be reported.
Important:
- OAuth will be used for security
Request
GET https://api.mercadolibre.com/travel-execution/{site_id}/incidents/types?scope=stage
| Parameter | Type | Description |
|---|---|---|
site_id | String | Country identifier for the query. Example: Brazil (MLB) |
scope | String | Query scope. Example: stage (test environment) or production (production environment) |
Response
json1[ 2 { "id": "REFUEL_VEHICLE", "description": "Fuel refill" }, 3 { "id": "HEAVY_TRAFFIC", "description": "Heavy traffic" } 4]
The response returns HTTP status 200 (OK) with an array of objects containing the id and description fields. If no incident types exist, the array will be empty.
| Field | Type | Description |
|---|---|---|
id | String | Incident type ID |
description | String | Human-readable description of the incident type |
The
idfield is used when creating an incident.
2. Create Incident
Introduction
The API allows creating new incidents in the travel execution system. This endpoint accepts incident data and creates a new incident record.
Important:
- OAuth will be used for security
- All fields in the request body are required
- The incident type must be a valid type from the Incident Types API
Request
POST https://api.mercadolibre.com/travel-execution/incidents?scope=stage
The scope query parameter is required and must be stage for the test environment or production for the production environment.
| Parameter | Type | Description |
|---|---|---|
site_id | String | Country identifier for the incident. Example: MLB (Brazil) |
travel_id | String | Unique travel identifier |
stop_sequence | Number | Sequence number of the stop where the incident occurred |
type | String | Incident type (must be a valid type from the Incident Types API) |
affected_goal_id | String | Which goal is affected by the incident? (ORIGIN_EXPECTED_ARRIVAL_DATE, DESTINATION_EXPECTED_ARRIVAL_DATE, or CRITICAL_PULL_TIME) |
date_occurred | String (ISO 8601) | Date and time when the incident occurred |
expected_duration_in_minutes | Number | Expected duration of the incident in minutes |
description | String | Detailed description of the incident |
location_reference | String | Location reference where the incident occurred |
Request Body
json1{ 2 "site_id": "MLB", 3 "travel_id": "1", 4 "stop_sequence": 1, 5 "type": "REFUEL_VEHICLE", 6 "affected_goal_id": "DESTINATION_EXPECTED_ARRIVAL_DATE", 7 "date_occurred": "2022-03-18T23:11:59Z", 8 "expected_duration_in_minutes": 40, 9 "description": "Fuel refill incident", 10 "location_reference": "Near São Paulo" 11}
Response
json1{ "incident_id": 1 }
The response returns HTTP status 200 (OK) with the identifier of the created incident in the response body.
HTTP Status Codes
| Code | Description |
|---|---|
200 | OK - Incident created successfully |
400 | Bad Request - Invalid payload or missing required fields |
403 | Forbidden - Creation not authorized |
404 | Not Found - Travel not found |
3. Upload Incident Attachments
Introduction
The API allows uploading files as attachments to existing incidents in the LH Monitoring system.
Important:
- OAuth will be used for security
- Files must be sent using
multipart/form-dataformat- Supported file types:
png,jpeg, andjpg
Request
POST https://api.mercadolibre.com/travel-execution/incidents/{incident_id}/attachments/upload?scope=stage
| Parameter | Type | Description |
|---|---|---|
incident_id | String | Unique identifier of the incident to which the attachment will be uploaded |
scope | String | Operation scope. Example: stage (test environment) or production (production environment) |
attachment | File | The file to be uploaded as an attachment (multipart/form-data) |
Response
json1{ "message": "attachment uploaded successfully" }
The response returns HTTP status 201 (Created) when the upload is successful.
HTTP Status Codes
| Code | Description |
|---|---|
201 | Created - Upload completed successfully |
400 | Bad Request - Invalid payload or missing required fields |
403 | Forbidden - Upload not authorized |
404 | Not Found - Incident not found |
4. Set Incident as Root Cause
Introduction
The API allows marking (or unmarking) an existing incident as the root cause of a travel. Use this endpoint after creating one or more incidents on the same travel, when you need to point out which one was the underlying cause.
Important:
- OAuth will be used for security
- Send
root_cause: trueto mark the incident as root cause- Send
root_cause: falseto unmark — useful when the wrong incident was previously selected- The carrier identity is taken from your authenticated request; you do not need to send any user identifier
Request
PUT https://api.mercadolibre.com/travel-execution/incidents/{incident_id}/root-cause?scope=stage
The scope query parameter is required and must be stage for the test environment or production for the production environment.
| Parameter | Type | Description |
|---|---|---|
incident_id | String | Unique identifier of the incident to mark or unmark as the root cause |
scope | String | Operation scope. Example: stage (test environment) or production (production environment) |
root_cause | Boolean | Body field. true marks the incident as root cause; false unmarks it |
Request Body
json1{ 2 "root_cause": true 3}
Response
json1{ "message": "incident set as root cause" }
The response returns HTTP status 200 (OK) when the operation is successful.
HTTP Status Codes
| Code | Description |
|---|---|
200 | OK - Root cause flag updated successfully |
400 | Bad Request - Invalid incident_id format or malformed body |
403 | Forbidden - Carrier is not the owner of the travel that holds the incident |
404 | Not Found - Incident not found |
