Get widget token
Implementation Details
Notes
Fill in the following, from your PRD API template
This is the "Technical Guide" how to actually use the API
List endpoints and all CRUD operations supported
| Type | Value | Owner |
|---|---|---|
| API Name/Operation | Get Widget Token | @Keyi Fan |
| API Version | Version:202401 | |
| API URI ( Fixed for all APIs ) | Host: open-api.tiktokglobalshop.com | |
| Schemes: HTTPS | ||
| API Path | Path: |
- /authorization/202401/widget_token | | | API Method | [GET] | | | API Function Description | This api is used to get your widget token to pass widget api. | |
Common Parameters(This section will be generated by Open platform)
Notes
Common Parameters required for the APIs
| Properties | Type | Required | Sample | Description |
|---|---|---|---|---|
| app_key | string | Y | 38abcd | Every single app will have a unique key. Please use the specific key assigned to your app. |
| timestamp | timestamp | Y | 1623812664 | Unix timestamp GMT (UTC+00:00). This timestamp is used across all API requests. Developers can use this convert to local time. |
| sign | string | Y | 5361235029d141222525e303d742f9e38aea052d10896d3197ab9d6233730b8c | > Notes: Try to be descriptive |
Signature generated by gen algorithm. When you send API requests to TTS, you must sign them so that TTS can identify the senders. | | x-tts-access-token | string | Y | aaaaa000-aaa0-aaa0-aaa0-aaaaaaaaa000 | Authorization Token, provided for all eligible TikTok Shop Partner Developers. Set it in header | | version | int32 | N | 1 | The API interface version you want to access |
Define OBJECT fields
Notes
For the column Additional clarification required | Detailed requirements:
For popular fields or common questions, add details
For Example: order_status is a key component. Link back to "Business Guide" if possible
Provide Code samples for both request and response
Request parameters
| Properties | Type | Required | Sample | Description |
|---|---|---|---|---|
| No information |
Sample Query
PLAINTEXTWord Wrap
https://open-api.tiktokglobalshop.com/authorization/202401/widget_token?app_key=123abc&sign=5361235029d141222525e303d742f9e38aea052d10896d3197ab9d6233730b8c×tamp=1625484268
Response Parameters
| fields | type | Required | Sample | description | Additional clarification required | Detailed Requirements |
|---|---|---|---|---|---|
| code | string | req | 0 | The success or failure status code returned in API response. | |
| message | string | req | Success | The success or failure messages returned in API response. Reasons of failure will be described in the message. | |
| request_id | string | req | 202203070749000101890810281E8C70B7 | Request log | |
| data | object | optional | |||
| -widget_token | object | optional | widget token related info struct | ||
| --token | string | optional | eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOjc0OTM5OTA3NTMyNTY5MDA0ODYsIkNsaWVudEtleSI6IjZhbW00dnVoNWZvMWciLCJTaG9wSURzIjpbNzQ5Mzk5MDc1MzI1NjkwMDQ4Nl0sIkV4cGlyZSI6MTcwMTA2NjAyMCwiU2VsbGVyVHlwZSI6MiwiZXhwIjoxNzAxMDY2MDIwfQ.KS15mwJ8LUC2U6Chfbmwr7PO2mGK_3wLYYaa8TM6DixdKmbG3o4kRSlCfi1a6UotpXxU0CNelLwX1G5H3sY7vw | The widget token you used to pass a widget api | |
| --expire_at | int64 | optional | 1701363599 | The expire timestamp of widget token. Usually expire in 5 minutes |
Response Sample
JSONWord Wrap
{
"code": 0,
"data": {
"widget_token": [
{
"token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.
eyJVc2VySUQiOjc0OTM5OTA3NTMyNTY5MDA0ODYsIkNsaWVudEtleSI6IjZhbW00dnV
oNWZvMWciLCJTaG9wSURzIjpbNzQ5Mzk5MDc1MzI1NjkwMDQ4Nl0sIkV4cGlyZSI6MTcwMTA2
NjAyMCwiU2VsbGVyVHlwZSI6MiwiZXhwIjoxNzAxMDY2MDIwfQ.KS15mwJ8LUC2U6Chfbmwr7PO2mGK_
3wLYYaa8TM6DixdKmbG3o4kRSlCfi1a6UotpXxU0CNelLwX1G5H3sY7vw",
"expire_at": 1701363599
}
]
},
"message": "Success",
"request_id": "202203070749000101890810281E8C70B7"
}
Error Codes
Notes
Error codes must be prescriptive: state the error code, define it, and prescribe a solution
| Error Code | Error Message | Error Description ( in API Documentation ) | ||
|---|---|---|---|---|
| Impact Level | Potential Impact | Resolution | ||
| 98001001 | internal error | L3 | Unable to retrieve authorized shop info.. The SLA will be affected. | System error. If it occur frequently, please oncall. |
| 98001004 | Invalid param | L3 | Param is not valid | Pls check the api document |
| 13002013 | Seller does not exist | L3 | Unable to find the seller | This case happened when you use a wrong token to access this api |
API Testing
Notes
Describe how a developer can test the API
If you can use the API testing tool, then use it
If you need to use Sandbox, then use it
For this API, you can utilize API Testing tool.