PostGate

TikTok API error codes: what each one means and how to fix it

Readable strings, not numbers

Every TikTok API v2 response has an error object with code, message and log_id. A successful call returns code "ok".

Errors live in three places

1. The request itself
2. The fail_reason when you check the post status
3. The OAuth token endpoints, with their own error field

Watch for errors on HTTP 200

creator_info/query returns spam_risk_too_many_posts and reached_active_user_cap with HTTP 200 on purpose. Always check error.code, not only the status.

access_token_invalid (401)

Access tokens last 2 hours. Refresh and retry once. If the refresh fails, the account has to reconnect.

rate_limit_exceeded (429)

Limits are per endpoint, per token. Direct Post init allows 6 requests per minute, the status fetch 30. Back off and retry later.

Codes that block a post

spam_risk_too_many_posts, reached_active_user_cap, unaudited_client_can_only_post_to_private_accounts, url_ownership_unverified and privacy_level_option_mismatch. Retrying the same request right away will not fix them.

fail_reason after the upload

file_format, duration, frame_rate and picture_size checks need a new file. internal and pull failures can be retried. auth_removed and spam_risk cannot.

invalid_grant on refresh

Every refresh returns a new refresh token. Reusing the old one fails and forces the user to authorize again. Lock refreshes per account.

Catch errors before posting

Read creator_info/query first: privacy_level_options, max_video_post_duration_sec and the Duet, Stitch and comment settings.

In the full guide

Tables for every code with HTTP status and fix, a TypeScript retry classifier and what to send TikTok support.

postgate.studio

Read the full guide