Note:
- This guide is meant to be accompanied with Deliverr's API spec: https://api.deliverr.com/documentation/v1/spec
- This requires the following scopes: api/products, api/orders, api/webhooks
Although the best way to confirm that your integration is working as expected is to send a few orders through our system and have them be shipped, the Deliverr API offers resources for testing some features of order and product inventory management.
Products
Creating products with the Deliverr API is perfectly harmless. They will just show up inside your Deliverr seller portal. But if you are adding a lot of test products, it could clutter your inventory list.
Product Inventory
Currently, the Get Product Inventory cannot be tested, but the availableUnits
value is set to 0 for any product that does not currently have inventory with us so you can use that endpoint as is to map the response accordingly on your end.
Product inventory webhooks can be tested through the Trigger mock event endpoint available in the Webhooks subsection. To use this endpoint for testing inventory updates via webhooks, you will have to first register a webhook for the INVENTORY_UPDATE
type. Once you have registered the webhook, make a request like the one below with the external_product_id you would like to receive an INVENTORY_UPDATE webhook for.
curl --location --request POST '<https://api.deliverr.com/webhooks/v1/event>' \\
--header 'Authorization: Bearer {valid_access_token}' \\
--header 'Content-Type: application/json' \\
--data-raw '{
"type": "INVENTORY_UPDATE",
"updateType": "INVENTORY_AVAILABLE",
"externalProductId": "{external_product_id}"
}'
Once you have made a request like this, you can expect to receive a request at the URL you registered for the INVENTORY_UPDATE webhook in the INVENTORY_UPDATE schema.
Order management
The Deliverr API offers a way for you to test order creation and the order’s journey without having any inventory with us.
To test order creation, use the Create order endpoint in the Orders subsection but add the X-Deliverr-Mock-Request
header with a string value of true
. Please note that for test orders, we do not validate inventory, we only confirm that the externalProductId is linked to an existing product.
curl --location --request POST '<https://api.deliverr.com/orders/v1/order>' \\
--header 'Authorization: Bearer {valid_access_token}' \\
--header 'X-Deliverr-Mock-Request: true' \\
--header 'Content-Type: application/json' \\
--data-raw '{
"externalOrderId": "string",
"source": "string",
"sourceOrderId": "string",
"shiptoAddress": {
"name": "string",
"company": "string",
"street1": "string",
"street2": "string",
"city": "string",
"state": "string",
"postcode": "string",
"countryCode": "string"
},
"lineItems": [
{
"externalProductId": "string",
"quantity": 0
}
],
"orderDeliveryTime": "2019-08-24T14:15:22Z",
"shipMethod": "string",
"orderShipmentTime": "2019-08-24T14:15:22Z",
"orderCreationTime": "2019-08-24T14:15:22Z"
}'
Once you have created the order, you will receive a CREATED
status update webhook if you have registered an ORDER_STATUS_UPDATE
webhook. If you have not registered an ORDER_STATUS_UPDATE
webhook, you can ignore this.
Once an order has been created, it is live in the testing environment for 1 hour. Within that hour, you can test order shipments and order cancellations.
To test order shipments, you can trigger a mock ORDER_STATUS_UPDATE
webhook event for the SHIPPED
updateType using the Trigger mock event endpoint. When using the endpoint, provide the externalOrderId used to create the order.
curl --location --request POST '<https://api.deliverr.com/webhooks/v1/event>' \\
--header 'Authorization: Bearer {valid_access_token}' \\
--header 'Content-Type: application/json' \\
--data-raw '{
"type": "ORDER_STATUS_UPDATE",
"updateType": "SHIPPED",
"externalOrderId": "{external_order_id}"
}'
Triggering this mock webhook event, will also update the test order’s shipments and will move the order into the SHIPPED
status. You can now also see the shipment details at the Get order and Get order by externalOrderId endpoints. To see the test order, you will have to provide the X-Deliverr-Mock-Request
header set to true
.
To test order cancellations, you can use the Cancel order endpoint with the X-Deliverr-Mock-Request
header set to true
. When you cancel an order, you will receive a CANCELLED
status update webhook if you have registered an ORDER_STATUS_UPDATE
webhook.