planpo.st
FeaturesFor AI agentsRevenue trackingPlatformsPricingBlogSupport
Sign inStart free trial →
planpo.st

Social scheduling with revenue built in. One platform for creators and businesses who treat social as a growth engine.

Product

SchedulerFor creatorsFor agenciesCompare toolsAlternativesPricing

Channels

InstagramLinkedInX (Twitter)ThreadsFacebookYouTubeTikTokAll channels →

AI agents

MCP serverFor AI agentsClaude CodeCursorChatGPTGemini CLIAll agents →

Revenue

Revenue trackingRevenue attributionStripeShopifyRevenueCatAll integrations →

Resources

DocsMCP toolsAPI referenceBlogAboutSupportContactPrivacyTerms

Compare planpo.st

  • planpo.st vs Postiz
  • planpo.st vs Buffer
  • planpo.st vs Hootsuite
  • planpo.st vs Later
  • planpo.st vs Sprout Social
  • planpo.st vs SocialBee
  • planpo.st vs Planable
  • planpo.st vs Metricool
  • planpo.st vs Loomly
  • planpo.st vs Publer
  • planpo.st vs Post Bridge
  • planpo.st vs Mixpost
  • planpo.st vs Blotato
  • planpo.st vs Typefully
  • planpo.st vs RecurPost
  • planpo.st vs Post Planner
  • All comparisons →
  • Alternatives →
© 2026 planpo.st · all rights reservedstatus: ● all systems normal
  1. Home
  2. /AI agents
  3. /Codex CLI
  4. /TikTok
Codex CLI · TikTok

How to post to TikTok from Codex CLI

Codex CLI uploads the clip and schedules it, and it is told at create time, not at publish time, when the privacy level is missing.

Start 7-day free trial →Codex CLI setup docs
On this pageStepsWhat worksSettingsPromptsLimitsRevenueFAQ

How do I post to TikTok from Codex CLI?

Add the planpo.st MCP server to Codex CLI, connect TikTok once in the dashboard, then ask. The first three steps are one-time.

  1. 1

    Create an API key and add planpo.st to Codex CLI

    Make a scoped key in planpo.st under Settings. Add a [mcp_servers.planpost] table to ~/.codex/config.toml, or run codex mcp add and answer the prompts. The hosted form reads the token from the environment variable named in bearer_token_env_var, so export PLANPOST_API_KEY in your shell first.

  2. 2

    Confirm the server is connected

    Start Codex and run /mcp to check that planpost is connected.

  3. 3

    Connect TikTok

    Connect the TikTok account in the dashboard under Connections. Publishing goes through TikTok's Content Posting API as a direct post, and get_connection_link gives the agent a URL to hand you.

  4. 4

    Know what the post needs

    A TikTok post needs one video and platformSettings.tiktok.privacyLevel. TikTok makes the account owner choose who can view each video, so there is no default to fall back on.

  5. 5

    Ask in your terminal

    Say what to post and when. Codex CLI finds the TikTok connection, creates the post, and tells you whether it was scheduled or kept as a draft, with the reason.

Hosted
[mcp_servers.planpost]
url = "https://mcp.planpo.st/mcp"
bearer_token_env_var = "PLANPOST_API_KEY"
Local
[mcp_servers.planpost]
command = "npx"
args = ["-y", "planpost-mcp"]

[mcp_servers.planpost.env]
PLANPOST_API_KEY = "pk_live_xxx"

Config location: ~/.codex/config.toml, or .codex/config.toml in a trusted project. Replace pk_live_xxx with your own key.

Hosted or local for Codex CLI?

For Codex CLI I would use hosted with bearer_token_env_var, since the config file then holds no secret and can be shared. Use local when you would sooner keep the key in the config file's env table than in your shell profile.

  • The hosted form reads the token from an environment variable rather than the file, so export PLANPOST_API_KEY in your shell.
  • `codex mcp add` does the same thing interactively if you would rather not edit TOML.

The full walkthrough is on the Codex CLI setup page.

What can Codex CLI do on TikTok?

It can publish a video with a caption, a privacy level, comment, Duet and Stitch switches, a cover frame and the commercial content disclosures. It cannot publish photo posts, and it cannot schedule a video that has no privacy level.

Video post

One video with a caption of up to 2,200 characters, published directly at the scheduled time.

Who can view

required

PUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, FOLLOWER_OF_CREATOR or SELF_ONLY. The account may allow only some of them.

Interaction switches

Comments, Duet and Stitch each have a disable flag. All three are off until you pass false.

Disclosures

yourBrand for your own business, brandedContent for a paid partnership.

TikTok needs a video file on every post, and Codex CLI can take it from disk: it calls upload_media for a presigned URL, PUTs the file there with a shell command, and passes the returned asset into create_post. Files already uploaded come back from list_media, ready to reuse.

Which settings does a TikTok post take?

TikTok is the only network here with a required setting. privacyLevel has to be on every post, and the three interaction flags default the opposite way from what most people expect.

FieldAllowed valuesIf you leave it outWorth knowing
platformSettings.tiktok.privacyLevelPUBLIC_TO_EVERYONE, MUTUAL_FOLLOW_FRIENDS, FOLLOWER_OF_CREATOR, SELF_ONLYNone, requiredMissing saves the post as a draft with tiktok_privacy_missing. If the account allows exactly one level it is filled in and reported as tiktok_privacy_defaulted.
platformSettings.tiktok.disableCommenttrue or falsetrue, comments offPass false to allow comments.
platformSettings.tiktok.disableDuettrue or falsetrue, Duet offPass false to allow Duets.
platformSettings.tiktok.disableStitchtrue or falsetrue, Stitch offPass false to allow Stitches.
platformSettings.tiktok.videoCoverTimestampMsMilliseconds into the video0, the first framePicks the cover frame.
platformSettings.tiktok.brandedContenttrue or falsefalsePaid partnership disclosure. With SELF_ONLY it is refused as tiktok_branded_self_only.
platformSettings.tiktok.yourBrandtrue or falsefalseDiscloses that the video promotes your own brand.
media, platformMedia.tiktokOne videoNone, requiredNo media saves the post as a draft with media_required, images only with video_required.

What do I type to post to TikTok from Codex CLI?

Plain requests work. Each example lists the tool calls Codex CLI makes in response.

1. One video, public, comments on

You say

The video is at ./out/demo.mp4. Schedule it on TikTok for tonight 20:30 Europe/Warsaw, visible to everyone, comments allowed, Duet and Stitch off.

Tool calls

upload_media({ filename: "demo.mp4", contentType: "video/mp4", size: <bytes> })
PUT <file> to the returned URL (shell)
create_post({ content: "<caption>", platformSettings: { tiktok: { privacyLevel: "PUBLIC_TO_EVERYONE", disableComment: false } }, media: [<video>], connectionIds: ["<tiktok id>"], schedule: "today 20:30 Europe/Warsaw" })

One scheduled video. Duet and Stitch stay off because their flags default to true; only the comment flag had to be sent.

2. A batch with one privacy level

You say

Take the ten newest videos in my media library and schedule one per day on TikTok at 18:00 starting Monday, all public, campaign autumn-clips.

Tool calls

list_media({ type: "video", limit: 10 })
bulk_create_posts({ defaults: { connectionIds: ["<tiktok id>"], campaign: "autumn-clips", platformSettings: { tiktok: { privacyLevel: "PUBLIC_TO_EVERYONE" } } }, posts: [ { content: "...", media: [<video 1>], schedule: "monday 18:00" }, ... ] })

Ten scheduled posts from one call, the privacy level set once in defaults. I learned to put it there after 51 of my own TikTok posts failed for missing it.

3. Repair a post that stayed a draft

You say

My TikTok post for Friday is still a draft. Find out why, fix it and put it back on the schedule.

Tool calls

list_posts({ status: "draft", platform: "tiktok" })
preview_post({ id: "<post id>" })
update_post({ id: "<post id>", platformSettings: { tiktok: { privacyLevel: "PUBLIC_TO_EVERYONE" } }, schedule: "friday 18:00" })

preview_post lists the blocking issue with its code and the fix. One update_post later the post is scheduled again.

What stops a TikTok post from Codex CLI?

The tag on a card is the code that comes back in the tool result.

A privacy level on every post

tiktok_privacy_missing

TikTok requires the user to choose who can view each video. Without privacyLevel the post is kept as a draft and the response names the field and the four values.

The account decides which levels exist

At publish time planpo.st asks TikTok which levels this account may use. A level the account does not allow fails with a message to pick another.

Comments, Duet and Stitch start off

The three disable flags default to true. A video you wanted people to comment on needs disableComment: false.

Video only

video_required

The first attachment must be a video. Photo posts are not supported.

Length depends on the account

TikTok reports a maximum video duration per account. A longer video fails at publish with both numbers in the error.

Caption links are plain text

TikTok does not make links in captions clickable. The caption can run to 2,200 characters.

The token comes from your shell

Codex CLI

The hosted config names an environment variable, it does not hold the key. If PLANPOST_API_KEY is not exported in the shell that starts Codex, every call fails with an authorization error.

Can Codex CLI tell me what a TikTok post earned?

Per post, not really. TikTok captions carry no clickable links, so there is no click on the post to match a payment to. The TikTok guide explains the bio-link route, which judges the account as a whole. get_revenue_overview returns totals and recent transactions across networks, and for shops the sales side is usually Shopify.

Shopify integration How revenue attribution works

Codex CLI and TikTok: questions people ask

Why does TikTok need a privacy level on every post?
TikTok's rules for direct posting require the account owner to choose who can view each video. planpo.st refuses to pick one for you, except when the account allows exactly one level.
Are comments on by default?
No. disableComment, disableDuet and disableStitch all default to true. Pass false for the ones you want open.
What happens when Codex CLI sends a TikTok post that breaks a rule?
It is told at once. The usual case on TikTok is a video with no privacy level: the post is kept as a draft and the tool result carries tiktok_privacy_missing plus the fix, which Codex CLI applies with update_post.
Where does the config go?
In ~/.codex/config.toml, or .codex/config.toml in a trusted project. It is TOML, not JSON, which trips people who paste a snippet from another client. Once it loads, the TikTok tools are available in every session.
Does the key have to be in the file?
Not for the hosted server. bearer_token_env_var names a variable and Codex reads the key from your environment, so the file can be shared. The local form puts it under [mcp_servers.planpost.env]. Neither choice changes what you can post to TikTok.

Keep going

TikTok from other agents

Claude Code to TikTokCursor to TikTokClaude Desktop to TikTokChatGPT to TikTokGemini CLI to TikTokGoogle Antigravity to TikTokHermes Agent to TikTok

Other networks from Codex CLI

Codex CLI to ThreadsCodex CLI to LinkedInCodex CLI to InstagramCodex CLI to XCodex CLI to FacebookCodex CLI to YouTube

Background

Codex CLI overviewCodex CLI setupTikTok scheduling guideMCP tool reference