# TikTok Content Posting API: post checker and publishing example

Free resources from the APIWings guide [TikTok Content Posting API: audit, privacy and limits](https://apiwings.com/blog/tiktok-content-posting-api).
Code under the MIT License; data, checklist and cheat sheet under CC BY 4.0. Rules checked against TikTok for Developers on 29 November 2026 (Content Posting API pages last updated 25 and 26 November 2026).

## What is here

| File | What it is |
|---|---|
| `tiktok-post-check.mjs` | The checker in JavaScript (Node 18+, no dependencies) |
| `tiktok_post_check.py` | The same checker in Python (3.9+, standard library only) |
| `tiktok-posting-rules.json` | Every limit, spec, screen rule and error code, with the TikTok page it comes from |
| `example-plan.json` | Worked example: six planned posts from a fictional app, with 14 problems |
| `example-plan-fixed.json` | The same plan after the fixes |
| `tiktok-test-cases.json` | 957 test cases, built by `make-test-cases.mjs` |
| `test-tiktok-check.mjs`, `test_tiktok_check.py` | Run the checker tests in each language |
| `tiktok-post-example.mjs` | Publishes one post from a plan: creator_info, init, chunk upload, status polling |
| `test-post-example.mjs` | 17 publishing scenarios against a local mock of TikTok's API |
| `tiktok-export-screen-checklist.md` | Every element and text TikTok requires on your export screen |
| `tiktok-content-posting-api-cheat-sheet.pdf` | One-page cheat sheet |

## Check a plan

Describe your app and the posts you are about to send in a JSON file (copy `example-plan-fixed.json` and change it), then:

```
node tiktok-post-check.mjs my-plan.json
python tiktok_post_check.py my-plan.json
```

Add `--json` for machine-readable output, including the request body for each post and, for `FILE_UPLOAD`, the chunk plan with every `Content-Range`. The exit code is 1 when something must be fixed first.

Results:
- `fix_first`: TikTok's documentation says the request fails, or the guidelines require something the plan does not do.
- `review`: worth a second look (AI content without `is_aigc`, a creator near the daily cap, images over 1920 x 1080, `FILE_UPLOAD` for a file already on your server).
- `no_issues_found`: none of the problems the checker knows about. **It is not TikTok's approval.**

### The plan format

- `app`: `audited`, `direct_post_enabled`, `approved_scopes`, `verified_domains`, `verified_url_prefixes`, `creators_posted_last_24h`, optional `active_creator_cap`, `posts_last_24h_by_creator`, `pending_inbox_last_24h_by_creator`, and `export_screen` (true or false for each item of the checklist).
- `posts[]`: `id`, `creator`, `post_mode` (`DIRECT_POST` or `MEDIA_UPLOAD`), `media_type` (`VIDEO` or `PHOTO`), `creator_info` as TikTok returned it (add `error_code` if it returned one), `choices` (what the creator picked: `privacy_level`, `privacy_selected_by_user`, `allow_comment`, `allow_duet`, `allow_stitch`, `commercial`, `ai_generated`, `is_aigc`, `consent`), `title`, `description` (photos), and `video` or `photos` with the media details.

## Publish one post (optional)

```
TIKTOK_ACCESS_TOKEN=act.xxx node tiktok-post-example.mjs my-plan.json post-1
TIKTOK_ACCESS_TOKEN=act.xxx node tiktok-post-example.mjs my-plan.json post-2 --file video.mp4
```

It refuses posts the checker marks `fix_first`, reads `creator_info` again right before posting, sends each chunk with its `Content-Range`, retries only 429 and 5xx, polls the status with growing waits up to `TIKTOK_MAX_WAIT_MS`, and reports `published: true` only at `PUBLISH_COMPLETE`. Post IDs come back as strings, because TikTok's int64 IDs do not fit in a JavaScript number. The token goes only in the `Authorization` header, never in a URL.

Run `node test-post-example.mjs` to see the 17 scenarios pass against a local mock. They were not run against TikTok itself: a real post needs an approved app and an authorized account.

## Tests

```
node test-tiktok-check.mjs      # 957 of 957 cases pass
python test_tiktok_check.py     # 957 of 957 cases pass
node test-post-example.mjs      # 17 of 17 publishing scenarios pass
```

Both checkers return identical reports (issues, messages, request bodies and chunk plans) for all 949 generated plans. `node make-test-cases.mjs` rebuilds the test cases: each one changes one or two things in a valid post and states which codes that change must produce.

## What it cannot check

It reads what you declare and makes no calls to TikTok. It cannot tell whether your app passes app review or the audit, your active creator cap, a creator's real daily cap, whether your verified domain really serves the file, whether the file passes TikTok's processing, or how moderation will treat a post.

Two readings are ours, not TikTok's: sizes in "MB" are read as MiB (TikTok's own 4 MB example is 4,194,304 bytes), and photos over 1920 x 1080 are flagged for review because TikTok only says "1080p".
