curl --request POST \
--url 'https://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token=' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"internal_id": "1226",
"internal_reference": "AB-00001445",
"shipping_carrier": "postnord",
"shipping_method": "collect",
"subtotal_price_excluding_tax": 159.2,
"subtotal_price_including_tax": 199,
"shipping_price_excluding_tax": 20,
"shipping_price_including_tax": 25,
"total_price_excluding_tax": 179.2,
"total_price_including_tax": 224,
"total_tax_amount": 44.8,
"currency": "EUR",
"parcels": [
{
"internal_id": "1226",
"internal_reference": "AB-00001445",
"weight": 2.35,
"height": 12.2,
"width": 15.8,
"length": 30.5,
"freetext": "Leave at doorstep",
"total_price_excluding_tax": 79.2,
"total_price_including_tax": 99,
"total_tax_amount": 19.8,
"items": [
{
"internal_id": "1226",
"internal_reference": "PRODUCT-1231456",
"sku": "12345678",
"name": "Product A",
"description": "Small Blue Product A",
"hs_code": "10203040",
"country_of_origin": "CN",
"image_url": "https://example.com/catalog/product-a.jpg",
"unit_weight": 1.2,
"unit_price_excluding_tax": 40.6,
"unit_price_including_tax": 50.75,
"quantity": 2,
"total_price_excluding_tax": 81.2,
"total_price_including_tax": 101.5,
"total_tax_amount": 20.3
}
]
}
],
"addons": [
{
"value": "+4530274735"
}
]
}
'import requests
url = "https://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token="
payload = {
"internal_id": "1226",
"internal_reference": "AB-00001445",
"shipping_carrier": "postnord",
"shipping_method": "collect",
"subtotal_price_excluding_tax": 159.2,
"subtotal_price_including_tax": 199,
"shipping_price_excluding_tax": 20,
"shipping_price_including_tax": 25,
"total_price_excluding_tax": 179.2,
"total_price_including_tax": 224,
"total_tax_amount": 44.8,
"currency": "EUR",
"parcels": [
{
"internal_id": "1226",
"internal_reference": "AB-00001445",
"weight": 2.35,
"height": 12.2,
"width": 15.8,
"length": 30.5,
"freetext": "Leave at doorstep",
"total_price_excluding_tax": 79.2,
"total_price_including_tax": 99,
"total_tax_amount": 19.8,
"items": [
{
"internal_id": "1226",
"internal_reference": "PRODUCT-1231456",
"sku": "12345678",
"name": "Product A",
"description": "Small Blue Product A",
"hs_code": "10203040",
"country_of_origin": "CN",
"image_url": "https://example.com/catalog/product-a.jpg",
"unit_weight": 1.2,
"unit_price_excluding_tax": 40.6,
"unit_price_including_tax": 50.75,
"quantity": 2,
"total_price_excluding_tax": 81.2,
"total_price_including_tax": 101.5,
"total_tax_amount": 20.3
}
]
}
],
"addons": [{ "value": "+4530274735" }]
}
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({
internal_id: '1226',
internal_reference: 'AB-00001445',
shipping_carrier: 'postnord',
shipping_method: 'collect',
subtotal_price_excluding_tax: 159.2,
subtotal_price_including_tax: 199,
shipping_price_excluding_tax: 20,
shipping_price_including_tax: 25,
total_price_excluding_tax: 179.2,
total_price_including_tax: 224,
total_tax_amount: 44.8,
currency: 'EUR',
parcels: [
{
internal_id: '1226',
internal_reference: 'AB-00001445',
weight: 2.35,
height: 12.2,
width: 15.8,
length: 30.5,
freetext: 'Leave at doorstep',
total_price_excluding_tax: 79.2,
total_price_including_tax: 99,
total_tax_amount: 19.8,
items: [
{
internal_id: '1226',
internal_reference: 'PRODUCT-1231456',
sku: '12345678',
name: 'Product A',
description: 'Small Blue Product A',
hs_code: '10203040',
country_of_origin: 'CN',
image_url: 'https://example.com/catalog/product-a.jpg',
unit_weight: 1.2,
unit_price_excluding_tax: 40.6,
unit_price_including_tax: 50.75,
quantity: 2,
total_price_excluding_tax: 81.2,
total_price_including_tax: 101.5,
total_tax_amount: 20.3
}
]
}
],
addons: [{value: '+4530274735'}]
})
};
fetch('https://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token=', 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://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token=",
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([
'internal_id' => '1226',
'internal_reference' => 'AB-00001445',
'shipping_carrier' => 'postnord',
'shipping_method' => 'collect',
'subtotal_price_excluding_tax' => 159.2,
'subtotal_price_including_tax' => 199,
'shipping_price_excluding_tax' => 20,
'shipping_price_including_tax' => 25,
'total_price_excluding_tax' => 179.2,
'total_price_including_tax' => 224,
'total_tax_amount' => 44.8,
'currency' => 'EUR',
'parcels' => [
[
'internal_id' => '1226',
'internal_reference' => 'AB-00001445',
'weight' => 2.35,
'height' => 12.2,
'width' => 15.8,
'length' => 30.5,
'freetext' => 'Leave at doorstep',
'total_price_excluding_tax' => 79.2,
'total_price_including_tax' => 99,
'total_tax_amount' => 19.8,
'items' => [
[
'internal_id' => '1226',
'internal_reference' => 'PRODUCT-1231456',
'sku' => '12345678',
'name' => 'Product A',
'description' => 'Small Blue Product A',
'hs_code' => '10203040',
'country_of_origin' => 'CN',
'image_url' => 'https://example.com/catalog/product-a.jpg',
'unit_weight' => 1.2,
'unit_price_excluding_tax' => 40.6,
'unit_price_including_tax' => 50.75,
'quantity' => 2,
'total_price_excluding_tax' => 81.2,
'total_price_including_tax' => 101.5,
'total_tax_amount' => 20.3
]
]
]
],
'addons' => [
[
'value' => '+4530274735'
]
]
]),
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://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token="
payload := strings.NewReader("{\n \"internal_id\": \"1226\",\n \"internal_reference\": \"AB-00001445\",\n \"shipping_carrier\": \"postnord\",\n \"shipping_method\": \"collect\",\n \"subtotal_price_excluding_tax\": 159.2,\n \"subtotal_price_including_tax\": 199,\n \"shipping_price_excluding_tax\": 20,\n \"shipping_price_including_tax\": 25,\n \"total_price_excluding_tax\": 179.2,\n \"total_price_including_tax\": 224,\n \"total_tax_amount\": 44.8,\n \"currency\": \"EUR\",\n \"parcels\": [\n {\n \"internal_id\": \"1226\",\n \"internal_reference\": \"AB-00001445\",\n \"weight\": 2.35,\n \"height\": 12.2,\n \"width\": 15.8,\n \"length\": 30.5,\n \"freetext\": \"Leave at doorstep\",\n \"total_price_excluding_tax\": 79.2,\n \"total_price_including_tax\": 99,\n \"total_tax_amount\": 19.8,\n \"items\": [\n {\n \"internal_id\": \"1226\",\n \"internal_reference\": \"PRODUCT-1231456\",\n \"sku\": \"12345678\",\n \"name\": \"Product A\",\n \"description\": \"Small Blue Product A\",\n \"hs_code\": \"10203040\",\n \"country_of_origin\": \"CN\",\n \"image_url\": \"https://example.com/catalog/product-a.jpg\",\n \"unit_weight\": 1.2,\n \"unit_price_excluding_tax\": 40.6,\n \"unit_price_including_tax\": 50.75,\n \"quantity\": 2,\n \"total_price_excluding_tax\": 81.2,\n \"total_price_including_tax\": 101.5,\n \"total_tax_amount\": 20.3\n }\n ]\n }\n ],\n \"addons\": [\n {\n \"value\": \"+4530274735\"\n }\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://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token=")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"internal_id\": \"1226\",\n \"internal_reference\": \"AB-00001445\",\n \"shipping_carrier\": \"postnord\",\n \"shipping_method\": \"collect\",\n \"subtotal_price_excluding_tax\": 159.2,\n \"subtotal_price_including_tax\": 199,\n \"shipping_price_excluding_tax\": 20,\n \"shipping_price_including_tax\": 25,\n \"total_price_excluding_tax\": 179.2,\n \"total_price_including_tax\": 224,\n \"total_tax_amount\": 44.8,\n \"currency\": \"EUR\",\n \"parcels\": [\n {\n \"internal_id\": \"1226\",\n \"internal_reference\": \"AB-00001445\",\n \"weight\": 2.35,\n \"height\": 12.2,\n \"width\": 15.8,\n \"length\": 30.5,\n \"freetext\": \"Leave at doorstep\",\n \"total_price_excluding_tax\": 79.2,\n \"total_price_including_tax\": 99,\n \"total_tax_amount\": 19.8,\n \"items\": [\n {\n \"internal_id\": \"1226\",\n \"internal_reference\": \"PRODUCT-1231456\",\n \"sku\": \"12345678\",\n \"name\": \"Product A\",\n \"description\": \"Small Blue Product A\",\n \"hs_code\": \"10203040\",\n \"country_of_origin\": \"CN\",\n \"image_url\": \"https://example.com/catalog/product-a.jpg\",\n \"unit_weight\": 1.2,\n \"unit_price_excluding_tax\": 40.6,\n \"unit_price_including_tax\": 50.75,\n \"quantity\": 2,\n \"total_price_excluding_tax\": 81.2,\n \"total_price_including_tax\": 101.5,\n \"total_tax_amount\": 20.3\n }\n ]\n }\n ],\n \"addons\": [\n {\n \"value\": \"+4530274735\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token=")
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 \"internal_id\": \"1226\",\n \"internal_reference\": \"AB-00001445\",\n \"shipping_carrier\": \"postnord\",\n \"shipping_method\": \"collect\",\n \"subtotal_price_excluding_tax\": 159.2,\n \"subtotal_price_including_tax\": 199,\n \"shipping_price_excluding_tax\": 20,\n \"shipping_price_including_tax\": 25,\n \"total_price_excluding_tax\": 179.2,\n \"total_price_including_tax\": 224,\n \"total_tax_amount\": 44.8,\n \"currency\": \"EUR\",\n \"parcels\": [\n {\n \"internal_id\": \"1226\",\n \"internal_reference\": \"AB-00001445\",\n \"weight\": 2.35,\n \"height\": 12.2,\n \"width\": 15.8,\n \"length\": 30.5,\n \"freetext\": \"Leave at doorstep\",\n \"total_price_excluding_tax\": 79.2,\n \"total_price_including_tax\": 99,\n \"total_tax_amount\": 19.8,\n \"items\": [\n {\n \"internal_id\": \"1226\",\n \"internal_reference\": \"PRODUCT-1231456\",\n \"sku\": \"12345678\",\n \"name\": \"Product A\",\n \"description\": \"Small Blue Product A\",\n \"hs_code\": \"10203040\",\n \"country_of_origin\": \"CN\",\n \"image_url\": \"https://example.com/catalog/product-a.jpg\",\n \"unit_weight\": 1.2,\n \"unit_price_excluding_tax\": 40.6,\n \"unit_price_including_tax\": 50.75,\n \"quantity\": 2,\n \"total_price_excluding_tax\": 81.2,\n \"total_price_including_tax\": 101.5,\n \"total_tax_amount\": 20.3\n }\n ]\n }\n ],\n \"addons\": [\n {\n \"value\": \"+4530274735\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"shipment_id": "c5540f2b-3eea-45c4-957a-9d7b53f899e7",
"type": "label",
"internal_id": "1226",
"internal_reference": "AB-00001445",
"carrier_code": "postnord",
"carrier_name": "PostNord",
"pdf": {
"link": "https://example.com/labels/DK123456789.pdf",
"base_64_encoded": "<base64-encoded-pdf-here>"
},
"parcels": [
{
"parcel_id": "c5540f2b-3eea-45c4-957a-9d7b53f899e7",
"parcel_internal_id": "1226",
"parcel_internal_reference": "AB-00001445",
"carrier_code": "postnord",
"carrier_name": "PostNord",
"tracking_code": "DK123456789",
"tracking_link": "https://smartsend.io/tracking/DK123456789"
}
]
}
}{
"message": "Description of the error will be inserted here.",
"code": "ValidationException",
"id": "",
"errors": {},
"links": {}
}{
"message": "Description of the error will be inserted here.",
"code": "ValidationException",
"id": "",
"errors": {},
"links": {}
}{
"message": "Description of the error will be inserted here.",
"code": "ValidationException",
"id": "",
"errors": {},
"links": {}
}{
"message": "Description of the error will be inserted here."
}Store a new shipment and book a label
This endpoint is used to create a new shipment and book a label in one request
curl --request POST \
--url 'https://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token=' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"internal_id": "1226",
"internal_reference": "AB-00001445",
"shipping_carrier": "postnord",
"shipping_method": "collect",
"subtotal_price_excluding_tax": 159.2,
"subtotal_price_including_tax": 199,
"shipping_price_excluding_tax": 20,
"shipping_price_including_tax": 25,
"total_price_excluding_tax": 179.2,
"total_price_including_tax": 224,
"total_tax_amount": 44.8,
"currency": "EUR",
"parcels": [
{
"internal_id": "1226",
"internal_reference": "AB-00001445",
"weight": 2.35,
"height": 12.2,
"width": 15.8,
"length": 30.5,
"freetext": "Leave at doorstep",
"total_price_excluding_tax": 79.2,
"total_price_including_tax": 99,
"total_tax_amount": 19.8,
"items": [
{
"internal_id": "1226",
"internal_reference": "PRODUCT-1231456",
"sku": "12345678",
"name": "Product A",
"description": "Small Blue Product A",
"hs_code": "10203040",
"country_of_origin": "CN",
"image_url": "https://example.com/catalog/product-a.jpg",
"unit_weight": 1.2,
"unit_price_excluding_tax": 40.6,
"unit_price_including_tax": 50.75,
"quantity": 2,
"total_price_excluding_tax": 81.2,
"total_price_including_tax": 101.5,
"total_tax_amount": 20.3
}
]
}
],
"addons": [
{
"value": "+4530274735"
}
]
}
'import requests
url = "https://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token="
payload = {
"internal_id": "1226",
"internal_reference": "AB-00001445",
"shipping_carrier": "postnord",
"shipping_method": "collect",
"subtotal_price_excluding_tax": 159.2,
"subtotal_price_including_tax": 199,
"shipping_price_excluding_tax": 20,
"shipping_price_including_tax": 25,
"total_price_excluding_tax": 179.2,
"total_price_including_tax": 224,
"total_tax_amount": 44.8,
"currency": "EUR",
"parcels": [
{
"internal_id": "1226",
"internal_reference": "AB-00001445",
"weight": 2.35,
"height": 12.2,
"width": 15.8,
"length": 30.5,
"freetext": "Leave at doorstep",
"total_price_excluding_tax": 79.2,
"total_price_including_tax": 99,
"total_tax_amount": 19.8,
"items": [
{
"internal_id": "1226",
"internal_reference": "PRODUCT-1231456",
"sku": "12345678",
"name": "Product A",
"description": "Small Blue Product A",
"hs_code": "10203040",
"country_of_origin": "CN",
"image_url": "https://example.com/catalog/product-a.jpg",
"unit_weight": 1.2,
"unit_price_excluding_tax": 40.6,
"unit_price_including_tax": 50.75,
"quantity": 2,
"total_price_excluding_tax": 81.2,
"total_price_including_tax": 101.5,
"total_tax_amount": 20.3
}
]
}
],
"addons": [{ "value": "+4530274735" }]
}
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({
internal_id: '1226',
internal_reference: 'AB-00001445',
shipping_carrier: 'postnord',
shipping_method: 'collect',
subtotal_price_excluding_tax: 159.2,
subtotal_price_including_tax: 199,
shipping_price_excluding_tax: 20,
shipping_price_including_tax: 25,
total_price_excluding_tax: 179.2,
total_price_including_tax: 224,
total_tax_amount: 44.8,
currency: 'EUR',
parcels: [
{
internal_id: '1226',
internal_reference: 'AB-00001445',
weight: 2.35,
height: 12.2,
width: 15.8,
length: 30.5,
freetext: 'Leave at doorstep',
total_price_excluding_tax: 79.2,
total_price_including_tax: 99,
total_tax_amount: 19.8,
items: [
{
internal_id: '1226',
internal_reference: 'PRODUCT-1231456',
sku: '12345678',
name: 'Product A',
description: 'Small Blue Product A',
hs_code: '10203040',
country_of_origin: 'CN',
image_url: 'https://example.com/catalog/product-a.jpg',
unit_weight: 1.2,
unit_price_excluding_tax: 40.6,
unit_price_including_tax: 50.75,
quantity: 2,
total_price_excluding_tax: 81.2,
total_price_including_tax: 101.5,
total_tax_amount: 20.3
}
]
}
],
addons: [{value: '+4530274735'}]
})
};
fetch('https://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token=', 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://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token=",
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([
'internal_id' => '1226',
'internal_reference' => 'AB-00001445',
'shipping_carrier' => 'postnord',
'shipping_method' => 'collect',
'subtotal_price_excluding_tax' => 159.2,
'subtotal_price_including_tax' => 199,
'shipping_price_excluding_tax' => 20,
'shipping_price_including_tax' => 25,
'total_price_excluding_tax' => 179.2,
'total_price_including_tax' => 224,
'total_tax_amount' => 44.8,
'currency' => 'EUR',
'parcels' => [
[
'internal_id' => '1226',
'internal_reference' => 'AB-00001445',
'weight' => 2.35,
'height' => 12.2,
'width' => 15.8,
'length' => 30.5,
'freetext' => 'Leave at doorstep',
'total_price_excluding_tax' => 79.2,
'total_price_including_tax' => 99,
'total_tax_amount' => 19.8,
'items' => [
[
'internal_id' => '1226',
'internal_reference' => 'PRODUCT-1231456',
'sku' => '12345678',
'name' => 'Product A',
'description' => 'Small Blue Product A',
'hs_code' => '10203040',
'country_of_origin' => 'CN',
'image_url' => 'https://example.com/catalog/product-a.jpg',
'unit_weight' => 1.2,
'unit_price_excluding_tax' => 40.6,
'unit_price_including_tax' => 50.75,
'quantity' => 2,
'total_price_excluding_tax' => 81.2,
'total_price_including_tax' => 101.5,
'total_tax_amount' => 20.3
]
]
]
],
'addons' => [
[
'value' => '+4530274735'
]
]
]),
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://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token="
payload := strings.NewReader("{\n \"internal_id\": \"1226\",\n \"internal_reference\": \"AB-00001445\",\n \"shipping_carrier\": \"postnord\",\n \"shipping_method\": \"collect\",\n \"subtotal_price_excluding_tax\": 159.2,\n \"subtotal_price_including_tax\": 199,\n \"shipping_price_excluding_tax\": 20,\n \"shipping_price_including_tax\": 25,\n \"total_price_excluding_tax\": 179.2,\n \"total_price_including_tax\": 224,\n \"total_tax_amount\": 44.8,\n \"currency\": \"EUR\",\n \"parcels\": [\n {\n \"internal_id\": \"1226\",\n \"internal_reference\": \"AB-00001445\",\n \"weight\": 2.35,\n \"height\": 12.2,\n \"width\": 15.8,\n \"length\": 30.5,\n \"freetext\": \"Leave at doorstep\",\n \"total_price_excluding_tax\": 79.2,\n \"total_price_including_tax\": 99,\n \"total_tax_amount\": 19.8,\n \"items\": [\n {\n \"internal_id\": \"1226\",\n \"internal_reference\": \"PRODUCT-1231456\",\n \"sku\": \"12345678\",\n \"name\": \"Product A\",\n \"description\": \"Small Blue Product A\",\n \"hs_code\": \"10203040\",\n \"country_of_origin\": \"CN\",\n \"image_url\": \"https://example.com/catalog/product-a.jpg\",\n \"unit_weight\": 1.2,\n \"unit_price_excluding_tax\": 40.6,\n \"unit_price_including_tax\": 50.75,\n \"quantity\": 2,\n \"total_price_excluding_tax\": 81.2,\n \"total_price_including_tax\": 101.5,\n \"total_tax_amount\": 20.3\n }\n ]\n }\n ],\n \"addons\": [\n {\n \"value\": \"+4530274735\"\n }\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://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token=")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"internal_id\": \"1226\",\n \"internal_reference\": \"AB-00001445\",\n \"shipping_carrier\": \"postnord\",\n \"shipping_method\": \"collect\",\n \"subtotal_price_excluding_tax\": 159.2,\n \"subtotal_price_including_tax\": 199,\n \"shipping_price_excluding_tax\": 20,\n \"shipping_price_including_tax\": 25,\n \"total_price_excluding_tax\": 179.2,\n \"total_price_including_tax\": 224,\n \"total_tax_amount\": 44.8,\n \"currency\": \"EUR\",\n \"parcels\": [\n {\n \"internal_id\": \"1226\",\n \"internal_reference\": \"AB-00001445\",\n \"weight\": 2.35,\n \"height\": 12.2,\n \"width\": 15.8,\n \"length\": 30.5,\n \"freetext\": \"Leave at doorstep\",\n \"total_price_excluding_tax\": 79.2,\n \"total_price_including_tax\": 99,\n \"total_tax_amount\": 19.8,\n \"items\": [\n {\n \"internal_id\": \"1226\",\n \"internal_reference\": \"PRODUCT-1231456\",\n \"sku\": \"12345678\",\n \"name\": \"Product A\",\n \"description\": \"Small Blue Product A\",\n \"hs_code\": \"10203040\",\n \"country_of_origin\": \"CN\",\n \"image_url\": \"https://example.com/catalog/product-a.jpg\",\n \"unit_weight\": 1.2,\n \"unit_price_excluding_tax\": 40.6,\n \"unit_price_including_tax\": 50.75,\n \"quantity\": 2,\n \"total_price_excluding_tax\": 81.2,\n \"total_price_including_tax\": 101.5,\n \"total_tax_amount\": 20.3\n }\n ]\n }\n ],\n \"addons\": [\n {\n \"value\": \"+4530274735\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.smartsend.io/api/v1/website/{team}/shipments/labels?api_token=")
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 \"internal_id\": \"1226\",\n \"internal_reference\": \"AB-00001445\",\n \"shipping_carrier\": \"postnord\",\n \"shipping_method\": \"collect\",\n \"subtotal_price_excluding_tax\": 159.2,\n \"subtotal_price_including_tax\": 199,\n \"shipping_price_excluding_tax\": 20,\n \"shipping_price_including_tax\": 25,\n \"total_price_excluding_tax\": 179.2,\n \"total_price_including_tax\": 224,\n \"total_tax_amount\": 44.8,\n \"currency\": \"EUR\",\n \"parcels\": [\n {\n \"internal_id\": \"1226\",\n \"internal_reference\": \"AB-00001445\",\n \"weight\": 2.35,\n \"height\": 12.2,\n \"width\": 15.8,\n \"length\": 30.5,\n \"freetext\": \"Leave at doorstep\",\n \"total_price_excluding_tax\": 79.2,\n \"total_price_including_tax\": 99,\n \"total_tax_amount\": 19.8,\n \"items\": [\n {\n \"internal_id\": \"1226\",\n \"internal_reference\": \"PRODUCT-1231456\",\n \"sku\": \"12345678\",\n \"name\": \"Product A\",\n \"description\": \"Small Blue Product A\",\n \"hs_code\": \"10203040\",\n \"country_of_origin\": \"CN\",\n \"image_url\": \"https://example.com/catalog/product-a.jpg\",\n \"unit_weight\": 1.2,\n \"unit_price_excluding_tax\": 40.6,\n \"unit_price_including_tax\": 50.75,\n \"quantity\": 2,\n \"total_price_excluding_tax\": 81.2,\n \"total_price_including_tax\": 101.5,\n \"total_tax_amount\": 20.3\n }\n ]\n }\n ],\n \"addons\": [\n {\n \"value\": \"+4530274735\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"shipment_id": "c5540f2b-3eea-45c4-957a-9d7b53f899e7",
"type": "label",
"internal_id": "1226",
"internal_reference": "AB-00001445",
"carrier_code": "postnord",
"carrier_name": "PostNord",
"pdf": {
"link": "https://example.com/labels/DK123456789.pdf",
"base_64_encoded": "<base64-encoded-pdf-here>"
},
"parcels": [
{
"parcel_id": "c5540f2b-3eea-45c4-957a-9d7b53f899e7",
"parcel_internal_id": "1226",
"parcel_internal_reference": "AB-00001445",
"carrier_code": "postnord",
"carrier_name": "PostNord",
"tracking_code": "DK123456789",
"tracking_link": "https://smartsend.io/tracking/DK123456789"
}
]
}
}{
"message": "Description of the error will be inserted here.",
"code": "ValidationException",
"id": "",
"errors": {},
"links": {}
}{
"message": "Description of the error will be inserted here.",
"code": "ValidationException",
"id": "",
"errors": {},
"links": {}
}{
"message": "Description of the error will be inserted here.",
"code": "ValidationException",
"id": "",
"errors": {},
"links": {}
}{
"message": "Description of the error will be inserted here."
}Authorizations
Provide API Token as Bearer authentication
Query API Token
Path Parameters
The domain of the website making the agent lookup request
Body
Input data format
Base shipment
The database id used by the website for the resource
"1226"
The id that is used to reference the resource externally
"AB-00001445"
The carrier code
postnord, gls, dao, bifrost, bring "postnord"
The code for the shipping method
"collect"
The subtotal price excluding tax
159.2
The subtotal price including tax
199
The shipping price excluding tax
20
The shipping price including tax
25
The total price excluding tax
179.2
The total price including tax
224
The total tax amount
44.8
The three letter ISO4217 currency code
"EUR"
Base Receiver
Show child attributes
Show child attributes
Base Sender
Show child attributes
Show child attributes
Base Pickup
Show child attributes
Show child attributes
List of parcels
Show child attributes
Show child attributes
List of addons
Show child attributes
Show child attributes
Response
Successful operation
Label Resource
Show child attributes
Show child attributes
Was this page helpful?