Introduction
Shorages API Documentation
This documentation aims to provide all the information you need to work with our API.
Base URL
https://app.shorages.com
Authenticating requests
Authenticate requests to this API's endpoints by sending an Authorization
header with the value "Bearer {YOUR_API_KEY}"
.
All authenticated endpoints are marked with a requires authentication
badge in the documentation below.
You can retrieve your token by visiting your dashboard and clicking Generate API token.
Orders
Order Management API: Interact with orders, view their details, and manage shipments.
List Orders
requires authentication
Retrieve a list of orders, each with summarized information.
Example request:
curl --request GET \
--get "https://app.shorages.com/api/v2/orders" \
--header "Authorization: Bearer {YOUR_API_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://app.shorages.com/api/v2/orders"
);
const headers = {
"Authorization": "Bearer {YOUR_API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"status": 200,
"data": {
"current_page": 1,
"data": [
{
"id": 4,
"order_number": "53",
"status": "RTO",
"financial_status": "CASH ON DELIVERY",
"shipping_method": "EXPRESS",
"currency": "AED",
"customer": {
"name": "Ginger Rodgers",
"email": "xulajonaxi@mailinator.com"
},
"billing_address": {
"name": "",
"phone": "",
"country": "",
"country_code": "",
"city": "",
"zip": "",
"address1": "",
"address2": "",
"company": ""
},
"shipping_address": {
"name": "Ginger Rodgers",
"phone": "",
"country": "Afghanistan",
"country_code": "AF",
"city": "Consequatur sed eve",
"zip": "24172",
"address1": "Et animi excepturi",
"address2": "",
"company": ""
},
"line_items": [
{
"name": "Box 1 - Medium",
"sku": "BX-3",
"upc": "85016402",
"hs_code": "85016402",
"quantity": 15,
"unit_price": "120.00",
"discount": "0.00",
"tax": "0.00",
"shipping": "0.00",
"sub_total": "2400.00",
"total": "2400.00"
}
],
"attachments": [],
"line_items_total": "1800.00",
"total_discount": "0.00",
"total_tax": "0.00",
"total_shipping": "0.00",
"total": "1800.00",
"note": "Sit rerum sit culpa",
"created_at": "2022-09-23T10:34:43.000000Z",
"updated_at": "2022-09-23T10:47:37.000000Z"
},
{
"id": 3,
"order_number": "8",
"status": "RETURNED",
"financial_status": "PRE PAID",
"shipping_method": "STANDARD",
"currency": "BHD",
"customer": {
"name": "Amy Sears",
"email": "fitalyju@mailinator.com"
},
"billing_address": {
"name": "",
"phone": "",
"country": "",
"country_code": "",
"city": "",
"zip": "",
"address1": "",
"address2": "",
"company": ""
},
"shipping_address": {
"name": "Amy Sears",
"phone": "",
"country": "Thailand",
"country_code": "TH",
"city": "Voluptatibus itaque",
"zip": "64353",
"address1": "Non odio aut itaque",
"address2": "",
"company": ""
},
"line_items": [
{
"name": "Box 1 - Medium",
"sku": "BX-3",
"upc": "85016402",
"hs_code": "85016402",
"quantity": 10,
"unit_price": "0.00",
"discount": "0.00",
"tax": "0.00",
"shipping": "0.00",
"sub_total": "0.00",
"total": "0.00"
}
],
"attachments": [],
"line_items_total": "0.00",
"total_discount": "0.00",
"total_tax": "0.00",
"total_shipping": "0.00",
"total": "0.00",
"note": "Sit consectetur volu",
"created_at": "2022-09-22T12:17:39.000000Z",
"updated_at": "2022-09-22T12:23:52.000000Z"
}
],
"first_page_url": "https://app.shorages.com/api/v2/orders/list?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "https://app.shorages.com/api/v2/orders/list?page=1",
"next_page_url": null,
"path": "https://app.shorages.com/api/v2/orders/list",
"per_page": 25,
"prev_page_url": null,
"to": 2,
"total": 2
}
}
Received response:
Request failed with error:
Get Order
requires authentication
Retrieve detailed information about a specific order by providing its unique identifier
Example request:
curl --request GET \
--get "https://app.shorages.com/api/v2/orders/12" \
--header "Authorization: Bearer {YOUR_API_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://app.shorages.com/api/v2/orders/12"
);
const headers = {
"Authorization": "Bearer {YOUR_API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"status": 200,
"data": {
"id": 1,
"order_number": "963",
"status": "RETURNED",
"financial_status": "CASH ON DELIVERY",
"shipping_method": "EXPRESS",
"currency": "SAR",
"customer": {
"name": "Gannon Moody",
"email": "selyj@mailinator.com"
},
"billing_address": {
"name": "",
"phone": "",
"country": "",
"country_code": "",
"city": "",
"zip": "",
"address1": "",
"address2": "",
"company": ""
},
"shipping_address": {
"name": "Gannon Moody",
"phone": "",
"country": "Congo",
"country_code": "CG",
"city": "Est qui vel est qui",
"zip": "27791",
"address1": "Optio consequatur",
"address2": "",
"company": ""
},
"line_items": [
{
"name": "Box 1 - Small",
"sku": "BX-1",
"upc": "85016400",
"hs_code": "85016400",
"quantity": 2,
"unit_price": "10.00",
"discount": "0.00",
"tax": "0.00",
"shipping": "0.00",
"sub_total": "20.00",
"total": "20.00"
},
{
"name": "Box 1 - Large",
"sku": "BX-2",
"upc": "85016401",
"hs_code": "85016401",
"quantity": 4,
"unit_price": "30.00",
"discount": "0.00",
"tax": "0.00",
"shipping": "0.00",
"sub_total": "90.00",
"total": "90.00"
}
],
"attachments": [],
"line_items_total": "140.00",
"total_discount": "0.00",
"total_tax": "0.00",
"total_shipping": "0.00",
"total": "140.00",
"note": "Dolores dicta eaque",
"created_at": "2022-09-22T11:16:30.000000Z",
"updated_at": "2022-09-22T11:18:24.000000Z"
}
}
Received response:
Request failed with error:
Create Order
requires authentication
Create a new order, providing necessary details like customer information and selected products.
Example request:
curl --request POST \
"https://app.shorages.com/api/v2/orders" \
--header "Authorization: Bearer {YOUR_API_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"order_number\": \"voluptas\",
\"order_reference\": \"est\",
\"order_type\": \"NOON_FBP_SHORAGES_COURIER\",
\"line_items\": [
{
\"name\": \"vel\",
\"sku\": \"SS\",
\"unit_price\": 0,
\"quantity\": 16,
\"shipping\": 0,
\"discount\": 0,
\"tax\": 0
}
],
\"shipping_address\": {
\"state\": \"cumque\",
\"country\": \"laudantium\",
\"city\": \"libero\",
\"address\": \"dolor\",
\"zip\": \"molestiae\"
},
\"customer\": {
\"first_name\": \"assumenda\",
\"last_name\": \"vel\",
\"email\": \"lenna60@example.org\",
\"phone_number\": \"modi\"
},
\"financial_status\": \"INSTALLMENTS\",
\"currency\": \"EGP\",
\"shipping_method\": \"STANDARD\"
}"
const url = new URL(
"https://app.shorages.com/api/v2/orders"
);
const headers = {
"Authorization": "Bearer {YOUR_API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"order_number": "voluptas",
"order_reference": "est",
"order_type": "NOON_FBP_SHORAGES_COURIER",
"line_items": [
{
"name": "vel",
"sku": "SS",
"unit_price": 0,
"quantity": 16,
"shipping": 0,
"discount": 0,
"tax": 0
}
],
"shipping_address": {
"state": "cumque",
"country": "laudantium",
"city": "libero",
"address": "dolor",
"zip": "molestiae"
},
"customer": {
"first_name": "assumenda",
"last_name": "vel",
"email": "lenna60@example.org",
"phone_number": "modi"
},
"financial_status": "INSTALLMENTS",
"currency": "EGP",
"shipping_method": "STANDARD"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Example response (200):
{
"status": 200,
"message": "Order created successfully",
"data": {
"id": 4123,
"order_number": "12345678",
"order_reference": "#ABC-123",
"type": "OTHER_PICKUP",
"status": "PENDING",
"financial_status": "PRE PAID",
"shipping_method": "EXPRESS",
"currency": "AED",
"customer": {
"name": "John Doe",
"email": "email@gmail.com"
},
"billing_address": {
"name": "",
"phone": "",
"country": "",
"country_code": "",
"city": "",
"zip": "",
"address1": "",
"address2": "",
"company": ""
},
"shipping_address": {
"name": "Derrick Wolf",
"phone": "",
"country": "United Arab Emirates",
"country_code": "AE",
"city": "Dubai",
"zip": "",
"address1": "Dubai",
"address2": "",
"company": ""
},
"line_items": [
{
"name": "Soap",
"sku": "FTP-208",
"upc": "",
"hs_code": "",
"quantity": 2,
"unit_price": "12.00",
"discount": "1.00",
"tax": "2.50",
"shipping": "0.50",
"sub_total": "24.00",
"total": "26.00"
},
{
"name": "Hat",
"sku": "RSS-846",
"upc": "",
"hs_code": "",
"quantity": 4,
"unit_price": "10.00",
"discount": "2.00",
"tax": "0.00",
"shipping": "0.00",
"sub_total": "40.00",
"total": "38.00"
}
],
"attachments": [],
"line_items_total": 64,
"total_discount": 3,
"total_tax": 2.5,
"total_shipping": 0.5,
"total": 64,
"note": "Order Note",
"created_at": "2023-06-06T10:14:55.000000Z",
"updated_at": "2023-06-06T10:14:55.000000Z"
}
}
Received response:
Request failed with error:
Get Order Shipment
requires authentication
Obtain shipment-specific details for an order, including tracking information and delivery status.
Example request:
curl --request GET \
--get "https://app.shorages.com/api/v2/orders/9/shipment" \
--header "Authorization: Bearer {YOUR_API_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://app.shorages.com/api/v2/orders/9/shipment"
);
const headers = {
"Authorization": "Bearer {YOUR_API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"status": 200,
"data": {
"order_id": 127,
"carrier_name": "John Doe",
"carrier_tracking_url": "https://tracking-url.com",
"carrier_tracking_number": "123456",
"shorages_tracking_url": "https://shorages-tracking-url.com",
"shorages_tracking_number": "654321",
"shipment_statuses": [
{
"shipment_id": 1,
"status": "delivered",
"description": "order received by customer",
"created_at": "2023-07-19T08:18:13.000000Z"
},
{
"shipment_id": 1,
"status": "out_for_delivery",
"description": "order shipped",
"created_at": "2023-07-16T08:08:10.000000Z"
},
{
"shipment_id": 1,
"status": "booked",
"description": "order has been booked",
"created_at": "2023-07-14T08:00:17.000000Z"
}
]
}
}
Received response:
Request failed with error:
Products
Product Management API: Access and manipulate product-related information and inventory data.
List Products
requires authentication
Retrieve a list of products, each with key information.
Example request:
curl --request GET \
--get "https://app.shorages.com/api/v2/products" \
--header "Authorization: Bearer {YOUR_API_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://app.shorages.com/api/v2/products"
);
const headers = {
"Authorization": "Bearer {YOUR_API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"status": 200,
"data": {
"current_page": 1,
"data": [
{
"id": 4,
"name": "Product Name",
"sku": "SKU123",
"upc": 12345,
"hs_code": 12345,
"width": 2,
"height": 4,
"depth": 10,
"weight": 30,
"warehouse": "WH123",
"stock_received": 27,
"stock_consumed": 12,
"stock_allocated": 3,
"stock_on_hand": 12,
"created_at": "2022-10-21T12:04:54.000000Z",
"updated_at": "2022-10-23T07:35:19.000000Z"
},
{
"id": 3,
"name": "Product Name 2",
"sku": "SKU1234",
"upc": 123456,
"hs_code": 123456,
"width": 4,
"height": 4,
"depth": 5,
"weight": 5,
"warehouse": "WH123",
"stock_received": 10,
"stock_consumed": 5,
"stock_allocated": 0,
"stock_on_hand": 5,
"created_at": "2022-09-22T11:07:22.000000Z",
"updated_at": "2022-11-01T09:12:51.000000Z"
}
],
"first_page_url": "https://app.shorages.com/api/v2/products/list?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "https://app.shorages.com/api/v2/products/list?page=1",
"next_page_url": null,
"path": "https://app.shorages.com/api/v2/products/list",
"per_page": 25,
"prev_page_url": null,
"to": 2,
"total": 2
}
}
Received response:
Request failed with error:
Get Product
requires authentication
Retrieve comprehensive information about a specific product using its unique identifier.
Example request:
curl --request GET \
--get "https://app.shorages.com/api/v2/products/11" \
--header "Authorization: Bearer {YOUR_API_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://app.shorages.com/api/v2/products/11"
);
const headers = {
"Authorization": "Bearer {YOUR_API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"status": 200,
"data": {
"id": 8,
"name": "Product Name",
"sku": "SKU123",
"upc": 12345,
"hs_code": 12345,
"width": 2,
"height": 4,
"depth": 10,
"weight": 30,
"warehouse": "WH123",
"stock_received": 27,
"stock_consumed": 12,
"stock_allocated": 3,
"stock_on_hand": 12,
"created_at": "2022-11-08T09:14:41.000000Z",
"updated_at": "2022-11-08T09:14:41.000000Z"
}
}
Received response:
Request failed with error:
List Product Stocks
requires authentication
List product current stock quantities, aiding in inventory management.
Example request:
curl --request GET \
--get "https://app.shorages.com/api/v2/products/20/stocks" \
--header "Authorization: Bearer {YOUR_API_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://app.shorages.com/api/v2/products/20/stocks"
);
const headers = {
"Authorization": "Bearer {YOUR_API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"status": 200,
"data": {
"current_page": 1,
"data": [
{
"id": 3,
"product_id": 3,
"space": "A01",
"location": "L01",
"batch": "2",
"expiry_date": null,
"stock_received": 10,
"stock_consumed": 5,
"stock_allocated": 0,
"stock_on_hand": 5,
"is_damaged": false,
"created_at": "2022-09-22T11:15:26.000000Z",
"updated_at": "2022-11-01T09:12:51.000000Z"
},
{
"id": 4,
"product_id": 3,
"space": "A01",
"location": "L01",
"batch": "1",
"expiry_date": null,
"stock_received": 5,
"stock_allocated": 0,
"stock_consumed": 5,
"stock_on_hand": 0,
"is_damaged": false,
"created_at": "2022-09-22T11:27:43.000000Z",
"updated_at": "2022-09-23T10:36:17.000000Z"
},
{
"id": 7,
"product_id": 3,
"space": "A01",
"location": "L01",
"batch": null,
"expiry_date": null,
"stock_received": 0,
"stock_consumed": 0,
"stock_allocated": 0,
"stock_on_hand": 0,
"is_damaged": false,
"created_at": "2022-09-22T12:25:33.000000Z",
"updated_at": "2022-09-28T09:09:41.000000Z"
},
{
"id": 8,
"product_id": 3,
"space": "A01",
"location": "L01",
"batch": null,
"expiry_date": null,
"stock_received": 5,
"stock_consumed": 0,
"stock_allocated": 0,
"stock_on_hand": 5,
"is_damaged": false,
"created_at": "2022-09-23T10:31:07.000000Z",
"updated_at": "2022-09-28T09:09:41.000000Z"
}
],
"first_page_url": "https://app.shorages.com/api/v2/products/3/stock?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "https://app.shorages.com/api/v2/products/3/stock?page=1",
"next_page_url": null,
"path": "https://app.shorages.com/api/v2/products/3/stock",
"per_page": 25,
"prev_page_url": null,
"to": 4,
"total": 4
}
}
Received response:
Request failed with error:
List Product Stock Logs
requires authentication
Retrieve a log of stock-related activities for a specific product stock, including updates, restocks, etc...
Example request:
curl --request GET \
--get "https://app.shorages.com/api/v2/products/2/stocks/16/logs" \
--header "Authorization: Bearer {YOUR_API_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://app.shorages.com/api/v2/products/2/stocks/16/logs"
);
const headers = {
"Authorization": "Bearer {YOUR_API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"status": 200,
"data": {
"current_page": 1,
"data": [
{
"id": 1,
"product_stock_id": 1,
"quantity": 19,
"location": "LOC-01",
"space": "A01",
"log": "Stock Received",
"reference": "https://app.shorages.com/admin/receiving-shipments/1",
"comment": null,
"created_at": "2022-11-02T11:51:29.000000Z",
"updated_at": "2022-11-02T11:51:29.000000Z"
},
{
"id": 2,
"product_stock_id": 1,
"quantity": 3,
"location": "LOC-01",
"space": "A01",
"log": "Stock Allocated",
"reference": "https://app.shorages.com/admin/orders/1",
"comment": null,
"created_at": "2022-11-09T06:09:35.000000Z",
"updated_at": "2022-11-09T06:09:35.000000Z"
},
{
"id": 3,
"product_stock_id": 1,
"quantity": 10,
"location": "LOC-01",
"space": "A01",
"log": "Stock Added",
"reference": null,
"comment": "New stock found",
"created_at": "2022-11-09T06:52:06.000000Z",
"updated_at": "2022-11-09T06:52:06.000000Z"
}
],
"first_page_url": "https://app.shorages.com/api/v2/stock/3?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "https://app.shorages.com/api/v2/stock/3?page=1",
"next_page_url": null,
"path": "https://app.shorages.com/api/v2/stock/3",
"per_page": 25,
"prev_page_url": null,
"to": 3,
"total": 3
}
}
Received response:
Request failed with error:
Create Product
requires authentication
Create a new product, by providing relevant details.
Example request:
curl --request POST \
"https://app.shorages.com/api/v2/products" \
--header "Authorization: Bearer {YOUR_API_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"nesciunt\",
\"sku\": \"assumenda\",
\"upc\": \"velit\",
\"hs_code\": \"saepe\",
\"width\": \"sit\",
\"height\": \"quod\",
\"depth\": \"dolore\",
\"weight\": \"at\"
}"
const url = new URL(
"https://app.shorages.com/api/v2/products"
);
const headers = {
"Authorization": "Bearer {YOUR_API_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "nesciunt",
"sku": "assumenda",
"upc": "velit",
"hs_code": "saepe",
"width": "sit",
"height": "quod",
"depth": "dolore",
"weight": "at"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Example response (200):
{
"status": 200,
"message": "Product created successfully",
"data": {
"id": 321,
"name": "Product Name",
"sku": "SKU123",
"upc": 12345,
"hs_code": 12345,
"width": 2,
"height": 4,
"depth": 10,
"weight": 30,
"warehouse": "WH123",
"created_by_id": 123,
"total_stock_received": 0,
"total_stock_consumed": 0,
"total_stock_allocated": 0,
"total_stock_on_hand": 0,
"updated_at": "2023-06-06T08:55:37.000000Z",
"created_at": "2023-06-06T08:55:37.000000Z"
}
}
Received response:
Request failed with error:
Webhooks
Webhooks provide real-time notifications for events related to selected resources, such as orders. When configuring a REST API Integration, you define webhooks by specifying:
- Resource : the item you want to be notified about (e.g. Orders)
- Events : the actions or changes you want to be notified about
- Endpoint : the URL that will receive a POST with the event payload
When an event occurs, a POST request containing the event details is sent to your configured endpoint.
Events Setup
You can configure webhooks during the creation of a REST API Integration (from the dashboard, under Integrations module) or by editing an existing integration to include the desired webhooks. The configuration process involves two key sections: Headers and Webhooks.
Headers Section
In this section, you can specify any custom headers that should be included in the webhook requests. These headers will be appended to every POST request sent to your configured endpoint, ensuring that any required metadata or authentication information is always provided. Note that providing custom headers is optional.
Webhooks Section
This section allows you to define the webhooks by specifying the following:
- Resource: The entity you want to monitor for events (e.g.,
orders
). - Event: The specific action or change you want to be notified about (e.g.,
status_update
). - Endpoint: The URL where the webhook payload will be delivered.
You can configure multiple webhooks within a single integration, enabling you to monitor various resources and events as needed.
Order Resource Events
status_update
tracking_details_update
inventory_update
Event Details
Status Update Example Payload:
{
"source":"status_update",
"data": {
"order_id":"12345",
"external_order_id":"EXT12345",
"status":"NEW"
}
}
Order Returned Status Example Payload:
{
"source": "status_update",
"data": {
"order_id":"12345",
"external_order_id":"EXT12345",
"status":"RETURNED",
"returned_items": [
{
"sku":"SKU123",
"quantity":"2"
},
{
"sku":"SKU456",
"quantity":"1"
}
]
}
}
Tracking Details Update Example Payload:
{
"source": "tracking_details_update",
"data": {
"order_id":"12345",
"external_order_id":"EXT12345",
"carrier_name":"FedEx",
"tracking_number":"TRK123456789",
"tracking_link":"https://tracking.fedex.com/TRK123456789"
}
}
Inventory Update Example Payload:
{
"source": "inventory_update",
"data": {
"product_id":"1",
"product_sku":"sku123",
"quantity":1,
"total_stock_available":5
}
}
1. status_update
This is triggered when an order is changed from one status to the other, e.g. from PENDING to NEW. The example payload contains the structure of the data sent to your webhook endpoint for the two events below:
-
Status updated to
NEW
-
Status updated to
RETURNED
2. tracking_details_update
This is triggered when shipment details are added to an Order and the status is updated to SHIPPED. The example payload contains the structure of the data sent to your specified endpoint.
3. inventory_update
This event is triggered when an order is marked as SHIPPED and inventory is deducted.
The system sends the updated stock levels to your specified endpoint.
See the example payload for the data.