Skip to content

UPS - Create Shipment / Label

This module creates a shipment in UPS through the Shipments v1 API. It receives the shipper and recipient data in JSON format, service code, weight, optional dimensions, label format, and reference. It builds the complete ShipmentRequest payload including payment information (bill to shipper), label specification, and package details. It makes a POST request to the /api/shipments/v1/ship endpoint and returns the tracking number, base64 label, total charges, and currency.

ParameterTypeRequiredDescription
credentials_idcredentialsYesUPS credential (provider: ups)
shippertextareaYesShipper data in JSON with Name, ShipperNumber, and Address
ship_totextareaYesRecipient data in JSON with Name and Address
service_codeselectYesService code: 01 (Next Day Air), 02 (2nd Day Air), 03 (Ground), 07 (Express), 08 (Expedited), 11 (Standard), 65 (Saver)
package_weighttextYesPackage weight in kilograms
package_dimensionstextareaNoDimensions in JSON (Length, Width, Height)
label_formatselectNoLabel format: PDF (default), PNG, ZPL, GIF
referencetextNoInternal shipment reference

A ups type credential is required with the following fields:

  • client_id: UPS API Client ID
  • client_secret: UPS API Client Secret
  • account_number: UPS account number (optional, can be in the shipper JSON)

Credentials are obtained from the UPS Developer Portal (https://developer.ups.com/).

{
"success": true,
"tracking_number": "1Z999AA10123456784",
"shipment_id": "1Z999AA10123456784",
"label_base64": "iVBORw0KGgo...",
"label_format": "PDF",
"total_charges": "25.50",
"currency": "EUR",
"service_code": "11",
"status": "CREATED",
"message": "Envio UPS creado - Tracking: 1Z999AA10123456784"
}
{
"credentials_id": "mi_credencial_ups",
"shipper": "{\"Name\":\"Mi Empresa\",\"ShipperNumber\":\"ABC123\",\"Address\":{\"AddressLine\":[\"Calle Gran Via 1\"],\"City\":\"Madrid\",\"StateProvinceCode\":\"M\",\"PostalCode\":\"28001\",\"CountryCode\":\"ES\"}}",
"ship_to": "{\"Name\":\"Cliente\",\"Address\":{\"AddressLine\":[\"Av Diagonal 100\"],\"City\":\"Barcelona\",\"PostalCode\":\"08001\",\"CountryCode\":\"ES\"}}",
"service_code": "11",
"package_weight": "2.5",
"label_format": "PDF"
}
  • Authentication uses OAuth2 with client_id and client_secret
  • Payment is automatically configured as bill to shipper (BillShipper)
  • For ZPL format, the label size is automatically set to 6x4
  • The ShipperNumber can come from the shipper JSON or from the credentials
  • The API SubVersion is 1801
  • Dimensions are expressed in centimeters and weight in kilograms