Get Shipping Rates for Order
curl --request POST \
--url https://staging-api.puppetvendors.com/shipping/get-rates \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"orderNumber": {},
"vendorId": "<string>",
"lineItems": [
"<string>"
],
"length": 123,
"width": 123,
"height": 123,
"weight": 123,
"weightunit": "<string>",
"distanceunit": "<string>",
"to_address": {},
"to_address.street1": "<string>",
"to_address.street2": "<string>",
"to_address.country": "<string>",
"to_address.zip": "<string>",
"to_address.city": "<string>",
"to_address.phone": "<string>",
"to_address.state": "<string>",
"to_address.name": "<string>",
"to_address.email": "<string>",
"from_address": {},
"from_address.street1": "<string>",
"from_address.street2": "<string>",
"from_address.country": "<string>",
"from_address.zip": "<string>",
"from_address.city": "<string>",
"from_address.phone": "<string>",
"from_address.state": "<string>",
"from_address.name": "<string>",
"from_address.email": "<string>"
}
'import requests
url = "https://staging-api.puppetvendors.com/shipping/get-rates"
payload = {
"orderNumber": {},
"vendorId": "<string>",
"lineItems": ["<string>"],
"length": 123,
"width": 123,
"height": 123,
"weight": 123,
"weightunit": "<string>",
"distanceunit": "<string>",
"to_address": {},
"to_address.street1": "<string>",
"to_address.street2": "<string>",
"to_address.country": "<string>",
"to_address.zip": "<string>",
"to_address.city": "<string>",
"to_address.phone": "<string>",
"to_address.state": "<string>",
"to_address.name": "<string>",
"to_address.email": "<string>",
"from_address": {},
"from_address.street1": "<string>",
"from_address.street2": "<string>",
"from_address.country": "<string>",
"from_address.zip": "<string>",
"from_address.city": "<string>",
"from_address.phone": "<string>",
"from_address.state": "<string>",
"from_address.name": "<string>",
"from_address.email": "<string>"
}
headers = {
"x-access-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
orderNumber: {},
vendorId: '<string>',
lineItems: ['<string>'],
length: 123,
width: 123,
height: 123,
weight: 123,
weightunit: '<string>',
distanceunit: '<string>',
to_address: {},
'to_address.street1': '<string>',
'to_address.street2': '<string>',
'to_address.country': '<string>',
'to_address.zip': '<string>',
'to_address.city': '<string>',
'to_address.phone': '<string>',
'to_address.state': '<string>',
'to_address.name': '<string>',
'to_address.email': '<string>',
from_address: {},
'from_address.street1': '<string>',
'from_address.street2': '<string>',
'from_address.country': '<string>',
'from_address.zip': '<string>',
'from_address.city': '<string>',
'from_address.phone': '<string>',
'from_address.state': '<string>',
'from_address.name': '<string>',
'from_address.email': '<string>'
})
};
fetch('https://staging-api.puppetvendors.com/shipping/get-rates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging-api.puppetvendors.com/shipping/get-rates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'orderNumber' => [
],
'vendorId' => '<string>',
'lineItems' => [
'<string>'
],
'length' => 123,
'width' => 123,
'height' => 123,
'weight' => 123,
'weightunit' => '<string>',
'distanceunit' => '<string>',
'to_address' => [
],
'to_address.street1' => '<string>',
'to_address.street2' => '<string>',
'to_address.country' => '<string>',
'to_address.zip' => '<string>',
'to_address.city' => '<string>',
'to_address.phone' => '<string>',
'to_address.state' => '<string>',
'to_address.name' => '<string>',
'to_address.email' => '<string>',
'from_address' => [
],
'from_address.street1' => '<string>',
'from_address.street2' => '<string>',
'from_address.country' => '<string>',
'from_address.zip' => '<string>',
'from_address.city' => '<string>',
'from_address.phone' => '<string>',
'from_address.state' => '<string>',
'from_address.name' => '<string>',
'from_address.email' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://staging-api.puppetvendors.com/shipping/get-rates"
payload := strings.NewReader("{\n \"orderNumber\": {},\n \"vendorId\": \"<string>\",\n \"lineItems\": [\n \"<string>\"\n ],\n \"length\": 123,\n \"width\": 123,\n \"height\": 123,\n \"weight\": 123,\n \"weightunit\": \"<string>\",\n \"distanceunit\": \"<string>\",\n \"to_address\": {},\n \"to_address.street1\": \"<string>\",\n \"to_address.street2\": \"<string>\",\n \"to_address.country\": \"<string>\",\n \"to_address.zip\": \"<string>\",\n \"to_address.city\": \"<string>\",\n \"to_address.phone\": \"<string>\",\n \"to_address.state\": \"<string>\",\n \"to_address.name\": \"<string>\",\n \"to_address.email\": \"<string>\",\n \"from_address\": {},\n \"from_address.street1\": \"<string>\",\n \"from_address.street2\": \"<string>\",\n \"from_address.country\": \"<string>\",\n \"from_address.zip\": \"<string>\",\n \"from_address.city\": \"<string>\",\n \"from_address.phone\": \"<string>\",\n \"from_address.state\": \"<string>\",\n \"from_address.name\": \"<string>\",\n \"from_address.email\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://staging-api.puppetvendors.com/shipping/get-rates")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"orderNumber\": {},\n \"vendorId\": \"<string>\",\n \"lineItems\": [\n \"<string>\"\n ],\n \"length\": 123,\n \"width\": 123,\n \"height\": 123,\n \"weight\": 123,\n \"weightunit\": \"<string>\",\n \"distanceunit\": \"<string>\",\n \"to_address\": {},\n \"to_address.street1\": \"<string>\",\n \"to_address.street2\": \"<string>\",\n \"to_address.country\": \"<string>\",\n \"to_address.zip\": \"<string>\",\n \"to_address.city\": \"<string>\",\n \"to_address.phone\": \"<string>\",\n \"to_address.state\": \"<string>\",\n \"to_address.name\": \"<string>\",\n \"to_address.email\": \"<string>\",\n \"from_address\": {},\n \"from_address.street1\": \"<string>\",\n \"from_address.street2\": \"<string>\",\n \"from_address.country\": \"<string>\",\n \"from_address.zip\": \"<string>\",\n \"from_address.city\": \"<string>\",\n \"from_address.phone\": \"<string>\",\n \"from_address.state\": \"<string>\",\n \"from_address.name\": \"<string>\",\n \"from_address.email\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging-api.puppetvendors.com/shipping/get-rates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"orderNumber\": {},\n \"vendorId\": \"<string>\",\n \"lineItems\": [\n \"<string>\"\n ],\n \"length\": 123,\n \"width\": 123,\n \"height\": 123,\n \"weight\": 123,\n \"weightunit\": \"<string>\",\n \"distanceunit\": \"<string>\",\n \"to_address\": {},\n \"to_address.street1\": \"<string>\",\n \"to_address.street2\": \"<string>\",\n \"to_address.country\": \"<string>\",\n \"to_address.zip\": \"<string>\",\n \"to_address.city\": \"<string>\",\n \"to_address.phone\": \"<string>\",\n \"to_address.state\": \"<string>\",\n \"to_address.name\": \"<string>\",\n \"to_address.email\": \"<string>\",\n \"from_address\": {},\n \"from_address.street1\": \"<string>\",\n \"from_address.street2\": \"<string>\",\n \"from_address.country\": \"<string>\",\n \"from_address.zip\": \"<string>\",\n \"from_address.city\": \"<string>\",\n \"from_address.phone\": \"<string>\",\n \"from_address.state\": \"<string>\",\n \"from_address.name\": \"<string>\",\n \"from_address.email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyShipping Operations
Get Shipping Rates for Order
Fetch real-time shipping rates for an order’s line items
POST
/
shipping
/
get-rates
Get Shipping Rates for Order
curl --request POST \
--url https://staging-api.puppetvendors.com/shipping/get-rates \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"orderNumber": {},
"vendorId": "<string>",
"lineItems": [
"<string>"
],
"length": 123,
"width": 123,
"height": 123,
"weight": 123,
"weightunit": "<string>",
"distanceunit": "<string>",
"to_address": {},
"to_address.street1": "<string>",
"to_address.street2": "<string>",
"to_address.country": "<string>",
"to_address.zip": "<string>",
"to_address.city": "<string>",
"to_address.phone": "<string>",
"to_address.state": "<string>",
"to_address.name": "<string>",
"to_address.email": "<string>",
"from_address": {},
"from_address.street1": "<string>",
"from_address.street2": "<string>",
"from_address.country": "<string>",
"from_address.zip": "<string>",
"from_address.city": "<string>",
"from_address.phone": "<string>",
"from_address.state": "<string>",
"from_address.name": "<string>",
"from_address.email": "<string>"
}
'import requests
url = "https://staging-api.puppetvendors.com/shipping/get-rates"
payload = {
"orderNumber": {},
"vendorId": "<string>",
"lineItems": ["<string>"],
"length": 123,
"width": 123,
"height": 123,
"weight": 123,
"weightunit": "<string>",
"distanceunit": "<string>",
"to_address": {},
"to_address.street1": "<string>",
"to_address.street2": "<string>",
"to_address.country": "<string>",
"to_address.zip": "<string>",
"to_address.city": "<string>",
"to_address.phone": "<string>",
"to_address.state": "<string>",
"to_address.name": "<string>",
"to_address.email": "<string>",
"from_address": {},
"from_address.street1": "<string>",
"from_address.street2": "<string>",
"from_address.country": "<string>",
"from_address.zip": "<string>",
"from_address.city": "<string>",
"from_address.phone": "<string>",
"from_address.state": "<string>",
"from_address.name": "<string>",
"from_address.email": "<string>"
}
headers = {
"x-access-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
orderNumber: {},
vendorId: '<string>',
lineItems: ['<string>'],
length: 123,
width: 123,
height: 123,
weight: 123,
weightunit: '<string>',
distanceunit: '<string>',
to_address: {},
'to_address.street1': '<string>',
'to_address.street2': '<string>',
'to_address.country': '<string>',
'to_address.zip': '<string>',
'to_address.city': '<string>',
'to_address.phone': '<string>',
'to_address.state': '<string>',
'to_address.name': '<string>',
'to_address.email': '<string>',
from_address: {},
'from_address.street1': '<string>',
'from_address.street2': '<string>',
'from_address.country': '<string>',
'from_address.zip': '<string>',
'from_address.city': '<string>',
'from_address.phone': '<string>',
'from_address.state': '<string>',
'from_address.name': '<string>',
'from_address.email': '<string>'
})
};
fetch('https://staging-api.puppetvendors.com/shipping/get-rates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging-api.puppetvendors.com/shipping/get-rates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'orderNumber' => [
],
'vendorId' => '<string>',
'lineItems' => [
'<string>'
],
'length' => 123,
'width' => 123,
'height' => 123,
'weight' => 123,
'weightunit' => '<string>',
'distanceunit' => '<string>',
'to_address' => [
],
'to_address.street1' => '<string>',
'to_address.street2' => '<string>',
'to_address.country' => '<string>',
'to_address.zip' => '<string>',
'to_address.city' => '<string>',
'to_address.phone' => '<string>',
'to_address.state' => '<string>',
'to_address.name' => '<string>',
'to_address.email' => '<string>',
'from_address' => [
],
'from_address.street1' => '<string>',
'from_address.street2' => '<string>',
'from_address.country' => '<string>',
'from_address.zip' => '<string>',
'from_address.city' => '<string>',
'from_address.phone' => '<string>',
'from_address.state' => '<string>',
'from_address.name' => '<string>',
'from_address.email' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://staging-api.puppetvendors.com/shipping/get-rates"
payload := strings.NewReader("{\n \"orderNumber\": {},\n \"vendorId\": \"<string>\",\n \"lineItems\": [\n \"<string>\"\n ],\n \"length\": 123,\n \"width\": 123,\n \"height\": 123,\n \"weight\": 123,\n \"weightunit\": \"<string>\",\n \"distanceunit\": \"<string>\",\n \"to_address\": {},\n \"to_address.street1\": \"<string>\",\n \"to_address.street2\": \"<string>\",\n \"to_address.country\": \"<string>\",\n \"to_address.zip\": \"<string>\",\n \"to_address.city\": \"<string>\",\n \"to_address.phone\": \"<string>\",\n \"to_address.state\": \"<string>\",\n \"to_address.name\": \"<string>\",\n \"to_address.email\": \"<string>\",\n \"from_address\": {},\n \"from_address.street1\": \"<string>\",\n \"from_address.street2\": \"<string>\",\n \"from_address.country\": \"<string>\",\n \"from_address.zip\": \"<string>\",\n \"from_address.city\": \"<string>\",\n \"from_address.phone\": \"<string>\",\n \"from_address.state\": \"<string>\",\n \"from_address.name\": \"<string>\",\n \"from_address.email\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://staging-api.puppetvendors.com/shipping/get-rates")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"orderNumber\": {},\n \"vendorId\": \"<string>\",\n \"lineItems\": [\n \"<string>\"\n ],\n \"length\": 123,\n \"width\": 123,\n \"height\": 123,\n \"weight\": 123,\n \"weightunit\": \"<string>\",\n \"distanceunit\": \"<string>\",\n \"to_address\": {},\n \"to_address.street1\": \"<string>\",\n \"to_address.street2\": \"<string>\",\n \"to_address.country\": \"<string>\",\n \"to_address.zip\": \"<string>\",\n \"to_address.city\": \"<string>\",\n \"to_address.phone\": \"<string>\",\n \"to_address.state\": \"<string>\",\n \"to_address.name\": \"<string>\",\n \"to_address.email\": \"<string>\",\n \"from_address\": {},\n \"from_address.street1\": \"<string>\",\n \"from_address.street2\": \"<string>\",\n \"from_address.country\": \"<string>\",\n \"from_address.zip\": \"<string>\",\n \"from_address.city\": \"<string>\",\n \"from_address.phone\": \"<string>\",\n \"from_address.state\": \"<string>\",\n \"from_address.name\": \"<string>\",\n \"from_address.email\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging-api.puppetvendors.com/shipping/get-rates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"orderNumber\": {},\n \"vendorId\": \"<string>\",\n \"lineItems\": [\n \"<string>\"\n ],\n \"length\": 123,\n \"width\": 123,\n \"height\": 123,\n \"weight\": 123,\n \"weightunit\": \"<string>\",\n \"distanceunit\": \"<string>\",\n \"to_address\": {},\n \"to_address.street1\": \"<string>\",\n \"to_address.street2\": \"<string>\",\n \"to_address.country\": \"<string>\",\n \"to_address.zip\": \"<string>\",\n \"to_address.city\": \"<string>\",\n \"to_address.phone\": \"<string>\",\n \"to_address.state\": \"<string>\",\n \"to_address.name\": \"<string>\",\n \"to_address.email\": \"<string>\",\n \"from_address\": {},\n \"from_address.street1\": \"<string>\",\n \"from_address.street2\": \"<string>\",\n \"from_address.country\": \"<string>\",\n \"from_address.zip\": \"<string>\",\n \"from_address.city\": \"<string>\",\n \"from_address.phone\": \"<string>\",\n \"from_address.state\": \"<string>\",\n \"from_address.name\": \"<string>\",\n \"from_address.email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyV2 Preview — This endpoint is part of the V2 API preview. Breaking changes may occur.
Overview
Fetch real-time shipping rates from connected carriers for a specific set of line items. Provide package dimensions, weight, and origin/destination addresses to receive available rates with pricing and estimated delivery times.Use Cases
- Show rate options to vendors before purchasing a label
- Compare carrier pricing for a shipment
- Integrate shipping rate selection into custom fulfillment workflows
Request Body
The Shopify order number.
The vendor’s ID.
Array of line item IDs to ship. Minimum 1 item.
Package length. Must be a positive number.
Package width. Must be a positive number.
Package height. Must be a positive number.
Package weight. Must be a positive number.
Weight unit (e.g.
lb, kg, oz, g).Distance unit for dimensions (e.g.
in, cm).Destination address.
Street address line 1.
Street address line 2.
Country code (e.g.
US, GB).Postal / ZIP code.
City name.
Phone number.
State or province.
Recipient name.
Recipient email.
Origin address. Same fields as
to_address.Street address line 1.
Street address line 2.
Country code.
Postal / ZIP code.
City name.
Phone number.
State or province.
Sender name.
Sender email.
Response
200
{
"success": true,
"data": {
"rates": [
{
"provider": "shippo",
"service": "usps_priority",
"serviceName": "USPS Priority Mail",
"amount": 7.49,
"currency": "USD",
"estimatedDays": 3,
"carrierCode": "usps"
},
{
"provider": "shippo",
"service": "ups_ground",
"serviceName": "UPS Ground",
"amount": 9.15,
"currency": "USD",
"estimatedDays": 5,
"carrierCode": "ups"
}
]
}
}
Example
curl -X POST "https://staging-api.puppetvendors.com/shipping/get-rates" \
-H "x-access-token: YOUR_VENDOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"orderNumber": "1042",
"vendorId": "507f1f77bcf86cd799439011",
"lineItems": ["660a1b2e3d98f0001a2b3c01"],
"length": 12,
"width": 8,
"height": 6,
"weight": 2.5,
"weightunit": "lb",
"distanceunit": "in",
"to_address": {
"street1": "456 Oak Ave",
"city": "Portland",
"state": "OR",
"zip": "97201",
"country": "US"
},
"from_address": {
"street1": "123 Main St",
"city": "Austin",
"state": "TX",
"zip": "78701",
"country": "US"
}
}'
More Examples
International shipment ratescurl -X POST "https://staging-api.puppetvendors.com/shipping/get-rates" \
-H "x-access-token: YOUR_VENDOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"orderNumber": "1055",
"vendorId": "507f1f77bcf86cd799439012",
"lineItems": ["665a1b2c3d4e5f6a7b8c9d0e"],
"length": 12,
"width": 8,
"height": 6,
"weight": 2.5,
"weightunit": "lb",
"distanceunit": "in",
"from_address": {
"street1": "123 Main St",
"city": "New York",
"state": "NY",
"country": "US",
"zip": "10001"
},
"to_address": {
"street1": "10 Downing St",
"city": "London",
"country": "GB",
"zip": "SW1A 2AA"
}
}'
Was this page helpful?
⌘I