Stock API Overview
Introduction
The Stock API allows suppliers to manage their inventory in real time by tracking stock levels across different locations. With this API, you can ensure that retailers see accurate product availability, preventing over-ordering and improving fulfilment accuracy.
1. Creating Stock Locations
Stock locations represent warehouses or storage sites. Use the /v2/locations
endpoint to create new locations.
Example Request:
curl -X POST "https://app.ordermentum.com/v2/locations" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"name": "Main Warehouse",
"default": true,
"supplierId": "supplier_id"
}'
2. Creating Stock Items
Once a location is created, you can add items to track inventory levels.
Example Request:
curl -X POST "https://app.ordermentum.com/v2/items" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"productId": "product_id",
"locationId": "location_id",
"available": 100,
"tracked": true
}'
3. Updating Stock Levels
To adjust stock levels for an item, use the /v2/items/{itemId}
endpoint.
Example Request:
curl -X PATCH "https://app.ordermentum.com/v2/items/item_id" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{
"available": 75
}'
4. Retrieving Stock Information
To get current stock levels for a specific location or product, make a GET request to the /v2/items
endpoint.
Example Request:
curl -X GET "https://app.ordermentum.com/v2/items?locationId=location_id" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Key Stock Attributes
Understanding the key stock attributes in the Stock API will help you manage inventory efficiently and avoid ordering issues.
-
Tracked
Description: Controls whether stock levels are enforced.
Options:
true
: Prevents overselling by enforcing stock limits.false
: Allows ordering beyond available stock.
Allow Oversell
Description: Works alongside tracked to determine if overselling is allowed.
Options:
true
: Retailers can place orders exceeding available stock.false
: Orders are capped at the available stock level.
Default Location
Description: Automatically applies a stock location if no locationId is specified in an order.
Usage: Helps streamline stock management for suppliers with a single warehouse.
Available
Description: Represents the current stock level of an item.
Usage: Update this attribute regularly to reflect accurate inventory.
Updated about 2 months ago