Pack and Quote API

The RESTful API calculates packing requirement and/or shipping rates. For the API to work properly, create a warehouse profile to obtain API key and warehouse ID, and add boxes and delivery services. To familiarize with the API features, you may use the online calculator in your warehouse profile for testing.

To avoid per minute quota, requests should be spread out whenever possible.

Hash Types

The common hash types referenced in the API are:

Address Hash
firstName
string, optional
Recipient first name.
lastName
string, optional
Recipient last name.
company
string, optional
Company name.
phone
string, optional
Recipient phone number.
streetAddress
list, optional
A list of street address lines.
city
string, optional
City name.
post
string
Postal code.
region
string
Province or state abbreviation.
country
string
ISO 3166-1 two-letter country code.
residential
boolean
Residential or commercial address.
Item Hash
sku
string
Item unique identifier.
name
string
Item name.
qty
integer, optional
default 1
Item quantity.
shelf
string, optional
Shelf ID as defined in warehouse layout where item is stored.
unitPrice
float, optional
default 0.00
Item unit price.
weight
float, optional
default 0.0001
The weight of each unit of item.
weightUnit
string, optional
default lb
The weight unit of item is "kg", "g", "oz" or "lb".
dimensions
list, optional
default length 0.0001
default width 0.0001
default height 0.0001
A list of dimension hashes. Each dimension hash has attributes:
length
float
Item length.
width
float
Item width.
height
float
Item height.
Maximum 2 dimension hashes allowed.
dimensionUnit
string, optional
default in
The dimension unit of item is "m", "cm", "mm", "ft" or "in".
rotatable
boolean, optional
default true
Item can be rotated in any direction for packing.
packable
boolean, optional
default true
Item is not shipped separately.
strappable
boolean, optional
default true
Package containing the product can be bundled with other packages.
voidFiller
boolean, optional
default false
Item is allowed to fill the void space of another item.
voidDimensions
list, optional
A list of void dimension hashes. Each hash has attributes:
length
float
Void space length.
width
float
Void space width.
height
float
Void space height.
Maximum 3 dimension hashes allowed.
prepackageMinQty
integer, optional
default 1
Minimum quantity required to trigger prepackaging.
prepackages
list, optional
A list of prepackaging hashes. Each hash has attributes:
length
float
Prepackage length.
width
float
Prepackage width.
height
float
Prepackage height.
weight
float
Prepackage tare weight.
capacity
integer
Prepackage item capacity.
Maximum 2 prepackaging hashes allowed.
stack
hash, optional
A hash of product stacking rules. Each hash has attributes:
lengthIncrement
float
Length increment per stacked item.
widthIncrement
float
Width increment per stacked item.
heightIncrement
float
Height increment per stacked item.
maxQty
integer
Maximum items per stack.
packaging
hash, optional
A hash of shippable packaging (e.g. manufacturer's original box) with attributes:
length
float
Packaging length.
width
float
Packaging width.
height
float
Packaging height.
weight
float
Gross weight of packaging and item.
irregular
boolean
Packaging is irregular shape (e.g. pails, drums or tires).
preferContainers
list, optional
List of tags of containers preferred for packing.
excludeContainers
list, optional
List of tags of containers to avoid for packing.
excludeServices
list, optional
List of tags of services to avoid.
group
integer, optional
default 0
Pack items separately by group 0, 1 or 2.
Package Hash
container
string
Box name or null if item is ship-separately or manufacturer original packaging is used.
weight
float
Package gross weight.
weightUnit
string
Package weight unit is "kg", "g", "oz" or "lb".
length
float
Package length.
width
float
Package width.
height
float
Package or pallet height.
dimensionUnit
string
Package dimension unit is "m", "cm", "mm", "ft" or "in".
value
float
Total value of package content.
items
list
A list of packed item hashes
bundle
integer, optional
ID of bundle to strap package to.
tags
list, optional
A list of tags, if defined, for box.
Packed Item Hash
sku
string
Item SKU.
name
string
Item name.
qty
integer
Item quantity.
voidSku
string, optional
The embedding item SKU.
voidIndex
integer, optional
The index of the embedding item's void space.
prepackage
hash, optional
Indicate this item is prepacked with attributes:
id
integer
System assigned prepackaging identifier.
length
float
Length of prepackaging.
width
float
Width of prepackaging.
height
float
Height of prepackaging.
dimensionUnit
string
Prepackaging dimension unit is "m", "cm", "mm", "ft" or "in".
capacity
integer
Capacity of prepackaging.
Service Hash
status
hash
A hash with attributes:
success
boolean
Indicate if delivery service is applicable.
carrier
string
Courier name.
service
string
Delivery method name.
value
float
Total value of merchandise in shipment.
currency
string
3-letter currency code e.g. USD.
weight
float
Total gross weight of shipment in kilograms.
weightUnit
string
kg
rate
float, optional
Handling fee plus negotiated or standard list shipping rates.
listRate
float, optional
Standard list rates for FedEx Packages and UPS Packages.
freeShipping
boolean, optional
True if shipment qualifies for free shipping, otherwise, omitted.
delivery
hash, optional
A hash for estimated delivery date and time with attributes:
date
string
MM-DD-YYYY
time
string, optional
HH:MM
packing
list
A list of package hashes
Status Hash
success
boolean
Status of API request.
messages
list
List of messages of type string.
Create a Pack and Quote Request

Calculate packing requirements and shipping rates for items. To skip rates, set showRates input parameter to false.

URI
http(s)://api.solvingmaze.com/calculate/key/API_KEY/warehouse/WAREHOUSE_ID
Input Parameters
items
list
A list of item hashes.
showRates
boolean, optional
default true
Return shipping rates along with packing requirements.
enableCatalog
boolean, optional
default false
Load default item attributes from product catalog with same SKU.
validateDestination
string, optional
Match destination to a valid U.S. street address and return the match in response using:
upsUPS Street Level Address Validation API.
uspsUSPS Address API.
Shipping rates, if requested, are based on input destination not matched address.
destination
hash, optional
shipDate
hash, optional
Date of shipment hash with attributes:
date
string
MM-DD-YYYY
time
string
HH:MM
voidFill
integer, optional
default 1
Void filling method for items marked as void fillers:
0No void filling.
1Pack all void fillers into void spaces or none.
2Pack as many void fillers into void spaces as possible.
services
list, optional
A list of tags of delivery services to use.
Output Parameters
status
Request status and messages.
destinationMatch
address hash, optional
Valid street addresss matching input destination. Absent if no match is found.
services
list
A list of delivery service hashes available.
Input Example
 {
	"destination": {
		"post": "90210",
		"region": "CA",
		"city": "Beverly Hills",
		"country": "US",
		"residential": true
	},
	"items": [
		{
			"sku": "101",
			"name": "Toy",
			"qty": 2,
			"value": 40,
			"weight": 0.7,
			"weightUnit": "lb",
			"dimensions": [
				{
					"length": 6,
					"width": 2,
					"height": 2
				}
			]
			"dimensionUnit": "in",
		}
	]
 }
Output Example
 {
	"status": {
		"success": true,
		"messages": [
			"One or more shipping services available."
		]
	},
	"services": [
		{
			"carrier": "USPS",
			"service": "Priority Mail Flat Rate",
			"rate": 11.35,
			"currency": "USD",
			"status": {
				"success": true
			},
			"delivery": {
				"date": "05-20-2013"
			},
			"packing": [
				{
					"container": "USPS Flat Rate Medium Box",
					"tags": ["box"],
					"weight": 3.2,
					"length": 11,
					"width": 8.5,
					"height": 5.5,
					"weightUnit": "lb",
					"dimensionUnit": "in",
					"value": 40,
					"items": [
						{
							"sku": 1,
							"name": "Fish Toy",
							"qty": 2
						}
					]
				}
			]
		}
	]
 }
Code Examples:   PHP | Ruby | C# | Javascript

The example code calculates shipping rates for an item with multiple quantities. It assumes the warehouse is already configured with shipper info, courier and packaging boxes.

<?php

// new item
$items = array();
$item = array();
$item['sku'] = '105';
$item['qty'] = 2;
$item['name'] = 'Trousers';
$item['weight'] = 0.8;
$item['unitPrice'] = 51.60;
$item['weightUnit'] = 'lb';
$item['dimensionUnit'] = 'in';
$dimensions = array();
$dimensions[] = array('length'=>13, 'width'=>12, 'height'=>2);
$item['dimensions'] = $dimensions;
$items[] = $item;

// destination
$dest = array('country'=>'US', 'region'=>'CA', 'post'=>'90210', 'city'=>'Beverly Hills', 'residential'=>true);

// submit request
$ch = curl_init("http://api.solvingmaze.com/calculate/key/$apiKey/warehouse/$warehouseId");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POST, true);
$params = array(
	"destination" => $dest,
	"items" => $items,
);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

// print response
echo $response;

?>


UPS, FedEx, DHL, Spee-Dee, USPS, Shopify trademarks are property of their respective owners.
SolvingMaze Ltd, Company No. 11016672, Copyright © 2024  
    Contact  -  FAQ  - Knowledge Base  -  Terms Of Service  -  Privacy Policy