industry-department-solutions
latest
false
Supply Chain & Retail Solutions API guide
- Overview
- API Resources
stock API resource for the Merchandising solution representing inventory levels per product-location combination on a daily basis.
Overview
The stock resource represents inventory levels for products at specific locations on specific dates. This resource tracks stock quantities over time for inventory management.
Resource Endpoint
/api/v2/ingest/object/{prefix}STOCK{suffix}
/api/v2/ingest/object/{prefix}STOCK{suffix}
Supported Methods
| Method | Return Type | Description |
|---|---|---|
| POST | Response | Ingest (create/update) stock records via UPSERT operation |
Request Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Your Personal Access Token (PAT) from platform.peak.ai |
Content-Type | Yes | Must be application/json |
Properties
Primary Keys
- location_id (string) - Foreign key reference to locations
- product_id (string) - Foreign key reference to products
- stock_date_at (date) - Date for the stock snapshot
Attributes
About Required + Nullable: every attribute key must appear in each payload (Required: Yes). Nullable: Yes means the value can be null when you don't have data; Nullable: No means a non-null value is required. See Schema definition structure for the underlying rules.
| Attribute | Data Type | Required | Nullable | Description |
|---|---|---|---|---|
location_id | string | Yes | No | Location identifier (Primary Key, Foreign Key) |
product_id | string | Yes | No | Product identifier (Primary Key, Foreign Key) |
stock_date_at | date | Yes | No | Stock snapshot date (Primary Key) |
stock_units | integer | Yes | No | Number of units in stock |
stock_id | string | Yes | Yes | Alternative stock record identifier |
created_at | timestamp | Yes | Yes | Timestamp when the record was created |
updated_at | timestamp | Yes | Yes | Timestamp when the record was last updated |
Relationships
Outbound References
None
Inbound References
- location - Foreign key
location_idreferences location - product - Foreign key
product_idreferences product
JSON Representation
{
"solutionName": "MP_OOTB",
"data": [
{
"location_id": "LOC-UK-001",
"product_id": "PROD-001",
"stock_date_at": "2025-01-28",
"stock_units": 450,
"stock_id": "STK-2025-001",
"created_at": "2025-01-28T00:00:00Z",
"updated_at": "2025-01-28T10:00:00Z"
}
],
"operationType": "UPSERT"
}
{
"solutionName": "MP_OOTB",
"data": [
{
"location_id": "LOC-UK-001",
"product_id": "PROD-001",
"stock_date_at": "2025-01-28",
"stock_units": 450,
"stock_id": "STK-2025-001",
"created_at": "2025-01-28T00:00:00Z",
"updated_at": "2025-01-28T10:00:00Z"
}
],
"operationType": "UPSERT"
}
Example Request
curl -X POST \
'https://ingestion.peak.ai/api/v2/objects/MP_STOCK_OOTB' \
-H 'Authorization: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"solutionName": "MP_OOTB",
"data": [
{
"location_id": "LOC-UK-001",
"product_id": "PROD-001",
"stock_date_at": "2025-01-28",
"stock_units": 450,
"stock_id": "STK-2025-001",
"created_at": "2025-01-28T00:00:00Z",
"updated_at": "2025-01-28T10:00:00Z"
}
],
"operationType": "UPSERT"
}'
curl -X POST \
'https://ingestion.peak.ai/api/v2/objects/MP_STOCK_OOTB' \
-H 'Authorization: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"solutionName": "MP_OOTB",
"data": [
{
"location_id": "LOC-UK-001",
"product_id": "PROD-001",
"stock_date_at": "2025-01-28",
"stock_units": 450,
"stock_id": "STK-2025-001",
"created_at": "2025-01-28T00:00:00Z",
"updated_at": "2025-01-28T10:00:00Z"
}
],
"operationType": "UPSERT"
}'
Important Notes
- Foreign Key Dependencies: Requires valid
product_idandlocation_idto exist in their respective tables - Daily Snapshots: Captures stock levels at specific dates for historical tracking
- Location-Specific: Stock is tracked separately for each location
- Inventory Management: Essential for stock level monitoring and replenishment planning
- Custom Attributes: Additional custom attributes can be added using the
/STOCK/add-attributeendpoint - Data Validation: All attributes are validated according to their defined data types
Related Resources
- product - Product information
- location - Stock location
- purchase_order - Incoming stock from orders
- sale - Stock depletion from sales