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.
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"
}
}
Status
code
Meaning
400
bad_request
The body isn't valid JSON, or a header is malformed
401
unauthorized
Missing, wrong or revoked key
403
forbidden
The key doesn't have the permission this endpoint needs, or the account is suspended
404
not_found
No order, product, return or endpoint with that id
409
conflict
The order can't change that way (e.g. cancelling a despatched order), or the same Idempotency-Key is still running
422
invalid
A field is missing or wrong, or the change would break a rule such as stock below zero. details lists each field
422
idempotency_key_reused
The Idempotency-Key was used before with a different request
429
rate_limited
Too many requests. Wait for Retry-After seconds
500
server_error
Something 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.
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.
source
Use it for
pos
Till / POS system
woocommerce
WooCommerce (WordPress)
magento
Magento / Adobe Commerce
prestashop
PrestaShop
opencart
OpenCart
custom
Custom software
csv
File 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 daysPersonal 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 monthsKeep request and access logs for 12 months, then delete them.
Use buyer data only to fulfil the orderNever use marketplace buyer data for marketing, profiling or building data sets, and never pass it to anyone who would.
Report breaches within 24 hoursTell us at [email protected] within 24 hours of finding any breach or suspected leak of data from CloudDespatch.
Lock accounts downUse 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.
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"
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.
Field
In
Description
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)
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.
Field
In
Description
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"
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.
Field
In
Description
products[]
body
Same fields as PUT /products/{sku}, plus sku (array)
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.
Event
Sent when
data
order.created
A new order arrives from any channel, the API or an import
Order
order.updated
An order's status, notes or tracking changes
Order
order.despatched
A parcel leaves, with carrier, tracking and despatch code
Order
stock.changed
Stock of a product changes at a location
StockChange
stock.low
Stock at a location is at or below the product's reorder point
The event's id. Retries keep the same id, so you can ignore repeats.
X-CloudDespatch-Event
The 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.
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
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.