Cross-Border Trade (CBT)

Contenidos

La API para orquestar todos los datos necesarios para la generación de los documentos fiscales del flujo de CBT ha sido desarrollada para permitir la automatización del proceso de creación de documentos fiscales.

Importante:
  • Asegúrese de que ya tiene aplicación y token válidos, y que está autorizado para usar este endpoint
  • Por seguridad se utilizará OAuth.

Request

GET https://api.mercadolibre.com/MLM/shipments/{shipment_id}/cbt/fiscal-info?access_token={access_token}
Parámetro
Tipo
Descripción
shipment_idStringID del envio
access_tokenString
Token de acceso para autenticación.

Response

Si la consulta es exitosa, recibirás una respuesta en formato JSON que contiene los datos fiscales.

{
   "id": 123456789,
   "invoice_url": "https://api.mercadolibre.com/shipments/123456789/documents/cbt_invoice",
   "invoice_date": "string",
   "receiver": {
       "fiscal_information": {
           "full_name": "string",
           "phone_number": "string",
           "fiscal_residence": "string",
           "identification": {
               "type": "string",
               "number": "string"
           }
       },
       "address": {
           "address_line": "string",
           "street_name": "string",
           "street_number": "string",
           "zip_code": "string",
           "intersection": "string",
           "longitude": float,
           "latitude": float,
           "receiver_name": "string",
           "state": {
               "id": "string",
               "name": "string"
           },
           "city": {
               "id": "string",
               "name": "string"
           },
           "neighborhood": {
               "id": "string",
               "name": "string"
           },
           "country": {
               "id": "string",
               "name": "string"
           },
           "municipality": {
               "id": "string",
               "name": "string"
           }
       }
   },
   "package": {
       "total_items": int,
       "total_price": float,
       "dimensions": {
           "height": float,
           "width": float,
           "length": float,
           "weight": float
       },
       "items": [
           {
               "id": "string",
               "description": "string",
               "currency": "string",
               "price": float,
               "quantity": int,
               "seller": {
                   "name": "string",
                   "address": {
                       "address_line": "string",
                       "street_name": "string",
                       "street_number": "string",
                       "zip_code": "string",
                       "intersection": "string",
                       "longitude": float,
                       "latitude": float,
                       "receiver_name": "string",
                       "state": {
                           "id": "string",
                           "name": "string"
                       },
                       "city": {
                           "id": "string",
                           "name": "string"
                       },
                       "neighborhood": {
                           "id": "string",
                           "name": "string"
                       },
                       "country": {
                           "id": "string",
                           "name": "string"
                       },
                       "municipality": {
                           "id": "string",
                           "name": "string"
                       }
                   }
               },
               "dimensions": {
                   "height": float,
                   "width": float,
                   "length": float,
                   "weight": float
               },
               "unit_code": "string",
               "sat_category": "string",
               "dangerous_material_key": "string",
               "dangerous_material": "string",
               "package_key": "string",
               "package_description": "string",
               "brand": "string",
               "model": "string",
               "serials": [
                  "string",
                  "string"
               ]
           }
       ]
   },
   "tags": []
}

Ejemplos de status Codes

Si ocurre un error, la API devolverá un estado HTTP diferente de 200 junto con el error, el mensaje y la causa del mismo, y el content-type será application/json.

401 (UNAUTHORIZED)

Ocurre un error 401 cuando no hay autenticación válida para el usuario que realiza la solicitud.

{
  "message": "Unauthorized to get details. Error: [reason]",
  "error": "unauthorized_error",
  "status": 401,
  "cause": ["error_auth"]
}

422 (UNPROCESSABLE ENTITY)

Un error 422 ocurre cuando la solicitud es correcta pero alguna información importante para el payload no se ha proporcionado correctamente, siendo validada en el flujo y devolviendo este error.

{
  "message": "The field is empty",
  "error": "empty_field",
  "status": 422
}

424 (FAILED DEPENDENCY)

Un error 424 ocurre cuando la solicitud es correcta, pero algún servicio dependiente falló, resultando en este error.

{
  "message": "An error occurred while trying to get api",
  "error": "error_api",
  "status": 424
}

500 (INTERNAL_ERROR)

Ocurre un error 500 cuando se produce una falla interna a esta API.

{
  "message": "Error when try get shipment CBT fiscal information",
  "error": "error_code",
  "status": 500
}
Código HTTP
Content type
Response body
Descripción
200application/jsonJSON (ejemplo de arriba)Cuando se obtienen los datos fiscales correctamente.
401application/json{"message": "Unauthorized to get details. Error: [reason]"}Cuando no hay autenticación válida.
422application/json{"message": "The field is empty", "error": "empty_field", "status": 422}Cuando la solicitud es correcta pero falta alguna información importante para el payload.
424application/json{"message": "An error occurred while trying to get api", "error": "error_api", "status": 424}Cuando la solicitud es correcta pero falla debido a la dependencia de otro servicio o sistema.
500application/json{"message": "Error when try get shipment CBT fiscal information", "error": "error_code", "status": 500}Cuando ocurre una falla interna en la API.