Query CT-e List for Redispatch by Route
Introduction
The CT-e listing API for redispatch allows querying fiscal documents generated by Mercado Livre on behalf of the carrier, associated with a specific route. It uses the GET method, requiring the 'routeID' as a parameter.
Important: OAuth will be used for security.
Request
bash1GET https://api.mercadolibre.com/MLB/routes/{route_id}/redispatch/fiscal-info?access_token={token}&page={page}&limit={limit}
Request Example
bash1https://api.mercadolibre.com/MLB/routes/1234567/redispatch/fiscal-info?access_token=123*******************************123&page=1&limit=100
Request Parameters
Name | Data Type | Description | Type |
|---|---|---|---|
| route_id | Int | Route ID | |
| access_token | String | Authentication token | |
| page | Int | This query is paginated. You must specify the page index to retrieve. When 'page' is not provided, the default value is 1. | |
| limit | Int | This query is paginated. You must specify the maximum number of results per page. When 'limit' is not provided, the default value is 100. |
Response
The API response includes a list of CT-e documents associated with the specified route. The response is formatted in JSON, containing detailed information about each CT-e.
json1{ 2 "total_elements": 10, 3 "page": 1, 4 "limit": 10, 5 "type": "CTE", 6 "documents": [ 7 { 8 "entity": "12345678901", 9 "type": "CTE", 10 "format": "xml", 11 "cte_key": "35111222333344445555666677", 12 "href": "https://api.mercadolibre.com/MLB/routes/987654321/shipments/12345678901/cte/35111222333344445555666677?doctype=xml" 13 }, 14 ] 15}
Response Fields
Name | Data Type | Description | Type |
|---|---|---|---|
| total_elements | Int | Total number of available CT-e documents | |
| page | Int | Current page number in the pagination response | |
| limit | Int | Maximum number of CT-e documents per page | |
| type | String | Document type (CTE) | |
| documents | Array | List of CT-e documents with details | |
| entity | String | Shipment identification | |
| type | String | Document type (CTE) | |
| format | String | CT-e file format | |
| cte_key | String | CT-e key | |
| href | String | Download link for the CT-e document (see Redispatch CT-e Query documentation) |
| Note: The same Shipment ('entity') may contain more than one CT-e in cases where a complementary CT-e is required. |
|---|
Status Codes
The API uses HTTP status codes to indicate different states of the request. The most common codes and their descriptions are listed below.
HTTP Code | Content Type | Response Body | Description |
|---|---|---|---|
| 200 | application/xml | (example above) | Route data returned successfully. |
| 404 | application/json | { "error": "route_not_found", "status": 404, "message": "Route not found", "cause": [] } | When the route is not found. |
