Orders API - RoyalGr4pe/stockx-sdk GitHub Wiki
📦 Orders API
The Orders API allows you to retrieve both active and historical sales orders from your StockX account. This includes filtering by order status, product IDs, inventory types, and date ranges.
🔐 Authentication
Before calling any Orders API function, ensure you've initialized authentication:
from stockx.connection import setup
setup({"api_key": "YOUR_API_KEY", "jwt": "YOUR_JWT_TOKEN"})
📘 Available Functions
get_active_orders(params: dict) -> dict
Fetch a list of active (ongoing) orders.
Parameters
Name | Type | Description |
---|---|---|
pageNumber |
int | Page number (starts at 1). |
pageSize |
int | Number of results per page (1–100). |
orderStatus |
str | Comma-separated statuses: "CREATED" , "CCAUTHORIZATIONFAILED" , "SHIPPED" , "RECEIVED" , "AUTHENTICATING" , "AUTHENTICATED" , "PAYOUTPENDING" , "PAYOUTCOMPLETED" , "SYSTEMFULFILLED" , "PAYOUTFAILED" , "SUSPENDED" . |
productId |
str | StockX product ID. |
variantId |
str | Variant ID of the product. |
sortOrder |
str | Field to sort by: "CREATEDAT" or "SHIPBYDATE" . |
inventoryTypes |
str | Comma-separated inventory types: "STANDARD" , "FLEX" . |
initiatedShipmentDisplayIds |
str | Shipment display IDs. |
Example
from stockx.orders import get_active_orders
import asyncio
async def main():
orders = await get_active_orders({
"pageNumber": 1,
"pageSize": 20,
"orderStatus": "CREATED"
})
print(orders)
asyncio.run(main())
get_order_history(params: dict) -> dict
Fetch a list of historical (completed, cancelled, etc.) orders.
Parameters
Name | Type | Description |
---|---|---|
fromDate |
str | Start date for order filtering. Format: YYYY-MM-DD . |
toDate |
str | End date for order filtering. Format: YYYY-MM-DD . |
pageNumber |
int | Page number (starts at 1). |
pageSize |
int | Number of results per page (1–100). |
orderStatus |
str | Comma-separated statuses: "AUTHFAILED" , "DIDNOTSHIP" , "CANCELED" , "COMPLETED" , "RETURNED" . |
productId |
str | StockX product ID. |
variantId |
str | Variant ID of the product. |
inventoryTypes |
str | Comma-separated inventory types: "STANDARD" , "FLEX" . |
initiatedShipmentDisplayIds |
str | Shipment display IDs. |
Example
from stockx.orders import get_order_history
import asyncio
async def main():
history = await get_order_history({
"fromDate": "2024-01-01",
"toDate": "2024-05-01",
"pageNumber": 1,
"pageSize": 10
})
print(history)
asyncio.run(main())
get_single_order(order_number: str) -> dict
Fetch a single order using the order number.
Parameters
Name | Type | Description |
---|---|---|
order_number |
str | Unique StockX order number. |
Example
from stockx.orders import get_single_order
import asyncio
async def main():
order = await get_single_order("ORDER123456")
print(order)
asyncio.run(main())
📝 Notes
- All list-type parameters (like
orderStatus
,inventoryTypes
) must be comma-separated strings — no brackets or quotes. - Date fields must be formatted as
YYYY-MM-DD
. - Invalid or expired credentials will result in HTTP 401 errors.
🛠️ Need Help?
Check out the Setup & Authentication page or open an issue for support.