curl --request PATCH \
--url https://{defaultHost}/v1/shipments/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"shipment": {
"label_file_type": "PNG"
}
}
'import requests
url = "https://{defaultHost}/v1/shipments/{id}"
payload = { "shipment": { "label_file_type": "PNG" } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({shipment: {label_file_type: 'PNG'}})
};
fetch('https://{defaultHost}/v1/shipments/{id}', 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://{defaultHost}/v1/shipments/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'shipment' => [
'label_file_type' => 'PNG'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://{defaultHost}/v1/shipments/{id}"
payload := strings.NewReader("{\n \"shipment\": {\n \"label_file_type\": \"PNG\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://{defaultHost}/v1/shipments/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"shipment\": {\n \"label_file_type\": \"PNG\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/shipments/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shipment\": {\n \"label_file_type\": \"PNG\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "0b94a4e8-d34e-47f8-914e-f5aa516406f6",
"object": "shipment",
"carrier": null,
"carrier_messages": [],
"contact_validations": null,
"dimensions": {
"length": 10,
"width": 8,
"height": 5,
"unit": "in"
},
"eta": null,
"inherit_weight": false,
"label_file_type": "PNG",
"label_url": null,
"live_mode": true,
"rates": [],
"selected_rate": null,
"shipping_date": 1789344000,
"status": "draft",
"tracking_number": null,
"tracking_status": null,
"tracking_url": null,
"weight": "2.0",
"weight_unit": "lb",
"carrier_parcel_template_token": null,
"from_contact": "c36acb2c-b266-4de4-98d5-b52593e8e21e",
"fulfillment": "3ab26a4d-8375-48d1-94e2-3c36cc925817",
"parcel_template": null,
"shipping_provider": "22b5db99-9679-4a01-832d-9edd593ed75d",
"to_contact": "dc33f63b-3734-4f35-8772-e9d60ce0bbcd",
"created_at": 1789424622,
"updated_at": 1789424622
}Update
Updates a specific shipment.
curl --request PATCH \
--url https://{defaultHost}/v1/shipments/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"shipment": {
"label_file_type": "PNG"
}
}
'import requests
url = "https://{defaultHost}/v1/shipments/{id}"
payload = { "shipment": { "label_file_type": "PNG" } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({shipment: {label_file_type: 'PNG'}})
};
fetch('https://{defaultHost}/v1/shipments/{id}', 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://{defaultHost}/v1/shipments/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'shipment' => [
'label_file_type' => 'PNG'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://{defaultHost}/v1/shipments/{id}"
payload := strings.NewReader("{\n \"shipment\": {\n \"label_file_type\": \"PNG\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://{defaultHost}/v1/shipments/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"shipment\": {\n \"label_file_type\": \"PNG\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/shipments/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shipment\": {\n \"label_file_type\": \"PNG\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "0b94a4e8-d34e-47f8-914e-f5aa516406f6",
"object": "shipment",
"carrier": null,
"carrier_messages": [],
"contact_validations": null,
"dimensions": {
"length": 10,
"width": 8,
"height": 5,
"unit": "in"
},
"eta": null,
"inherit_weight": false,
"label_file_type": "PNG",
"label_url": null,
"live_mode": true,
"rates": [],
"selected_rate": null,
"shipping_date": 1789344000,
"status": "draft",
"tracking_number": null,
"tracking_status": null,
"tracking_url": null,
"weight": "2.0",
"weight_unit": "lb",
"carrier_parcel_template_token": null,
"from_contact": "c36acb2c-b266-4de4-98d5-b52593e8e21e",
"fulfillment": "3ab26a4d-8375-48d1-94e2-3c36cc925817",
"parcel_template": null,
"shipping_provider": "22b5db99-9679-4a01-832d-9edd593ed75d",
"to_contact": "dc33f63b-3734-4f35-8772-e9d60ce0bbcd",
"created_at": 1789424622,
"updated_at": 1789424622
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
Show child attributes
Show child attributes
Response
Success
The UUID of the specific object.
A string describing the object type returned.
The file type for the shipping label – one of PDF, PDF_A4, PDF_A6, PDF_4x6, PDF_4x8, PNG, ZPLII.
Expandable – The associated parcel template ID.
The weight of the parcel.
The unit of the weight – one of g, kg, lb, oz.
When true, inherit the weight from the fulfillment.
The date the shipment will be tendered to the carrier. Measured in seconds since the Unix epoch.
The dimensions of the parcel. Defaults to the parcel template's dimensions when parcel_template is set and no dimensions are given, and to the carrier's own preset when carrier_parcel_template_token resolves to a fixed-size package.
Show child attributes
Show child attributes
The token of a carrier parcel template (e.g. USPS_SmallFlatRateBox), resolved against this shipment's own shipping provider. Defaults to the parcel template's token when parcel_template is set, and can be cleared or overridden by passing it explicitly. When it resolves to a fixed-size package its dimensions are used, and quoted rates cover only that carrier — read the carrier itself from the parcel template, or from the selected rate once one is chosen. Cannot be changed after the label is purchased.
The current status of this shipment – one of draft, quoted, purchased, voided.
Whether or not this shipment was created in live mode.
The URL for the purchased shipping label.
The tracking number for this shipment.
The URL to track this shipment.
The shipping carrier of the selected rate.
Messages from carriers about this shipment.
Show child attributes
Show child attributes
Contact validation results returned by the shipping provider. Only available after quoting.
Show child attributes
Show child attributes
The current tracking status – one of unknown, pre_transit, in_transit, delivered, returned, failure.
The estimated time of arrival.
The available shipping rates for this shipment.
Show child attributes
Show child attributes
The selected shipping rate for this shipment.
Show child attributes
Show child attributes
Expandable – The associated fulfillment ID.
Expandable – The associated shipping provider ID.
Expandable – The associated contact ID.
Expandable – The associated contact ID.
Time at which the object was created. Measured in seconds since the Unix epoch.
Time at which the object was last updated. Measured in seconds since the Unix epoch.
Was this page helpful?