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": "ca590436-bcc6-4ad9-8e5b-681c2b573bae",
"object": "shipment",
"carrier": null,
"carrier_messages": [],
"contact_validations": null,
"dimensions": {
"length": 10,
"width": 8,
"height": 5,
"unit": "in"
},
"customs_declaration": null,
"international": false,
"customs_required": false,
"eta": null,
"inherit_weight": false,
"label_file_type": "PNG",
"label_url": null,
"live_mode": true,
"rates": [],
"selected_rate": null,
"shipping_date": 1793750400,
"status": "draft",
"tracking_number": null,
"tracking_status": null,
"tracking_url": null,
"weight": "2.0",
"weight_unit": "lb",
"carrier_parcel_template_token": null,
"from_contact": "f4c9bb7e-20eb-4685-a2cb-a1a37c6b9310",
"fulfillment": "f1e6c36c-8422-4c49-9bb0-cb4d8d146245",
"parcel_template": null,
"shipping_provider": "a008f394-d9f4-4346-9920-11671c12fd7e",
"to_contact": "d9c75bf3-a9bd-4fd1-8282-17d8f41c9c06",
"created_at": 1793796993,
"updated_at": 1793796993
}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": "ca590436-bcc6-4ad9-8e5b-681c2b573bae",
"object": "shipment",
"carrier": null,
"carrier_messages": [],
"contact_validations": null,
"dimensions": {
"length": 10,
"width": 8,
"height": 5,
"unit": "in"
},
"customs_declaration": null,
"international": false,
"customs_required": false,
"eta": null,
"inherit_weight": false,
"label_file_type": "PNG",
"label_url": null,
"live_mode": true,
"rates": [],
"selected_rate": null,
"shipping_date": 1793750400,
"status": "draft",
"tracking_number": null,
"tracking_status": null,
"tracking_url": null,
"weight": "2.0",
"weight_unit": "lb",
"carrier_parcel_template_token": null,
"from_contact": "f4c9bb7e-20eb-4685-a2cb-a1a37c6b9310",
"fulfillment": "f1e6c36c-8422-4c49-9bb0-cb4d8d146245",
"parcel_template": null,
"shipping_provider": "a008f394-d9f4-4346-9920-11671c12fd7e",
"to_contact": "d9c75bf3-a9bd-4fd1-8282-17d8f41c9c06",
"created_at": 1793796993,
"updated_at": 1793796993
}Authorizations
Response
Success
Expandable – The associated parcel template ID.
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.
Expandable – The associated fulfillment ID.
Expandable – The associated shipping provider ID.
Expandable – The associated contact ID.
Expandable – The associated contact ID.
Was this page helpful?