This REST API manages customer shipping couriers for a warehouse profile. For the API to work properly, create a warehouse profile to obtain API key and warehouse ID. This API also requires a valid partner ID.
To avoid per minute quota, requests should be spread out whenever possible.
country,region,post,fee,10,20,30 gb,%,SW1%,3,10.00,12.00,14.00 us,%,90100-92199,1,4.00,4.50,5.00 us,%,75001,0.5,6.00,6.50,7.00
country,region,post,percentage GB,%,SW1%,12 US,%,90100-90199,6.75 US,%,75001,10
country,region,post,percentage GB,%,SW1%,12 US,%,90100-90199,6.75 US,%,75001,10
{
"status": {"success": true, "messages": []},
"couriers": [
{
"enabled": true,
"type": 0,
"courier": "Custom Courier",
"service": "Express Delivery",
"tags": ["parcel", "ground"],
"courierId": "f3b4a6c8-7b3c-4d2c-94ab-2c1f6cdb2c99",
"containers": [
"06bb9ea1-0fcf-4d25-90aa-c7aab916abfb"
],
"weightUnit": "lb",
"dimensionalWeightEnabled": true,
"dimensionalWeightDivisor": 139,
"dimensionalWeightMinVolume": 0,
"dimensionalWeightVolumeUnit": "in",
"ratesTable": "country,region,post,fee,1,5,10\nus,CA,90000-96999,0,8.5,10.75,13",
"postageTaxTable": "country,region,post,percentage\nus,CA,90000-96999,7.25",
"handlingTaxTable": "country,region,post,percentage\nus,CA,90000-96999,2.5"
}
]
}
{
"couriers": [
{
"enabled": true,
"type": 0,
"courier": "Custom Courier",
"service": "Express Delivery",
"containers": [
"06bb9ea1-0fcf-4d25-90aa-c7aab916abfb"
],
"tags": ["parcel", "ground"],
"weightUnit": "lb",
"dimensionalWeightEnabled": true,
"dimensionalWeightDivisor": 139,
"dimensionalWeightMinVolume": 0,
"dimensionalWeightVolumeUnit": "in",
"ratesTable": "country,region,post,fee,1,5,10\nus,CA,90000-96999,0,8.5,10.75,13",
"postageTaxTable": "country,region,post,percentage\nus,CA,90000-96999,7.25",
"handlingTaxTable": "country,region,post,percentage\nus,CA,90000-96999,2.5"
}
]
}
{
"couriers": [
{
"enabled": true,
"type": 0,
"courier": "Custom Courier",
"service": "Express Delivery",
"tags": ["parcel", "ground"],
"courierId": "f3b4a6c8-7b3c-4d2c-94ab-2c1f6cdb2c99",
"containers": [
"06bb9ea1-0fcf-4d25-90aa-c7aab916abfb"
],
"weightUnit": "lb",
"dimensionalWeightEnabled": true,
"dimensionalWeightDivisor": 139,
"dimensionalWeightMinVolume": 0,
"dimensionalWeightVolumeUnit": "in",
"ratesTable": "country,region,post,fee,1,5,10\nus,CA,90000-96999,0,8.5,10.75,13",
"postageTaxTable": "country,region,post,percentage\nus,CA,90000-96999,7.25",
"handlingTaxTable": "country,region,post,percentage\nus,CA,90000-96999,2.5"
}
],
"status": {
"success": true,
"messages": [
"Data saved succesfully."
]
}
}
Important: PUT updates only the fields you send. Fields omitted from a PUT request remain unchanged. To clear containers or tags, send an empty array. To clear ratesTable, postageTaxTable, or handlingTaxTable, send an empty string.
{
"couriers": [
{
"courierId": "f3b4a6c8-7b3c-4d2c-94ab-2c1f6cdb2c99",
"service": "Express Delivery",
"containers": [],
"tags": ["parcel"],
"ratesTable": "country,region,post,fee,1,5,10\nus,CA,90000-96999,0,9.25,11.5,14.25",
"postageTaxTable": "",
"handlingTaxTable": ""
}
]
}
{
"couriers": [
{
"enabled": true,
"type": 0,
"courier": "Custom Courier",
"service": "Express Delivery",
"tags": ["parcel"],
"courierId": "f3b4a6c8-7b3c-4d2c-94ab-2c1f6cdb2c99",
"containers": [],
"weightUnit": "lb",
"dimensionalWeightEnabled": false,
"dimensionalWeightDivisor": 1,
"dimensionalWeightMinVolume": 0,
"dimensionalWeightVolumeUnit": "in",
"ratesTable": "country,region,post,fee,1,5,10\nus,CA,90000-96999,0,9.25,11.5,14.25",
"postageTaxTable": "",
"handlingTaxTable": ""
}
],
"status": {
"success": true,
"messages": [
"Data saved succesfully."
]
}
}
{
"couriers": [
{"courierId": "f3b4a6c8-7b3c-4d2c-94ab-2c1f6cdb2c99"}
]
}
{
"status": {
"success": true,
"messages": [
"Data deleted succesfully."
]
}
}
The example code creates, updates, and deletes a custom courier. Refer to Containers API on how to manage containers.
Important: PUT updates only the fields you send. Fields omitted from a PUT request remain unchanged. To clear containers or tags, send an empty array. To clear ratesTable, postageTaxTable, or handlingTaxTable, send an empty string.
<?php
$baseUrl = "https://api.solvingmaze.com/api/v1/couriers/partner/$partner/key/$apiKey/warehouse/$warehouseId";
$headers = array('Content-Type: application/json');
$containerId = "CONTAINER_ID";
$create = array(
"couriers" => array(
array(
"enabled" => true,
"type" => 0,
"courier" => "Custom Courier",
"service" => "Express Delivery",
"containers" => array($containerId),
"tags" => array("parcel"),
"weightUnit" => "lb",
"dimensionalWeightEnabled" => true,
"dimensionalWeightDivisor" => 139,
"dimensionalWeightMinVolume" => 0,
"dimensionalWeightVolumeUnit" => "in",
"ratesTable" => "country,region,post,fee,1,5,10\nus,CA,90000-96999,0,8.5,10.75,13"
)
)
);
$ch = curl_init($baseUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($create));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$createResponse = curl_exec($ch);
curl_close($ch);
echo $createResponse;
$courierId = "COURIER_ID";
$update = array(
"couriers" => array(
array(
"courierId" => $courierId,
"enabled" => true,
"type" => 0,
"courier" => "Custom Courier",
"service" => "Express Delivery",
"containers" => array(),
"tags" => array("parcel"),
"weightUnit" => "lb",
"dimensionalWeightEnabled" => false,
"dimensionalWeightDivisor" => 1,
"dimensionalWeightMinVolume" => 0,
"dimensionalWeightVolumeUnit" => "in",
"ratesTable" => "country,region,post,fee,1,5,10\nus,CA,90000-96999,0,9.25,11.5,14.25",
"postageTaxTable" => "",
"handlingTaxTable" => ""
)
)
);
$ch = curl_init($baseUrl);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($update));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$updateResponse = curl_exec($ch);
curl_close($ch);
echo $updateResponse;
$delete = array(
"couriers" => array(
array("courierId" => $courierId)
)
);
$ch = curl_init($baseUrl);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($delete));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$deleteResponse = curl_exec($ch);
curl_close($ch);
echo $deleteResponse;
?>