← 返回目录
📁 API Reference › Authentication

刷新短期访问令牌

您可以使用本接口通过 refresh_token 刷新短期访问令牌。

短期访问令牌是从 TikTok 账户获取授权后生成的访问令牌类型。该令牌有效期为一天。

请求

地址 https://business-api.tiktok.com/open_api/v1.3/tt_user/oauth2/refresh_token/

方法 POST

Header

|字段{30%}|类型{15%}|描述{55%}|
|---|---|---|
|Content-Type {必填}|string|请求消息类型。<br>允许格式:`application/json`。 |

参数

|字段{30%}|类型{15%}|描述{55%}|
|---|---|---|
|client_id {必填}|string|开发者应用 ID。<br><br>若想获取<strong>应用 ID</strong>,可以导航至<strong>[应用管理](https://ads.tiktok.com/marketing_api/apps/)</strong> > <strong>App Detail</strong> > <strong>基本信息</strong>。 |
|client_secret {必填}|string| 开发者应用密钥。<br><br>若想获取<strong>密钥</strong>,可以导航至<strong>[应用管理](https://ads.tiktok.com/marketing_api/apps/)</strong> > <strong>App Detail</strong> > <strong>基本信息</strong>。|
|grant_type {必填}|string|生成访问令牌的方式。<br><br>允许的枚举值:<ul><li>`refresh_token`:通过刷新令牌生成访问令牌。</li></ul>|
|refresh_token {必填}|string| 刷新令牌,用于刷新现有的访问令牌。<br><br>您可在使用[/tt_user/oauth2/token/](1833997638479041.html)生成访问令牌时的返回中获取刷新令牌。|

示例

(code curl http)
curl --location --request POST 'https://business-api.tiktok.com/open_api/v1.3/tt_user/oauth2/refresh_token/' \
--header 'Content-Type: application/json' \
--data '{
    "client_id":"{{client_id}}",
    "client_secret":"{{client_secret}}",
    "grant_type":"refresh_token",
    "refresh_token":"{{refresh_token}}"
}'
(/code)

返回

|字段{30%}|类型{15%}|描述{55%}|
|---|---|---|
|code |number|返回码。完整返回码列表及描述,可查看[附录 - 返回码](https://ads.tiktok.com/marketing_api/docs?id=1737172488964097)。|
|message |string|返回信息。更多信息可查看[附录 - 返回码](https://ads.tiktok.com/marketing_api/docs?id=1737172488964097)。|
|request_id|string|请求的日志 ID,唯一标识一个请求。|
|data|object|返回数据。|
#|access_token|string|用于权限验证的短期访问令牌。该令牌有效期为 1 天。|
#|token_type|string|令牌类型。<br><br>枚举值:<ul><li>`Bearer`:不记名令牌,拥有该令牌后任何人均可访问相关资源。</li></ul>|
#|scope|string|该访问令牌所拥有的权限。|
#|expires_in|number|访问令牌的剩余有效时长,以秒为单位。|
#|refresh_token|string|用于刷新访问令牌的刷新令牌。刷新令牌有效期为 1 年。<br><br><p><span style="color:darkred"><b>注意</b></span>:请保留此字段,用于刷新`access_token`。|
#|refresh_token_expires_in|number|刷新令牌的剩余有效时长,以秒为单位。|
#|open_id|string|TikTok 账户的应用唯一识别 ID。|

示例

(code Success-Response http)
HTTPS/1.1 200 OK
{
    "code": 0,
    "message": "OK",
    "request_id": "{{request_id}}",
    "data": {
        "access_token": "{{access_token}}",
        "expires_in": 86400,
        "open_id": "{{open_id}}",
        "refresh_token": "{{refresh_token}}",
        "refresh_token_expires_in": 28484364,
        "scope": "message.list.manage,video.list,video.insights,user.insights,user.info.basic,comment.list,biz.brand.insights,biz.spark.auth,tcm.order.update,comment.list.manage,video.upload,video.publish,biz.ads.recommend,user.account.type,biz.creator.info,user.info.username,message.list.send,user.info.profile,user.info.stats,message.list.read,biz.creator.insights",
        "token_type": "Bearer"
    }
}
(/code)

内容来源:TikTok API for Business 官方文档 · 本地归档

在接这个接口时卡住了?
Stuck wiring this API into production? We build ad-delivery tooling on these platforms — campaign automation, reporting pipelines, error-handling and migration between API versions.
联系我们 · Talk to us 每日平台更新简报 →