Upload shipping documents to an order
curl --request PATCH \
--url https://api.cubbo.com/v1/orders/{id}/upload-shipping-documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"shipping_documents": [
{
"filename": "label.pdf",
"base64_data": "JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==",
"content_type": "application/pdf",
"printing_type": "label",
"document_type": "base64",
"metadata": {
"tracking_number": "TRACK0000001",
"carrier": "DHL"
}
}
]
}
'import requests
url = "https://api.cubbo.com/v1/orders/{id}/upload-shipping-documents"
payload = { "shipping_documents": [
{
"filename": "label.pdf",
"base64_data": "JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==",
"content_type": "application/pdf",
"printing_type": "label",
"document_type": "base64",
"metadata": {
"tracking_number": "TRACK0000001",
"carrier": "DHL"
}
}
] }
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({
shipping_documents: [
{
filename: 'label.pdf',
base64_data: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==',
content_type: 'application/pdf',
printing_type: 'label',
document_type: 'base64',
metadata: {tracking_number: 'TRACK0000001', carrier: 'DHL'}
}
]
})
};
fetch('https://api.cubbo.com/v1/orders/{id}/upload-shipping-documents', 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://api.cubbo.com/v1/orders/{id}/upload-shipping-documents",
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([
'shipping_documents' => [
[
'filename' => 'label.pdf',
'base64_data' => 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==',
'content_type' => 'application/pdf',
'printing_type' => 'label',
'document_type' => 'base64',
'metadata' => [
'tracking_number' => 'TRACK0000001',
'carrier' => 'DHL'
]
]
]
]),
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://api.cubbo.com/v1/orders/{id}/upload-shipping-documents"
payload := strings.NewReader("{\n \"shipping_documents\": [\n {\n \"filename\": \"label.pdf\",\n \"base64_data\": \"JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==\",\n \"content_type\": \"application/pdf\",\n \"printing_type\": \"label\",\n \"document_type\": \"base64\",\n \"metadata\": {\n \"tracking_number\": \"TRACK0000001\",\n \"carrier\": \"DHL\"\n }\n }\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://api.cubbo.com/v1/orders/{id}/upload-shipping-documents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"shipping_documents\": [\n {\n \"filename\": \"label.pdf\",\n \"base64_data\": \"JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==\",\n \"content_type\": \"application/pdf\",\n \"printing_type\": \"label\",\n \"document_type\": \"base64\",\n \"metadata\": {\n \"tracking_number\": \"TRACK0000001\",\n \"carrier\": \"DHL\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cubbo.com/v1/orders/{id}/upload-shipping-documents")
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 \"shipping_documents\": [\n {\n \"filename\": \"label.pdf\",\n \"base64_data\": \"JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==\",\n \"content_type\": \"application/pdf\",\n \"printing_type\": \"label\",\n \"document_type\": \"base64\",\n \"metadata\": {\n \"tracking_number\": \"TRACK0000001\",\n \"carrier\": \"DHL\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Shipping documents uploaded: label.pdf"
}Orders
Upload shipping documents to an order
Attaches one or more files (shipping labels, invoices, other printable documents) to an order. Files are sent as base64 strings inside a JSON body, not as multipart form data. Use it to provide the shipping label of an order that ships with your own carrier, or to add documents the warehouse must print and include in the package.
- Documents are appended; documents that have content are not removed. Use
PUT /orders/{id}withshipping_documentsif you need to replace the ones you uploaded before. - An existing document of the same
printing_typewhose file is empty is replaced by the one you upload, so the warehouse prints the new file instead of the empty one. Use this to fix a label that arrived empty. - If you send a document without
metadata, it keeps the metadata of the empty document it replaces. For alabel, if no empty document had any, it takes the metadata sent with a label URL of this order that has not given back a label yet. - Each file must have content, and a file declared as
application/pdfmust be a PDF. Otherwise the request is refused with422and nothing is stored or removed. - The order can be in any status. If the order is in
error(for example because its label was missing), it is automatically re-processed after the upload. - Accepted file types: PDF, PNG and JPEG, each under 5 MB.
metadatais free-form JSON of at most 10 KB. - At least one document is required.
- Requires an API user with the “orders update” permission and access to the store.
PATCH
/
orders
/
{id}
/
upload-shipping-documents
Upload shipping documents to an order
curl --request PATCH \
--url https://api.cubbo.com/v1/orders/{id}/upload-shipping-documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"shipping_documents": [
{
"filename": "label.pdf",
"base64_data": "JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==",
"content_type": "application/pdf",
"printing_type": "label",
"document_type": "base64",
"metadata": {
"tracking_number": "TRACK0000001",
"carrier": "DHL"
}
}
]
}
'import requests
url = "https://api.cubbo.com/v1/orders/{id}/upload-shipping-documents"
payload = { "shipping_documents": [
{
"filename": "label.pdf",
"base64_data": "JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==",
"content_type": "application/pdf",
"printing_type": "label",
"document_type": "base64",
"metadata": {
"tracking_number": "TRACK0000001",
"carrier": "DHL"
}
}
] }
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({
shipping_documents: [
{
filename: 'label.pdf',
base64_data: 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==',
content_type: 'application/pdf',
printing_type: 'label',
document_type: 'base64',
metadata: {tracking_number: 'TRACK0000001', carrier: 'DHL'}
}
]
})
};
fetch('https://api.cubbo.com/v1/orders/{id}/upload-shipping-documents', 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://api.cubbo.com/v1/orders/{id}/upload-shipping-documents",
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([
'shipping_documents' => [
[
'filename' => 'label.pdf',
'base64_data' => 'JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==',
'content_type' => 'application/pdf',
'printing_type' => 'label',
'document_type' => 'base64',
'metadata' => [
'tracking_number' => 'TRACK0000001',
'carrier' => 'DHL'
]
]
]
]),
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://api.cubbo.com/v1/orders/{id}/upload-shipping-documents"
payload := strings.NewReader("{\n \"shipping_documents\": [\n {\n \"filename\": \"label.pdf\",\n \"base64_data\": \"JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==\",\n \"content_type\": \"application/pdf\",\n \"printing_type\": \"label\",\n \"document_type\": \"base64\",\n \"metadata\": {\n \"tracking_number\": \"TRACK0000001\",\n \"carrier\": \"DHL\"\n }\n }\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://api.cubbo.com/v1/orders/{id}/upload-shipping-documents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"shipping_documents\": [\n {\n \"filename\": \"label.pdf\",\n \"base64_data\": \"JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==\",\n \"content_type\": \"application/pdf\",\n \"printing_type\": \"label\",\n \"document_type\": \"base64\",\n \"metadata\": {\n \"tracking_number\": \"TRACK0000001\",\n \"carrier\": \"DHL\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cubbo.com/v1/orders/{id}/upload-shipping-documents")
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 \"shipping_documents\": [\n {\n \"filename\": \"label.pdf\",\n \"base64_data\": \"JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQ==\",\n \"content_type\": \"application/pdf\",\n \"printing_type\": \"label\",\n \"document_type\": \"base64\",\n \"metadata\": {\n \"tracking_number\": \"TRACK0000001\",\n \"carrier\": \"DHL\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Shipping documents uploaded: label.pdf"
}Authorizations
Body
application/json