Skip to content

UPS - Get Rates

This module queries the available UPS shipping rates for a given package. It receives the shipper and recipient data in JSON format, weight, optional dimensions, and optional service type. It makes a POST request to the /api/rating/v1/Rate endpoint with the RateRequest payload. It processes the response to extract the service code and name, total charges, currency, base charges, service options charges, guaranteed days, and delivery time. It identifies the cheapest rate.

ParameterTypeRequiredDescription
credentials_idcredentialsYesUPS credential (provider: ups)
shippertextareaYesShipper data in JSON with Name and Address
ship_totextareaYesRecipient data in JSON with Name and Address
package_weighttextYesPackage weight in kilograms
package_dimensionstextareaNoDimensions in JSON (Length, Width, Height)
service_codeselectNoFilter by service: 01 (Next Day Air), 02 (2nd Day Air), 03 (Ground), 07 (Express), 08 (Expedited), 11 (Standard), 65 (Saver). Empty for all

A ups type credential is required with the following fields:

  • client_id: UPS API Client ID
  • client_secret: UPS API Client Secret
{
"success": true,
"rates": [
{
"service_code": "11",
"service_name": "Standard",
"total_charges": "18.50",
"currency": "EUR",
"base_charges": "15.00",
"service_options_charges": "3.50",
"guaranteed_days": "3",
"delivery_by": "23:30"
}
],
"rates_count": 4,
"cheapest": {
"service_code": "11",
"service_name": "Standard",
"total_charges": "18.50",
"currency": "EUR"
},
"message": "4 tarifas UPS obtenidas"
}
{
"credentials_id": "mi_credencial_ups",
"shipper": "{\"Name\":\"Mi Empresa\",\"Address\":{\"AddressLine\":[\"Calle Gran Via 1\"],\"City\":\"Madrid\",\"PostalCode\":\"28001\",\"CountryCode\":\"ES\"}}",
"ship_to": "{\"Name\":\"Cliente\",\"Address\":{\"AddressLine\":[\"Av Diagonal 100\"],\"City\":\"Barcelona\",\"PostalCode\":\"08001\",\"CountryCode\":\"ES\"}}",
"package_weight": "2.0"
}
  • If no service is specified, all available options are returned
  • The response can be an object or an array; the module handles both cases
  • Dimensions are optional and expressed in centimeters
  • ShipFrom is automatically configured the same as Shipper