Log inStart Free Trial
easyCoexistence Official APIs

TikTok error 40102: access token expired

TikTok error 40102 means the access token sent with the request has expired, and the endpoint has to be called with the latest token. An Accounts API access token lasts one day. Renew it by sending the refresh token to /tt_user/oauth2/refresh_token/, then repeat the call. The refresh token itself lasts one year, after which the account owner authorizes the app again.

easyCoexistence renews the 24-hour TikTok token with the refresh token on its own, ahead of expiry, so calls from Claude, ChatGPT or your own code go out with a current one.

40102

TikTok's return code for an expired access token; the endpoint must be called with the latest one.

1 day

How long a TikTok account access token from the Accounts API stays valid.

86,400

The expires_in value, in seconds, in TikTok's example of a newly issued access token.

1 year

How long the refresh token stays valid; once it expires, the owner has to authorize the app again.

What does error 40102 mean?

The access token in the Access-Token header has passed its expiry. TikTok's return code appendix lists 40102 as an expired access token and says the endpoint needs to be called with the latest one. Its fix is to use a valid access token and try again.

The code arrives in the response body. Most calls to TikTok's API for Business return HTTP 200, and the return code, not the status, says whether the call succeeded.

How long does a TikTok access token last?

One day on the API for Business. The Accounts API issues a TikTok account access token when the app exchanges an authorization code at /tt_user/oauth2/token/, and the response gives its lifetime in expires_in, 86,400 seconds in TikTok's example. The same response carries a refresh token, valid for one year, which TikTok says to retain for renewing the access token. TikTok for Developers' user access tokens, used by the Content Posting API, last 2 hours instead.

How do you renew it?

Send the refresh token to /tt_user/oauth2/refresh_token/ with the app's ID and secret and grant_type set to refresh_token. The response holds a new access token and a refresh token: store both, send the new access token in the Access-Token header from then on, and repeat the call that failed. Renewing before the day is up keeps calls from reaching TikTok with an expired token at all.

Renew a TikTok account access token
curl -X POST 'https://business-api.tiktok.com/open_api/v1.3/tt_user/oauth2/refresh_token/' \
  -H 'Content-Type: application/json' \
  -d '{
    "client_id": "<APP_ID>",
    "client_secret": "<SECRET>",
    "grant_type": "refresh_token",
    "refresh_token": "<REFRESH_TOKEN>"
  }'

# data: access_token, expires_in (86400), refresh_token, refresh_token_expires_in

When does the owner have to authorize again?

When renewal is no longer possible. The refresh token is valid for one year, and TikTok's documentation says that once it expires, the developer asks the account owner to authorize the app again through the authorization flow. The owner can also revoke the authorization at any time from the TikTok app, under Settings and privacy, Security, Manage app permissions, and a new authorization is then the way back.

Common mistakes

  • Renewing only after a call fails. A token that lasts one day runs out daily, so renew it ahead of time and keep calls from reaching TikTok with an old one.
  • Ignoring the refresh token in the renewal response. TikTok's reference says to retain it for the next renewal, so store the one each renewal returns.
  • Checking only the HTTP status. TikTok usually answers with HTTP 200 and puts 40102 in the code field, so a status check alone reads the failure as success.
  • Keeping copies of the token in several places. Renewing one copy leaves the others to reach the end of their day and fail with 40102.
Doing this with EasyCoexistence

If TikTok rejects the token anyway with 40102, 40104 or 40105, the connection is marked for reconnecting at once and you get an email. Your own code can fetch the current token from get_social_credentials instead of keeping a copy. US$ 9 to US$ 0.75 per connection per month, falling as you add connections, with the first 3 days free.

easyCoexistence is a multichannel API and MCP server that connects AI agents such as Claude and ChatGPT to WhatsApp, Instagram, TikTok, Facebook and more. On WhatsApp it uses Coexistence: the business keeps using its number in the WhatsApp Business app while the AI works through Meta's official API.

Frequently asked questions

What does expires_in mean in a TikTok token response?

It is the number of seconds before the access token expires: 86,400, one day, in TikTok's example of a new Accounts API token. Add it to the time of the response to know when to renew, before 40102.

Can an expired TikTok access token be renewed?

Yes, while the refresh token is valid. Send it to /tt_user/oauth2/refresh_token/, and TikTok returns a new access token with a refresh token.

Does error 40102 mean the account must be reconnected?

Not by itself. A valid refresh token renews access without the owner; a new authorization is needed only when the refresh token has expired or the owner has revoked access.

Why does a response with HTTP 200 contain error 40102?

TikTok's return codes take precedence over the HTTP status. A call succeeded only if its code is 0, whatever the status line says.

Keep reading

Connect your first channel in two minutes.

No platform reviews to wait for. Connect WhatsApp, Instagram, TikTok or another channel, then ask your AI to post, reply or report, and watch it work.

  • 3 days free
  • Cancel any time
  • Official APIs only
  • Monitored 24/7

Verified on