Endpoints: Actions & recommendations
In DataGlass, Actions are profit-improving recommendations the engine generates. These endpoints let you read them — the recommendation list, per-item details, dedup checks (does this product already have an active recommendation?), and what-if previews. See Getting started for auth and Conventions. All read-only — applying or deploying an Action requires the DataGlass app.
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
| Field | Type | Required | Description |
|---|---|---|---|
shopId | integer | no | Filter by shop |
recommendationType | string | no | e.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 |
status | string | no | e.g. proposed, approved, executing, paused, completed, failed, stopped, rolled_back, rejected |
recommendationId | integer | no | Fetch a single recommendation by id |
experimentId | integer | no | Filter by experiment id |
Response — Array of Recommendation
| Field | Type | Description |
|---|---|---|
recommendationId | integer | Recommendation id |
shopId | integer | Shop id |
platform | string | Platform |
recommendationType | string | The type (see filter values above) |
status | string | Lifecycle state |
confidence | number | Confidence (0–1, higher = more certain) |
expectedUpliftValue | number | Estimated profit impact |
riskScore | number | Risk score (0–1) |
validUntil | string (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 body — RecommendationFilter (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
| Field | Type | Required | Description |
|---|---|---|---|
recommendationId | integer | no | Recommendation 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
| Field | Type | Required | Description |
|---|---|---|---|
recommendationId | integer | no | Fetch a single recommendation |
shopId | integer | no | Filter by shop |
region | string | no | Filter by region |
platform | string | no | shopee or tiktok_shop |
status | string | no | Filter by status |
Response — Array of PriceBufferDiscountRecommendationResponse — recommendationId, 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 PriceBufferDiscountRecommendationItemResponse — recommendationId, 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 PriceBufferDiscountRecommendationModelResponse — recommendationId, 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
| Field | Type | Required | Description |
|---|---|---|---|
shopId | integer | yes | Shop id |
itemIds | array | yes | Item ids to check (max 500) |
Response — Set<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
| Field | Type | Required | Description |
|---|---|---|---|
shopId | integer | yes | Shop id |
platform | string | yes | shopee or tiktok_shop |
platformItemIds | array | yes | Platform-native item ids (max 500) |
Response — Set<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
| Field | Type | Required | Description |
|---|---|---|---|
recommendationId | integer | no | Fetch a single recommendation |
shopId | integer | no | Filter by shop |
region | string | no | Filter by region |
platform | string | no | Filter by platform |
status | string | no | Filter by status |
Response — Array of BundleDealRecommendation — recommendationId, 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 BundleDealRecommendationDetail — recommendationId, 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 BundleDealRecommendationItem — recommendationId, 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
| Field | Type | Required | Description |
|---|---|---|---|
shopId | integer | yes | Shop id |
itemIds | array | yes | Item ids to check (max 500) |
Response — Set<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
| Field | Type | Required | Description |
|---|---|---|---|
shopId | integer | yes | Shop id |
region | string | yes | Region code |
status | string | no | Filter by status |
Response — Array of CommissionAdjustActionResponse — recommendationId, 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
| Field | Type | Required | Description |
|---|---|---|---|
recommendationId | integer | no | Fetch a single recommendation |
shopId | integer | no | Filter by shop |
region | string | no | Filter by region |
status | string | no | Filter by status |
Response — Array of BoostRecommendation — recommendationId, 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 BoostRecommendationItem — recommendationId, 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
| Field | Type | Required | Description |
|---|---|---|---|
shopId | integer | yes | Shop id |
Response — boolean — 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
| Field | Type | Required | Description |
|---|---|---|---|
recommendationId | integer | no | Fetch a single recommendation |
shopId | integer | no | Filter by shop |
region | string | no | Filter by region |
status | string | no | Filter by status |
campaignId | integer | no | Filter by Shopee campaign id |
adsActionType | string | no | e.g. budget_adjust, keyword_change |
includeHistory | boolean | no | Include rejected/completed (default false → active only) |
Response — Array of ShopeeAdsRecommendation — recommendationId, 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 ShopeeAdsRecommendationDetailResponse — recommendationId, 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 ShopeeAdsRecommendationKeywordChange — recommendationId, 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
| Field | Type | Required | Description |
|---|---|---|---|
shopId | integer | yes | Shop id |
campaignId | integer | no | Shopee campaign id (omit → checks all campaigns) |
Response — boolean — 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
| Field | Type | Required | Description |
|---|---|---|---|
shopId | integer | yes | Shop id |
campaignId | integer | no | Shopee campaign id |
Response — boolean — 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
| Field | Type | Required | Description |
|---|---|---|---|
recommendationId | integer | no | Fetch a single recommendation |
shopId | integer | no | Filter by shop (required for list) |
region | string | no | Filter by region |
status | string | no | Filter by status |
campaignId | integer | no | Filter by campaign |
Response — Array of TargetRoasRecommendationView — recommendation (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
| Field | Type | Required | Description |
|---|---|---|---|
shopId | integer | yes | Shop id |
region | string | yes | Region code |
margin | number | no | Product margin (0–1, e.g. 0.15) |
targetMargin | number | no | Desired net margin after ad spend (default: margin/2) |
desiredRoas | number | no | A specific ROAS target → returns implied margin |
Response — TargetRoasPreviewResponse — breakEvenRoas, 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
| Field | Type | Required | Description |
|---|---|---|---|
shopId | integer | yes | Shop id |
region | string | yes | Region code |
targetProfit | number | yes | Target absolute profit |
adSpend | number | yes | Ad spend over which profit is measured |
margin | number | no | Product margin |
desiredRoas | number | no | A specific ROAS → returns implied profit |
Response — TargetProfitPreviewResponse — breakEvenRoas, 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 body — ShopeeAdsRecommendationFilter (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 body — TargetRoasPreviewRequest (same fields as target-roas/preview).
Response — TargetRoasPreviewResponse — 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
| Field | Type | Required | Description |
|---|---|---|---|
shopId | integer | yes | Shop id |
region | string | yes | Region code |
itemId | integer | yes | Shopee item id |
modelId | integer | no | Variant id (omit for single-variant) |
targetMargin | number | no | Override target margin (default: min(shop margin, 0.10)) |
cogs | number | no | Override COGS (uses inferred if omitted) |
Response — CampaignEnrollmentEligibilityResponse — status (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
| Field | Type | Required | Description |
|---|---|---|---|
shopId | integer | yes | Shop id |
region | string | yes | Region code |
Response — Array of ShopeeCampaignEnrollmentEligibility — itemId, 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
| Field | Type | Required | Description |
|---|---|---|---|
shopId | integer | yes | Shop id |
region | string | yes | Region code |
Response — Array of CampaignEnrollmentActionResponse — recommendationId, 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
| Field | Type | Required | Description |
|---|---|---|---|
recommendationId | integer | no | Fetch a single recommendation |
shopId | integer | no | Filter by shop (required for list) |
region | string | no | Filter by region |
status | string | no | Filter by status |
campaignId | string | no | Filter by TikTok campaign id |
Response — Array of TikTokBudgetRecommendationView — recommendation (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 body — TikTokAdsRecommendationFilter (same fields as budget/fetch).
Response — Array of TikTokTargetRoasRecommendationView — recommendation (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 body — TargetRoasPreviewRequest (shopId, region required; margin, targetMargin, desiredRoas optional).
Response — TargetRoasPreviewResponse — 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
| Name | Type | Required | Description |
|---|---|---|---|
shopId | integer | yes | Shop id |
region | string | yes | Region code |
Response — AdsPortfolio (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
| Field | Type | Required | Description |
|---|---|---|---|
portfolioId | integer | yes | Portfolio id |
Response — Array of AdsPortfolioCampaign — campaignId, 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
| Name | Type | Required | Description |
|---|---|---|---|
recommendationId | integer | yes | Portfolio recommendation id |
Response — Array of AdsPortfolioAllocation — campaignId, 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
| Field | Type | Required | Description |
|---|---|---|---|
experimentId | integer | no | Fetch a single experiment |
shopId | integer | no | Filter by shop |
region | string | no | Filter by region |
platform | string | no | Filter by platform |
status | string | no | active, completed, cancelled |
name | string | no | Substring match on experiment name |
Response — Array of PolicyExperiment — experimentId, 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
| Field | Type | Required | Description |
|---|---|---|---|
policyId | integer | no | Fetch a single policy |
shopId | integer | no | Filter by shop |
region | string | no | Filter by region |
platform | string | no | shopee, tiktok_shop, lazada |
isActive | boolean | no | Filter by active status |
status | string | no | active, inactive, deprecated |
Response — Array of Policy — policyId, 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
| Field | Type | Required | Description |
|---|---|---|---|
policyId | integer | yes | Policy to fetch history for |
isCurrent | boolean | no | Only the current version |
version | integer | no | A specific version number |
experimentId | integer | no | Filter by experiment id |
validFromGte | string (date) | no | Valid-from ≥ this date |
validFromLt | string (date) | no | Valid-from < this date |
Response — Array of PolicyHistory — policyHistoryId, policyId, controller, params (JSON), version, validFrom, validTo, isCurrent, experimentId, changedBy, changeReason, createdAt.