Table of Content
Overview
Test
Create Label
Authentication
Create Order
Get Orders
Get Order
Update Order
Delete Order
Get Order Inventory
Get Couriers
Get Courier Services
Get Order Despatch
Get Inventory Item
Get Inventory Stock
Get Inventory Locations
Delete Inventory Item
Add Inventory to Order
Update Order Inventory
Remove Order Inventory
Create Inventory
Update Inventory
Add Inventory Stock Location
Delete Inventory Location
Inventory Stock Movement
Ship & Despatch Order
Remove Location From Inventory
Overview
Despatch Cloud's REST API allows you to perform 'RESTful' operations such as reading, modifying, adding or deleting data from your Despatch Cloud account.
The Despatch Cloud API is free to use on all Despatch Cloud v6 premium accounts.
Test
If you wish to perform a test connection to the API to ensure that you can reach endpoints and that your API key is valid, you can call this endpoint to conduct a test.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/connect_test
Method: GET
Example Response:
{
"success": true
}
Create Label
Creates a shipment in your Despatch Cloud account and will return a courier label.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/create_shipment
Method: POST
| Field Name | Required | Format | Notes |
| order_id | No | String | Automatically generated if empty. |
| alt_id | No | String | |
| shipping_name_company | No | String | |
| shipping_name | Yes | String | |
| shipping_address_line_one | Yes | String | |
| shipping_address_line_two | No | String | |
| shipping_address_city | Yes | String | |
| shipping_address_county | Conditional | String | This is required for certain countries, such as US or CA who have ISO 3166-2 codes for States (eg. Florida = FL, California = CA). |
| shipping_address_postcode | Conditional | String | Required in all cases, apart from countries such as IE where post/zip codes aren't mandatory, however, this may be courier specific. |
| shipping_address_iso | Yes | String | ISO 3166-2 code (eg. United Kingdom = GB, Germany = DE, France = FR, Japan = JP). |
| Conditional | String | If the courier service offers an email update service, they may insist this information is sent. | |
| phone_one | Conditional | String | If the courier service offers an SMS update service, they may insist this information is sent. Alternatively, this may be used to contact the recipient in the event of an issue with delivery. |
| total_paid | Yes | Float/Integer | Value of the contents of the shipment. |
| payment_currency | Yes | String | ISO 4217 code for the currency of the value of the shipment (eg. £ = GBP, € = EUR, $ = USD/CAD). |
| shipping_service_id | Yes | Integer | Shipping Rule ID of the shipping service you wish to use to ship the order. |
| weight | Yes | Float/Integer | Weight in kilograms. Can be submitted as a whole number or as a float to 3 decimal places (eg. 2kg // 1.998 kg). |
| value | Yes | Float/Integer | Value of the individual parcel. Can be submitted as a whole number or as a float to 2 decimal places (eg. £2 // £1.99). |
| width | Yes | Float/Integer | Width in centimetres of the parcel. Can be submitted as a whole integer or as a float to 2 decimal places (eg. 30cm // 29.98cm). |
| length | Yes | Float/Integer | Length in centimetres of the parcel. Can be submitted as a whole integer or as a float to 2 decimal places (eg. 30cm // 29.98cm). |
| height | Yes | Float/Integer | Height in centimetres of the parcel. Can be submitted as a whole integer or as a float to 2 decimal places (eg. 30cm // 29.98cm). |
Example Request (POST):
{
"order_id": "1234567890",
"alt_id": "0987654321",
"shipping_address": {
"shipping_name_company": "Despatch Cloud Ltd",
"shipping_name": "John Doe",
"shipping_address_line_one": "Fake Street",
"shipping_address_line_two": "Fake Area",
"shipping_address_city": "Fakeville",
"shipping_address_county": "Fakeshire",
"shipping_address_country": "United Kingdom",
"shipping_address_postcode": "FA11 1KE",
"shipping_address_iso": "GB"
},
"contact": {
"email": "[email protected]",
"phone_one": "01234567890"
},
"payment": {
"total_paid": "0.01",
"payment_currency": "GBP"
},
"shipping_service_id": 119,
"parcels": [
{
"weight": 3,
"value": 25,
"width": 30,
"length": 20,
"height": 10
},
{
"weight": 3,
"value": 25,
"width": 30,
"length": 20,
"height": 10
}
]
}
Example Response:
{
"status": "SUCCESS",
"order_id": "1234567890",
"despatch_cloud_ref": "DC-1570625609-435",
"shipping_service": 219,
"label_type": "pdf",
"label": "QSBiYXNlLTY0IGVuY29kZWQgbGFiZWwgd2lsbCBhcHBlYXIgaGVyZSE=",
"tracking_code": "12345678900987654321A",
"service_code": null,
"courier_name": "DPD"
}
Authentication
Requests to the Despatch Cloud API must authenticate using an API key.
By default, a Despatch Cloud account doesn't have an API key. You can create an API key in Settings under "General Settings" > "Web Service".
The client can authenticate itself by sending an appropriate HTTP request header.
The header's name should be Authorization: and its value should be DC followed by your API key.
Authorization: DC YOUR-API-KEY
Authorization: DC AE5A7FA6E44C50C3AA7023EAB4BBD026
The above is an example using API key "AE5A7FA6E44C50C3AA7023EAB4BBD026".
Example Request:
curl --header "Authorization: DC YOUR-API-KEY" https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/create_order/
Example Response:
{"status":"SUCCESS","order_id":"1529938140-52"}
Create Order
Creates a new order in Despatch Cloud and returns a success or failure message as well as the order id of the order created.
This API call can be used to create both manual orders and orders linked to a sales channel setup in Despatch Cloud.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/create_order
Method: POST
| Field Name | Required | Format | Notes |
| order_id | No | String | Automatically generated if empty. |
| channel_id | No | String | |
| channel_alt_id | No | String | |
| date_received | No | Unix Time Stamp | Automatically generated if empty. |
| sales_channel | No | String | Must be a valid sales channel, Automatically set to manual if empty. |
| status | No | Integer | 1 = Draft / 2 = On Hold / 3 = Ready |
| invoice_name_company | No | String | |
| invoice_name | No | String | |
| invoice_address_line_one | No | String | |
| invoice_address_line_two | No | String | |
| invoice_address_city | No | String | |
| invoice_address_county | No | String | |
| invoice_address_country | No | String | |
| invoice_address_postcode | No | String | |
| invoice_address_iso | No | String | |
| shipping_name_company | No | String | |
| shipping_name | No | String | |
| shipping_address_line_one | No | String | |
| shipping_address_line_two | No | String | |
| shipping_address_city | No | String | |
| shipping_address_county | No | String | |
| shipping_address_country | No | String | |
| shipping_address_postcode | No | String | |
| shipping_address_iso | No | String | |
| No | String | ||
| phone_one | No | String | |
| phone_two | No | String | |
| total_paid | No | String | |
| tax_paid | No | String | |
| shipping_paid | No | String | |
| payment_method | No | String | |
| payment_ref | No | String | |
| payment_currency | No | String | |
| shipping_method_requested | No | String | |
| customer_comments | No | String | |
| staff_notes | No | String |
Example Request (POST):
{
"order": {
"order_id": "123456789-9",
"channel_id": "1",
"channel_alt_id": "",
"shipping_name_company": "Despatch Cloud Ltd",
"shipping_name": "Jane Doe",
"shipping_address_line_one": "Unit 76",
"shipping_address_line_two": "Warfield Road",
"shipping_address_city": "Driffield",
"shipping_address_county": "East Yorkshire",
"shipping_address_country": "United Kingdom",
"shipping_address_postcode": "YO25 9DJ",
"shipping_address_iso": "GB",
"invoice_name_company": "Despatch Cloud Ltd",
"invoice_name": "Jane Doe",
"invoice_address_line_one": "Unit 76",
"invoice_address_line_two": "Warfield Road",
"invoice_address_city": "Driffield",
"invoice_address_county": "East Yorkshire",
"invoice_address_country": "United Kingdom",
"invoice_address_postcode": "YO25 9DJ",
"invoice_address_iso": "GB",
"email": "[email protected]",
"phone_one": "01377455180",
"phone_two": "",
"total_paid": "24.00",
"tax_paid": "4.00",
"shipping_paid": "4.00",
"total_discount": "0.00",
"shipping_method_requested": "Next Day",
"shipping_tracking_code": "",
"payment_method": "Shopifypayments",
"payment_ref": "",
"payment_currency": "GBP",
"sales_channel": "Shopify",
"date_received": "1564655767",
"date_dispatched": "0",
"status": "1",
"customer_comments": "",
"staff_comments": "",
"deleted": "0",
"files": "",
"discount_code_used": "",
"coupon_code": "",
"inventory": [
{
"stock_code": "TESTSKU",
"name": "Test Product",
"quantity": 1,
"price": "30.00",
"options": "Colour: Brown | Size: 9",
"notes": ""
}
]
}
}
Example Response:
{"status":"SUCCESS","order_id":"123456789-9"}
Get Orders
You can obtain a selection/all orders using the following endpoint
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/get_orders?page={page}&limit={limit}&date_from={{YYYY-MM-DD}}&date_to={{YYYY-MM-DD}}&status={{integer}}
Method: GET
Statuses correspond to the order status which can be found in the status manager. If no status is specified, it will not be used as a filter.
Example Response:
{
"status": "SUCCESS",
"order": {
"order_id": "123456789-0",
"channel_id": "1",
"channel_alt_id": "",
"shipping_name_company": "Despatch Cloud Ltd",
"shipping_name": "Jane Doe",
"shipping_address_line_one": "Unit 76",
"shipping_address_line_two": "Warfield Road",
"shipping_address_city": "Driffield",
"shipping_address_county": "East Yorkshire",
"shipping_address_country": "United Kingdom",
"shipping_address_postcode": "YO25 9DJ",
"shipping_address_iso": "GB",
"invoice_name_company": "Despatch Cloud Ltd",
"invoice_name": "Jane Doe",
"invoice_address_line_one": "Unit 76",
"invoice_address_line_two": "Warfield Road",
"invoice_address_city": "Driffield",
"invoice_address_county": "East Yorkshire",
"invoice_address_country": "United Kingdom",
"invoice_address_postcode": "YO25 9DJ",
"invoice_address_iso": "GB",
"email": "[email protected]",
"phone_one": "01377455180",
"phone_two": "",
"total_paid": "24.00",
"tax_paid": "4.00",
"shipping_paid": "4.00",
"total_discount": "0.00",
"shipping_method_requested": "Next Day",
"shipping_tracking_code": "",
"payment_method": "Shopifypayments",
"payment_ref": "",
"payment_currency": "GBP",
"sales_channel": "Shopify",
"date_received": "1564655767",
"date_dispatched": "0",
"status": "1",
"customer_comments": "",
"staff_comments": "",
"deleted": "0",
"files": "s:0:\"\";",
"discount_code_used": "",
"coupon_code": "",
"inventory": [
{
"id": "5341",
"stock_code": "Test01",
"quantity": "1",
"name": "Test Product 1",
"unit_price": "8.00",
"line_total_discount": "0.00",
"options": "",
"notes": "",
"sales_channel_item_id": ""
}
]
}
}
Get Order
Retrieves the order details of the specified order ID
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/get_order/{order_id}
Method: GET
Example Response:
{
"status": "SUCCESS",
"order": {
"order_id": "123456789-0",
"channel_id": "1",
"channel_alt_id": "",
"shipping_name_company": "Despatch Cloud Ltd",
"shipping_name": "Jane Doe",
"shipping_address_line_one": "Unit 76",
"shipping_address_line_two": "Warfield Road",
"shipping_address_city": "Driffield",
"shipping_address_county": "East Yorkshire",
"shipping_address_country": "United Kingdom",
"shipping_address_postcode": "YO25 9DJ",
"shipping_address_iso": "GB",
"invoice_name_company": "Despatch Cloud Ltd",
"invoice_name": "Jane Doe",
"invoice_address_line_one": "Unit 76",
"invoice_address_line_two": "Warfield Road",
"invoice_address_city": "Driffield",
"invoice_address_county": "East Yorkshire",
"invoice_address_country": "United Kingdom",
"invoice_address_postcode": "YO25 9DJ",
"invoice_address_iso": "GB",
"email": "[email protected]",
"phone_one": "01377455180",
"phone_two": "",
"total_paid": "24.00",
"tax_paid": "4.00",
"shipping_paid": "4.00",
"total_discount": "0.00",
"shipping_method_requested": "Next Day",
"shipping_tracking_code": "",
"payment_method": "Shopifypayments",
"payment_ref": "",
"payment_currency": "GBP",
"sales_channel": "Shopify",
"date_received": "1564655767",
"date_dispatched": "0",
"status": "1",
"customer_comments": "",
"staff_comments": "",
"deleted": "0",
"files": "s:0:\"\";",
"discount_code_used": "",
"coupon_code": "",
"inventory": [
{
"id": "5341",
"stock_code": "Test01",
"quantity": "1",
"name": "Test Product 1",
"unit_price": "8.00",
"line_total_discount": "0.00",
"options": "",
"notes": "",
"sales_channel_item_id": ""
}
]
}
}
Update Order
Updates an existing order in Despatch Cloud and returns a success or failure message as well as the Order ID of the order updated.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/update_order/{order_id}
Method: POST
| Field Name | Required | Format | Notes |
| channel_id | No | String | |
| channel_alt_id | No | String | |
| date_received | No | Unix Time Stamp | Automatically generated if empty. |
| sales_channel | No | String | Must be a valid sales channel, Automatically set to manual if empty. |
| status | No | Integer | 1 = Draft / 2 = On Hold / 3 = Ready |
| invoice_name_company | No | String | |
| invoice_name | No | String | |
| invoice_address_line_one | No | String | |
| invoice_address_line_two | No | String | |
| invoice_address_city | No | String | |
| invoice_address_county | No | String | |
| invoice_address_country | No | String | |
| invoice_address_postcode | No | String | |
| invoice_address_iso | No | String | |
| shipping_name_company | No | String | |
| shipping_name | No | String | |
| shipping_address_line_one | No | String | |
| shipping_address_line_two | No | String | |
| shipping_address_city | No | String | |
| shipping_address_county | No | String | |
| shipping_address_country | No | String | |
| shipping_address_postcode | No | String | |
| shipping_address_iso | No | String | |
| No | String | ||
| phone_one | No | String | |
| phone_two | No | String | |
| total_paid | No | String | |
| tax_paid | No | String | |
| shipping_paid | No | String | |
| payment_method | No | String | |
| payment_ref | No | String | |
| payment_currency | No | String | |
| shipping_method_requested | No | String | |
| customer_comments | No | String | |
| staff_notes | No | String |
Example Request (POST):
{
"order": {
"channel_id": "1",
"channel_alt_id": "",
"shipping_name_company": "Despatch Cloud Ltd",
"shipping_name": "Jane Doe",
"shipping_address_line_one": "Unit 76",
"shipping_address_line_two": "Warfield Road",
"shipping_address_city": "Driffield",
"shipping_address_county": "East Yorkshire",
"shipping_address_country": "United Kingdom",
"shipping_address_postcode": "YO25 9DJ",
"shipping_address_iso": "GB",
"invoice_name_company": "Despatch Cloud Ltd",
"invoice_name": "Jane Doe",
"invoice_address_line_one": "Unit 76",
"invoice_address_line_two": "Warfield Road",
"invoice_address_city": "Driffield",
"invoice_address_county": "East Yorkshire",
"invoice_address_country": "United Kingdom",
"invoice_address_postcode": "YO25 9DJ",
"invoice_address_iso": "GB",
"email": "[email protected]",
"phone_one": "01377455180",
"phone_two": "",
"total_paid": "24.00",
"tax_paid": "4.00",
"shipping_paid": "4.00",
"total_discount": "0.00",
"shipping_method_requested": "Next Day",
"shipping_tracking_code": "",
"payment_method": "Shopifypayments",
"payment_ref": "",
"payment_currency": "GBP",
"sales_channel": "Shopify",
"date_received": "1564655767",
"date_dispatched": "0",
"status": "1",
"customer_comments": "",
"staff_comments": "",
"deleted": "0",
"files": "",
"discount_code_used": "",
"coupon_code": ""
}
}
Example Response:
{"status":"SUCCESS","order_id":"123456789-9"}
Delete Order
You can delete an order via the Web Service API by specifing an Order ID in the endpoint.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/delete_order/{order_id}
Method: GET
Example Response:
{
"status": "SUCCESS"
}
Get Order Inventory
By specifying an Order ID in the URL, you can retrieve the inventory items from the corresponding order.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/get_order_inventory/{order_id}
Method: GET
Example Response:
{
"status": "SUCCESS",
"order_id": "123456789-9",
"inventory": [
{
"id": "5341",
"stock_code": "Test01",
"quantity": "1",
"name": "Test Product 1",
"unit_price": "8.00",
"line_total_discount": "0.00",
"options": "",
"notes": "",
"sales_channel_item_id": "",
"price": "8.00"
}
]
}
Get Couriers
You can obtain a list of all couriers on your account.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/get_couriers
Method: GET
Example Response:
{
"status": "SUCCESS",
"couriers": [
{
"courier_id": "dhl",
"platform": "dhl",
"name": "DHL"
},
{
"courier_id": "dpd",
"platform": "dpd",
"name": "DPD"
},
{
"courier_id": "hermes",
"platform": "hermes",
"name": "Hermes"
},
{
"courier_id": "other",
"platform": "other",
"name": "Other"
},
{
"courier_id": "royalmail_demo",
"platform": "royalmail_demo",
"name": "Royal Mail Demo"
},
{
"courier_id": "ukmail_dom",
"platform": "ukmail-dom",
"name": "UK Mail Domestic"
},
{
"courier_id": "ukmail_intl",
"platform": "ukmail_international",
"name": "UK Mail International"
}
]
}
Get Courier Services
You can obtain a list of the courier services on your account.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/get_courier_services/{{courier_id}}
Method: GET
Specifying {{courier_id}} is optional. Not specifying will show all courier services on your account. The {{courier_id}} allows you to filter services by courier (i.e. if you wanted just to show DHL services).
Example Response:
{
"status": "SUCCESS",
"courier_services": [
{
"service_id": "1",
"courier": "royalmail_demo",
"enabled": "1",
"name": "Demo",
"local_tracking": "0",
"pd_options": "0",
"default_dimensions_l": "0.0",
"default_dimensions_w": "0.0",
"default_dimensions_h": "0.0",
"config": "",
"local_tracking_url": "",
"courier_eta": "",
"included_postcodes": "",
"excluded_postcodes": "",
"use_postcode": ""
},
{
"service_id": "3",
"courier": "other",
"enabled": "1",
"name": "Test Other",
"local_tracking": "0",
"pd_options": "0",
"default_dimensions_l": "0.0",
"default_dimensions_w": "0.0",
"default_dimensions_h": "0.0",
"config": "",
"local_tracking_url": "",
"courier_eta": "",
"included_postcodes": "",
"excluded_postcodes": "",
"use_postcode": ""
}
]
}
Get Order Despatch
You can obtain the despatch information about an order.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/get_order_pack/{{order_id}}
Method: GET
Specifying {{order_id}} is required. Not specifying will show an error.
Example Response:
{
"status": "SUCCESS",
"order_pack": [
{
"order_id": "1569928829-50",
"eod": "1",
"print_ref": "DC-1569928880-703",
"shipping_service": "TEST SERVICE",
"shipping_tracking_code": "",
"shipping_weight": "0.250",
"packing_note": "Label Shipping Address, Phone, Email & Currency: Despatch Cloud Ltd John Doe Unit 76 Warfield Road Driffield East Yorkshire GB United Kingdom YO25 9DJ 01377455180 [email protected] GBP ",
"date_dispatched": "1570708812",
"total_pick_count": "5",
"staff_id": "Jane Doe",
"shipping_cost": "0.00",
"package_value": "0.00",
"shipping_label": "url/to/shipping/label/here.pdf",
"shipping_label_type": "pdf",
"total_pieces": "1",
"shipping_status": "1",
"date_processed": "1570708806",
"courier": "other",
"carrier_ref_code": "",
"carrier_ref_number": "",
"shipping_tracking_url": ""
}
]
}
Get Inventory Item
By specifying a Product Code at the end of the endpoint, you can bring up information about the corresponding product.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/get_inventory/{product_code}
Method: GET
Example Response:
{
"status": "SUCCESS",
"inventory": {
"product_id": "21584",
"product_code": "Test5",
"product_type_id": "1",
"item_barcode": "2123456",
"item_barcode_2": "",
"item_barcode_3": "",
"item_barcode_4": "",
"item_barcode_5": "",
"name": "Test Product 5",
"image": "Test5.jpg",
"stock_warn_level": "0",
"sync_stock": "1",
"production": "0",
"product_weight": "0.475",
"product_height": "0.0",
"product_width": "0.0",
"product_length": "0.0",
"date_added": "0",
"data_array": "",
"description": "",
"supplier": "",
"cost_price": "0.00",
"last_updated": "1564658547",
"vat_option": "0",
"accounts_code": "",
"max_level": "0",
"multiplier": "1",
"retail_price": "0.00",
"shipping_service_id": "0",
"stock_level": 0,
"locations": [
{
"il_id": "21603",
"product_id": "21584",
"location_id": "0",
"stock_level": "0",
"stock_warn_level": "0",
"priority": "10",
"parent_location_id": "0",
"location_name": "Default",
"location_type_id": "1",
"pickable": "0",
"on_hand_stock": "1",
"deleted_status": "0",
"location_type": "Default",
"location_priority": "1000"
}
]
}
}
Get Inventory Stock
By specifying a Product Code at the end of the endpoint, you can bring up stock and location information about the corresponding product.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/get_inventory_locations
Method: GET
Example Response:
{
"status": "SUCCESS",
"inventory": {
"product_code": "Test5",
"product_id": "21584",
"stock_level": 12,
"on_puchase_order": 0,
"locations": [
{
"il_id": "21603",
"product_id": "21584",
"location_id": "A1",
"stock_level": "12",
"stock_warn_level": "0",
"priority": "10",
"parent_location_id": "0",
"location_name": "Default",
"location_type_id": "1",
"pickable": "0",
"on_hand_stock": "1",
"deleted_status": "0",
"location_type": "Default",
"location_priority": "1000"
}
]
}
}
Get Inventory Locations
Simply sending a GET request to the endpoint will list and detail all of your inventory locations.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/get_inventory_locations
Method: GET
Example Response:
{
"status": "SUCCESS",
"locations": [
{
"location_id": "0",
"parent_location_id": "0",
"location_name": "Default",
"location_type_id": "1",
"priority": "1000",
"pickable": "0",
"on_hand_stock": "1",
"deleted_status": "0",
"location_type": "Default"
},
{
"location_id": "1",
"parent_location_id": "0",
"location_name": "Returns",
"location_type_id": "1",
"priority": "1000",
"pickable": "0",
"on_hand_stock": "1",
"deleted_status": "0",
"location_type": "Default"
},
{
"location_id": "1308",
"parent_location_id": "0",
"location_name": "Test",
"location_type_id": "1",
"priority": "1",
"pickable": "1",
"on_hand_stock": "1",
"deleted_status": "0",
"location_type": "Default"
}
]
}
Delete Inventory Item
Simply sending a GET request and amending the endpoint with your Product Code, you can delete an inventory item.Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/delete_inventory/{ProductCode}
Method: GET
Example Response:
{
"status": "SUCCESS"
}
Add Inventory to Order
By specifying an Order ID, you can add inventory to an existing order.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/add_order_inventory/{OrderId}
Method: POST
| Field Name | Required | Format | Notes |
| stock_code | Yes | String | |
| quantity | Yes | Integer | |
| name | No | String | |
| unit_price | No | String | |
| line_total_discount | No | String | |
| options | No | Integer | |
| notes | No | String | |
| sales_channel_item_id | No | String |
Example Request (POST):
{
"inventory": {
"stock_code": "Test5",
"quantity": "5",
"name": "Test Product 5",
"unit_price": "5.00",
"line_total_discount": "0.00",
"options": "",
"notes": "",
"sales_channel_item_id": ""
}
}
Example Response:
{
"status": "SUCCESS"
}
Update Order Inventory
By specifying an Order ID, you can update the inventory attached to an order.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/update_order_inventory/{OrderId}
Method: POST
| Field Name | Required | Format | Notes |
| id | Yes | Integer | |
| stock_code | Yes | String | |
| quantity | Yes | Integer | |
| name | No | String | |
| unit_price | No | String | |
| line_total_discount | No | String | |
| options | No | Integer | |
| notes | No | String | |
| sales_channel_item_id | No | String |
Example Request (POST):
{
"inventory": {
"id": 1234,
"stock_code": "Test5",
"quantity": 5,
"name": "Test Product 5",
"unit_price": "5.00",
"line_total_discount": "0.00",
"options": "",
"notes": "",
"sales_channel_item_id": ""
}
}
Example Response:
{
"status": "SUCCESS"
}
Remove Order Inventory
Simply sending a GET request and amending the endpoint with the inventory location ID, you can remove the inventory location.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/remove_order_inventory/{id}
Method: GET
Example Response:
{
"status": "SUCCESS"
}
Create Inventory
By sending through a JSON body, you can create inventory in your Despatch Cloud account.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/create_inventory/
Method: POST
| Field Name | Required | Format | Notes |
| product_code | Yes | String | |
| item_barcode | No | String | |
| item_barcode_2 | No | String | |
| item_barcode_3 | No | String | |
| item_barcode_4 | No | String | |
| name | No | String | |
| image | No | String | |
| stock_warn_level | No | Integer | |
| sync_stock | No | Boolean | |
| product_weight | No | String | |
| product_height | No | String | |
| product_width | No | String | |
| product_length | No | String | |
| description | No | String | |
| cost_price | No | String | |
| max_level | No | String | |
| multiplier | No | String | |
| retail_price | No | String |
Example Request (POST)
{
"inventory":{
"product_code":"TESTSKU6",
"item_barcode":"0123456789101",
"item_barcode_2":"",
"item_barcode_3":"",
"item_barcode_4":"",
"item_barcode_5":"",
"name":"Test Product 6",
"image":"https://via.placeholder.com/500.jpg",
"stock_warn_level":"0",
"sync_stock":"1",
"product_weight":"0.500",
"product_height":"0.0",
"product_width":"0.0",
"product_length":"0.0",
"description":"",
"cost_price":"0.00",
"max_level":"0",
"multiplier":"1",
"retail_price":"0.00"
}
}
Example Response:
{
"status": "SUCCESS"
}
Update Inventory
You can update product attributes by specifying a product code at the end of the URL.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/update_inventory/{product_code}
Method: POST
| Field Name | Required | Format | Notes |
| item_barcode | No | String | |
| item_barcode_2 | No | String | |
| item_barcode_3 | No | String | |
| item_barcode_4 | No | String | |
| name | No | String | |
| image | No | String | |
| stock_warn_level | No | Integer | |
| sync_stock | No | Boolean | |
| product_weight | No | String | |
| product_height | No | String | |
| product_width | No | String | |
| product_length | No | String | |
| description | No | String | |
| cost_price | No | String | |
| max_level | No | String | |
| multiplier | No | String | |
| retail_price | No | String |
Example Request (POST)
{
"inventory": {
"item_barcode": "0123456789101",
"item_barcode_2": "",
"item_barcode_3": "",
"item_barcode_4": "",
"item_barcode_5": "",
"name": "Test Product 6",
"image": "https://via.placeholder.com/500.jpg",
"stock_warn_level": "0",
"sync_stock": "1",
"product_weight": "0.500",
"product_height": "0.0",
"product_width": "0.0",
"product_length": "0.0",
"description": "",
"cost_price": "0.00",
"max_level": "0",
"multiplier": "1",
"retail_price": "0.00"
}
}
Example Response:
{
"status": "SUCCESS"
}
Add Inventory Stock Location
You can add a stock location and inventory to a product by specifying an SKU at the end of the URL.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/add_inventory_stock_location/(product_code)
Method: POST
| Field Name | Required | Format | Notes |
| location_id | Yes | Integer | |
| stock_level | No | Integer |
Example Request (POST):
{
"location_id": 0,
"stock_level": 10
}
Example Response:
{
"status": "SUCCESS"
}
Delete Inventory Location
Simply sending a GET request and amending the endpoint with the inventory location ID (not to be confused with Product Code).
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/delete_inventory_location/{id}
Method: GET
Example Response:
{
"status": "SUCCESS"
}
Inventory Stock Movement
You can move stock of a specified product code and quantity from one location to another.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/inventory_stock_movement/(product_code)
Method: POST
| Field Name | Required | Format | Notes |
| source_location_id | Yes | Integer | |
| target_location_id | Yes | Integer | |
| quantity | Yes | Integer |
Example Request (POST):
{
"source_location_id": 0,
"target_location_id": 10,
"quantity": 5
}
Example Response:
{
"status": "SUCCESS"
}
Ship & Despatch Order
You can mark an order as despatched, as well as return tracking number and service (if applicable).
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/ship_and_despatch_order
Method: POST
| Field Name | Required | Format | Notes |
| order_id | Yes | String | |
| shipping_service_id | Yes | Integer | |
| package_weight | Yes | String | |
| package_value | Yes | String | |
| package_width | Conditional | String | Only needs to be specified if the Shipping Service requires dimensions to be submitted. |
| package_length | Conditional | String | Only needs to be specified if the Shipping Service requires dimensions to be submitted. |
| package_height | Conditional | String | Only needs to be specified if the Shipping Service requires dimensions to be submitted. |
| parcels->length | Conditional | String | Only needs to be specified if the Shipping Service requires dimensions to be submitted. |
| parcels->height | Conditional | String | Only needs to be specified if the Shipping Service requires dimensions to be submitted. |
| parcels->width | Conditional | String | Only needs to be specified if the Shipping Service requires dimensions to be submitted. |
| parcels->weight | Conditional | String | Only needs to be specified if the Shipping Service requires dimensions to be submitted. |
Example Request (POST):
{
"order_id": "5678",
"shipping_service_id": 216,
"package_weight": "0",
"package_value": "0",
"package_width": "0",
"package_length": "0",
"package_height": "0",
"parcels": [
{
"length": "0",
"height": "0",
"width": "0",
"weight": "0"
},
{
"length": "0",
"height": "0",
"width": "0",
"weight": "0"
}
]
}
Example Response:
{
"status": "SUCCESS"
}
Remove Location From Inventory
By specifying a product code and locaon ID, you can remove an assigned locaon from a product, providing that the stock itself has been moved to another location.
Endpoint: https://YOUR-ACCOUNT-NAME.despatchcloud.co.uk/ws/v1/wsorders/remove_inventory_from_location?product_code={product_code&location_id={location_id}
Method: GET
Example Response:
{
"success": true
}