v2.public.get_access_token
POST /api/v2/auth/token/get
Use the code from the authorization step to call this API to obtain the authorized shop_id, merchant_id, supplier_id, or user_id, and its corresponding access_token and refresh_token.
Endpoint URL
URL: https://partner.shopeemobile.com/api/v2/auth/token/get
Common Request Parameters
| Name | Type | Sample | Description |
|---|---|---|---|
| partner_id | int | 1 | Partner ID is assigned upon registration is successful. Required for all requests. |
| timestamp | timestamp | 1610000000 | This is to indicate the timestamp of the request. Required for all requests. Expires in 5 minutes. |
| sign | string | e318d3e932719916a9f9ebb57e2011961bd47abfa54a36e040d050d8931596e2 | Signature generated by partner_id, api path, timestamp and partner_key via HMAC-SHA256 hashing algorithm. More details: https://open.shopee.com/documents?module=87&type=2&id=58&version=2 |
Request Parameters
| Name | Type | Required | Sample | Description |
|---|---|---|---|---|
| code | string | True | 5a5477794a55537954697169514f4653 | The code in redirect url after the authorization. Valid for one-time use, expires in 10 minutes |
| partner_id | int64 | True | 1001141 | Partner ID is assigned upon registration is successful. Required for all requests. |
| shop_id | int64 | False | Shopee's unique identifier for a shop. | |
| main_account_id | int64 | False | The main_account_id of the seller that authorized the developer. |
Response Parameters
| Name | Type | Sample | Description |
|---|---|---|---|
| error | string | Error codes for API requests; always returned.When the API call is successful, the error code returned is empty. | |
| message | string | Always returned. Provides detailed error information. | |
| request_id | string | ID of API requests; always returned. Used to diagnose problems. | |
| shop_id_list | int64[] | Returned all shop_ids authorized this time. | |
| merchant_id_list | int64[] | Returned all merchant_ids authorized this time. | |
| supplier_id_list | int64[] | Returned all supplier_ids authorized this time. | |
| user_id_list | int64[] | Returned all user_ids authorized this time. | |
| access_token | string | Returned when the API call is successful. A dynamic token that can be used multiple times and expires after 4 hours. | |
| refresh_token | string | Returned when the API call is successful. Use refresh_token to get a new access_token. Valid for each shop_id, merchant_id, supplier_id, or user_id respectively, for 30 days. | |
| expire_in | timestamp | Returned when the API call is successful. The validity period of the access_token, in seconds. |