Skip to main content
POST
/
shipping
/
purchase-label
Purchase Shipping Label
curl --request POST \
  --url https://staging-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://staging-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://staging-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://staging-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://staging-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://staging-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://staging-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_body
V2 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:
orderNumber
string | number
required
The Shopify order number.
vendorId
string
required
The vendor’s ID.
lineItems
string[]
required
Array of line item IDs to ship. Minimum 1 item.
service_code
string
required
The service code from the selected rate (e.g. usps_priority).
shippingCarrier
string
required
The shipping carrier provider (e.g. shippo, shipstation).
carrierCode
string
Carrier-specific code (e.g. usps, ups, fedex).
length
number
Package length. Must be a positive number.
width
number
Package width. Must be a positive number.
height
number
Package height. Must be a positive number.
weight
number
Package weight. Must be a positive number.
weightunit
string
Weight unit (e.g. lb, kg, oz, g).
distanceunit
string
Distance unit for dimensions (e.g. in, cm).
to_address
object
Destination address. See Get Shipping Rates for field details.
from_address
object
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://staging-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 label
curl -X POST "https://staging-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"
    }
  }'