v1

latestOpenAPI 3.1.0Proprietary2026-07-24710198.3 KB
Labels

Generate a Shipping Label

Generate a shipping label with a tracking number for a specific carrier and service. This is the core endpoint for creating shipments — it returns a printable label and registers the shipment with the carrier.

When to use: Call this endpoint after you have selected a rate from the /ship/rate/ response and are ready to create an actual shipment.

Prerequisites:

  • Valid JWT authentication token (Bearer)
  • A selected carrier and service (typically from a prior rate quote)
  • Complete origin and destination addresses
  • Package dimensions and weight
  • For international shipments: customs items information and content description

Key behaviors:

  • Returns a label URL (PDF), tracking number, and shipment metadata
  • Once generated, the label is registered with the carrier and may incur charges
  • Cancel unused labels via /ship/cancel/ to request a refund
  • Supports additional services (insurance, signature, etc.) through the settings object
  • For international DDP shipments, include duty/tax payment details in the request
post/ship/generate/

Request body

Example request

{
  "origin": {
    "name": "Juan Pérez",
    "company": "Envia Corp",
    "email": "juan.perez@example.com",
    "phone_code": "+52",
    "phone": "8180000000",
    "street": "Av. Revolución 500",
    "number": "500",
    "district": "Centro",
    "city": "Monterrey",
    "state": "NL",
    "country": "MX",
    "postalCode": "64060",
    "reference": "Frente al parque",
    "identificationNumber": "XAXX010101000"
  },
  "destination": {
    "name": "María García",
    "company": "Tienda Online SA",
    "email": "maria.garcia@example.com",
    "phone_code": "+52",
    "phone": "8180000000",
    "street": "Calle Reforma 123",
    "number": "123",
    "district": "Coyoacán",
    "city": "Ciudad de México",
    "state": "CX",
    "country": "MX",
    "postalCode": "04530",
    "reference": "Edificio azul, piso 3",
    "identificationNumber": "XAXX010101000"
  },
  "packages": [
    {
      "type": "box",
      "content": "Electronics",
      "amount": 1,
      "name": "Standard Box",
      "declaredValue": 500,
      "lengthUnit": "CM",
      "weightUnit": "KG",
      "weight": 2.5,
      "dimensions": {
        "length": 30,
        "width": 20,
        "height": 15
      },
      "additionalServices": [
        {
          "data": {
            "amount": "500"
          },
          "service": "envia_insurance"
        }
      ],
      "items": [
        {
          "description": "Wireless headphones",
          "productCode": "8518.30",
          "quantity": 2,
          "countryOfManufacture": "CN",
          "price": 45,
          "currency": "MXN"
        }
      ],
      "xmlData": [
        {
          "documentType": "dce",
          "dceNumber": "375",
          "dceSerie": "1",
          "dceDate": "2026-04-06T23:44:06-03:00",
          "dceKey": "35260440728044000157990010000003751103167477",
          "dceValue": "50.00",
          "nfeKey": "35260412345678000195550010000012341123456789",
          "nfeNumber": "1234",
          "nfeSerie": "1",
          "nfeDate": "2026-04-06T20:00:00-03:00"
        }
      ],
      "bolComplement": [
        {
          "productCode": "8518.30",
          "productDescription": "Electronic components",
          "weightUnit": "KG",
          "quantity": 2,
          "unitPrice": 25,
          "currency": "MXN"
        }
      ]
    }
  ],
  "settings": {
    "currency": "MXN",
    "printFormat": "pdf",
    "printSize": "PAPER_7X4.75",
    "comments": "Fragile items, handle with care"
  },
  "shipment": {
    "type": 1,
    "carrier": "ups",
    "service": "express",
    "declaredValue": 500,
    "additionalServices": [
      {
        "service": "envia_insurance"
      }
    ],
    "pickup": {
      "date": "2026-03-10",
      "totalPackages": 5,
      "totalWeight": 12.5
    },
    "orderReference": "ORD-2026-5678"
  },
  "customsSettings": {
    "dutiesPaymentEntity": "receiver",
    "exportReason": "sale"
  }
}

Response

Label created successfully

metastring

Action name