List couriers
curl --request GET \
--url https://{host}/v1/couriers \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{host}/v1/couriers', 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://{host}/v1/couriers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://{host}/v1/couriers"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"data": [
{
"type": "couriers",
"id": "postnl",
"attributes": {
"name": "PostNL",
"trackingNumberPatterns": [
"^3S[A-Z0-9]{4}[0-9]{5,11}$",
"^[A-Z]{2}[0-9]{9}NL$"
],
"buildsTrackingUrl": true,
"trackingUrlTemplate": "https://jouw.postnl.nl/track-and-trace/{number}-{country}-{postcode}",
"detectionPriority": 5
}
},
{
"type": "couriers",
"id": "ups",
"attributes": {
"name": "UPS",
"trackingNumberPatterns": [
"^1Z[0-9A-Z]{16}$"
],
"buildsTrackingUrl": true,
"trackingUrlTemplate": "https://www.ups.com/track?tracknum={number}",
"detectionPriority": 3
}
},
{
"type": "couriers",
"id": "other",
"attributes": {
"name": "Other",
"trackingNumberPatterns": [],
"buildsTrackingUrl": false,
"trackingUrlTemplate": null,
"detectionPriority": null
}
}
],
"meta": {
"total": 43
}
}{
"errors": [
{
"status": "404",
"code": "watch_reserved",
"title": "Not Found",
"detail": "<string>",
"meta": {},
"source": {
"pointer": "/data/attributes/reference",
"parameter": "<string>"
}
}
],
"jsonapi": {
"version": "1.0"
}
}Orders
List couriers
Scope: orders:read or orders:write
The couriers an order can be marked as shipped with. The id is the value
courier takes on an order; name is what the dashboard shows for it. other is
last, for a carrier we do not have.
Each also says what the dashboard does with it, so an app can do the same:
trackingNumberPatterns: regular expressions (anchors, classes and counts only) matched against the number with spaces removed and in capitals. Preselect a courier when exactly one courier’s patterns match. When several match, take the one with the lowestdetectionPriority; when none of those has one, recognise none.detectionPriority: 1 to 5 for the couriers most shops ship with (DHL Express, FedEx, UPS, DHL, PostNL), null for the rest.buildsTrackingUrl: whethertrackingUrlmay be left out on an order.trackingUrlTemplate: the link we build, for a preview, with{number}and where the carrier needs them{country}(ISO 3166 alpha-2) and{postcode}(without spaces) from the order’s shipping address. Null when we build none.
Not paged: a picker needs all of them at once. meta.total says how many.
GET
/
v1
/
couriers
List couriers
curl --request GET \
--url https://{host}/v1/couriers \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{host}/v1/couriers', 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://{host}/v1/couriers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://{host}/v1/couriers"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"data": [
{
"type": "couriers",
"id": "postnl",
"attributes": {
"name": "PostNL",
"trackingNumberPatterns": [
"^3S[A-Z0-9]{4}[0-9]{5,11}$",
"^[A-Z]{2}[0-9]{9}NL$"
],
"buildsTrackingUrl": true,
"trackingUrlTemplate": "https://jouw.postnl.nl/track-and-trace/{number}-{country}-{postcode}",
"detectionPriority": 5
}
},
{
"type": "couriers",
"id": "ups",
"attributes": {
"name": "UPS",
"trackingNumberPatterns": [
"^1Z[0-9A-Z]{16}$"
],
"buildsTrackingUrl": true,
"trackingUrlTemplate": "https://www.ups.com/track?tracknum={number}",
"detectionPriority": 3
}
},
{
"type": "couriers",
"id": "other",
"attributes": {
"name": "Other",
"trackingNumberPatterns": [],
"buildsTrackingUrl": false,
"trackingUrlTemplate": null,
"detectionPriority": null
}
}
],
"meta": {
"total": 43
}
}{
"errors": [
{
"status": "404",
"code": "watch_reserved",
"title": "Not Found",
"detail": "<string>",
"meta": {},
"source": {
"pointer": "/data/attributes/reference",
"parameter": "<string>"
}
}
],
"jsonapi": {
"version": "1.0"
}
}Authorizations
oauth2bearerAuth
Response
Every courier we know, and other.