Create
curl --request POST \
--url https://{defaultHost}/v1/parcel_templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"parcel_template": {
"name": "Small Box",
"dimensions": {
"length": 10,
"width": 8,
"height": 6,
"unit": "in"
},
"shipping_provider": "11f472cd-e937-4edc-9c29-9bdf71e99d8e"
}
}
'import requests
url = "https://{defaultHost}/v1/parcel_templates"
payload = { "parcel_template": {
"name": "Small Box",
"dimensions": {
"length": 10,
"width": 8,
"height": 6,
"unit": "in"
},
"shipping_provider": "11f472cd-e937-4edc-9c29-9bdf71e99d8e"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
parcel_template: {
name: 'Small Box',
dimensions: {length: 10, width: 8, height: 6, unit: 'in'},
shipping_provider: '11f472cd-e937-4edc-9c29-9bdf71e99d8e'
}
})
};
fetch('https://{defaultHost}/v1/parcel_templates', 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/parcel_templates",
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([
'parcel_template' => [
'name' => 'Small Box',
'dimensions' => [
'length' => 10,
'width' => 8,
'height' => 6,
'unit' => 'in'
],
'shipping_provider' => '11f472cd-e937-4edc-9c29-9bdf71e99d8e'
]
]),
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/parcel_templates"
payload := strings.NewReader("{\n \"parcel_template\": {\n \"name\": \"Small Box\",\n \"dimensions\": {\n \"length\": 10,\n \"width\": 8,\n \"height\": 6,\n \"unit\": \"in\"\n },\n \"shipping_provider\": \"11f472cd-e937-4edc-9c29-9bdf71e99d8e\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://{defaultHost}/v1/parcel_templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"parcel_template\": {\n \"name\": \"Small Box\",\n \"dimensions\": {\n \"length\": 10,\n \"width\": 8,\n \"height\": 6,\n \"unit\": \"in\"\n },\n \"shipping_provider\": \"11f472cd-e937-4edc-9c29-9bdf71e99d8e\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/parcel_templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"parcel_template\": {\n \"name\": \"Small Box\",\n \"dimensions\": {\n \"length\": 10,\n \"width\": 8,\n \"height\": 6,\n \"unit\": \"in\"\n },\n \"shipping_provider\": \"11f472cd-e937-4edc-9c29-9bdf71e99d8e\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "ccb718a1-1014-450b-9b3d-8f438232d2ec",
"object": "parcel_template",
"default": false,
"dimensions": {
"length": 10,
"width": 8,
"height": 6,
"unit": "in"
},
"name": "Small Box",
"package_type": "box",
"weight": null,
"weight_unit": "lb",
"carrier_parcel_template_token": null,
"carrier_token": null,
"carrier_name": null,
"carrier_logo_url": null,
"shipping_provider": "11f472cd-e937-4edc-9c29-9bdf71e99d8e",
"created_at": 1794901810,
"updated_at": 1794901810
}Parcel Templates
Create
Creates a new parcel template.
POST
/
v1
/
parcel_templates
Create
curl --request POST \
--url https://{defaultHost}/v1/parcel_templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"parcel_template": {
"name": "Small Box",
"dimensions": {
"length": 10,
"width": 8,
"height": 6,
"unit": "in"
},
"shipping_provider": "11f472cd-e937-4edc-9c29-9bdf71e99d8e"
}
}
'import requests
url = "https://{defaultHost}/v1/parcel_templates"
payload = { "parcel_template": {
"name": "Small Box",
"dimensions": {
"length": 10,
"width": 8,
"height": 6,
"unit": "in"
},
"shipping_provider": "11f472cd-e937-4edc-9c29-9bdf71e99d8e"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
parcel_template: {
name: 'Small Box',
dimensions: {length: 10, width: 8, height: 6, unit: 'in'},
shipping_provider: '11f472cd-e937-4edc-9c29-9bdf71e99d8e'
}
})
};
fetch('https://{defaultHost}/v1/parcel_templates', 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/parcel_templates",
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([
'parcel_template' => [
'name' => 'Small Box',
'dimensions' => [
'length' => 10,
'width' => 8,
'height' => 6,
'unit' => 'in'
],
'shipping_provider' => '11f472cd-e937-4edc-9c29-9bdf71e99d8e'
]
]),
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/parcel_templates"
payload := strings.NewReader("{\n \"parcel_template\": {\n \"name\": \"Small Box\",\n \"dimensions\": {\n \"length\": 10,\n \"width\": 8,\n \"height\": 6,\n \"unit\": \"in\"\n },\n \"shipping_provider\": \"11f472cd-e937-4edc-9c29-9bdf71e99d8e\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://{defaultHost}/v1/parcel_templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"parcel_template\": {\n \"name\": \"Small Box\",\n \"dimensions\": {\n \"length\": 10,\n \"width\": 8,\n \"height\": 6,\n \"unit\": \"in\"\n },\n \"shipping_provider\": \"11f472cd-e937-4edc-9c29-9bdf71e99d8e\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/parcel_templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"parcel_template\": {\n \"name\": \"Small Box\",\n \"dimensions\": {\n \"length\": 10,\n \"width\": 8,\n \"height\": 6,\n \"unit\": \"in\"\n },\n \"shipping_provider\": \"11f472cd-e937-4edc-9c29-9bdf71e99d8e\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "ccb718a1-1014-450b-9b3d-8f438232d2ec",
"object": "parcel_template",
"default": false,
"dimensions": {
"length": 10,
"width": 8,
"height": 6,
"unit": "in"
},
"name": "Small Box",
"package_type": "box",
"weight": null,
"weight_unit": "lb",
"carrier_parcel_template_token": null,
"carrier_token": null,
"carrier_name": null,
"carrier_logo_url": null,
"shipping_provider": "11f472cd-e937-4edc-9c29-9bdf71e99d8e",
"created_at": 1794901810,
"updated_at": 1794901810
}Authorizations
Response
200 - application/json
Success
The token of a carrier parcel template (e.g. USPS_SmallFlatRateBox). When set, dimensions are populated from the carrier's own preset unless it allows custom dimensions, and shipments using this parcel template are quoted for that carrier only. Set to null to turn this back into a plain parcel template.
Expandable – The associated shipping provider ID.
Was this page helpful?