Purchase Shipping Label
curl --request POST \
--url https://production-api.puppetvendors.com/shipping/purchase-label \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"orderNumber": {},
"vendorId": "<string>",
"lineItems": [
"<string>"
],
"service_code": "<string>",
"shippingCarrier": "<string>",
"carrierCode": "<string>",
"length": 123,
"width": 123,
"height": 123,
"weight": 123,
"weightunit": "<string>",
"distanceunit": "<string>",
"to_address": {},
"from_address": {}
}
'import requests
url = "https://production-api.puppetvendors.com/shipping/purchase-label"
payload = {
"orderNumber": {},
"vendorId": "<string>",
"lineItems": ["<string>"],
"service_code": "<string>",
"shippingCarrier": "<string>",
"carrierCode": "<string>",
"length": 123,
"width": 123,
"height": 123,
"weight": 123,
"weightunit": "<string>",
"distanceunit": "<string>",
"to_address": {},
"from_address": {}
}
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>'],
service_code: '<string>',
shippingCarrier: '<string>',
carrierCode: '<string>',
length: 123,
width: 123,
height: 123,
weight: 123,
weightunit: '<string>',
distanceunit: '<string>',
to_address: {},
from_address: {}
})
};
fetch('https://production-api.puppetvendors.com/shipping/purchase-label', 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://production-api.puppetvendors.com/shipping/purchase-label",
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>'
],
'service_code' => '<string>',
'shippingCarrier' => '<string>',
'carrierCode' => '<string>',
'length' => 123,
'width' => 123,
'height' => 123,
'weight' => 123,
'weightunit' => '<string>',
'distanceunit' => '<string>',
'to_address' => [
],
'from_address' => [
]
]),
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://production-api.puppetvendors.com/shipping/purchase-label"
payload := strings.NewReader("{\n \"orderNumber\": {},\n \"vendorId\": \"<string>\",\n \"lineItems\": [\n \"<string>\"\n ],\n \"service_code\": \"<string>\",\n \"shippingCarrier\": \"<string>\",\n \"carrierCode\": \"<string>\",\n \"length\": 123,\n \"width\": 123,\n \"height\": 123,\n \"weight\": 123,\n \"weightunit\": \"<string>\",\n \"distanceunit\": \"<string>\",\n \"to_address\": {},\n \"from_address\": {}\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://production-api.puppetvendors.com/shipping/purchase-label")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"orderNumber\": {},\n \"vendorId\": \"<string>\",\n \"lineItems\": [\n \"<string>\"\n ],\n \"service_code\": \"<string>\",\n \"shippingCarrier\": \"<string>\",\n \"carrierCode\": \"<string>\",\n \"length\": 123,\n \"width\": 123,\n \"height\": 123,\n \"weight\": 123,\n \"weightunit\": \"<string>\",\n \"distanceunit\": \"<string>\",\n \"to_address\": {},\n \"from_address\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://production-api.puppetvendors.com/shipping/purchase-label")
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 \"service_code\": \"<string>\",\n \"shippingCarrier\": \"<string>\",\n \"carrierCode\": \"<string>\",\n \"length\": 123,\n \"width\": 123,\n \"height\": 123,\n \"weight\": 123,\n \"weightunit\": \"<string>\",\n \"distanceunit\": \"<string>\",\n \"to_address\": {},\n \"from_address\": {}\n}"
response = http.request(request)
puts response.read_bodyShipping Operations
Purchase Shipping Label
Purchase a shipping label for an order using a selected rate
POST
/
shipping
/
purchase-label
Purchase Shipping Label
curl --request POST \
--url https://production-api.puppetvendors.com/shipping/purchase-label \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"orderNumber": {},
"vendorId": "<string>",
"lineItems": [
"<string>"
],
"service_code": "<string>",
"shippingCarrier": "<string>",
"carrierCode": "<string>",
"length": 123,
"width": 123,
"height": 123,
"weight": 123,
"weightunit": "<string>",
"distanceunit": "<string>",
"to_address": {},
"from_address": {}
}
'import requests
url = "https://production-api.puppetvendors.com/shipping/purchase-label"
payload = {
"orderNumber": {},
"vendorId": "<string>",
"lineItems": ["<string>"],
"service_code": "<string>",
"shippingCarrier": "<string>",
"carrierCode": "<string>",
"length": 123,
"width": 123,
"height": 123,
"weight": 123,
"weightunit": "<string>",
"distanceunit": "<string>",
"to_address": {},
"from_address": {}
}
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>'],
service_code: '<string>',
shippingCarrier: '<string>',
carrierCode: '<string>',
length: 123,
width: 123,
height: 123,
weight: 123,
weightunit: '<string>',
distanceunit: '<string>',
to_address: {},
from_address: {}
})
};
fetch('https://production-api.puppetvendors.com/shipping/purchase-label', 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://production-api.puppetvendors.com/shipping/purchase-label",
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>'
],
'service_code' => '<string>',
'shippingCarrier' => '<string>',
'carrierCode' => '<string>',
'length' => 123,
'width' => 123,
'height' => 123,
'weight' => 123,
'weightunit' => '<string>',
'distanceunit' => '<string>',
'to_address' => [
],
'from_address' => [
]
]),
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://production-api.puppetvendors.com/shipping/purchase-label"
payload := strings.NewReader("{\n \"orderNumber\": {},\n \"vendorId\": \"<string>\",\n \"lineItems\": [\n \"<string>\"\n ],\n \"service_code\": \"<string>\",\n \"shippingCarrier\": \"<string>\",\n \"carrierCode\": \"<string>\",\n \"length\": 123,\n \"width\": 123,\n \"height\": 123,\n \"weight\": 123,\n \"weightunit\": \"<string>\",\n \"distanceunit\": \"<string>\",\n \"to_address\": {},\n \"from_address\": {}\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://production-api.puppetvendors.com/shipping/purchase-label")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"orderNumber\": {},\n \"vendorId\": \"<string>\",\n \"lineItems\": [\n \"<string>\"\n ],\n \"service_code\": \"<string>\",\n \"shippingCarrier\": \"<string>\",\n \"carrierCode\": \"<string>\",\n \"length\": 123,\n \"width\": 123,\n \"height\": 123,\n \"weight\": 123,\n \"weightunit\": \"<string>\",\n \"distanceunit\": \"<string>\",\n \"to_address\": {},\n \"from_address\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://production-api.puppetvendors.com/shipping/purchase-label")
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 \"service_code\": \"<string>\",\n \"shippingCarrier\": \"<string>\",\n \"carrierCode\": \"<string>\",\n \"length\": 123,\n \"width\": 123,\n \"height\": 123,\n \"weight\": 123,\n \"weightunit\": \"<string>\",\n \"distanceunit\": \"<string>\",\n \"to_address\": {},\n \"from_address\": {}\n}"
response = http.request(request)
puts response.read_bodyV2 Preview — This endpoint is part of the V2 API preview. Breaking changes may occur.
Overview
Purchase a shipping label for an order after selecting a rate from the Get Shipping Rates endpoint. Provide the same shipment details plus the chosen service code and carrier.Use Cases
- Purchase a label after a vendor selects a rate
- Automate label generation in fulfillment workflows
- Integrate carrier label purchase into custom shipping UIs
Request Body
Accepts the same fields as Get Shipping Rates, plus:Destination address. See Get Shipping Rates for field details.
Origin address. See Get Shipping Rates for field details.
Response
200
{
"success": true,
"data": {
"trackingNumber": "9400111899223456789012",
"trackingUrl": "https://tools.usps.com/go/TrackConfirmAction?tLabels=9400111899223456789012",
"labelUrl": "https://deliver.goshippo.com/label_abc123.pdf",
"carrier": "USPS"
}
}
Example
curl -X POST "https://production-api.puppetvendors.com/shipping/purchase-label" \
-H "x-access-token: YOUR_VENDOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"orderNumber": "1042",
"vendorId": "507f1f77bcf86cd799439011",
"lineItems": ["660a1b2e3d98f0001a2b3c01"],
"service_code": "usps_priority",
"shippingCarrier": "shippo",
"carrierCode": "usps",
"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
Purchase a USPS Priority Mail labelcurl -X POST "https://production-api.puppetvendors.com/shipping/purchase-label" \
-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",
"service_code": "usps_priority",
"shippingCarrier": "USPS",
"from_address": {
"street1": "123 Main St",
"city": "New York",
"state": "NY",
"country": "US",
"zip": "10001"
},
"to_address": {
"street1": "456 Oak Ave",
"city": "Los Angeles",
"state": "CA",
"country": "US",
"zip": "90001"
}
}'
Was this page helpful?