Shopee Store Authorization and Management
OAuth authorization, authorized store list, and authorization status retrieval for Shopee Open Platform.
Prerequisite for downstream services (calls open interfaces via
).
Shopee ERP and AD (Advertising) use different applications and Tokens, and must be authorized separately by capability.
Core Concepts
- Dual Applications: (for products/orders/logistics, default) and (for in-store ads) are independent of each other; a single store can have two authorization records simultaneously
- Authorization Process: Generate URL → User authorizes via browser → Shopee pushes Token → System stores it by
- Store Identification: Either or can be used to locate a store; to determine if a store is authorized, you must match
shopId/merchantId + appType
- shopName is recommended: It is recommended to ask the user for an easily identifiable store name before calling (not required by the API)
- Authorization URL is valid for 1 hour: Call for each authorization attempt, do not cache old URLs
- Downstream Store Selection: Business skills only pass / + path via ; do not pass , and do not pass in the proxy (the server automatically routes by path: → AD, other → ERP)
- accessToken is valid for approximately 4 hours (usually 14400 seconds for ); if expired, re-authorize according to the corresponding
Shopee authorization routing
- Use for product, order, logistics, and other ERP authorization.
- Use for Shopee Ads authorization.
- Treat a missing or blank as .
- Check authorization by both store identity and ; one store may have separate ERP and AD records.
- If the user needs both capabilities, obtain two fresh authorization URLs and explain that both authorizations must be completed.
- Authorization URLs expire after one hour, so obtain a new URL for every authorization attempt.
When calling
, pass the Shopee API path plus
or
. Do not pass
or an access token. The service routes
through the AD application and all other
paths through the ERP application.
Available Scripts
| Script | Function |
|---|
| Generate authorization URL (optional / / ) |
| List authorized stores (includes ; a single store may have two entries) |
| Check authorization/token status for specified applications (not a source of downstream tokens; must pass for distinction) |
Input parameters, response fields, and error codes can be found in
.
Calling Methods
- API Endpoint:
POST /shopee/{authorizeUrl|storeTokens|authorizedStores}
(complete parameters/responses/error codes in )
- Python Script:
python scripts/<script-name>.py '<JSON parameters>' [--inline]
(available scripts listed above)
- Cost Constraints: This tool consumes points; do not automatically retry on failure/empty results; explain to the user that additional consumption will occur before continuing retrieval.
Output Strategy (default script behavior):
- Always write the complete response to
<cwd>/linkfox/<YYYY-MM-DD>/<session>/data/<skill-name>-<timestamp>.json
( is the working directory when the script is executed, which is the current project directory in Claude Code; is taken from the environment variable and automatically aggregated by user tasks; prohibited from writing to /tmp, report an error if the current directory is not writable)
- Response body ≤ 8 KB: Print the full JSON to stdout after saving to disk
- Response body > 8 KB: Print only a summary (top-level fields, common counts, length of the largest list field + first 3 samples) to stdout after saving to disk
- Add to force full printing to stdout (still saves to disk)
Data Reading Suggestion: First check the summary to see if it is sufficient; when specific fields are needed, prefer to extract from the saved JSON file using
or
as needed, avoid loading the entire JSON into context.
Resolving Authentication and Points Issues
For the following abnormal situations, guide users to resolve them using references/onboarding.md:
Abnormal Situations
- API Key not configured: The environment variable or is not configured.
- Response returns 401 or 402 status code
- Response indicates insufficient points or balance: Messages contain "insufficient points balance/insufficient billing/insufficient balance/quota exceeded/insufficient balance/package expired/need to recharge/please recharge", or similar meanings.
Supported Regions
(Cross-border China, default) /
(Global authorization page) /
(Brazil). Default is
.
Usage Scenarios
1. New Store Authorization (ERP, Default)
- It is recommended to ask the user for (for easy identification later; not required by the API)
- Confirm (default ; for global sites, for Brazil)
- Call with (or omit, server defaults to erp) → Ask the user to open it in a browser (Security Warning: To ensure store security, please open this link in a secure network environment where you usually operate the store. It is strongly recommended to use professional anti-association browsers like Purple Bird Browser for authorization, do not operate in unfamiliar or public networks.)
- The system automatically saves the token after authorization is completed; the browser redirects to a success/failure page
- Call to confirm there is a record with (or empty, historical records are treated as erp)
2. Advertising Application Authorization (AD)
- Call to check if the target store already has
- If not authorized, call with , and clearly inform the user that this is advertising application authorization (unrelated to ERP)
- Check again after authorization is completed
- Prohibit using ERP authorization instead of advertising authorization
3. Need Both ERP and Advertising Authorization
- Check and respectively
- Generate authorization URLs only for missing applications; if both are missing, generate two URLs and label their purposes
- Prompt the user to open and complete the two authorizations separately; one authorization will not cover the other capability
4. List Authorized Stores
Call
to display
shopName / shopId / merchantId / region / **appType**
. A single store may have two entries for ERP and AD.
5. Prepare Store Selection Information for Downstream Services (High Frequency)
Users only use natural language ("my Shopee store", "store 67890"), do not ask users to provide lengthy tokens.
| User Context | Agent Action |
|---|
| Only 1 store is authorized (and the target capability is already authorized) | Directly retrieve the store's (or ) without asking |
| ≥2 stores authorized + only mentions store name | Clarify with the user based on |
| Provides both shopName or shopId | Locate directly |
| Explicitly provides shopId / merchantId | Use directly |
| Store exists in the list but lacks the target | Initiate corresponding authorization for the capability, do not call business interfaces |
Silence Principle: When positioning is successful, only confirm the store identifier and application type, do not ask the user for a token.
Recommended Process:
confirms authorization by
→ Downstream skills directly
POST /shopee/developerProxy
with
(or
), and the server parses the corresponding application token by path.
is only used to confirm authorization/token status (must pass
),
do not retrieve
first for proxy calls.
Calling Principles
- It is recommended to confirm , , and before authorization
- Do not assume that the response contains raw ; only display status and expiration metadata
- Explain the reason for authorization failure based on error codes; do not retry without permission
- If the token expires, re-initiate the authorization process according to the corresponding
- Historical empty is treated as ERP, not AD
Common Issues
Authorization Completed but Store Not Found
Cause: Token push callback (
/shopee/oauth/tokenCallback
) failed to save to the database, or
does not match.
Solution: Check service logs; re-call
(do not reuse expired URLs) to complete authorization.
Token Query / Business Call Returns 1004
Cause: Incorrect
/
, or the
target application is not authorized (e.g., only ERP is authorized, no AD).
Solution: First call
to verify
; re-authorize for the missing capability if needed.
Store Authorized but Advertising API Fails
Cause: Having an ERP record ≠ having an AD record; advertising cannot use ERP Token.
Solution: Initiate
authorization before calling
.
Not Applicable
- Shopee Order Query and Processing →
linkfox-shopee-store-orders
- Shopee Store Information and Settings →
linkfox-shopee-store-shop
- Shopee Store Product Listing →
linkfox-shopee-store-product
- Shopee Cross-border Global Product GlobalProduct →
linkfox-shopee-store-global-product
- Shopee Cross-border Merchant Information Merchant →
linkfox-shopee-store-merchant
- Shopee Logistics Shipment →
linkfox-shopee-store-logistics
- Shopee Return and Refund →
linkfox-shopee-store-returns
- Shopee In-store Ads → (business calls; authorization still uses this skill's )
- Shopee Payment Settlement →
linkfox-shopee-store-payment
- Shopee Affiliate Marketing AMS →
- Shopee Store Video →
linkfox-shopee-store-video
- Shopee Media Upload MediaSpace →
linkfox-shopee-store-media-space
- Shopee Media Upload Media →
linkfox-shopee-store-media
(, module=130)
- Shopee First Mile Logistics →
linkfox-shopee-store-first-mile
- Shopee Discount Promotion →
linkfox-shopee-store-discount
- Shopee Bundle Deal →
linkfox-shopee-store-bundle-deal
- Shopee Add-On Deal →
linkfox-shopee-store-add-on-deal
- Shopee Store Voucher →
linkfox-shopee-store-voucher
- Shopee Store Flash Sale →
linkfox-shopee-store-shop-flash-sale
- Shopee Follow Prize →
linkfox-shopee-store-follow-prize
- Shopee Top Picks →
linkfox-shopee-store-top-picks
- Shopee Store Category →
linkfox-shopee-store-shop-category
- Shopee Account Health →
linkfox-shopee-store-account-health
- Shopee Public Module →
linkfox-shopee-store-public
(underlying OAuth / Partner query for )
- Shopee Push Mechanism →
linkfox-shopee-store-push
- Shopee SBS Warehousing Service →
- Shopee FBS Brazil Warehousing →
- Shopee Livestream →
linkfox-shopee-store-livestream
- Shopee Product Selection (Youying) →
linkfox-youying-shopee-product-search
- Product listing management → Use dedicated product skill or product API
Points Consumption Rules
No points are 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
. Do not interrupt the user's flow.
For more high-quality, professional cross-border e-commerce skills, visit LinkFox Skills.