# Errors

The tiktornado API error shape, every reason it can answer with its HTTP status and cause, and the reasons a failed post or reply can carry.

## The error shape [#the-error-shape]

Every error, on every route, has the same body:

```json operation="POST /posts" kind="response" status="400"
{
  "error": {
    "reason": "schedule_too_soon",
    "message": "Pick a time at least 10 minutes from now."
  }
}
```

- `reason` is a stable code. Write your program against it.
- `message` is a plain sentence you can show to a person. Its wording may change, so don't match on it.

Treat a reason you don't know as a general failure of that request: new reasons may be added. The [API reference](/api-reference) lists the reasons each route can answer.

## Statuses [#statuses]

| Status | Meaning |
| --- | --- |
| 400 | The request can't be done as sent. The reason says why |
| 401 | The API key is missing, malformed or revoked |
| 403 | The key lacks the scope, or the subscription isn't active |
| 404 | The route, or the thing it names, doesn't exist or isn't yours |
| 409 | A request with the same `Idempotency-Key` is still running |
| 422 | The `Idempotency-Key` was already used for a different request |
| 429 | Too many requests. Wait the seconds in `Retry-After` |
| 500 | Something went wrong on our side |
| 503 | The service, or TikTok behind it, is briefly unavailable |

A 400 or 404 answer to a change is stored under its `Idempotency-Key`, so retrying with the same key gives the same refusal: fix the request and send it with a new key. A 429, 500 or 503 is never stored, so a retry with the same key runs again. See [Safe retries](/getting-started/idempotency).

## Every reason [#every-reason]

### Key and access [#key-and-access]

| Reason | Status | When |
| --- | --- | --- |
| `api_key_invalid` | 401 | No `Authorization: Bearer` header, a key in the wrong format, or a key that doesn't exist or was revoked. The answer carries `WWW-Authenticate: Bearer realm="tiktornado"` |
| `api_scope_missing` | 403 | The key doesn't have the scope this route needs. See [Scopes](/getting-started/authentication#scopes) |
| `access_locked` | 403 | The subscription that bills this account isn't active, or your whole tiktornado account is locked. Fix it under Billing in the app |
| `not_found` | 404 | The route doesn't exist, or the account, post, comment or upload it names doesn't exist or isn't yours |

### The request itself [#the-request-itself]

| Reason | Status | When |
| --- | --- | --- |
| `invalid_request` | 400 | The body isn't a JSON object, is over 64 KB, has a field the route doesn't list, misses a required field, has a field of the wrong type or `null` where `null` isn't taken. Also: a query parameter that isn't valid (`kind`, `limit`, `cursor`, `country`, `query`, `from`, `to`), a new post with none or more than one of `scheduledFor`, `postNow: true` and `queue: true`, an edit with no field, a video post with more than one media item, or the same media item twice |
| `idempotency_key_required` | 400 | A change was sent without an `Idempotency-Key` header, or with one that isn't 1 to 255 visible ASCII characters |
| `idempotency_in_progress` | 409 | A request with this `Idempotency-Key` is still running. Wait a moment and try again |
| `idempotency_key_reused` | 422 | This `Idempotency-Key` was already used with a different method, path or body. Use a new key for a new change |

### Accounts [#accounts]

| Reason | Status | When |
| --- | --- | --- |
| `account_not_ready` | 400 | The account isn't set up to post yet, or TikTok is reviewing a ban on it (`appealing_ban`). The message says which |
| `invalid_state` | 400 | The account is `banned` or `inactive`. On a post: it isn't in a state that allows this, for example cancelling a post that already failed, or editing one that was cancelled |
| `account_reconnecting` | 400 | The account is being reconnected to TikTok, so its post options, music and places can't be read right now. Posts to it are still taken |

### Media and captions [#media-and-captions]

| Reason | Status | When |
| --- | --- | --- |
| `media_required` | 400 | `mediaRefs` is empty |
| `too_many_photos` | 400 | More than 35 photos |
| `mixed_media` | 400 | A video in a photo post, or a photo in a video post |
| `file_type_not_supported` | 400 | Not MP4, MOV or WebM for a video, or JPEG, PNG or WebP for a photo or a cover image |
| `file_too_large` | 400 | A video over 4 GB |
| `photo_too_large` | 400 | A photo or a cover image over 20 MB |
| `file_damaged` | 400 | The file can't be read as a video or a photo. Export it again |
| `link_not_allowed` | 400 | A media link or cover link that isn't `https`, has a login in it, uses an IP address or a local host name, or can't be used for another reason |
| `link_unreachable` | 400 | We couldn't open the link. It must be public and point straight at the file |
| `upload_expired` | 400 | The upload behind this `mediaRef` has expired. Upload the file again |
| `caption_too_long` | 400 | Over 2,200 characters for a video or 4,000 for photos, counted in UTF-16 code units, so some emoji count as 2 |

### Time [#time]

| Reason | Status | When |
| --- | --- | --- |
| `schedule_too_soon` | 400 | `scheduledFor` is 10 minutes or less from now: a time must be more than 10 minutes ahead. Editing a failed post whose time has passed needs a new `scheduledFor` too |
| `past_account_end` | 400 | The time is after the account ends |
| `daily_limit_reached` | 400 | One more post of this kind would put more than 15 videos, or 15 photo posts, on the account in some 24 hours |
| `post_locked` | 400 | The post goes out in 10 minutes or less, or was sent with `postNow`, so it can't be changed or cancelled |
| `post_already_published` | 400 | The post is publishing or already live |

### Post settings [#post-settings]

| Reason | Status | When |
| --- | --- | --- |
| `drafts_no_settings` | 400 | A post with `toDrafts: true` carries settings. Add them in the TikTok app instead |
| `ai_label_photo` | 400 | `aiGenerated: true` on a photo post |
| `setting_videos_only` | 400 | A video-only setting on a photo post, for example `allowDuets`, a cover frame or a track's volume |
| `setting_photos_only` | 400 | A photo-only setting on a video post: `autoMusic`, `coverPhotoIndex`, or a `privacy` other than `everyone` |
| `music_conflict` | 400 | Both `music` and `autoMusic: true` |
| `auto_music_branded` | 400 | `autoMusic: true` with `brandedContent` other than `none` |
| `branded_private` | 400 | `privacy: "only_me"` with `brandedContent` other than `none` |
| `invalid_post_setting` | 400 | A value out of range: a number that isn't whole, a volume over 100, `endMs` not after `startMs`, a cover frame past 10 minutes, a `coverPhotoIndex` past the last photo, a blank or too long id or name, or both `coverAtMs` and `coverImageRef` |

See [Post settings](/posting/post-settings) for what each setting does.

### Posting times [#posting-times]

| Reason | Status | When |
| --- | --- | --- |
| `invalid_queue` | 400 | A time zone that isn't an IANA name (offsets such as `+05:00` included), a day outside 0 to 6, a minute outside 0 to 1439, the same time twice, or more than 15 times on one day |
| `queue_empty` | 400 | `queue: true`, or the next free time, on an account with no posting times |
| `queue_full` | 400 | No posting time is free in the next 4 weeks |

### Stats and replies [#stats-and-replies]

| Reason | Status | When |
| --- | --- | --- |
| `invalid_date_range` | 400 | `to` is before `from`, or the range is over 366 days. For all accounts while one account's subscription isn't active, also a range too long to add up at once: ask per account or for fewer days |
| `reply_length` | 400 | A reply that is empty or over 150 characters after spaces at either end are removed. Each emoji counts once |

### Limits and our side [#limits-and-our-side]

| Reason | Status | When |
| --- | --- | --- |
| `slow_down` | 429 | Over a rate limit. The answer carries `Retry-After: 60`. See [Rate limits](/getting-started/rate-limits) |
| `unknown_error` | 500 | Something went wrong on our side. A change can be retried with the same `Idempotency-Key` |
| `service_unavailable` | 503 | We, or TikTok behind us, can't take the request right now. Try again shortly |

## Reasons on a failed post or reply [#reasons-on-a-failed-post-or-reply]

A post that couldn't go out has `status: "failed"` and an `error` with a `reason` and a `message`, in the same shape as above. These are the reasons you will see there:

| Reason | What happened |
| --- | --- |
| `media_rejected` | TikTok didn't accept the video. Check it is 3 seconds to 10 minutes, vertical, and under 4 GB |
| `content_rejected` | TikTok didn't allow the post under its rules |
| `duplicate_post` | The account already has this exact post in the last 24 hours. Change the caption or the video |
| `posting_too_fast` | TikTok is limiting posts from this account. Try a later time |
| `daily_limit_reached` | TikTok's daily posting limit for the account was reached |
| `tiktok_drafts_full` | The account already has 5 drafts waiting in TikTok. Post or delete one in the TikTok app |
| `track_unavailable` | TikTok wouldn't use the track in `settings.music`. Pick another one |
| `tiktok_unavailable` | TikTok wasn't responding, was busy, or had a problem publishing |
| `link_unreachable` | The media link couldn't be downloaded when the post went out |
| `account_reconnecting` | The account was being reconnected to TikTok at the post's time |
| `account_not_ready` | The account couldn't post at the post's time |
| `account_needs_setup` | The account isn't ready to post yet. Our team has been told |
| `account_issue` | There's a problem with the account. Our team has been told |
| `post_failed` | The post couldn't be published. Our team has been told |
| `service_unavailable` | Something went wrong on our side |

A failed post can also carry `invalid_request`, `upload_expired`, `unknown_error` or another reason from this page. Edit it to try again: see [Editing a post](/posting/timing#edit-a-post).

A reply that couldn't be sent has `status: "failed"` in `GET /posts/{postId}/comments`, with an `error`. Its reason is usually `reply_not_allowed` (TikTok didn't accept it, for example because the comment was deleted), `comments_unavailable` or `service_unavailable`. To try again, send the reply again with a new `Idempotency-Key`.