CloudDespatch API

Send orders, products and stock from any till, webstore or system into CloudDespatch, and get tracking back when parcels leave. JSON over HTTPS, one key per system.

Base URL
https://clouddespatch.com/api/v1

The full reference is also available as an OpenAPI 3.1 document for code generators and API tools.

Authentication

Create a key in Developers, API keys inside your CloudDespatch account. Send it with every request in the Authorization header. Keys start with cd_live_ and carry the company they belong to. We only store a fingerprint of each key, so copy it when it's shown.

Header
Authorization: Bearer cd_live_yourcompany_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Each key has permissions. Give it only what its system needs: a till key needs inventory:write, products:read and orders:read, nothing else.

PermissionAllows
orders:readList and read orders
orders:writeCreate orders, change status, cancel, add tracking, bulk-import orders
products:readRead products and stock levels
products:writeCreate, update and archive products
inventory:writeAdjust stock and record till sales
shipments:readRead tracking and despatch codes
returns:readRead returns
webhooks:manageAdd, list and delete webhook endpoints

Errors

Errors use normal HTTP status codes and always have the same shape, with a message you can show to staff. For validation errors, details lists each field that needs fixing; otherwise it is null.

422 Unprocessable Entity
{
  "error": {
    "code": "invalid",
    "details": [
      {
        "field": "items[0].qty",
        "message": "must be a whole number of at least 1"
      }
    ],
    "message": "Every item needs a sku and a qty of at least 1"
  }
}
StatuscodeMeaning
400bad_requestThe body isn't valid JSON, or a header is malformed
401unauthorizedMissing, wrong or revoked key
403forbiddenThe key doesn't have the permission this endpoint needs, or the account is suspended
404not_foundNo order, product, return or endpoint with that id
409conflictThe order can't change that way (e.g. cancelling a despatched order), or the same Idempotency-Key is still running
422invalidA field is missing or wrong, or the change would break a rule such as stock below zero. details lists each field
422idempotency_key_reusedThe Idempotency-Key was used before with a different request
429rate_limitedToo many requests. Wait for Retry-After seconds
500server_errorSomething went wrong on our side. It's safe to retry with the same Idempotency-Key

Rate limits

Each key can make 120 requests a minute. The allowance refills steadily, so short bursts are fine. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (seconds until the allowance is full again). Over the limit you get 429 with a Retry-After header in seconds. For large catalogues, send up to 500 rows at a time to POST /imports.

Pagination

Lists come newest first, 50 at a time. Ask for up to 200 with limit. When there are more, has_more is true and next_cursor holds the value to send as cursor for the next page. The Link header has the full next URL too.

GET /api/v1/orders?status=new&limit=2
{
  "data": [
    {
      "id": "CD-48231",
      "…": "…"
    },
    {
      "id": "CD-48230",
      "…": "…"
    }
  ],
  "has_more": true,
  "next_cursor": "czo0ODEy"
}
Response header

Retries and idempotency

Networks fail. To retry a POST safely, send an Idempotency-Key header with any unique value (up to 255 characters), such as your order number. If we've seen that key from your API key in the last 24 hours, you get the first response again, with Idempotent-Replayed: true, and nothing runs twice. Reusing a key with a different body returns 422 idempotency_key_reused.

Header
Idempotency-Key: WC-1001

Sources and duplicates

Tell us where an order came from with source, and send your own order number as external_ref. If the same source and reference arrive twice, you get the original order back with "duplicate": true and status 200, and nothing new is created.

sourceUse it for
posTill / POS system
woocommerceWooCommerce (WordPress)
magentoMagento / Adobe Commerce
prestashopPrestaShop
opencartOpenCart
customCustom software
csvFile import

Data use rules

Orders from marketplaces carry buyers' personal details. Marketplaces set strict rules on them, and so do we. Everyone who holds a CloudDespatch API key agrees to these rules when the key is created.

  • Delete buyer details after 30 days Personal details of marketplace buyers (names, addresses, phone numbers, emails) must be deleted or anonymised within 30 days of the order shipping.
  • Keep logs for 12 months Keep request and access logs for 12 months, then delete them.
  • Use buyer data only to fulfil the order Never use marketplace buyer data for marketing, profiling or building data sets, and never pass it to anyone who would.
  • Report breaches within 24 hours Tell us at [email protected] within 24 hours of finding any breach or suspected leak of data from CloudDespatch.
  • Lock accounts down Use multi-factor sign-in on every account that can create keys, and give each key only the permissions its system needs.
CloudDespatch applies the same rules to its own systems: buyer details are anonymised 30 days after shipment, logs are kept for 12 months, and every account can use multi-factor sign-in.

Try it

This console calls the live API with a read-only key on the demo company. Pick an example or write your own GET request. To create orders or record sales, start free and make a key under Developers in your own account; the examples below show the requests.

GET

Response appears here.

{ }

Account

GET /api/v1/me Any key

Check a key works and see its company, permissions and stock locations.

Returns 200. Errors: 401, 429.

Request
curl -X GET https://clouddespatch.com/api/v1/me \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200
{
  "data": {
    "company": "Acme Outdoor",
    "default_location": "Leeds warehouse",
    "key": "Shop till",
    "locations": [
      "Leeds warehouse",
      "Amazon FBA"
    ],
    "rate_limit": 120,
    "scopes": [
      "inventory:write",
      "products:read",
      "orders:read"
    ],
    "source": "pos",
    "tenant": "acme"
  }
}

Orders

GET /api/v1/orders Needs orders:read

List orders, newest first, one page at a time.

FieldInDescription
status query One or more of new, awaiting_pick, picking, packed, despatched, on_hold, cancelled, comma separated (string)
source query Only orders from this source, e.g. pos or woocommerce (string)
external_ref query Find the order with your own reference (string)
placed_after query Placed at or after this time (ISO 8601) (date-time)
placed_before query Placed before this time (date-time)
updated_since query Changed at or after this time (date-time)
limit query 1 to 200, default 50 (integer)
cursor query next_cursor from the previous page (string)

Returns 200. Errors: 401, 403, 422, 429.

Request
curl -X GET https://clouddespatch.com/api/v1/orders \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200
{
  "data": [
    {
      "address": {
        "city": "Leeds",
        "country": "United Kingdom",
        "line1": "1 Main Street",
        "line2": "",
        "postcode": "LS1 1AA"
      },
      "carrier": null,
      "customer": {
        "email": "[email protected]",
        "name": "Jane Doe",
        "phone": ""
      },
      "despatch_code": null,
      "despatched_at": null,
      "external_ref": "WC-1001",
      "id": "CD-48231",
      "items": [
        {
          "name": "Trail Flask 750ml",
          "price": 18.0,
          "qty": 2,
          "sku": "TFM-100"
        }
      ],
      "notes": "",
      "placed_at": "2026-10-26T11:42:07Z",
      "priority": false,
      "service": null,
      "shipping_paid": 3.99,
      "source": "woocommerce",
      "status": "new",
      "tags": [],
      "total": 39.99,
      "tracking": null,
      "tracking_url": null
    }
  ],
  "has_more": true,
  "next_cursor": "czo0ODEy"
}
GET /api/v1/orders/{id} Needs orders:read

Fetch one order by its CloudDespatch id.

FieldInDescription
idrequired path CloudDespatch order id, e.g. CD-48231 (string)

Returns 200. Errors: 401, 403, 404, 429.

Request
curl -X GET https://clouddespatch.com/api/v1/orders/CD-48231 \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200
{
  "data": {
    "address": {
      "city": "Leeds",
      "country": "United Kingdom",
      "line1": "1 Main Street",
      "line2": "",
      "postcode": "LS1 1AA"
    },
    "carrier": null,
    "customer": {
      "email": "[email protected]",
      "name": "Jane Doe",
      "phone": ""
    },
    "despatch_code": null,
    "despatched_at": null,
    "external_ref": "WC-1001",
    "id": "CD-48231",
    "items": [
      {
        "name": "Trail Flask 750ml",
        "price": 18.0,
        "qty": 2,
        "sku": "TFM-100"
      }
    ],
    "notes": "",
    "placed_at": "2026-10-26T11:42:07Z",
    "priority": false,
    "service": null,
    "shipping_paid": 3.99,
    "source": "woocommerce",
    "status": "new",
    "tags": [],
    "total": 39.99,
    "tracking": null,
    "tracking_url": null
  }
}
POST /api/v1/orders Needs orders:write

Create an order from your shop or system. Returns 201, or 200 with "duplicate": true if the same source and external_ref was sent before.

FieldInDescription
source body Where it came from: pos, woocommerce, magento, prestashop, opencart, custom (default) (string)
external_ref body Your own order number. Stops duplicates. (string)
customer.namerequired body Buyer's name (string)
customer.email, customer.phone body Contact details (string)
address.line1, line2, city, postcode, country body Delivery address. country defaults to United Kingdom (string)
items[]required body 1 to 200 lines: sku (required), qty (at least 1), price and name (default to the product's) (array)
shipping_paid body What the buyer paid for delivery (number)
status body new (default), awaiting_pick, on_hold or despatched (string)
service body Courier service, e.g. Royal Mail Tracked 48 (string)
priority, tags, notes body true/false, list of tags, free text (mixed)

Returns 201. Errors: 401, 403, 409, 422, 429.

Request
curl -X POST https://clouddespatch.com/api/v1/orders \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: WC-1001" \
  -H "Content-Type: application/json" \
  -d '{"address":{"city":"Leeds","line1":"1 Main Street","postcode":"LS1 1AA"},"customer":{"email":"[email protected]","name":"Jane Doe"},"external_ref":"WC-1001","items":[{"qty":2,"sku":"TFM-100"}],"shipping_paid":3.99,"source":"woocommerce"}'
Response 201
{
  "data": {
    "address": {
      "city": "Leeds",
      "country": "United Kingdom",
      "line1": "1 Main Street",
      "line2": "",
      "postcode": "LS1 1AA"
    },
    "carrier": null,
    "customer": {
      "email": "[email protected]",
      "name": "Jane Doe",
      "phone": ""
    },
    "despatch_code": null,
    "despatched_at": null,
    "external_ref": "WC-1001",
    "id": "CD-48231",
    "items": [
      {
        "name": "Trail Flask 750ml",
        "price": 18.0,
        "qty": 2,
        "sku": "TFM-100"
      }
    ],
    "notes": "",
    "placed_at": "2026-10-26T11:42:07Z",
    "priority": false,
    "service": null,
    "shipping_paid": 3.99,
    "source": "woocommerce",
    "status": "new",
    "tags": [],
    "total": 39.99,
    "tracking": null,
    "tracking_url": null
  }
}
PATCH /api/v1/orders/{id} Needs orders:write

Change an order's status, notes, tags or priority. Despatched and cancelled orders can't change status (409); to despatch, add tracking.

FieldInDescription
idrequired path CloudDespatch order id (string)
status body new, awaiting_pick, picking, packed, on_hold or cancelled (string)
notes body Replaces the order's notes (string)
tags body Replaces the order's tags (array)
priority body Mark as priority (boolean)

Returns 200. Errors: 401, 403, 404, 409, 422, 429.

Request
curl -X PATCH https://clouddespatch.com/api/v1/orders/CD-48231 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"notes":"Customer asked us to wait","status":"on_hold"}'
Response 200
{
  "data": {
    "address": {
      "city": "Leeds",
      "country": "United Kingdom",
      "line1": "1 Main Street",
      "line2": "",
      "postcode": "LS1 1AA"
    },
    "carrier": null,
    "customer": {
      "email": "[email protected]",
      "name": "Jane Doe",
      "phone": ""
    },
    "despatch_code": null,
    "despatched_at": null,
    "external_ref": "WC-1001",
    "id": "CD-48231",
    "items": [
      {
        "name": "Trail Flask 750ml",
        "price": 18.0,
        "qty": 2,
        "sku": "TFM-100"
      }
    ],
    "notes": "Customer asked us to wait",
    "placed_at": "2026-10-26T11:42:07Z",
    "priority": false,
    "service": null,
    "shipping_paid": 3.99,
    "source": "woocommerce",
    "status": "on_hold",
    "tags": [],
    "total": 39.99,
    "tracking": null,
    "tracking_url": null
  }
}
POST /api/v1/orders/{id}/cancel Needs orders:write

Cancel an order that hasn't been despatched. Cancelling twice is fine; a despatched order returns 409.

FieldInDescription
idrequired path CloudDespatch order id (string)
reason body Shown on the order's timeline (string)

Returns 200. Errors: 401, 403, 404, 409, 429.

Request
curl -X POST https://clouddespatch.com/api/v1/orders/CD-48231/cancel \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: cancel-order-0001" \
  -H "Content-Type: application/json" \
  -d '{"reason":"Customer changed their mind"}'
Response 200
{
  "data": {
    "address": {
      "city": "Leeds",
      "country": "United Kingdom",
      "line1": "1 Main Street",
      "line2": "",
      "postcode": "LS1 1AA"
    },
    "carrier": null,
    "customer": {
      "email": "[email protected]",
      "name": "Jane Doe",
      "phone": ""
    },
    "despatch_code": null,
    "despatched_at": null,
    "external_ref": "WC-1001",
    "id": "CD-48231",
    "items": [
      {
        "name": "Trail Flask 750ml",
        "price": 18.0,
        "qty": 2,
        "sku": "TFM-100"
      }
    ],
    "notes": "",
    "placed_at": "2026-10-26T11:42:07Z",
    "priority": false,
    "service": null,
    "shipping_paid": 3.99,
    "source": "woocommerce",
    "status": "cancelled",
    "tags": [],
    "total": 39.99,
    "tracking": null,
    "tracking_url": null
  }
}
POST /api/v1/orders/{id}/tracking Needs orders:write

Add a tracking number, for orders you ship yourself. Marks the order despatched unless despatch is false, and sends order.despatched.

FieldInDescription
idrequired path CloudDespatch order id (string)
trackingrequired body Tracking number (string)
carrier body e.g. Royal Mail, DPD (string)
service body e.g. Royal Mail Tracked 48 (string)
tracking_url body Link the customer can follow (string)
despatch body Default true. false only stores the number (boolean)

Returns 200. Errors: 401, 403, 404, 409, 422, 429.

Request
curl -X POST https://clouddespatch.com/api/v1/orders/CD-48231/tracking \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: add-tracking-0001" \
  -H "Content-Type: application/json" \
  -d '{"carrier":"Royal Mail","tracking":"TT927510620GB"}'
Response 200
{
  "data": {
    "address": {
      "city": "Leeds",
      "country": "United Kingdom",
      "line1": "1 Main Street",
      "line2": "",
      "postcode": "LS1 1AA"
    },
    "carrier": "Royal Mail",
    "customer": {
      "email": "[email protected]",
      "name": "Jane Doe",
      "phone": ""
    },
    "despatch_code": null,
    "despatched_at": "2026-10-26T15:02:11Z",
    "external_ref": "WC-1001",
    "id": "CD-48231",
    "items": [
      {
        "name": "Trail Flask 750ml",
        "price": 18.0,
        "qty": 2,
        "sku": "TFM-100"
      }
    ],
    "notes": "",
    "placed_at": "2026-10-26T11:42:07Z",
    "priority": false,
    "service": null,
    "shipping_paid": 3.99,
    "source": "woocommerce",
    "status": "despatched",
    "tags": [],
    "total": 39.99,
    "tracking": "TT927510620GB",
    "tracking_url": null
  }
}

Tills

POST /api/v1/sales Needs inventory:write

Record an in-store sale. Takes the items off stock at the location and stores a despatched order with source pos. If any line is short, nothing changes and you get 422.

FieldInDescription
items[]required body sku and qty for each line; price defaults to the product's (array)
location body Stock location name; defaults to your main warehouse (string)
external_ref body Receipt number. Stops duplicates. (string)
customer body Defaults to Walk-in customer (object)

Returns 201. Errors: 401, 403, 404, 422, 429.

Request
curl -X POST https://clouddespatch.com/api/v1/sales \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: TILL-0001" \
  -H "Content-Type: application/json" \
  -d '{"external_ref":"TILL-0001","items":[{"qty":1,"sku":"TFM-100"}],"location":"Leeds warehouse"}'
Response 201
{
  "data": {
    "address": {
      "city": "Leeds",
      "country": "United Kingdom",
      "line1": "1 Main Street",
      "line2": "",
      "postcode": "LS1 1AA"
    },
    "carrier": null,
    "customer": {
      "email": "",
      "name": "Walk-in customer",
      "phone": ""
    },
    "despatch_code": null,
    "despatched_at": null,
    "external_ref": "TILL-0001",
    "id": "CD-48231",
    "items": [
      {
        "name": "Trail Flask 750ml",
        "price": 18.0,
        "qty": 2,
        "sku": "TFM-100"
      }
    ],
    "notes": "",
    "placed_at": "2026-10-26T11:42:07Z",
    "priority": false,
    "service": null,
    "shipping_paid": 3.99,
    "source": "pos",
    "status": "despatched",
    "tags": [],
    "total": 39.99,
    "tracking": null,
    "tracking_url": null
  }
}

Products and stock

GET /api/v1/products Needs products:read

List products with stock per location. stock_available is what you can sell now (free stock at your own locations minus the buffer, never Amazon FBA); use it for webstore stock. stock_total counts every location. Archived products are left out unless you ask.

FieldInDescription
q query Search by name or SKU (string)
sku query One or more SKUs, comma separated (string)
status query active, archived or all (string)
updated_since query Changed at or after this time (date-time)
limit query 1 to 200, default 50 (integer)
cursor query next_cursor from the previous page (string)

Returns 200. Errors: 401, 403, 422, 429.

Request
curl -X GET https://clouddespatch.com/api/v1/products \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200
{
  "data": [
    {
      "barcode": "5001234567890",
      "category": "Drinkware",
      "cost": 7.12,
      "name": "Trail Flask 750ml",
      "price": 18.0,
      "reorder_point": 20,
      "reorder_qty": 50,
      "sku": "TFM-100",
      "status": "active",
      "stock": {
        "Amazon FBA": 30,
        "Leeds warehouse": 120
      },
      "stock_available": 112,
      "stock_total": 150,
      "supplier": "S-11",
      "weight_g": 340
    }
  ],
  "has_more": true,
  "next_cursor": "czo0ODEy"
}
GET /api/v1/products/{sku} Needs products:read

Fetch one product by SKU.

FieldInDescription
skurequired path Product SKU (string)

Returns 200. Errors: 401, 403, 404, 429.

Request
curl -X GET https://clouddespatch.com/api/v1/products/TFM-100 \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200
{
  "data": {
    "barcode": "5001234567890",
    "category": "Drinkware",
    "cost": 7.12,
    "name": "Trail Flask 750ml",
    "price": 18.0,
    "reorder_point": 20,
    "reorder_qty": 50,
    "sku": "TFM-100",
    "status": "active",
    "stock": {
      "Amazon FBA": 30,
      "Leeds warehouse": 120
    },
    "stock_available": 112,
    "stock_total": 150,
    "supplier": "S-11",
    "weight_g": 340
  }
}
PUT /api/v1/products/{sku} Needs products:write

Create a product, or update the fields you send. 201 when created, 200 when updated. Updating an archived product makes it active again.

FieldInDescription
skurequired path Product SKU (up to 64 characters) (string)
name body Required when creating (string)
category, barcode, supplier body Product details (string)
price, cost body Zero or more (number)
weight_g, reorder_point, reorder_qty body Whole numbers (integer)
stock body Opening stock when creating: a number for your main warehouse, or {"location": qty} (integer or object)

Returns 201. Errors: 401, 403, 422, 429.

Request
curl -X PUT https://clouddespatch.com/api/v1/products/TFM-100 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"category":"Gifts","name":"Gift card £20","price":20,"stock":50}'
Response 201
{
  "data": {
    "barcode": "5001234567890",
    "category": "Drinkware",
    "cost": 7.12,
    "name": "Trail Flask 750ml",
    "price": 18.0,
    "reorder_point": 20,
    "reorder_qty": 50,
    "sku": "TFM-100",
    "status": "active",
    "stock": {
      "Amazon FBA": 30,
      "Leeds warehouse": 120
    },
    "stock_available": 112,
    "stock_total": 150,
    "supplier": "S-11",
    "weight_g": 340
  }
}
POST /api/v1/products/{sku}/archive Needs products:write

Archive a product. It leaves product lists but stays on past orders. PUT it again to bring it back.

FieldInDescription
skurequired path Product SKU (string)

Returns 200. Errors: 401, 403, 404, 429.

Request
curl -X POST https://clouddespatch.com/api/v1/products/TFM-100/archive \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: archive-product-0001"
Response 200
{
  "data": {
    "barcode": "5001234567890",
    "category": "Drinkware",
    "cost": 7.12,
    "name": "Trail Flask 750ml",
    "price": 18.0,
    "reorder_point": 20,
    "reorder_qty": 50,
    "sku": "TFM-100",
    "status": "archived",
    "stock": {
      "Amazon FBA": 30,
      "Leeds warehouse": 120
    },
    "stock_available": 112,
    "stock_total": 150,
    "supplier": "S-11",
    "weight_g": 340
  }
}
GET /api/v1/stock Needs products:read

Stock on hand per location for each product, and whether it is at or below the reorder point.

FieldInDescription
sku query One or more SKUs, comma separated (string)
location query Only this location (string)
q query Search by name or SKU (string)
limit query 1 to 200, default 50 (integer)
cursor query next_cursor from the previous page (string)

Returns 200. Errors: 401, 403, 422, 429.

Request
curl -X GET https://clouddespatch.com/api/v1/stock \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200
{
  "data": [
    {
      "locations": [
        {
          "location": "Amazon FBA",
          "low": false,
          "on_hand": 30
        },
        {
          "location": "Leeds warehouse",
          "low": false,
          "on_hand": 120
        }
      ],
      "name": "Trail Flask 750ml",
      "reorder_point": 20,
      "sku": "TFM-100",
      "total": 150
    }
  ],
  "has_more": true,
  "next_cursor": "czo0ODEy"
}
GET /api/v1/stock/{sku} Needs products:read

Stock on hand per location for one product.

FieldInDescription
skurequired path Product SKU (string)
location query Only this location (string)

Returns 200. Errors: 401, 403, 404, 429.

Request
curl -X GET https://clouddespatch.com/api/v1/stock/TFM-100 \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200
{
  "data": {
    "locations": [
      {
        "location": "Amazon FBA",
        "low": false,
        "on_hand": 30
      },
      {
        "location": "Leeds warehouse",
        "low": false,
        "on_hand": 120
      }
    ],
    "name": "Trail Flask 750ml",
    "reorder_point": 20,
    "sku": "TFM-100",
    "total": 150
  }
}
POST /api/v1/stock/adjust Needs inventory:write

Change stock by an amount, or set it to an exact count after a stock take. Stock can't go below zero (422). Also available as POST /inventory/adjust.

FieldInDescription
skurequired body Product SKU (string)
delta body Amount to add (negative to remove) (integer)
set body Exact level; use instead of delta (integer)
location body Defaults to your main warehouse (string)
reason body Shown in stock history (string)

Returns 200. Errors: 401, 403, 404, 422, 429.

Request
curl -X POST https://clouddespatch.com/api/v1/stock/adjust \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: adjust-0001" \
  -H "Content-Type: application/json" \
  -d '{"delta":-2,"reason":"Damaged in store","sku":"TFM-100"}'
Response 200
{
  "data": {
    "locations": [
      {
        "location": "Amazon FBA",
        "low": false,
        "on_hand": 30
      },
      {
        "location": "Leeds warehouse",
        "low": false,
        "on_hand": 120
      }
    ],
    "name": "Trail Flask 750ml",
    "reorder_point": 20,
    "sku": "TFM-100",
    "total": 150
  }
}

Bulk

POST /api/v1/imports Needs products:write, orders:write or inventory:write

Send up to 500 products, 500 orders and 500 stock changes in one request. Each row is handled on its own; problems are reported by row (0-based). Needs the permission for each kind you send.

FieldInDescription
products[] body Same fields as PUT /products/{sku}, plus sku (array)
orders[] body Same fields as POST /orders (array)
stock[] body Same fields as POST /stock/adjust (array)

Returns 200. Errors: 401, 403, 422, 429.

Request
curl -X POST https://clouddespatch.com/api/v1/imports \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: imports-0001" \
  -H "Content-Type: application/json" \
  -d '{"orders":[{"customer":{"name":"Ali Khan"},"external_ref":"B-1","items":[{"qty":1,"sku":"MUG-01"}]}],"products":[{"name":"Enamel mug","price":12,"sku":"MUG-01"}],"stock":[{"set":40,"sku":"MUG-01"}]}'
Response 200
{
  "data": {
    "orders": {
      "created": 1,
      "duplicates": 0,
      "errors": [],
      "updated": 0
    },
    "products": {
      "created": 1,
      "duplicates": 0,
      "errors": [],
      "updated": 0
    },
    "stock": {
      "created": 0,
      "duplicates": 0,
      "errors": [],
      "updated": 1
    }
  }
}

Shipping

GET /api/v1/shipments Needs shipments:read

Despatched orders with tracking. Plugins call this on a schedule with since to mark orders shipped in the shop.

FieldInDescription
since query Despatched or changed at or after this time (date-time)
source query Only orders from this source (string)
limit query 1 to 200, default 50 (integer)
cursor query next_cursor from the previous page (string)

Returns 200. Errors: 401, 403, 422, 429.

Request
curl -X GET https://clouddespatch.com/api/v1/shipments \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200
{
  "data": [
    {
      "carrier": "Royal Mail",
      "despatch_code": "RM48-LS1-2610-K",
      "despatched_at": "2026-10-26T15:02:11Z",
      "external_ref": "WC-998",
      "order_id": "CD-48215",
      "service": "Royal Mail Tracked 48",
      "source": "woocommerce",
      "status": "despatched",
      "tracking": "TT927510620GB",
      "tracking_url": null
    }
  ],
  "has_more": true,
  "next_cursor": "czo0ODEy"
}
GET /api/v1/shipments/{order_id} Needs shipments:read

Tracking and despatch details for one order, to show your customer.

FieldInDescription
order_idrequired path CloudDespatch order id (string)

Returns 200. Errors: 401, 403, 404, 429.

Request
curl -X GET https://clouddespatch.com/api/v1/shipments/CD-48215 \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200
{
  "data": {
    "carrier": "Royal Mail",
    "despatch_code": "RM48-LS1-2610-K",
    "despatched_at": "2026-10-26T15:02:11Z",
    "external_ref": "WC-998",
    "order_id": "CD-48215",
    "service": "Royal Mail Tracked 48",
    "source": "woocommerce",
    "status": "despatched",
    "tracking": "TT927510620GB",
    "tracking_url": null
  }
}

Returns

GET /api/v1/returns Needs returns:read

Returns, newest first.

FieldInDescription
status query requested, approved, in_transit, received, refunded, exchanged, rejected or closed (string)
order_id query Returns for one order (string)
limit query 1 to 200, default 50 (integer)
cursor query next_cursor from the previous page (string)

Returns 200. Errors: 401, 403, 422, 429.

Request
curl -X GET https://clouddespatch.com/api/v1/returns \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200
{
  "data": [
    {
      "created_at": "2026-10-25T09:12:40Z",
      "customer": {
        "email": "[email protected]",
        "name": "Oliver Bennett"
      },
      "fee": 0.0,
      "id": "RMA-1042",
      "items": [
        {
          "condition": null,
          "name": "Trail Flask 750ml",
          "price": 18.0,
          "qty": 1,
          "reason": "Arrived damaged",
          "sku": "TFM-100"
        }
      ],
      "notes": "",
      "order_id": "CD-48190",
      "refund_amount": 18.0,
      "resolution": "refund",
      "status": "requested"
    }
  ],
  "has_more": true,
  "next_cursor": "czo0ODEy"
}
GET /api/v1/returns/{id} Needs returns:read

Fetch one return.

FieldInDescription
idrequired path Return id, e.g. RMA-1042 (string)

Returns 200. Errors: 401, 403, 404, 429.

Request
curl -X GET https://clouddespatch.com/api/v1/returns/RMA-1042 \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200
{
  "data": {
    "created_at": "2026-10-25T09:12:40Z",
    "customer": {
      "email": "[email protected]",
      "name": "Oliver Bennett"
    },
    "fee": 0.0,
    "id": "RMA-1042",
    "items": [
      {
        "condition": null,
        "name": "Trail Flask 750ml",
        "price": 18.0,
        "qty": 1,
        "reason": "Arrived damaged",
        "sku": "TFM-100"
      }
    ],
    "notes": "",
    "order_id": "CD-48190",
    "refund_amount": 18.0,
    "resolution": "refund",
    "status": "requested"
  }
}

Webhooks

GET /api/v1/webhooks Needs webhooks:manage

Your webhook endpoints.

Returns 200. Errors: 401, 403, 429.

Request
curl -X GET https://clouddespatch.com/api/v1/webhooks \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200
{
  "data": [
    {
      "active": true,
      "consecutive_failures": 0,
      "created_at": "2026-10-26T09:00:00Z",
      "description": "Order system",
      "disabled_reason": null,
      "events": [
        "order.created",
        "order.despatched"
      ],
      "id": "wh_8812",
      "last_delivery_at": null,
      "url": "https://example.co.uk/hooks/clouddespatch"
    }
  ]
}
POST /api/v1/webhooks Needs webhooks:manage

Add an endpoint. The response includes its signing secret; this is the only time the API returns it.

FieldInDescription
urlrequired body Full https:// address that accepts POST (string)
events[]required body Events to send (see Webhooks below) (array)
description body A note for yourself (string)

Returns 201. Errors: 401, 403, 422, 429.

Request
curl -X POST https://clouddespatch.com/api/v1/webhooks \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: create-webhook-0001" \
  -H "Content-Type: application/json" \
  -d '{"events":["order.created","order.despatched"],"url":"https://example.co.uk/hooks/clouddespatch"}'
Response 201
{
  "data": {
    "active": true,
    "consecutive_failures": 0,
    "created_at": "2026-10-26T09:00:00Z",
    "description": "Order system",
    "disabled_reason": null,
    "events": [
      "order.created",
      "order.despatched"
    ],
    "id": "wh_8812",
    "last_delivery_at": null,
    "secret": "whsec_3kq…",
    "url": "https://example.co.uk/hooks/clouddespatch"
  }
}
DELETE /api/v1/webhooks/{id} Needs webhooks:manage

Delete an endpoint and its delivery history.

FieldInDescription
idrequired path Endpoint id (string)

Returns 200. Errors: 401, 403, 404, 429.

Request
curl -X DELETE https://clouddespatch.com/api/v1/webhooks/wh_8812 \
  -H "Authorization: Bearer YOUR_API_KEY"
Response 200
{
  "data": {
    "deleted": true,
    "id": "wh_8812"
  }
}

Webhook events

Add an endpoint in Developers, Webhooks (or with POST /webhooks) and choose events. We send a JSON POST when each one happens, so your systems never need to ask.

EventSent whendata
order.createdA new order arrives from any channel, the API or an importOrder
order.updatedAn order's status, notes or tracking changesOrder
order.despatchedA parcel leaves, with carrier, tracking and despatch codeOrder
stock.changedStock of a product changes at a locationStockChange
stock.lowStock at a location is at or below the product's reorder pointStockLow
return.createdA customer asks to send something backReturn
product.updatedA product is created, changed or archivedProduct

Payload

POST to your endpoint
{
  "created_at": "2026-10-26T15:02:11Z",
  "data": {
    "address": {
      "city": "Leeds",
      "country": "United Kingdom",
      "line1": "1 Main Street",
      "line2": "",
      "postcode": "LS1 1AA"
    },
    "carrier": "Royal Mail",
    "customer": {
      "email": "[email protected]",
      "name": "Jane Doe",
      "phone": ""
    },
    "despatch_code": "RM48-LS1-2610-K",
    "despatched_at": "2026-10-26T15:02:11Z",
    "external_ref": "WC-1001",
    "id": "CD-48231",
    "items": [
      {
        "name": "Trail Flask 750ml",
        "price": 18.0,
        "qty": 2,
        "sku": "TFM-100"
      }
    ],
    "notes": "",
    "placed_at": "2026-10-26T11:42:07Z",
    "priority": false,
    "service": "Royal Mail Tracked 48",
    "shipping_paid": 3.99,
    "source": "woocommerce",
    "status": "despatched",
    "tags": [],
    "total": 39.99,
    "tracking": "TT927510620GB",
    "tracking_url": null
  },
  "event": "order.despatched",
  "id": "evt_Qm9yZXN0Z3VtcA",
  "tenant": "acme"
}

Headers

X-CloudDespatch-Signaturet=<unix time>,v1=<signature>
X-CloudDespatch-Event-Id The event's id. Retries keep the same id, so you can ignore repeats.
X-CloudDespatch-EventThe event name, e.g. order.despatched

Delivery and retries

Answer with any 2xx status within 10 seconds. Anything else counts as a failure and we try again with growing gaps (about 30 seconds, then 1, 2, 4, 8, 16 and 32 minutes), up to 8 attempts in all. Every attempt shows in the endpoint's delivery log. After 15 failures in a row we turn the endpoint off and email the account owner; turn it back on from the Developers screen once it's fixed.

Checking signatures

The signature is the HMAC-SHA256, as lowercase hex, of the timestamp, a full stop and the raw request body ("<t>.<body>"), keyed with the endpoint's signing secret. Compute it yourself, compare it in constant time, and reject requests older than five minutes so a captured request can't be replayed.

PHP
<?php
// $signingSecret comes from Developers > Webhooks > your endpoint.
$payload = file_get_contents('php://input');
$header  = $_SERVER['HTTP_X_CLOUDDESPATCH_SIGNATURE'] ?? '';

$parts = ['t' => [], 'v1' => []];
foreach (explode(',', $header) as $pair) {
    [$k, $v] = array_pad(explode('=', trim($pair), 2), 2, '');
    $parts[$k][] = $v;
}
$t = (int) ($parts['t'][0] ?? 0);
$expected = hash_hmac('sha256', $t . '.' . $payload, $signingSecret);

$valid = abs(time() - $t) <= 300;
$valid = $valid && count(array_filter($parts['v1'], fn ($s) => hash_equals($expected, $s))) > 0;
if (!$valid) {
    http_response_code(401);
    exit;
}

$event = json_decode($payload, true); // ['id' => 'evt_…', 'event' => 'order.created', 'data' => […]]
http_response_code(200);

Webstore plugins

For WooCommerce (WordPress), Magento 2, PrestaShop and OpenCart you don't need to write code. Install our plugin, paste the API address and a connection key, and it uses this API for you:

  • each paid order goes to POST /orders with the shop's order number as external_ref
  • every 15 minutes it reads GET /shipments and marks despatched orders shipped, with tracking
  • stock levels are copied into the shop from GET /products (stock_available: free stock at your own warehouses minus the buffer, never Amazon FBA)

Set it up from Developers, Plugins in your account; it walks you through each step and checks the connection.

Tills and POS

Any till that can make an HTTPS request can share stock with your online channels. Create a till key, then:

  • send each sale to POST /sales; it takes the items off stock and appears in sales reports
  • read stock with GET /stock so the till knows what sold out online
  • after a stock count, send exact numbers with set on POST /stock/adjust

File import and export

If a system can only export a spreadsheet, use Import in your account. Upload a CSV (up to 20 MB, comma, semicolon or tab separated) of orders, products, stock levels or suppliers, match its columns to ours, check the rows, and import. It uses the same rules as the API, including duplicate checks on order references. Orders, products and stock can be exported as CSV from the same screen.