### GET API Request Example Source: https://open.shopee.com/developer-guide/16 Illustrates how to construct a URL for a GET request, including common parameters in the URL and a request parameter. ```APIDOC ## GET API Request Example For GET-type API requests, include both common parameters and request parameters in the URL. *Example: `V2.product.get_category`* API request URL: `https://partner.shopeemobile.com/api/v2/product/get_category?partner_id=851249×tamp=1654673582&shop_id=1001094&access_token=367a0a8eb9d1837cbf7c43b587a0faa4&sign=a40fc50a08c382eeee08e2eb00deb8464c6fdcbe4f1c271e033cdbca3ded4d5b&language=zh-hans` *Common Parameters:* `partner_id`, `timestamp`, `access_token`, `shop_id`, `sign` *Request Parameter:* `language` ``` -------------------------------- ### GET API Request URL Example Source: https://open.shopee.com/developer-guide/16 For GET requests, common parameters like partner_id, timestamp, access_token, shop_id, and sign are included directly in the URL along with any specific request parameters. ```URL https://partner.shopeemobile.com/api/v2/product/get_category?partner_id=851249×tamp=1654673582&shop_id=1001094&access_token=367a0a8eb9d1837cbf7c43b587a0faa4&sign=a40fc50a08c382eeee08e2eb00deb8464c6fdcbe4f1c271e033cdbca3ded4d5b&language=zh-hans ``` -------------------------------- ### POST API Request URL and Body Example Source: https://open.shopee.com/developer-guide/16 For POST requests, common parameters are in the URL, while request parameters are sent in the JSON body. This example shows the URL structure and the format of the request body. ```URL https://partner.shopeemobile.com/api/v2/shop/update_profile?partner_id=851249×tamp=1654673582&shop_id=1001094&access_token=367a0a8eb9d1837cbf7c43b587a0faa4&sign=80cbce8da907d5a1237711409920fc16908a9f9e01b1254ff9cc44aaf0836122 ``` ```JSON { "shop_logo": "https://cf.shopee.sg/file/8424390be4677b0b3c37ce6499ce261a", "description": "TTest", "shop_name": "123" } ``` -------------------------------- ### POST API Request Example Source: https://open.shopee.com/developer-guide/16 Demonstrates how to construct a URL for a POST request, with common parameters in the URL and request parameters in the body. ```APIDOC ## POST API Request Example For POST-type API requests, insert common parameters in the request URL and request parameters in the request body. *Example: `v2.shop.update_profile`* API request URL: `https://partner.shopeemobile.com/api/v2/shop/update_profile?partner_id=851249×tamp=1654673582&shop_id=1001094&access_token=367a0a8eb9d1837cbf7c43b587a0faa4&sign=80cbce8da907d5a1237711409920fc16908a9f9e01b1254ff9cc44aaf0836122` Request body: ```json { "shop_logo": "https://cf.shopee.sg/file/8424390be4677b0b3c37ce6499ce261a", "description": "TTest", "shop_name": "123" } ``` *Common Parameters:* `partner_id`, `timestamp`, `access_token`, `shop_id`, `sign` *Request Parameters:* `shop_logo`, `description`, `shop_name` ``` -------------------------------- ### API Request Methods Source: https://open.shopee.com/developer-guide/16 Shopee Open API supports GET and POST request methods for interacting with its services. ```APIDOC ## API Request Methods Currently, Open API only provides two request methods: GET and POST. ``` -------------------------------- ### Payment API Functions Source: https://open.shopee.com/developer-guide/16 Provides access to order income, payout data, wallet data, and installment settings. ```APIDOC ## Payment API ### Description This module provides access to financial information including order income, payout data, and wallet data. It also includes details on completed orders and settings for installment payments. ### Obtainable Information - Order income - Payout data - Wallet data - List of completed orders - Installment shop settings - List of products that have been set up for installment payment ``` -------------------------------- ### Merchant API Functions Source: https://open.shopee.com/developer-guide/16 For cross-border sellers to get merchant information and a list of authorized shops. ```APIDOC ## Merchant API ### Description This module is required by cross-border sellers to retrieve merchant information (name, market, currency) and a list of all shops under the merchant that have granted authorization. ### Obtainable Information - Merchant information (merchant name/market/currency) - List of all shops under the merchant that have granted authorization ``` -------------------------------- ### Python Code Sample for Signature Calculation Source: https://open.shopee.com/developer-guide/16 A Python script demonstrating how to calculate the signature for Shop, Merchant, and Public APIs, including constructing the URL with common parameters. ```APIDOC ## Python Sample Code ```python #!/usr/bin/env python # encoding:utf-8 import hmac import time import requests import hashlib timest = int(time.time()) host = "https://partner.shopeemobile.com" access_token = "random string" partner_id = 80001 partner_key = "test....." # Call shop level API shop_id = 209920 path = "/api/v2/example/shop_level/get" base_string_shop = f"{partner_id}{path}{timest}{access_token}{shop_id}" sign_shop = hmac.new(partner_key.encode('utf-8'), base_string_shop.encode('utf-8'), hashlib.sha256).hexdigest() url_shop = f"{host}{path}?partner_id={partner_id}&shop_id={shop_id}×tamp={timest}&access_token={access_token}&sign={sign_shop}" # resp_shop = requests.post(url_shop, headers={"Content-Type":"application/json"}) # Call merchant level API merchant_id = 1234567 path_merchant = "/api/v2/example/merchant_level/get" base_string_merchant = f"{partner_id}{path_merchant}{timest}{access_token}{merchant_id}" sign_merchant = hmac.new(partner_key.encode('utf-8'), base_string_merchant.encode('utf-8'), hashlib.sha256).hexdigest() url_merchant = f"{host}{path_merchant}?partner_id={partner_id}&merchant_id={merchant_id}×tamp={timest}&access_token={access_token}&sign={sign_merchant}" # resp_merchant = requests.get(url_merchant, headers={"Content-Type":"application/json"}) # Call public API path_public = "/api/v2/auth/merchant/access_token/get" base_string_public = f"{partner_id}{path_public}{timest}" sign_public = hmac.new(partner_key.encode('utf-8'), base_string_public.encode('utf-8'), hashlib.sha256).hexdigest() url_public = f"{host}{path_public}?partner_id={partner_id}×tamp={timest}&sign={sign_public}" body_public = {"partner_id": partner_id, "merchant_id": merchant_id, "refresh_token": "testingtoken"} # resp_public = requests.post(url_public, json=body_public, headers={"Content-Type":"application/json"}) ``` ``` -------------------------------- ### Signature Calculation Steps Source: https://open.shopee.com/developer-guide/16 This section details the process of creating a base string by concatenating API path and common parameters, followed by calculating the signature using HMAC-SHA256. ```APIDOC ## Signature Calculation ### Step 1: Create a Base String Concatenate the API path (without host) and the following common parameters into a single string, strictly following the specified sequence. * **API Path Example:** `/api/v2/auth/token/get` * **Shop API:** `partner_id`, `api path`, `timestamp`, `access_token`, `shop_id` *Example:* `2001887/api/v2/shop/get_shop_info165571443159777174636562737266615546704c6d14701711` * **Merchant API:** `partner_id`, `api path`, `timestamp`, `access_token`, `merchant_id` *Example:* `2001887/api/v2/global_product/get_category165571443109777174636962737266615546704c6d1000000` * **Public API:** `partner_id`, `api path`, `timestamp` *Example:* `2001887/api/v2/public/get_shops_by_partner1655714431` ### Step 2: Calculate the Signature Calculate the signature using the HMAC-SHA256 algorithm on the base string and your `partner_key`. The output is a hex-encoded string. *Example:* `sign=56f31d01aeda9d08bf456b37f6f6640ef8614b4d6ad49baafe30b39a061f0e26` ``` -------------------------------- ### Discount API Functions Source: https://open.shopee.com/developer-guide/16 Enables the creation, viewing, updating, and deletion of Discount Promotions. ```APIDOC ## Discount API ### Description This module allows for the management of Discount Promotions, including creating, viewing, updating, and deleting them. ### Actions - Create Discount Promotions - View Discount Promotions - Update Discount Promotions - Delete Discount Promotions ``` -------------------------------- ### Returns API Functions Source: https://open.shopee.com/developer-guide/16 Handles return and refund requests, including dispute management. ```APIDOC ## Returns API ### Description This module allows you to obtain a list of return and refund requests and their details. It also supports actions such as confirming refunds, submitting disputes, negotiating refunds, and uploading evidence for disputes. ### Obtainable Information - List of return and refund requests - Return and refund request details - Get a return and refund plan ### Actions - Confirm refunds - Submit disputes - Negotiate refunds - Upload image evidence for disputes ``` -------------------------------- ### Bundle Deal API Functions Source: https://open.shopee.com/developer-guide/16 Enables the creation, viewing, updating, and deletion of Bundle Deals. ```APIDOC ## Bundle Deal API ### Description This module allows for the management of Bundle Deals, including creating, viewing, updating, and deleting them. ### Actions - Create Bundle Deals - View Bundle Deals - Update Bundle Deals - Delete Bundle Deals ``` -------------------------------- ### Common Parameters Source: https://open.shopee.com/developer-guide/16 Details on common parameters required for API calls, including partner_id, timestamp, sign, access_token, shop_id, and merchant_id. ```APIDOC ## API request parameters In the API document, you will see two types of request parameters: 1. Common parameter 2. Request parameter For GET-type APIs, these two parameters may exist at the same time, or only the common parameter will exist. For POST-type APIs, these two parameters will exist at the same time. The table below consists of descriptions for common parameters: Parameters | Description ---|--- partner_id| All API calls require a partner ID. You can obtain a partner ID by creating an App on the Shopee Open Platform Console App list page. Test partner ID can only be used in the test environment, and Live partner ID can only be used in the production environment. timestamp| All API calls require timestamps. Example of a timestamp: 1610000000. Each API request needs to be requested within 5 minutes of a timestamp. sign| All API calls require signatures that are generated using the SHA256 algorithm. Different API types have different signature generation methods. For more details, please refer to the Signature Calculation section in this article. access_token | Access tokens are required to obtain and modify seller data-related APIs. Each access token is valid for 4 hours and can be reused within the validity period. The access token needs to be refreshed regularly. Refer to the Authorization and Authentication article to learn more about obtaining and refreshing access tokens. shop_id| The unique identification ID of a Shopee shop can be obtained after the shop has granted authorization. Refer to the Authorization and Authentication article on how to obtain your shop ID. merchant_id| The unique identification ID of a Shopee merchant, which can be obtained after a shop has granted authorization. Open API only supports cross-border sellers using a merchant ID. Refer to the Authorization and Authentication article on how to acquire your merchant ID. ``` -------------------------------- ### Product API Functions Source: https://open.shopee.com/developer-guide/16 Provides access to product-related information and allows for product data management. ```APIDOC ## Product API ### Description This module allows you to obtain product-related information such as category trees, attribute and brand details, shop product data, promotion information, boost items, reviews, and recommended categories/attributes. It also supports actions like creating, deleting, and updating product information. ### Obtainable Information - Product-related category tree - Attribute and brand information - Shop product data - Product promotion information - Boost item and boost item list - Product reviews and review list - Product recommended categories and recommended attributes - Registered product brands ### Actions - Create product information - Delete product information - Update product information ``` -------------------------------- ### MediaSpace API Functions Source: https://open.shopee.com/developer-guide/16 Allows users to upload videos and images. ```APIDOC ## MediaSpace API ### Description This module provides functionality to upload videos and images. ### Actions - Upload videos - Upload images ``` -------------------------------- ### Add-On Deal API Functions Source: https://open.shopee.com/developer-guide/16 Enables the creation, viewing, updating, and deletion of Add-on Deals. ```APIDOC ## Add-On Deal API ### Description This module allows for the management of Add-on Deals, including creating, viewing, updating, and deleting them. ### Actions - Create Add-on Deals - View Add-on Deals - Update Add-on Deals - Delete Add-on Deals ``` -------------------------------- ### Python Code for API Signature Calculation Source: https://open.shopee.com/developer-guide/16 This Python script demonstrates how to generate signatures for Shop, Merchant, and Public APIs using HMAC-SHA256. Ensure you replace placeholder values with your actual partner ID, key, access token, and other relevant IDs. The script constructs the base string according to API type and then calculates the signature. ```Python #!/usr/bin/envpython # encoding:utf-8 import hmac import time import requests import hashlib timest=int(time.time()) host="https://partner.shopeemobile.com access_token = "random string" partner id =80001 partner key = "test....." #### call shop level api shop id =209920 base string ="%s%s%s%s%s"%(partner id, path timest access token, shop id) sign = hmac.new( partner key,base string,hashlib.sha256)hexdigest() path ="/api/v2/example/shop level/get" url = host + path + "?partner_id=%s&shop_id=%s×tamp=%s&access_token=%s&sign=%s"%(partner_id, shop_id, timest, access_token, sign) headers={"Content-Type":"application/ison"? resp=requests.post(urlheaders=headers) #### call merchant level api merchant id =1234567 base string ="%s%s%s%s%s"%(partner id, path timest, access token, merchant id) sign =hmac.new( partner key,base string,hashlib.sha256).hexdigest() path ="/api/v2/example/merchant_level/get" url = host+ path +"?partner id=%s&merchant id=%s×tamp=%s&access token=%s&sign=%s"%(partnerid, merchant id, timest, access token, sign) headers ={"Content-Type":"application/ison"? resp =requests.eet(urlheaders=headers) #### call public api base string ="%s%s%5%s"%(partner idpathtimestaccess token) sign= hmac.new( partner keybase stringhashlib.sha256)hexdigest() path ="/api/v2/auth merchant/access token/get" url = host+path+"?partner id=%s×tamp=%s&sign=%s%(partner idtimest, sign) body ={"partner id":partner id, "merchant id": merchant id,"refresh token":"testingtoken") headers =["Content-Type":"application/ison"? resp =requests.post(url,json=bodyheaders=headers) ``` -------------------------------- ### Push API Functions Source: https://open.shopee.com/developer-guide/16 Allows retrieval and update of Push Mechanism settings. ```APIDOC ## Push API ### Description This module allows you to retrieve and update Push Mechanism settings. ### Actions - Retrieve Push Mechanism settings - Update Push Mechanism settings ``` -------------------------------- ### API Response Parameters Source: https://open.shopee.com/developer-guide/16 This section outlines the common parameters found in API responses, their purpose, and whether they are always returned. ```APIDOC ## API Response Parameters This document details the parameters returned in API responses, their purpose, and whether they are always returned. ### Parameters - **request id** (Yes) - Each API request has a unique request ID. When you encounter an API issue, please provide this ID and the corresponding API information to get a faster response. - **error** (Yes) - Error code. When the request is successful, the error parameter will return empty. If the request fails, the corresponding error code will be reflected in this field. - **message** (No) - Error message. When the request is successful, the message will return empty. If the request fails, this field will contain detailed information about the error. - **warning** (No) - If the API call is successful, but some data is not returned or some batch requests fail, the information will be reflected in this field. - **response** (No) - When the request is successful, the corresponding data will be reflected in this field. ``` -------------------------------- ### Shop API Functions Source: https://open.shopee.com/developer-guide/16 Allows retrieval of shop details and updating of shop information. ```APIDOC ## Shop API ### Description This module enables you to retrieve information about a shop, including its name, market, and type. It also supports updating shop information. ### Obtainable Information - Shop name - Market shop is based in - Shop type ### Actions - Update shop information ``` -------------------------------- ### ShopCategory API Functions Source: https://open.shopee.com/developer-guide/16 Enables the creation, viewing, updating, and deletion of Shop Categories. ```APIDOC ## ShopCategory API ### Description This module allows for the management of Shop Categories, including creating, viewing, updating, and deleting them. ### Actions - Create Shop Categories - View Shop Categories - Update Shop Categories - Delete Shop Categories ``` -------------------------------- ### Top Picks API Functions Source: https://open.shopee.com/developer-guide/16 Enables the creation, viewing, updating, and deletion of Top Picks. ```APIDOC ## Top Picks API ### Description This module allows for the management of Top Picks, including creating, viewing, updating, and deleting them. ### Actions - Create Top Picks - View Top Picks - Update Top Picks - Delete Top Picks ``` -------------------------------- ### Types of Open API Source: https://open.shopee.com/developer-guide/16 Categorization of Open APIs (Shop, Merchant, Public) based on their common parameters and authorization requirements. ```APIDOC ## Types of Open API In the API document, there are 3 API types due to the different common parameters. The public parameters contained in these 3 types are as follows: * Shop API: partner_id, timestamp, sign, access_token, shop_id * Merchant API: partner_id, timestamp, sign, access_token, merchant_id * Public API: partner_id, timestamp, sign ⚠️ Note: Red items are highlighted to indicate that they are different from Public API. The Public API does not require an access token, while both the Shop and Merchant APIs do. This means that Shop and Merchant APIs can be called only after the shop has granted authorization. Currently, only Shopee cross-border merchants need to use Merchant API. Local sellers do not need to use it. ``` -------------------------------- ### Voucher API Functions Source: https://open.shopee.com/developer-guide/16 Enables the creation, viewing, updating, and deletion of Vouchers. ```APIDOC ## Voucher API ### Description This module allows for the management of Vouchers, including creating, viewing, updating, and deleting them. ### Actions - Create Vouchers - View Vouchers - Update Vouchers - Delete Vouchers ``` -------------------------------- ### GlobalProduct API Functions Source: https://open.shopee.com/developer-guide/16 For cross-border sellers to manage global product data. ```APIDOC ## GlobalProduct API ### Description This module is for cross-border sellers to obtain and manage global product data. It includes information on related categories, attributes, brands, and various lists of products based on their market presence. Actions include creating, deleting, updating, enabling/disabling sync, and publishing global products. ### Obtainable Information - Related category tree - Attribute and brand information - Global product data - List of products that can be listed in certain markets only - List of products with global product already published - List of products already listed in specific markets - Global product ID corresponding to the product in a specific market - Recommended category and attribute of a global product ### Actions - Create global products - Delete global products - Update global products - Enable/Disable syncing of global product information - Publish global product ``` -------------------------------- ### Follow Prize API Functions Source: https://open.shopee.com/developer-guide/16 Enables the creation, viewing, updating, and deletion of Follow Prizes. ```APIDOC ## Follow Prize API ### Description This module allows for the management of Follow Prizes, including creating, viewing, updating, and deleting them. ### Actions - Create Follow Prizes - View Follow Prizes - Update Follow Prizes - Delete Follow Prizes ``` -------------------------------- ### API Protocol Source: https://open.shopee.com/developer-guide/16 The API primarily uses HTTP/JSON, with HTTP/FORM available for specific use cases like file uploads. ```APIDOC ## API Protocol HTTP/JSON for most APIs. HTTP/FORM for some certain APIs, for example, the API for uploading files. ``` -------------------------------- ### Order API Functions Source: https://open.shopee.com/developer-guide/16 Provides access to order information and management capabilities. ```APIDOC ## Order API ### Description This module allows you to obtain shop order lists, order details, and invoice information. It also supports managing orders by splitting, canceling, undoing splits, processing cancellation requests, adding remarks, and uploading/downloading invoices. ### Obtainable Information - Shop order list - Order list and order details - List of invoice orders to be uploaded - Invoice information ### Actions - Manage orders by splitting - Manage orders by canceling - Undo split orders - Process sellers’ order cancellation application - Add order remarks - Upload invoices to retrieve invoice information - Download invoices to retrieve invoice information ``` -------------------------------- ### FirstMile API Functions Source: https://open.shopee.com/developer-guide/16 For cross-border sellers to manage First Mile orders and shipping details. ```APIDOC ## FirstMile API ### Description This module is for cross-border sellers to obtain information on unbound First Mile orders, tracking numbers, shipping documents, and channel details. It provides insights into the initial stage of the shipping process. ### Obtainable Information - Unbound First Mile orders - First Mile tracking numbers and details - First Mile order details - First Mile shipping documents - FirstMile channel details ``` -------------------------------- ### Public API Functions Source: https://open.shopee.com/developer-guide/16 Provides general authorization and token management functions. ```APIDOC ## Public API ### Description This module provides actions related to authorization and token management. It allows you to obtain lists of authorized shops and merchants, resend and upgrade codes to retrieve tokens, and refresh tokens. ### Actions - Obtain list of shops that have granted authorization - Obtain list of merchants that have granted authorization - Resend code and upgrade codes to retrieve tokens - Retrieve and refresh tokens ``` -------------------------------- ### Chat API Functions Source: https://open.shopee.com/developer-guide/16 For whitelisted users to manage chats and related settings. ```APIDOC ## Chat API ### Description This module, open to whitelisted users, allows you to obtain chat information such as chat lists, details, and Make Offer settings. It also supports actions like deleting chats, marking them as unread, pinning/unpinning, uploading images, sending messages, and enabling/disabling Make Offer settings. ### Obtainable Information - Chat list - Chat details - Chat information - Obtain Make Offer settings ### Actions - Delete chats - Mark chats as unread - Pin chats - Unpin chats - Upload images to chats - Send manual chat messages - Send automatic chat messages - Enable Make Offer settings - Disable Make Offer settings ``` -------------------------------- ### AccountHealth API Functions Source: https://open.shopee.com/developer-guide/16 Provides shop performance and penalty point data. ```APIDOC ## AccountHealth API ### Description This module allows you to obtain shop performance data and any shop penalty points. ### Obtainable Information - Shop performance data - Shop penalty points data ``` -------------------------------- ### Logistics API Functions Source: https://open.shopee.com/developer-guide/16 Provides information and actions related to logistics and shipping. ```APIDOC ## Logistics API ### Description This module allows you to obtain information about shop channels, shipping parameters, order tracking, and shipping documents. It also supports actions like shipping orders, updating shop addresses, enabling/disabling shop channels, and deleting shop addresses. ### Obtainable Information - List of shop channel - Shipping parameters - Order tracking number and tracking information - Shipping document formats and shipping documents - List of shop addresses ### Actions - Ship orders - Ship orders in bulk - Update shop address flag - Enable shop channel - Disable shop channel - Delete shop addresses ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.