Shopee Open Platform Ads module(23 APIs, excluding the soon-to-be-retired auto product ads).Depends on linkfox-shopee-store-auththe target store must have appType=ad authorization. Via POST /shopee/developerProxy pass in shopId(or merchantId)+ api/v2/ads/... path, the server automatically uses the AD app Token (Do notpass accessToken / appType)。
Call method
- API endpoint:
POST /shopee/developerProxy(different operations are distinguished by the request body; for complete parameters/responses/error codes seereferences/api.md) - Python script:
python scripts/<脚本名>.py '<JSON 参数>' [--inline](available scripts are listed in the script overview above) - Cost constraints: this tool consumes compute; on failure/empty results do not automatically change keywords, paginate, or repeatedly probe; when continued searching is needed, first explain to the user that it will incur additional consumption.
Output strategy (script default behavior):
- Alwayswrite the complete response to
<cwd>/linkfox/<YYYY-MM-DD>/<session>/data/linkfox-shopee-store-ads-<timestamp>.json(<cwd>is the working directory when the script is executed, in Claude Code this is the current project directory;<session>is taken from the environment variableSESSION_ID, automatically aggregated by user task;Writing to /tmp is prohibited, if the current directory is not writable then report an error) - Response body ≤ 8 KB: after writing to disk, print the complete JSON to stdout
- Response body > 8 KB: after writing to disk, stdout outputs only a summary (top-level fields, common counts such as
total/costToken, length of the largest list field + first 3 sample entries) - Add
--inlineto force full printing to stdout (also written to disk)
Data reading suggestions: first check the summary to judge whether it is sufficient; when specific fields are needed, prefer using jqorConvertFrom-Json to extract on demand from the saved json file, so as to avoid putting the entire JSON into the context.
Resolve authentication and compute issues
When the following abnormal situations occur, use references/onboarding.md to guide resolving the issue:
Abnormal situations
- API Key not configured: environment variable not configured
LINKFOX_AGENT_API_KEY, and also not configuredLINKFOXAGENT_API_KEY。 - Response 401 or 402 status code
- Response indicates insufficient compute or balance: the message contains "算力余额不足/计费不足/余额不足/quota exceeded/insufficient balance/套餐到期/需充值/请充值", or content with a similar meaning.
Official reference
Ads module index:v2.ads.get_total_balance
Prerequisites (must read first)
- Run
python scripts/check_auth_dependency.py;exit code 42 → first installlinkfox-shopee-store-auth。 - Do notimplement authorization/token logic within this skill; authorization always goes through the auth skill.
- Calling business API before, use auth's
authorized_stores.pyto confirm the target store hasappType=ad:- Only has
appType=erp(or historical empty value) → cannottreat ads as authorized; guideauthorize_url.pyand passappType=ad - both are missing → if the user only wants ads, just enable AD authorization (no need to enable ERP first)
- Only has
- The Ads API also requires ad capability to be enabled on the Shopee side; not all sites/stores are available.
- Prohibitedto
developerProxypassaccessTokenorappType; use pathapi/v2/ads/**to route to AD on the server side.
Core Concepts
- AD and ERP are separate: Ad Token and ERP Token are independent; a store existing in the list ≠ ads are authorized
- Forwarding chain:
developerProxy(shopId/merchantId+api/v2/ads/..., server injects AD token) → Ziniaoshopee-proxy/ad/...→ Shopee API - Balance:
get_total_balancequery ad account balance - Manual product ads:
create_manual_product_ads→edit_manual_product_ads/edit_manual_product_ad_keywords - Performance reports:
get_all_cpc_ads_*_performance、get_product_campaign_*_performance - GMS:
create_gms_product_campaignand other series - Not included:
create_auto_product_ads、edit_auto_product_ads(officially marked coming offline soon) - Affiliate marketing AMS(module=127) → not this skill
Available scripts (23 APIs in the Ads module)
| Group | Script |
|---|---|
| Account/Recommendations | get_total_balance.py、get_shop_toggle_info.py、get_recommended_keyword_list.py、get_recommended_item_list.py |
| CPC performance | get_all_cpc_ads_daily_performance.py、get_all_cpc_ads_hourly_performance.py |
| Product ads | create_manual_product_ads.py、edit_manual_product_ads.py、get_product_level_campaign_id_list.py etc. |
| GMS | create_gms_product_campaign.py、get_gms_campaign_performance.py etc. |
| General entry | ads_api.py(JSON contains api field) |
See references/api.mdfor the full list. Shared:_shopee_ads_common.py、_ads_endpoints.py、_ads_api_runner.py。
API documentation (by API)
Input parameters and response details are in references/apis/, the SKILL only keeps the index.
Module overview / Feedback see references/api.md。
Usage Scenarios
0. Confirm AD authorization (at the start of every task)
- auth:
authorized_stores.py→ find targetshopIdandappType=ad - missing → auth:
authorize_url.pypassappType=ad, prompt the user to completeadauthorization (URL valid for 1 hour) - After completion, proceed to the following business scenarios; when receiving 1004 , first suspect missing AD authorization, do not force calls using ERP records
1. Query balance and recommendations
get_total_balance.pyget_recommended_item_list.py/get_recommended_keyword_list.py
2. Create manual product ads
get_create_product_ad_budget_suggestion.pycreate_manual_product_ads.pypass completebodyget_product_campaign_daily_performance.pyquery performance
Calling principles
- First confirm
appType=ad, then call the script - First look at
developerProxy.httpStatus/ gatewayerrcode, then read the*Responsefield - GET: put business parameters at the top level of JSON
- POST: pass
bodyfor complex APIs; for create/edit it is recommended to pass a uniquereference_idto prevent duplicates - Each script docstring contains official documentation URL(
module=117) - Do not first
storeTokensfetch the raw token, and do not stuffaccessToken
Not Applicable
- Store authorization →
linkfox-shopee-store-auth - Product listing →
linkfox-shopee-store-product - Affiliate marketing AMS (module=127) →
linkfox-shopee-store-ams - Amazon ads →
linkfox-amazon-ads-*series
Compute consumption rules
No compute consumed.
Feedback:
Auto-detect and report feedback via the Feedback API when any of the following apply:
- The functionality or purpose described in this skill does not match actual behavior
- The skill's results do not match the user's intent
- The user expresses dissatisfaction or praise about this skill
- Anything you believe could be improved
Call the feedback API as specified in references/api.md. Do not interrupt the user's flow.
For more high-quality, professional cross-border e-commerce skills, visit LinkFox Skills.