Create a custom carrier type
curl --request POST \
--url https://clarus-api.com/api/custom_carrier_types \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "custom_carrier_types",
"attributes": {
"name": "DPD Express",
"code": "DPDEXP",
"print_params": {
"orientation": "portrait",
"page_width": 100,
"page_height": 150,
"top": 5,
"bottom": 5,
"left": 5,
"right": 5
}
}
}
}
'import requests
url = "https://clarus-api.com/api/custom_carrier_types"
payload = { "data": {
"type": "custom_carrier_types",
"attributes": {
"name": "DPD Express",
"code": "DPDEXP",
"print_params": {
"orientation": "portrait",
"page_width": 100,
"page_height": 150,
"top": 5,
"bottom": 5,
"left": 5,
"right": 5
}
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
type: 'custom_carrier_types',
attributes: {
name: 'DPD Express',
code: 'DPDEXP',
print_params: {
orientation: 'portrait',
page_width: 100,
page_height: 150,
top: 5,
bottom: 5,
left: 5,
right: 5
}
}
}
})
};
fetch('https://clarus-api.com/api/custom_carrier_types', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "9",
"type": "custom_carrier_types",
"attributes": {
"name": "DPD Express",
"code": "DPDEXP",
"print_params": {
"orientation": "portrait",
"page_width": 100,
"page_height": 150
}
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Custom Carrier Types
Create a custom carrier type
Create a custom carrier type with print layout parameters for its label/document template.
POST
/
api
/
custom_carrier_types
Create a custom carrier type
curl --request POST \
--url https://clarus-api.com/api/custom_carrier_types \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "custom_carrier_types",
"attributes": {
"name": "DPD Express",
"code": "DPDEXP",
"print_params": {
"orientation": "portrait",
"page_width": 100,
"page_height": 150,
"top": 5,
"bottom": 5,
"left": 5,
"right": 5
}
}
}
}
'import requests
url = "https://clarus-api.com/api/custom_carrier_types"
payload = { "data": {
"type": "custom_carrier_types",
"attributes": {
"name": "DPD Express",
"code": "DPDEXP",
"print_params": {
"orientation": "portrait",
"page_width": 100,
"page_height": 150,
"top": 5,
"bottom": 5,
"left": 5,
"right": 5
}
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
type: 'custom_carrier_types',
attributes: {
name: 'DPD Express',
code: 'DPDEXP',
print_params: {
orientation: 'portrait',
page_width: 100,
page_height: 150,
top: 5,
bottom: 5,
left: 5,
right: 5
}
}
}
})
};
fetch('https://clarus-api.com/api/custom_carrier_types', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": "9",
"type": "custom_carrier_types",
"attributes": {
"name": "DPD Express",
"code": "DPDEXP",
"print_params": {
"orientation": "portrait",
"page_width": 100,
"page_height": 150
}
}
}
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Request Structure
{
"data": {
"type": "custom_carrier_types",
"attributes": {
"name": "DPD Express",
"code": "DPDEXP",
"print_params": {
"orientation": "portrait",
"page_width": 100.0,
"page_height": 150.0
}
}
}
}
Key Fields
| Field | Required | Description |
|---|---|---|
name | No | Custom carrier type name |
code | No | Custom carrier type code |
print_params | No | Page dimensions and margins for the printable label/document template |
POST /api/custom_carrier_types/{id}/attachment.Authorizations
OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.
The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.
Body
application/json
Show child attributes
Show child attributes
Response
Created successfully
Show child attributes
Show child attributes
⌘I

