Endpoints: Actions และคำแนะนำ

อ่าน Actions ที่ช่วยเพิ่มกำไรซึ่งระบบสร้างขึ้น — การตั้งราคา, โฆษณา, บันเดิล, การบูสต์, แคมเปญ และ policy

ใน DataGlass Actions คือคำแนะนำที่ช่วยเพิ่มกำไรซึ่งระบบสร้างขึ้น Endpoint เหล่านี้ให้คุณอ่านคำแนะนำเหล่านั้น — รายการคำแนะนำ, รายละเอียดต่อรายการ, การตรวจสอบซ้ำ และการพรีวิวแบบ what-if ดู เริ่มต้นใช้งาน และ หลักการทั่วไป ทุก endpoint เป็นแบบอ่านอย่างเดียว — การนำ Action ไปใช้ต้องทำผ่านแอป DataGlass

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

Recommendations (general)

POST/api/recommendation/fetch

Fetches your active recommendations across all types (pricing, ads, inventory), newest first. Each carries its type, shop, status, expected uplift, and risk metrics. Use this to populate the main Actions dashboard, or filter by shop/region/platform/type.

Request body

RecommendationFilter

FieldTypeRequiredDescription
shopIdintegernoFilter by shop
recommendationTypestringnoe.g. price_buffer_discount, bundle_deal, commission_adjust, product_boost, ads, ads_target_roas, ads_target_roas_gms, campaign_enrollment, tiktok_ads_budget, tiktok_ads_target_roas
statusstringnoe.g. proposed, approved, executing, paused, completed, failed, stopped, rolled_back, rejected
recommendationIdintegernoFetch a single recommendation by id
experimentIdintegernoFilter by experiment id

Response — Array of Recommendation

FieldTypeDescription
recommendationIdintegerRecommendation id
shopIdintegerShop id
platformstringPlatform
recommendationTypestringThe type (see filter values above)
statusstringLifecycle state
confidencenumberConfidence (0–1, higher = more certain)
expectedUpliftValuenumberEstimated profit impact
riskScorenumberRisk score (0–1)
validUntilstring (date)Expiry

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

POST/api/recommendation/fetch-failed

Returns recommendations whose apply operation failed, paired with the captured failure reason. The failure is terminal (the recommendation is dismissed).

Request bodyRecommendationFilter (same fields as above).

Response — Array of FailedRecommendation — all Recommendation fields plus failureReason (string) and failedAt (date).

POST/api/recommendation/state-change-log/fetch

Returns the state-change log for a recommendation — every transition (proposed → approved → executing → completed, or paused/stopped/rolled_back/rejected), who triggered it, and any captured reason.

Request body

RecommendationStateChangeLogFilter

FieldTypeRequiredDescription
recommendationIdintegernoRecommendation to audit (omit → empty result)

Response — Array of RecommendationStateChangeLog — entries with fromStatus, toStatus, changedBy, reason, metadata, createdAt.

Price-buffer discount

POST/api/recommendation/price-buffer-discount/fetch

Fetches price-buffer (margin-defence) recommendations for Shopee or TikTok — each protects your margin against fee/cost increases by recommending a price change. Returns a summary per recommendation; call /items for per-product detail.

Request body

FetchPriceBufferDiscountRecommendationsRequest

FieldTypeRequiredDescription
recommendationIdintegernoFetch a single recommendation
shopIdintegernoFilter by shop
regionstringnoFilter by region
platformstringnoshopee or tiktok_shop
statusstringnoFilter by status

Response — Array of PriceBufferDiscountRecommendationResponserecommendationId, shopId, region, platform, status, expectedUpliftValue, plus a nested items summary. …and more — see the full schema in the OpenAPI spec.

POST/api/recommendation/price-buffer-discount/items/fetch

Expands recommendations to per-item detail: current/proposed/promotion prices, discount %, the protection reason, and buyer-price impact.

Request body — Array of recommendation ids (integer; max 500).

Response — Array of PriceBufferDiscountRecommendationItemResponserecommendationId, itemId, unit count, current/proposed/promotion prices, discount %, reason (e.g. fee_increase, cost_increase), buyerPriceDelta, and cost-breakdown fields.

POST/api/recommendation/price-buffer-discount/models/fetch

Per-variant (model) price breakdown for the recommended items: current/proposed/promotion prices and buyer-price delta.

Request body — Array of recommendation ids (integer; max 500).

Response — Array of PriceBufferDiscountRecommendationModelResponserecommendationId, itemId, modelId, current/proposed/promotion price, discount %, buyer-price delta.

POST/api/recommendation/price-buffer-discount/check-dedup

Returns which of the given item ids already have an active (non-rejected) price-buffer recommendation, so a UI can pre-filter them from a "generate new" flow.

Request body

CheckPriceBufferDiscountDedupRequest

FieldTypeRequiredDescription
shopIdintegeryesShop id
itemIdsarrayyesItem ids to check (max 500)

ResponseSet<Long> — the subset of itemIds that already have an active recommendation (empty = all available).

POST/api/recommendation/price-buffer-discount/check-dedup-by-platform

Platform-neutral dedup: pass platform-native item ids (e.g. TikTok product ids as strings) instead of numeric Shopee item ids.

Request body

CheckPriceBufferDiscountPlatformDedupRequest

FieldTypeRequiredDescription
shopIdintegeryesShop id
platformstringyesshopee or tiktok_shop
platformItemIdsarrayyesPlatform-native item ids (max 500)

ResponseSet<String> — the subset of platformItemIds that already have an active recommendation.

Bundle deal

POST/api/recommendation/bundle-deal/fetch

Fetches Shopee bundle-deal recommendations — product groupings to offer as a bundle to lift basket size and AOV. Returns a summary per recommendation; call /details or /items for expanded data.

Request body

BundleDealRecommendationFilter

FieldTypeRequiredDescription
recommendationIdintegernoFetch a single recommendation
shopIdintegernoFilter by shop
regionstringnoFilter by region
platformstringnoFilter by platform
statusstringnoFilter by status

Response — Array of BundleDealRecommendationrecommendationId, shopId, region, status, expected uplift, and the bundle structure. …and more — see the full schema in the OpenAPI spec.

POST/api/recommendation/bundle-deal/details/fetch

Expands bundle recommendations: full bundle structure (items, variants, per-item pricing) and rationale.

Request body — Array of recommendation ids (integer; max 500).

Response — Array of BundleDealRecommendationDetailrecommendationId, bundle name/description, bundled items with prices/discounts, expected basket impact, reason.

POST/api/recommendation/bundle-deal/items/fetch

Per-item details within bundles: current vs bundled price, discount, margin impact, and contribution to uplift.

Request body — Array of recommendation ids (integer; max 500).

Response — Array of BundleDealRecommendationItemrecommendationId, itemId, current/bundled price, discount %, estimated sales lift, margin delta.

POST/api/recommendation/bundle-deal/check-dedup

Returns which item ids already have an active bundle-deal recommendation.

Request body

CheckBundleDealDedupRequest

FieldTypeRequiredDescription
shopIdintegeryesShop id
itemIdsarrayyesItem ids to check (max 500)

ResponseSet<Long> — the subset of itemIds that already have an active recommendation.

Commission adjust

POST/api/recommendation/commission-adjust/fetch

Fetches margin-defence actions for a Shopee shop facing an upcoming commission-rate increase. Each recommends a discount-trim or price-raise per item/variant to preserve the protected margin.

Request body

CommissionAdjustShopRequest

FieldTypeRequiredDescription
shopIdintegeryesShop id
regionstringyesRegion code
statusstringnoFilter by status

Response — Array of CommissionAdjustActionResponserecommendationId, shopId, region, status, commissionEffectiveDate, protectedMarginPct, impacted items with margin snapshot and estimated profit impact, and per-model recommended lever. …and more — see the full schema in the OpenAPI spec.

Product boost

POST/api/recommendation/boost/fetch

Fetches Shopee product-boost recommendations — which products to boost in search/feed to increase visibility and sales. Call /items for the full product list.

Request body

BoostRecommendationFilter

FieldTypeRequiredDescription
recommendationIdintegernoFetch a single recommendation
shopIdintegernoFilter by shop
regionstringnoFilter by region
statusstringnoFilter by status

Response — Array of BoostRecommendationrecommendationId, shopId, region, status, expected uplift, and the nested product list.

POST/api/recommendation/boost/items/fetch

Expands boost recommendations to the product list, current metrics, and expected uplift.

Request body — Array of recommendation ids (integer; max 500).

Response — Array of BoostRecommendationItemrecommendationId, itemId, current sales/profit, expected sales uplift %, estimated profit impact, and ranking.

POST/api/recommendation/boost/check-dedup

Returns true if the shop already has a non-rejected boost recommendation — so a UI can gate the "Create new" control.

Request body

CheckBoostDedupRequest

FieldTypeRequiredDescription
shopIdintegeryesShop id

Responseboolean — true if an active boost recommendation exists.

Shopee ads

POST/api/recommendation/ads/fetch

Fetches Shopee single-campaign ads recommendations — budget and bid adjustments to optimize ad-spend ROI. Each targets a specific campaign. Call /details or /keywords for expanded data.

Request body

ShopeeAdsRecommendationFilter

FieldTypeRequiredDescription
recommendationIdintegernoFetch a single recommendation
shopIdintegernoFilter by shop
regionstringnoFilter by region
statusstringnoFilter by status
campaignIdintegernoFilter by Shopee campaign id
adsActionTypestringnoe.g. budget_adjust, keyword_change
includeHistorybooleannoInclude rejected/completed (default false → active only)

Response — Array of ShopeeAdsRecommendationrecommendationId, shopId, campaignId, status, current vs proposed budget/bids, expected ROAS/ROI uplift. …and more — see the full schema in the OpenAPI spec.

POST/api/recommendation/ads/details/fetch

Expands a campaign ads recommendation: current vs proposed performance (spend, sales, ROAS), reason, confidence, and risk.

Request body — Array of recommendation ids (integer; max 500).

Response — Array of ShopeeAdsRecommendationDetailResponserecommendationId, current/proposed budget/bid/spend/sales/ROAS, expected uplift %, reason, confidence, risk.

POST/api/recommendation/ads/keywords/fetch

For keyword-optimization recommendations: the keywords to add/modify/remove and their estimated impact on relevance and CPC.

Request body — Array of recommendation ids (integer; max 500).

Response — Array of ShopeeAdsRecommendationKeywordChangerecommendationId, keyword, action (add/modify/remove), current/proposed bid, estimated CPC impact, relevance score.

POST/api/recommendation/ads/check-dedup

Returns true if the campaign already has a non-rejected ads recommendation.

Request body

CheckAdsDedupRequest

FieldTypeRequiredDescription
shopIdintegeryesShop id
campaignIdintegernoShopee campaign id (omit → checks all campaigns)

Responseboolean — true if an active recommendation exists for the campaign.

POST/api/recommendation/ads/check-actionable

Returns true if the recommendation is in a state that can be applied/resumed (proposed/paused), false if it's mid-flight or terminal — so a UI can show a refresh prompt.

Request body

CheckAdsDedupRequest

FieldTypeRequiredDescription
shopIdintegeryesShop id
campaignIdintegernoShopee campaign id

Responseboolean — true if the recommendation can be applied/resumed.

Target ROAS

POST/api/recommendation/ads/target-roas/fetch

Fetches margin-based target-ROAS recommendations for Shopee GMV-Max product campaigns. Each derives a ROAS target from product margin, break-even, and your desired net margin. Returns the recommendation plus current detail.

Request body

ShopeeAdsRecommendationFilter

FieldTypeRequiredDescription
recommendationIdintegernoFetch a single recommendation
shopIdintegernoFilter by shop (required for list)
regionstringnoFilter by region
statusstringnoFilter by status
campaignIdintegernoFilter by campaign

Response — Array of TargetRoasRecommendationViewrecommendation (full object), detail (current/proposed/break-even ROAS, margin %), and editedByUser flag.

POST/api/recommendation/ads/target-roas/preview

Given a product margin and desired net margin, returns break-even ROAS and recommended target ROAS (and optionally the implied margin for a desired ROAS). No writes — backs the margin/ROAS slider.

Request body

TargetRoasPreviewRequest

FieldTypeRequiredDescription
shopIdintegeryesShop id
regionstringyesRegion code
marginnumbernoProduct margin (0–1, e.g. 0.15)
targetMarginnumbernoDesired net margin after ad spend (default: margin/2)
desiredRoasnumbernoA specific ROAS target → returns implied margin

ResponseTargetRoasPreviewResponsebreakEvenRoas, recommendedRoasTarget, targetMarginInfeasible, impliedMarginForDesiredRoas, and a human-readable explanation.

POST/api/recommendation/ads/target-roas/preview-profit

Money-based sibling of preview: given a margin, absolute target profit, and ad spend, returns break-even ROAS and recommended target ROAS. No writes.

Request body

TargetProfitPreviewRequest

FieldTypeRequiredDescription
shopIdintegeryesShop id
regionstringyesRegion code
targetProfitnumberyesTarget absolute profit
adSpendnumberyesAd spend over which profit is measured
marginnumbernoProduct margin
desiredRoasnumbernoA specific ROAS → returns implied profit

ResponseTargetProfitPreviewResponsebreakEvenRoas, recommendedRoasTarget, targetProfitInfeasible, impliedProfitForDesiredRoas, explanation.

POST/api/recommendation/ads/target-roas-gms/fetch

Same as target-ROAS fetch, for Shopee GMS (GMV-Max shop) campaigns.

Request bodyShopeeAdsRecommendationFilter (same fields as target-roas/fetch).

Response — Array of TargetRoasRecommendationView — recommendation + current detail + editedByUser flag.

POST/api/recommendation/ads/target-roas-gms/preview

The margin → target-ROAS preview for GMS campaigns. No writes.

Request bodyTargetRoasPreviewRequest (same fields as target-roas/preview).

ResponseTargetRoasPreviewResponse — break-even and recommended ROAS, feasibility, and explanation.

Campaign enrollment

POST/api/recommendation/shopee/campaign-enrollment/eligibility

A price simulator for Shopee campaign enrollment: returns the lowest discounted price that keeps your target margin, whether it beats the 90-day low (Shopee's floor), and the full fee breakdown at that price. No writes.

Request body

CampaignEnrollmentEligibilityRequest

FieldTypeRequiredDescription
shopIdintegeryesShop id
regionstringyesRegion code
itemIdintegeryesShopee item id
modelIdintegernoVariant id (omit for single-variant)
targetMarginnumbernoOverride target margin (default: min(shop margin, 0.10))
cogsnumbernoOverride COGS (uses inferred if omitted)

ResponseCampaignEnrollmentEligibilityResponsestatus (ELIGIBLE, NOT_LOWEST_IN_90D, INELIGIBLE_RATING, COGS_UNKNOWN, MARGIN_INFEASIBLE), recommendedDiscountedPrice, current price, minPrice90d, discount amount/%, target/shop/achieved margins, COGS + source, rating, cost breakdown, and explanation.

POST/api/recommendation/shopee/campaign-enrollment/eligibility/list

Returns the pre-computed eligibility pool for a shop (one row per item/model), refreshed hourly and on COGS write — browse every product's status and recommended discounted price without a per-item re-check.

Request body

CampaignEnrollmentShopRequest

FieldTypeRequiredDescription
shopIdintegeryesShop id
regionstringyesRegion code

Response — Array of ShopeeCampaignEnrollmentEligibilityitemId, modelId, status, recommendedDiscountedPrice, current price, minPrice90d, discount %, margins, COGS, rating, and fee breakdown.

POST/api/recommendation/shopee/campaign-enrollment/fetch

Returns the shop-level campaign-join recommendation with its enrollable variants (the full export payload).

Request body

CampaignEnrollmentShopRequest

FieldTypeRequiredDescription
shopIdintegeryesShop id
regionstringyesRegion code

Response — Array of CampaignEnrollmentActionResponserecommendationId, shopId, region, and enrollable variants with prices, discounts, and fee breakdown. …and more — see the full schema in the OpenAPI spec.

TikTok ads

POST/api/recommendation/tiktok/ads/budget/fetch

Fetches budget-adjust recommendations for budget-constrained TikTok GMV Max campaigns — an optimal daily budget to maximize profit given the constraint. Returns the recommendation plus current detail.

Request body

TikTokAdsRecommendationFilter

FieldTypeRequiredDescription
recommendationIdintegernoFetch a single recommendation
shopIdintegernoFilter by shop (required for list)
regionstringnoFilter by region
statusstringnoFilter by status
campaignIdstringnoFilter by TikTok campaign id

Response — Array of TikTokBudgetRecommendationViewrecommendation (full object) and detail (current/proposed daily budget in ad-account currency, shop-currency equivalents, optimizer context).

POST/api/recommendation/tiktok/ads/target-roas/fetch

Fetches margin-based target-ROAS recommendations for TikTok GMV Max campaigns (Minimum-ROAS bidding). Returns the recommendation plus current detail.

Request bodyTikTokAdsRecommendationFilter (same fields as budget/fetch).

Response — Array of TikTokTargetRoasRecommendationViewrecommendation (full object), detail (current/proposed ROI target, break-even ROAS, margin %), and editedByUser flag.

POST/api/recommendation/tiktok/ads/target-roas/preview

The margin → target-ROAS preview for TikTok. No writes.

Request bodyTargetRoasPreviewRequest (shopId, region required; margin, targetMargin, desiredRoas optional).

ResponseTargetRoasPreviewResponse — break-even and recommended ROAS, feasibility, and explanation.

Ads portfolio

POST/api/recommendation/ads/portfolio/fetch

Returns the current ads portfolio (if any) for a shop — the campaigns grouped for joint budget optimization, portfolio-level metrics, and allocation mode.

Query parameters

NameTypeRequiredDescription
shopIdintegeryesShop id
regionstringyesRegion code

ResponseAdsPortfolio (or null) — portfolioId, shopId, region, campaigns, portfolioStatus, totalBudget, performanceMetrics, mode.

POST/api/recommendation/ads/portfolio/campaigns/fetch

Returns the campaigns added to a portfolio: id, name, current daily budget, and optimizer status.

Request body

FetchPortfolioCampaignsRequest

FieldTypeRequiredDescription
portfolioIdintegeryesPortfolio id

Response — Array of AdsPortfolioCampaigncampaignId, campaignName, currentDailyBudget, currency, optimizerStatus, addedAt.

POST/api/recommendation/ads/portfolio/allocations/fetch

Returns the per-campaign budget allocation a portfolio recommendation suggests — how much of the total budget to give each campaign to maximize overall profit. For preview before apply.

Query parameters

NameTypeRequiredDescription
recommendationIdintegeryesPortfolio recommendation id

Response — Array of AdsPortfolioAllocationcampaignId, campaignName, currentDailyBudget, recommendedDailyBudget, budgetDelta, currency, expectedRoiUplift, confidence.

Policy

POST/api/policy/experiments/fetch

Returns experiments (A/B and multivariate tests) tied to recommendations and policies — each tracks expected uplift, dates, and a performance time series.

Request body

PolicyExperimentFilter

FieldTypeRequiredDescription
experimentIdintegernoFetch a single experiment
shopIdintegernoFilter by shop
regionstringnoFilter by region
platformstringnoFilter by platform
statusstringnoactive, completed, cancelled
namestringnoSubstring match on experiment name

Response — Array of PolicyExperimentexperimentId, shopId, region, platform, name, description, status, expectedUpliftValue, startedAt, endedAt. …and more — see the full schema in the OpenAPI spec.

POST/api/policy/policies/fetch

Returns policies — the levers and feature gates that govern which recommendations are generated, how they're applied, and when they expire. Parameters live in the history; call /history/fetch.

Request body

PolicyFilter

FieldTypeRequiredDescription
policyIdintegernoFetch a single policy
shopIdintegernoFilter by shop
regionstringnoFilter by region
platformstringnoshopee, tiktok_shop, lazada
isActivebooleannoFilter by active status
statusstringnoactive, inactive, deprecated

Response — Array of PolicypolicyId, shopId, region, platform, isActive, status, currentHistoryId, createdAt, updatedAt.

POST/api/policy/policies/history/fetch

Returns the audit trail for a policy: each version of its parameters, when it was valid, which experiment it was tied to, and who changed it.

Request body

PolicyHistoryFilter

FieldTypeRequiredDescription
policyIdintegeryesPolicy to fetch history for
isCurrentbooleannoOnly the current version
versionintegernoA specific version number
experimentIdintegernoFilter by experiment id
validFromGtestring (date)noValid-from ≥ this date
validFromLtstring (date)noValid-from < this date

Response — Array of PolicyHistorypolicyHistoryId, policyId, controller, params (JSON), version, validFrom, validTo, isCurrent, experimentId, changedBy, changeReason, createdAt.