Creator OS
ai agentsapiautomationinstagramtiktok

How to Let an AI Agent Post to Instagram (and TikTok)

A step-by-step guide to letting an AI agent post to Instagram and TikTok: API key setup, CLI command, and your first scheduled post. Yes, it can actually publish.

Creator OS · October 18, 2026 · Updated October 24, 2026 · 9 min read

You want your agent to do the posting, not just write the caption. This walks through how to let an AI agent post to Instagram and TikTok, from API key to a live scheduled post, using Creator OS. You will see the exact commands, what each one returns in practice, and where it breaks.

The short answer: yes, an agent can publish for you, but only through an API that already holds the platform permissions. Your agent never touches Instagram or TikTok directly. It calls Creator OS, and Creator OS talks to the networks. That distinction matters, because it explains every error you will hit in step 3.

Your agent (Claude, ChatGPT, Codex, Cursor)
        |
        |  CLI command or MCP tool call
        v
Creator OS  ---->  Instagram Graph API
            ---->  TikTok Content Posting API
        |
        +-- workspace key (cos_live_...) pins one set of socials
        +-- media uploaded once, reused as med_ id
        +-- per platform rules applied (Reels, consent flags)
One key, one workspace, two networks, no platform SDK in your agent.

Can an AI Agent Actually Publish to Instagram and TikTok?

Yes, with a caveat on TikTok. On Instagram, Creator OS supports Reels, feed images, carousels and Stories, and the API publishes them for a Business or Creator account. Comment replies, comment hiding, DMs and comment-to-DM funnels also work.

On TikTok, Creator OS publishes videos and photo carousels. Replies to TikTok comments are not supported, and there are no DMs on TikTok. If your agent’s job is “reply to every comment on both platforms,” it will do Instagram only. Plan around that.

Two more limits to know before you promise your agent anything. The Instagram API cannot attach trending audio, so sound has to be baked into the file. And TikTok requires consent flags on every post: content_preview_confirmed and express_consent_given must both be true. The simple post form fills those for you. The advanced form does not.

If you have not read the longer piece on running these agents day to day, start with Social Agents and come back here for the mechanics.

Get started for $0

What You Need Before You Start (Accounts, Permissions, API Access)

Four things, in this order.

  1. Instagram as a Business or Creator account. Personal accounts cannot publish through the API at all.
  2. The accounts connected in Creator OS. The web app handles the OAuth dance to each network. Your agent never sees those tokens.
  3. A Creator OS API key. It starts with cos_live_ and is pinned to one workspace. A key for one set of socials cannot post to another set.
  4. A CLI or an MCP connection. Pick one. The CLI is better for scripts and cron jobs. The MCP server is better when a chat app like Claude or ChatGPT is driving.

Creator OS applies each platform’s rules for you. You send a caption, platforms and media. It turns that into a Reel with a cover, or a TikTok video with the right consent flags. You are not writing two integrations.

Step 1: Get Your Instagram and TikTok API Keys

Create the key in Creator OS and store it as an environment variable. Do not paste it into a prompt.

export CREATOROS_API_KEY="cos_live_your_key_here"
creatoros auth:check

creatoros auth:check confirms the key is valid and tells you which workspace it belongs to. Run it first every time you debug, because half of “my agent cannot post” tickets are a key from the wrong workspace.

Then confirm both accounts are actually connected and healthy:

creatoros accounts:list
creatoros accounts:health

accounts:list gives you account ids in the acc_ format. You will need that id later if you post per account rather than per platform. accounts:health catches the expired Instagram token case before your scheduled run does.

Step 2: Connect Your Agent to Creator OS

Two paths. Choose based on who is driving.

Path A: the hosted MCP server

MCP is how a chat app or coding agent gets tools. The Creator OS server is hosted at https://mcp.creatoros.ca/mcp. Nothing to install.

In Claude: Settings, Connectors, Add custom connector. Paste the URL, sign in to Creator OS, pick the workspace, and choose read only or read and write. In ChatGPT, add the same URL as a connector in developer mode.

For Claude Code, one command:

claude mcp add --transport http creatoros https://mcp.creatoros.ca/mcp \
  --header "Authorization: Bearer cos_live_your_key_here"

In Cursor, Windsurf or VS Code, it is an mcpServers entry with type: http, the URL and the Authorization header.

Once connected, the agent sees tool names it can call directly: create_post, update_post, upload_media_from_url, list_posts, get_post_analytics, get_best_time_to_post, reply_to_comment, check_caption_length, and more.

Path B: the CLI

npx @creatoros/cli@latest init
creatoros sync

init installs 14 Claude Code skills, including post-everywhere, post-shortform, schedule-posts, respond-to-comments and analytics. sync updates the skills later without clobbering files you edited; changes arrive as .new files.

Step 3: Run Your First Publish Command From the CLI

Here is a real one, a nine by sixteen clip going to both networks.

creatoros posts:create \
  --text "Three ways to cut a talking head clip. Full video in bio." \
  --platforms instagram,tiktok \
  --media https://cdn.example.com/clip-vertical.mp4 \
  --coverAt 2400

What happens under the hood matters more than the syntax. Creator OS downloads the video once, uploads it as a med_ id, and reuses that id on both networks. On Instagram it builds a Reel and grabs the frame at 2400 ms for the cover. On TikTok it sends the consent flags and the required privacy fields.

Check the caption against platform limits before you send, not after:

creatoros validate:post-length --text "Your caption here"

If you only want a draft for a human to finish, add --draft. On TikTok that sends the video to the Creator Inbox so someone can add trending audio in the app. On Instagram, drafts stay in Creator OS until you publish.

And when you want per platform settings that differ, for example a Reel cover on Instagram but a timestamp cover on TikTok, use the advanced form of the API. In POST /v1/posts, platforms becomes an array of objects with per platform options, and TikTok settings go in a top level tiktok object. The full shapes live in the post options docs.

Step 4: Schedule Your First Post on Instagram and TikTok

Add a timestamp and a timezone. Do not omit the timezone.

creatoros posts:create \
  --text "Behind the edit: 40 minutes into 40 seconds." \
  --platforms instagram,tiktok \
  --media https://cdn.example.com/edit-breakdown.mp4 \
  --scheduledAt 2026-03-04T18:30:00Z \
  --timezone America/Toronto

The post now sits in the queue. List it to confirm:

creatoros posts:list --status scheduled

Two things worth knowing before you let an agent choose times on its own. First, creatoros analytics:best-time --platform instagram returns historical best times for that account, so the agent can propose a slot instead of guessing. Second, changing a scheduled time later is a single call:

creatoros posts:update post_abc123 \
  --scheduledAt 2026-03-05T14:00:00Z \
  --timezone America/Toronto

If you are planning a week in one go, creatoros posts:bulk-upload --file calendar.json --dryRun validates a whole calendar before anything publishes. Drop the --dryRun flag to run it for real.

Step 5: Verify the Post Is Live and Check Analytics

Fetch the post and look at its per platform status.

creatoros posts:get post_abc123

Then pull numbers a day later, not an hour later. Early engagement is noise.

creatoros analytics:posts --from 2026-03-01T00:00:00Z --platform instagram
creatoros analytics:daily --platform tiktok

Now the useful bit for an agent workflow: close the loop. Feed those results back and let the agent pick the next post. That is the difference between an agent that posts and an agent that posts better over time. If you want the agent reading its own published work, the pattern in letting an agent research published articles applies to short form too.

For comment follow up, the reply flow is here: an agent replying to Instagram comments in your voice.

Common Errors and How to Fix Them

Four failures account for most of the pain.

1. The post went out on one network, not both

Networks named in a post that are not connected come back in missing_platforms, and the rest still publish. That is by design. Check creatoros accounts:list and connect what is missing. Do not assume silence means success.

2. TikTok rejected the video

Usually a missing consent flag from the advanced form, or a privacy level the account type does not allow. Business app connections publish public only unless sent as drafts. Switch to --draft and finish in the app.

3. Instagram refused the Reel

The account is probably Personal, not Business or Creator. No API setting fixes that. Also check that collaborators you tagged are public Business or Creator accounts.

4. You cannot tell what broke

Errors all share one shape: { error: { code, message, status } }. Have your agent log that object verbatim. Ids are typed tokens, acc_, post_, cmt_, conv_, med_, so a mixed up id type shows up immediately in the message.

Safety Rails: Approval Flows, Read-Only Keys, and Rate Limits

An agent with publish rights is an agent that can publish the wrong thing. Three rails make that survivable.

  • Read only connections. A read only MCP connection only sees read tools, and the API refuses writes from it. Use one for analytics and research agents. The mechanics are covered in read only API keys for AI agents.
  • Destructive tools ask first. Delete post, delete comment, disconnect account and delete ad are marked so the AI app confirms before acting.
  • Workspace scoping. A key is pinned to one workspace, so an agent working on a client account cannot reach a different set of socials.

For anything touching ad spend, use dry runs. creatoros ads:create and ads:boost both accept --validateOnly, budgets are whole units of the ad account currency, and ads are created paused for review. The ads docs have the network specific limits.

On webhooks, you can subscribe your own endpoint to post.published and comment.received. Every delivery is signed with X-CreatorOS-Signature, so your agent can verify before it acts on a new comment.

Get Started: Publish Your First AI-Agent Post Today

The fastest route is the CLI, because every step in this post is one command. The second fastest is pasting the MCP URL into Claude and asking it to publish.

The Creator plan is $14.99/month or $59.99/year and covers 11 platforms plus Skool, one account on each. API keys, the MCP server, the CLI and the agent skills are included in every plan, including that one.

Two places to keep going. The MCP docs list the full tool set, and the CLI docs cover the commands we did not need here. For the visual version, watch the walkthroughs on the KevBuildsApps YouTube channel, or start with the launch video to see the whole loop in motion.

One last piece of advice. Give your agent the draft flag for the first week. Read every caption it writes before it publishes. Then remove the flag once you trust its output, not before.

Get started for $0
Free trial for new subscribers. Cancel anytime.

Keep reading