Endpoints: สินค้าและออเดอร์

อ่านสินค้า, แคตตาล็อกรวม, ออเดอร์, สต๊อก และร้านที่เชื่อมต่อของคุณ

Endpoint สำหรับแคตตาล็อก, ออเดอร์, สต๊อก และรายการร้านของคุณ เพิ่งเริ่มใช้งาน? อ่าน เริ่มต้นใช้งาน สำหรับการยืนยันตัวตน และดู หลักการทั่วไป สำหรับโครงห่อผลลัพธ์, วันที่ และการแบ่งหน้า ทุก endpoint เป็นแบบอ่านอย่างเดียว

คลิกที่ endpoint ใดก็ได้เพื่อขยายดูพารามิเตอร์, request body และ response (รายละเอียดเชิงเทคนิคเป็นภาษาอังกฤษ)

Products & catalog

POST/api/canonical-product-controller/canonical/fetch-products

Fetches canonical products with their current Shopee binding data. Returns one row per (canonical, binding) pair—canonicals with multiple Shopee listings produce multiple results. Useful for Shopee-keyed product lookups and reconciliation workflows.

Request body

Array of CanonicalProductWithShopeeBindingSearchParams — filter by canonical id, name, SKU, model SKU, or by Shopee item/model/shop id and region.

FieldTypeRequiredDescription
idintegernoCanonical variant id
namestringnoCanonical product name (exact match)
brandstringnoBrand name
skustringnoCanonical SKU
modelSkustringnoCanonical model SKU
shopeeItemIdintegernoShopee item id
shopeeModelIdintegernoShopee model id (for modeled items)
shopeeShopIdintegernoShopee shop id
regionstringnoRegion code (e.g. 'TH')

Response — Array of CanonicalProductWithShopeeBindingView

List of canonical products with their Shopee binding details (price, stock, margin, images). Each canonical can appear multiple times if it has multiple Shopee bindings.

FieldTypeDescription
idintegerCanonical variant id
namestringProduct name
skustringCanonical SKU
cogsnumberTotal cost of goods sold
pricenumberCurrent Shopee listing price
stockintegerCurrent Shopee stock
marginnumberMargin on this Shopee binding (0–1 fraction)
totalStockintegerMin stock across all platform bindings for this canonical
shopeeItemIdintegerShopee item id
shopeeModelIdintegerShopee model id (if modeled)
imageUrlstringProduct image URL from Shopee

…and more — see the full schema in the OpenAPI spec.

POST/api/canonical-product-controller/canonical/fetch-products-with-platforms

Fetches canonical products and attaches ALL platform bindings (Shopee, Lazada, TikTok) in a platforms array. One row per canonical, regardless of how many platforms it's bound to. Used for neutral, multi-platform product lists.

Request body

Array of CanonicalProductSearchParams — filter by canonical id, name, SKU, model SKU, or by platform and platform shop id.

FieldTypeRequiredDescription
idintegernoCanonical variant id
namestringnoProduct name
skustringnoCanonical SKU
modelSkustringnoModel SKU
platformstringnoPlatform code ('shopee', 'lazada', 'tiktok')
platformShopIdstringnoShopee shop id, Lazada seller id, or TikTok shop id
activeOnlybooleannoWhen true, exclude inactive bindings (default false)

Response — Array of CanonicalProductWithPlatforms

List of canonical products, each carrying margin distribution stats and a platforms array of all bound marketplace items.

FieldTypeDescription
idintegerCanonical variant id
namestringProduct name
skustringCanonical SKU
cogsnumberTotal COGS
totalStockintegerMin stock across all bindings
variantCountintegerNumber of platform variants/bindings
medianMarginnumberMedian margin across bindings
platformsarrayPer-binding refs (platform, item/model ids, shop id, price, stock, margin)

…and more — see the full schema in the OpenAPI spec.

POST/api/canonical-product-controller/canonical/fetch-products-with-platforms-paginated

Cursor-paginated canonical product list with the same platform-bindings metadata as the non-paginated variant. Pass the returned nextCursor.canonicalId back as cursorCanonicalId for the next page. Supports optional platform/shop scoping.

Request body

CanonicalProductPaginatedFetchRequest

FieldTypeRequiredDescription
cursorCanonicalIdintegernoCursor from prior page's nextCursor (omit for first page)
pageSizeintegernoRows per page (default 20)
platformstringnoFilter to this platform
platformShopIdstringnoFilter to this shop/seller id
filtersarraynoColumn filters (text search, numeric range)

ResponseCursorPaginatedResult<CanonicalProductCursor, CanonicalProductWithPlatforms>

FieldTypeDescription
rowsarrayArray of CanonicalProductWithPlatforms
nextCursorobjectCursor for next page (canonicalId, userId) or null if at end
POST/api/canonical-product-controller/canonical/fetch-products-with-platforms-paginated/v2

Offset-based pagination (page number + size) over canonical products with platform bindings. Supports sorting (name, SKU, COGS, stock) and per-column filters. Preferred for UI product tables that need page numbers and sort controls.

Request body

CanonicalProductPaginatedV2FetchRequest

FieldTypeRequiredDescription
pageintegerno0-based page number (default 0)
pageSizeintegernoRows per page (default 20)
sortFieldstringnoSort column ('name', 'sku', 'modelSku', 'cogs', 'stock')
sortDirstringno'asc' or 'desc' (default 'asc')
platformstringnoFilter by platform
platformShopIdstringnoFilter by shop/seller id
filtersarraynoPer-column text/numeric filters

ResponseOffsetPaginatedResult<CanonicalProductWithPlatforms>

FieldTypeDescription
rowsarrayProducts for this page
totalItemsintegerTotal product count
totalPagesintegerTotal page count
currentPageinteger0-based current page
POST/api/canonical-product-controller/canonical/fetch-products-margin-stats

Computes margin distribution (min, max, median, quartiles) over the filtered canonical product set. Uses the same filters as the paginated fetch; pagination parameters are ignored. Products with no margined binding are excluded.

Request body

CanonicalProductPaginatedV2FetchRequest — only the filter/platform/platformShopId fields are used.

ResponseProductMarginStats

FieldTypeDescription
productCountintegerProducts with non-null margin in the result set
minMarginnumberLowest margin (0–1 fraction)
maxMarginnumberHighest margin
medianMarginnumberMedian margin
q1Marginnumber25th percentile margin
q3Marginnumber75th percentile margin
dataFreshAtstring (date)Oldest product pull time across the user's shops
POST/api/canonical-product-controller/canonical/fetch-product-costs

Reads the detailed per-component cost breakdown (manufacturing, labor, shipping, packaging) and VAT-inclusivity flags for one or more canonical variants. Backs the product Cost Breakdown editor.

Request body

Array of integer — canonical variant ids.

Response — Array of CanonicalProductCostRow

FieldTypeDescription
idintegerCanonical variant id
cogsnumberTotal cost of goods sold
manufacturingCostnumberManufacturing cost
laborCostnumberLabor cost
shippingCostnumberInbound shipping cost
packagingCostnumberPackaging cost
manufacturingCostVatInclusivebooleanWhether manufacturing cost includes VAT
shippingCostVatInclusivebooleanWhether shipping cost includes VAT
packagingCostVatInclusivebooleanWhether packaging cost includes VAT
POST/api/canonical-product-controller/canonical/search-products

Searches canonical products by name, SKU, model SKU, and (if numeric) platform item ids using trigram similarity. Results are ranked by relevance and hard-capped at 50 hits. Optional platform/shop filters narrow results.

Request body

CanonicalProductSearchRequest

FieldTypeRequiredDescription
querystringnoFree-text: product name, SKU, model SKU, or numeric item id
platformstringnoRestrict to canonicals bound on this platform
platformShopIdstringnoRestrict to canonicals bound to this shop/seller id

Response — Array of CanonicalProductSearchHit

Top-50 results ranked by relevance.

FieldTypeDescription
canonicalobjectCanonicalProductWithPlatforms (name, SKU, COGS, all platform bindings)
scorenumberRelevance score
matchedFieldsarrayWhich fields matched (NAME, SKU, MODEL_SKU, ITEM_ID)
GET/api/canonical-product-controller/canonical/has-cogs

Checks whether any canonical product variant has COGS set for a given Shopee shop. Used to gate features (like the financial breakdown) until the seller has populated cost data.

Query parameters

NameTypeRequiredDescription
shopIdintegeryesShopee shop id

ResponseHasCogsResponse

FieldTypeDescription
hasCogsbooleanTrue if at least one variant for this shop has COGS > 0
GET/api/canonical-product-controller/lazada/canonical/has-cogs

Checks whether any canonical product variant has COGS set for a given Lazada seller.

Query parameters

NameTypeRequiredDescription
sellerIdintegeryesLazada seller account id
regionstringyesRegion code (e.g. 'TH')

ResponseHasCogsResponse

FieldTypeDescription
hasCogsbooleanTrue if at least one variant for this seller has COGS > 0
GET/api/canonical-product-controller/tiktok/canonical/has-cogs

Checks whether any canonical product variant has COGS set for a given TikTok shop.

Query parameters

NameTypeRequiredDescription
shopIdintegeryesTikTok shop id
regionstringyesRegion code (e.g. 'TH')

ResponseHasCogsResponse

FieldTypeDescription
hasCogsbooleanTrue if at least one variant for this shop has COGS > 0

Orders

POST/api/canonical-order-controller/canonical/orders/fetch-paginated

Cursor-paginated list of orders across all the user's shops on every connected platform (Shopee, Lazada, TikTok). Returns order id, platform, status, buyer-paid total, and timestamps. Pass the returned nextCursor.canonicalOrderId back as cursorCanonicalOrderId for the next page.

Request body

CanonicalOrderPaginatedFetchRequest

FieldTypeRequiredDescription
cursorCanonicalOrderIdintegernoCursor from prior page (omit for first page)
pageSizeintegernoRows per page (default 20)
platformstringnoFilter by platform ('shopee', 'lazada', 'tiktok'); omit for all
fromDateintegernoStart date (YYYYMMDD)
toDateintegernoEnd date (YYYYMMDD)

ResponseCursorPaginatedResult<CanonicalOrderCursor, CanonicalOrder>

FieldTypeDescription
rowsarrayArray of CanonicalOrder
nextCursorobjectCursor for next page or null if at end
GET/api/canonical-order-controller/canonical/orders/{canonicalOrderId}

Fetches one complete order with all line items, quantities, prices, and fees — including the per-line and order-level financial breakdown (revenue, COGS, profit, margin).

Path parameters

NameTypeRequiredDescription
canonicalOrderIdintegeryesCanonical order id

ResponseCanonicalOrder

FieldTypeDescription
canonicalOrderIdintegerOrder id
platformstringPlatform ('shopee', 'lazada', 'tiktok')
orderSnstringOrder serial number
orderStatusstringPlatform-specific status code
totalOrderRevenuenumberPost-discount item revenue
totalOrderCogsnumberTotal COGS across line items
totalOrderProfitnumberTotal profit (revenue − COGS − fees)
totalOrderMarginnumberOverall order margin (profit / revenue)
createTimestring (date)Order creation timestamp
lineItemsarrayPer-line items (name, quantity, price, COGS, profit, margin, fulfillment status)

…and more — see the full schema in the OpenAPI spec.

GET/api/canonical-order-controller/canonical/orders/count-by-date

Counts total orders across all the user's shops for an optional platform and date range. Returns a single integer. Useful for dashboards, health checks, and sync progress.

Query parameters

NameTypeRequiredDescription
platformstringnoFilter by platform; omit for all
fromDatestringnoStart date (YYYY-MM-DD), inclusive
toDatestringnoEnd date (YYYY-MM-DD), inclusive

Responseinteger — total order count matching the filters.

GET/api/canonical-order-controller/canonical/orders/pending-shipment/count

Counts orders awaiting shipment over a rolling recent window — a real-time fulfillment backlog indicator.

Query parameters

NameTypeRequiredDescription
sinceDaysintegernoLook back N days (default 30)

Responseinteger — count of orders in pending-shipment status in the last N days.

Inventory

GET/api/inventory/reorder

Fetches the latest computed reorder policies for all SKUs: when to reorder and how much, with reorder point, order-now quantity, and order-by date.

Response — Array of InventoryReorderPolicyDto

FieldTypeDescription
canonicalVariantIdintegerSKU id
canonicalVariantNamestringProduct/variant name
currentStockintegerOn-hand inventory
reorderPointintegerStock level triggering a reorder signal
orderQuantityintegerUnits to order when triggered
orderByDatestring (date)Target procurement date to avoid stockout
stockoutRiskPercentnumberProbability of stockout in the forecast horizon

…and more — see the full schema in the OpenAPI spec.

GET/api/inventory/forecast

Fetches the demand forecast for one or all canonical products over the planning horizon. Returns forecast rows with predictive bands (q10/q90), expected-demand center line (q50), credible band (muQ10/muQ90), and a trailing-week baseline (ma8) for charting.

Query parameters

NameTypeRequiredDescription
canonicalVariantIdintegernoOne SKU; omit for all products
bucketstringnoTime bucket ('D' daily, 'W' weekly; default weekly)

ResponseInventoryForecastResponseDto

FieldTypeDescription
variantsarrayPer-variant forecasts: product header, stats block, bindings, and forecast rows (q10, q50, q90, muQ10, muQ90, ma8)

…and more — see the full schema in the OpenAPI spec.

GET/api/inventory/demand-chart

Fetches realized weekly demand history and the latest forecast (with all confidence bands) in one call, ready for plotting. Partial in-progress weeks are flagged.

Query parameters

NameTypeRequiredDescription
canonicalVariantIdintegernoOne SKU; omit for all products
bucketstringnoTime bucket (default 'W' weekly)
weeksBackintegernoWeeks of history to include (default 26)

ResponseInventoryDemandChartDto

FieldTypeDescription
canonicalVariantIdintegerSKU id
historyarrayRealized weekly units (isPartial=true for in-progress week)
forecastarrayLatest forecast rows (q10, q50, q90, muQ10, muQ90, ma8)

…and more — see the full schema in the OpenAPI spec.

GET/api/inventory/params

Fetches inventory settings: lead time, service target, MOQ/lot size, capital budget, alert toggles, plus any per-variant reorder-point overrides.

Response — Array of InventoryPolicyParamsDto

FieldTypeDescription
canonicalVariantIdintegerSKU id (null for the shop-default row)
leadTimeDaysintegerProcurement lead time
serviceLevelnumberTarget in-stock probability (0–1, e.g. 0.95)
minimumOrderQuantityintegerMinimum purchase quantity per order
capitalBudgetnumberCapital budget for reorders
userReorderPointintegerManual reorder-point override (null = use model)
alertsEnabledbooleanLive alerts on/off (shop-default row)

…and more — see the full schema in the OpenAPI spec.

GET/api/inventory/alerts

Fetches live and resolved inventory alerts. An alert fires when stock reaches the reorder point and auto-resolves once stock recovers.

Query parameters

NameTypeRequiredDescription
statusstringnoFilter by status ('open', 'acknowledged', 'dismissed', 'resolved')

Response — Array of InventoryAlertDto

FieldTypeDescription
idintegerAlert id
canonicalVariantIdintegerSKU id
currentStockintegerStock level when the alert fired
thresholdSourcestring'user' (override) or 'model' (algorithm)
thresholdLevelintegerReorder point that triggered the alert
statusstring'open', 'acknowledged', 'dismissed', or 'resolved'
firedAtstring (date)When the alert was triggered
resolvedAtstring (date)When stock recovered (null if still open)

…and more — see the full schema in the OpenAPI spec.

GET/api/inventory/open-orders

Fetches purchase orders the merchant has logged as in flight. Open orders feed the next model run as pipeline arrivals and count into the position checked by alerts.

Query parameters

NameTypeRequiredDescription
statusstringnoFilter by status ('open', 'received', 'cancelled')

Response — Array of InventoryOpenOrderDto

FieldTypeDescription
idintegerPurchase order id
canonicalVariantIdintegerSKU id
orderedQuantityintegerUnits ordered
expectedArrivalWeekstring (date)Target arrival date (Monday of the week)
statusstring'open', 'received', or 'cancelled'
receivedAtstring (date)When stock was received (null if not yet arrived)

…and more — see the full schema in the OpenAPI spec.

Unified financial overview

POST/api/unified/financial-overview/shop-overview

A user-wide realized-profit overview rolled up across ALL your shops (Shopee + TikTok + Lazada) over a lookback window. Returns total profit, revenue-weighted average margin, top/worst products, the cost-breakdown P&L waterfall, and per-platform subtotals. The optional body tunes the window, top-N, and VAT treatment.

Request body

UnifiedFinancialOverviewFetchRequest (optional)

FieldTypeRequiredDescription
lookbackDaysintegernoTrailing window in days (default 30); ignored if from/to set
fromstring (date)noExplicit start date (YYYY-MM-DD); overrides lookbackDays
tostring (date)noExplicit end date (YYYY-MM-DD)
topNintegernoTop/worst products to return (default 5)
includeVatbooleannoInclude VAT calculation (default false)

ResponseUnifiedUserFinancialOverview

FieldTypeDescription
grossGmvnumberTotal GMV across platforms
totalNetRevenuenumberPost-discount, pre-fee revenue
totalProfitnumberRealized profit (revenue − COGS − fees)
avgMarginnumberRevenue-weighted average margin (0–1)
lossMakerCountintegerProducts with negative profit
costBreakdownarrayP&L waterfall (commission, payment fee, shipping, VAT, etc.)
topProductsarrayTop earners by profit
worstProductsarrayThinnest margins
perPlatformarrayPer-platform revenue, profit, and margins

…and more — see the full schema in the OpenAPI spec.

Shops & accounts

GET/api/shopee/fetch-all-user-shops

Fetches all Shopee shops connected to your account. Call this first to discover which shops you own — most shop-scoped endpoints need a shopId from here.

Response — Array of ShopeeShop

FieldTypeDescription
shopIdintegerShopee shop id
shopNamestringDisplay shop name
regionstringRegion code (e.g. 'TH')
timezonestringShop timezone (e.g. 'Asia/Bangkok')
sellerClassstringSeller classification
authorizationStatusstringe.g. 'AUTHORIZED', 'DEAUTHORIZED'
GET/api/shopee/fetch-all-user-shop-accounts

Fetches authorization status for each Shopee (shop, app-type) grant. A non-null deauthorizedAt means the grant is revoked/expired and needs re-auth — handy for diagnosing why a shop's orders or ads data is missing.

Response — Array of ShopeeAccountEntry

FieldTypeDescription
shopIdintegerShopee shop id
appTypestringGrant type ('default' core data, 'ads' campaign data, 'ams' open campaign)
authorizedAtstring (date)When the grant was last authorized
deauthorizedAtstring (date)When it expired/was revoked (null if active)
POST/api/shopee/shop/check-commission-rates

Compares empirical commission rates (computed from order data) against the rates declared in Shopee Seller Centre — useful for auditing when displayed and calculated rates diverge.

Query parameters

NameTypeRequiredDescription
shopIdintegeryesShopee shop id
regionstringyesRegion code (e.g. 'TH')

ResponseShopeeCommissionRateCheckResult

FieldTypeDescription
declaredRatenumberCommission rate from Seller Centre (%)
empiricalRatenumberCalculated rate from orders (%)
sampleOrderCountintegerOrders used in the empirical calculation
mismatchPercentnumberMismatch frequency (%)

…and more — see the full schema in the OpenAPI spec.

GET/api/shopee/shop/profile

Fetches shop profile details (name, logo, description) from Shopee.

Query parameters

NameTypeRequiredDescription
shopIdintegeryesShopee shop id

ResponseShopeeShopProfile

FieldTypeDescription
shopNamestringShop name
shopLogostringLogo image URL
shopDescriptionstringShop bio/description
followCountintegerShop followers
responseRatenumberSeller response rate (0–1)
GET/api/lazada/auth/fetch-all-user-shops

Fetches all Lazada sellers (accounts) connected to your account. Call this first to discover which Lazada accounts you own — seller-scoped endpoints need the sellerId from here.

Response — Array of LazadaShop

FieldTypeDescription
sellerIdintegerLazada seller account id
shopNamestringShop/account name
regionstringRegion code (e.g. 'TH', 'VN', 'PH')
sellerTypestringSeller type ('REGULAR', 'LAZMALL', 'SHOP')
GET/api/tiktok/auth/fetch-all-user-shops

Fetches all TikTok Shops connected to your account. TikTok shop ids are 19-digit numbers larger than JavaScript's safe-integer max — treat them as opaque strings end-to-end.

Response — Array of TikTokShopResponse

FieldTypeDescription
shopIdstringTikTok shop id (opaque string, not a number)
shopNamestringShop name
regionstringRegion code (e.g. 'TH', 'VN')