Tracking Notifications

Introduction

When a shipment's status changes, the carrier must inform Mercado Libre of this transition by sending a corresponding event notification. There are two ways to report the event recorded for a shipment:

  • PUSH: The carrier sends the corresponding event notification to our tracking endpoint.
  • PULL: The carrier exposes all notifications already recorded for the shipment via API.

In all cases, the objective is to ensure alignment with the carrier on the shipment's current status and the events already recorded. The notifications must reflect the actual transportation sequence and arrive in chronological order. Mercado Libre uses notification codes (code) associated with carrier event codes (carrier_code) to receive and validate each event. It is critical to follow the notification flow and the order in which events occur, because some status codes are considered final. Once a notification for a final state is received, any subsequent events after that status will be disregarded.

Notifications Payload

Important: Some fields are mandatory depending on the notification code sent. Push and Pull notifications payload must contain the same information.

Notification Fields

The fields that can be included in the notification payload are:

Name
Type of data
Description
Type
tracking_numberStringShipping identifier.Mandatory
codeStringEvent code.Mandatory
carrier_codeStringCarrier internal event code.Mandatory
payloadNodeContains information relevant to a particular event.
payload.dateDate (ISO8601)Event occurrence date. Valid values: UTC 2024-07-04T12:08.235Z or relative local time 2024-07-04T12:08.235-07.Mandatory
payload.reasonStringIndicates the specific reason associated with the reported code, providing predefined additional information that explains the occurrence of the event. Possible values of 'reason' for code 0114: establishment_not_found waiting_time_exceeded establishments_closed load_capacity_exceeded address_unsafe already_picked_up delivery_cancelled delivery_not_found payment_requested other_pickup_problems Possible values of 'reason' for code CBT-0272: oversize overweight overprice prohibited_item otherMandatory for code 0114 (Proximity) or CBT-0272 (Consolidation)
payload.commentStringAdditional information on the status code.Optional
payload.flight.awbStringAir Waybill NumberOptional
payload.declaration_numberStringPedimento Number/Customs Document NumberMandatory for code CBT-0283
payload.agency_idStringAgency identification code.Mandatory codes CBT-0201 and CBT-0215.
payload.agency.phone_numberStringAgency phone number where the package can be picked up. The format must be a number of up to fifteen digits that begins with "+". [+] [country code] [subscriber number including area code]. Example: +541142345678Only available for notifications CBT-0215 of CBT
payload.costBigDecimalShipping item cost.Mandatory for codes CBT-0260 and CBT-0265.
payload.locationNodeContains information relevant to the location where the event occurred.
payload.location.zip_codeStringZIP code where the event occurred.Optional
payload.location.country_idStringCountry id where the event occurred. ISO 3166 for country names.Mandatory for codes with prefix "CBT"
payload.location.state_nameStringName of state / province where the event occurred.Optional
payload.location.city_nameStringName of city where the event occurred.Optional
payload.location.neighborhood_nameStringName of neighborhood where the event occurred.Optional
payload.location.facilityStringIdentifier of the Logistics Center where the event occurred.Optional
payload.location.geolocationNodeGeolocation of the place where the event occurred.Optional
payload.location.geolocation.geolocation_typeStringGeolocation accuracy provided. May contain any of the following values: APPROXIMATE: approximate geolocation. GEOMETRIC_CENTER: the center of a region that is used as a reference is located. RANGE_INTERPOLATED: constrains precision to midpoint of 2 nearby reference points. ROOFTOP: Indicates that the location is exact. UNKNOWN: Indicates that the location was not validated.Optional
payload.location.geolocation.latitudeBigDecimalLatitude of geolocalization.Optional
payload.location.geolocation.longitudeBigDecimalLongitude of geolocalization.Optional
payload.dimensionsNode
payload.dimensions.heightBigDecimalIn centimetres.Optional
payload.dimensions.widthBigDecimalIn centimetres.Optional
payload.dimensions.lengthBigDecimalIn centimetres.Optional
payload.dimensions.weightBigDecimalGross weight in grams.Mandatory for code CBT-0260
payload.redispatchNodeOptional
payload.redispatch.tracking_numberStringRedispatch carrier shipment identifier.Optional
payload.redispatch.carrier_idBigDecimalRedispatch carrier identifier defined by Mercado Libre.Optional
payload.redispatch.tracking_urlStringWeb tracking URL of the redispatch carrier.Optional
payload.estimated_delivery_dateDate (ISO8601)Estimated delivery date of shipment. Valid values: UTC 2024-07-04T12:08.235Z or relative local time 2024-07-04T12:08.235-07.Mandatory for codes CBT-0265.
payload.estimated_pickup_dateDate (ISO8601)Estimated pick-up date of shipment. Valid values: UTC 2024-07-04T12:08.235Z or relative local time 2024-07-04T12:08.235-07.Mandatory for codes CBT-0265 and CBT-0133.
payload.proof_of_deliveryNodeOptional
payload.proof_of_delivery.receiver_documentNodeOptional
payload.proof_of_delivery.receiver_document.typeStringType of identity document of the person who receives the package. Valid values: CI: Identification Card. PASSPORT CPF: Individual Registration. RG: General Registration. CURP: Unique Population Registration Key. INE_IFE: National Electoral Institute. LICENCIA: Driver License. RFC: Federal Register of Taxpayers. RUT: Sole Tax Roll. CC: Citizen Card. DNI: National Identity Document.Mandatory
payload.proof_of_delivery.receiver_document.numberStringIdentity document number of the person who receives the package.Mandatory
payload.proof_of_delivery.receiver_last_nameStringSurname of the person who receives the package.Optional
payload.proof_of_delivery.receiver_nameStringName of the person who receives the package.Optional
payload.proof_of_delivery.receiver_relationshipStringWho received the package. Valid values: BUYER FAMILY NEIGHBOUR DOORMAN RECEPTION FRIEND HOLDER OTHEROptional
payload.proof_of_delivery.imageStringImage of receiver signature containing the full name and document number. The image must be sent encoded in Base64.Optional
payload.driverNodeProvider delivery informationOptional
payload.driver.idStringId of the delivery person in the carrier's registrationMandatory for code 0133
payload.driver.nameStringDelivery person nameMandatory for code 0133
payload.driver.emailStringDelivery person emailOptional
payload.driver.phoneStringDelivery person phone number. The format must be a number of up to fifteen digits that begins with "+". [+] [country code] [subscriber number including area code]. Example: +541142345678Optional
payload.driver.license_plateStringDelivery vehicle identificationOptional
payload.vehicleObjectVehicle information for the deliveryOptional
payload.vehicle.reference_typeStringType of information related to the vehicle, which can be: ID: id of the delivery person in the carrier's registration LICENSE_PLATE: delivery vehicle identificationOptional
payload.vehicle.referenceStringInformation about the field payload.vehicle.reference_typeOptional
payload.consolidated_packagesNodeNode containing information about the consolidation.Mandatory for code CBT-0272
payload.consolidated_packages.consolidation_idStringIdentification sent in the consolidation flow.Mandatory for code CBT-0272
payload.consolidated_packages.tracking_numberStringTracking number assigned to the consolidation.Mandatory for code CBT-0272
payload.consolidated_packages.shipmentsListList of shipment IDs included in the consolidation.Mandatory for code CBT-0272
payload.details.transport.content.restricted_item_typeStringUsed to identify the type of special goods are included inside the package. Valid values are: CREAM, LIQUID, POWDER, BATTERYMandatory for code CBT-0270

Payload Example

json
1{ 2 "tracking_number":string, 3 "code":string, 4 "carrier_code":string, 5 "payload":{ 6 "date":string (ISO8601), 7 "reason":string, 8 "comment":string, 9 "flight":{ 10 "awb":string 11 }, 12 "declaration_number":string, 13 "agency_id":string, 14 "agency":{ 15 "phone_number":string 16 }, 17 "cost":number, 18 "location":{ 19 "zip_code":string, 20 "country_id":string, 21 "state_name":string, 22 "city_name":string, 23 "neighborhood_name":string, 24 "facility":string, 25 "geolocation":{ 26 "geolocation_type":string, 27 "latitude":number, 28 "longitude":number 29 } 30 }, 31 "dimensions":{ 32 "height":number, 33 "width":number, 34 "length":number, 35 "weight":number 36 }, 37 "redispatch":{ 38 "tracking_number":string, 39 "carrier_id":number, 40 "tracking_url":string 41 }, 42 "estimated_delivery_date":string (ISO8601), 43 "estimated_pickup_date":string (ISO8601), 44 "proof_of_delivery":{ 45 "receiver_document":{ 46 "type":string, 47 "number":string 48 }, 49 "receiver_last_name":string, 50 "receiver_name":string, 51 "receiver_relationship":string, 52 "image":string 53 }, 54 "driver":{ 55 "id":string, 56 "name":string, 57 "email":string, 58 "phone":string, 59 "license_plate":string 60 }, 61 "vehicle":{ 62 "reference_type":string, 63 "reference":string 64 }, 65 "consolidated_packages":{ 66 "consolidation_id":string, 67 "tracking_number":string, 68 "shipments":array 69 }, 70 "details":{ 71 "transport":{ 72 "content":{ 73 "restricted_item_type":string 74 } 75 } 76 } 77 } 78}

Note: Send all available "location" data. The most valuable location data is the "geolocation" node.

Push Notifications

Important: For security in push tracking, OAuth will be used. Please check the required fields that must be sent according to the specified event.

Request

Shipments

The shipment notifications must be sent to this endpoint:

bash
1POST 'https://api.mercadolibre.com/shipments/{shipmentId}/notifications' \ --header 'Authorization: Bearer {accessToken}'

Handling Units

The HU notifications must be sent to this endpoint:

bash
1POST 'https://api.mercadolibre.com/tracking/{id}/notifications' \ --header 'Authorization: Bearer {accessToken}'

Response

Successful

If the notification was received successfully, the POST returns status OK.

json
1{ 2 "status": "OK" 3}

Failed (4XX FAILED)

If the HTTP error code is type 4XX, it should not be reattempted (as there is some problem with the request).

json
1{ 2 "message": "User must have a valid scope", 3 "error": "invalid_scopes", 4 "status": 403, 5 "cause": null, 6 "internal_cause": [ ] 7}

Error (500 ERROR)

If the HTTP error code is of type 5XX, it must be reattempted using some backoff mechanism with at least three retries.

json
1{ 2 "message": "Internal server error", 3 "error": "internal_server_error", 4 "status": 500, 5 "cause": null, 6 "internal_cause": [ ] 7}

Test Notifications

To send a test notification, it will be necessary: Valid credentials (access token) to the stage environment. Notification mappings validated and created in the stage environment. Shipment created with a "test" tag. The shipment test notifications must be sent to this endpoint:

bash
1POST 'https://api.mercadolibre.com/stage/shipments/{shipmentId}/notifications' \--header 'Authorization: Bearer {accessToken}'

Note: To create a test shipment, please contact the Integrations or Tracking team.

Pull Notifications

The carrier should provide an HTTP REST endpoint to retrieve the shipment events as the specification details as follows.

Important: We recommend that the number of shipments consulted be at least 50. For security in pull tracking, OAuth will be used. Inside the request body, a JSON will be sent with the following attributes:

OAuth Request Format

For the authentication mechanism through the generation of a Bearer token, the following header must be added to the request:

bash
1--request POST 'https://hostname/tracking' 2--header 'Authorization: Bearer TOKEN' 3--body 'What is described in each integration is maintained'

Inside the request body, a JSON will be sent with the following attributes:

Name
Type of data
Description
Type
idLongUnique identifier of the shipment used by Mercado Libre, required to authorize. This ID will later be used to notify the events that occur in the operational flow of the shipment.Mandatory
tracking_numberStringShipping identifier.Mandatory
json
1[ 2 { 3 "id": long, 4 "tracking_number": string 5 }, 6 { 7 "id": long, 8 "tracking_number": string 9 } 10]

Response Format

Note: Push and Pull notifications payload must contain the same information. If there are no events for a shipment, or the tracking number does not exist on your side, the "events" node will be empty.

Successful

Should be returned when the request was successfully processed.

json
1[ 2 { 3 "id":26379079680, 4 "tracking_number":"1234NLUG123", 5 "events":[ 6 { 7 "code":"0227", 8 "carrier_code":"a31", 9 "payload":{ 10 "date":"2017-05-22T00:00:00-04:00", 11 "comment":"Out for delivery", 12 "location":{ 13 "geolocation":{ 14 "geolocation_type":"ROOFTOP", 15 "latitude":-32.96234, 16 "longitude":-60.64053 17 } 18 } 19 } 20 } 21 ] 22 } 23]

Error response format

Name
Type of data
Description
statusIntegerError code. Matches the http status code.
messageStringAny details relevant to the state. Mandatory in case of failure.
errorStringhttp status error message in snake_case.
causeArrayList of errors

Failed (4XX FAILED)

Should be returned when the request could not be processed due to an error in the request.

json
1{ 2 "status":403, 3 "message":"User must have a valid scope", 4 "error":"invalid_scopes", 5 "cause":null 6}

Error (500 ERROR)

Should be returned due to any server side error.

json
1{ 2 "message":"DB is not available", 3 "error":"server_error", 4 "status":500, 5 "cause":[] 6}

Notifications Mapping

The mappings link the event codes used by carriers (carrier_code) with Mercado Libre's standardized internal codes (code). They are essential for validating, standardizing, and correctly processing received tracking notifications, ensuring that the shipment status is updated.

Definitions: carrier_code: event code as sent by the carrier. code: standardized notification code of Mercado Libre.

Note: A notification may be related to several event codes from a carrier, just as a carrier event code may be related to more than one MELI notification, according to the rules and events that may be reported by the carrier (e.g., variations by flow, delivery problems, incidents, etc.).

Invalid Mappings Impact

If a notification is received with incorrect mapping, the corresponding event will be ignored and the delivery status will not be updated. It is necessary to communicate code changes in advance to avoid discarding important notifications and to ensure there are no inconsistencies in the package lifecycle.

How to create or change a mapping

The Tracking Core team is responsible for managing and maintaining the internal mapping database and ensuring that received updates are consistent with the actual movement of the package. To create, adjust, or disregard a mapping, send an email to: shipping_tracking_it@mercadolivre.com following these guidelines: Subject: [MercadoLibre][carrier-name] Mapping Adjustment/Creation In the body of the email, be sure to include: Carrier name and country; Carrier event code and corresponding MELI update code; Justification for the mapping change or creation; Expected start date for sending updates after the adjustment.