API Reference
Authorization and tokens

Get a long-term access token

POST/open_api/v1.3/oauth2/access_token/
Base URL: https://tiktok-ads.mimicr.dev · provider: https://business-api.tiktok.com

Use this endpoint to obtain a long-term access token from the auth_code the advertiser authorization redirect carries. Only Content-Type: application/json is supported.

The auth_code is valid for 1 hour and can be used once. The token does not expire and there is no refresh token: the response has no expires_in or refresh_token. scope lists numeric permission ids (1 Ad Account Management, 2 Ads Management, 3 Audience Management, 4 Reporting, 5 Measurement, 6 Creative Management, 8 Pixel Management, 12000000 Lead Management).

Errors: 40002 (missing field), 40113 (unknown app), 40101 (wrong secret, or a code of another app), 40110 (code used, revoked or older than 1 hour).

Authorization

Public route, no token.

Body

application/json
app_idstringrequired

ID of your developer app.

secretstringrequired

Secret of your developer app.

auth_codestringrequired

The authorization code (auth_code) generated by your Advertiser authorization URL.

Responses

200Response envelope {code, message, request_id, data}. code 0 (message "OK") is success. Validation and business errors also come with HTTP 200 and a non-zero code: check code, not the HTTP status.
codenumber

Return code. 0 means success; see the return codes appendix for the others.

messagestring

Return message: OK on success, otherwise the error description.

request_idstring

The log ID of the request, which uniquely identifies it (also sent in the X-Tt-Logid header).

dataobject

Returned data.

Show child attributes
access_tokenstring

The long-term access token for permission verification.

advertiser_idsstring[]

The list of ad accounts that the token can access.

scopenumber[]

The scope of permissions granted to the access token. See Permission scope to learn about the permission that a scope ID (value of scope) corresponds to.