Log inStart Free Trial
easyCoexistence Official APIs

How to post a video to TikTok through the API

To post a video through TikTok's API for Business, send POST /business/video/publish/ with the account's business_id, a video_url on a verified domain or URL prefix, and a post_info object holding the caption and settings, with the Access-Token header. TikTok answers with a share_id; pass it as publish_id to /business/publish/status/ until the status reads PUBLISH_COMPLETE and post_ids appear.

easyCoexistence posts TikTok videos with publish_tiktok_post from Claude, ChatGPT or your own agent: pass an HTTPS link, the caption and whether comments are on, then follow the post with get_tiktok_publish_status, while the file reaches TikTok through its verified media route.

share_id

Returned by the publish call, such as v_pub_url~v1.2345123456789123456, and passed to the status call as publish_id.

Nov 16, 2023

Since then, TikTok refuses to publish videos from URLs whose domain or URL prefix is not verified.

6 a minute

TikTok's cap on video posts per account through the publish endpoint, with at most 15 a day.

3 min

How long post_ids can take to appear after PUBLISH_COMPLETE; TikTok says to retry after three minutes.

post_id

Sent in the post.publish.publicly_available webhook once a post passes moderation, ready for querying its insights.

What do you need before the first call?

Three things. A TikTok account access token and the account's open_id, from the token exchange; a developer app holding the Video Publish permission under TikTok Accounts; and the video at a public HTTPS or HTTP URL that sits under a domain or URL prefix verified for the app. TikTok downloads the file itself, so it has to stay reachable, and TikTok recommends a URL that lives for at least 30 minutes.

What does the publish request look like?

A POST to https://business-api.tiktok.com/open_api/v1.3/business/video/publish/ with the account's token in the Access-Token header and Content-Type set to application/json. The JSON body names the account in business_id, the file in video_url and the post's settings in post_info; this one publishes a captioned video with comments, Duet and Stitch left on:

Publish a video with curl
curl -X POST 'https://business-api.tiktok.com/open_api/v1.3/business/video/publish/' \
  -H 'Access-Token: <ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
    "business_id": "<OPEN_ID>",
    "video_url": "https://media.example.com/tiktok/launch.mp4",
    "post_info": {
      "caption": "Our new menu is live #food",
      "is_brand_organic": false,
      "is_branded_content": false,
      "disable_comment": false,
      "disable_duet": false,
      "disable_stitch": false
    }
  }'

What does each body field do?

The fields TikTok's reference lists for a video post, top level first. The cover, the AI-generated label, a location, drafts and the ads-only option sit in the same body:

  • business_id: the account's open_id from the token exchange.
  • video_url: the file TikTok downloads, MP4, MOV or WebM, on a verified domain or URL prefix.
  • post_info: required on every call, even as an empty object, and home to the post's settings.
  • post_info.caption: up to 2,200 characters counted in UTF-16, with #hashtags and up to 30 @mentions.
  • post_info.is_brand_organic and is_branded_content: the Promotional content and Paid partnership labels, which TikTok's table marks as required.
  • post_info.disable_comment, disable_duet and disable_stitch: true turns comments, Duet or Stitch off; all three default to false.

What does TikTok return?

The usual envelope, with the publishing task's ID in data. A code of 0 means TikTok accepted the task, not that the video is live: TikTok still has to download the file, check it and moderate the post. In TikTok's examples, a video's share_id starts with v_pub_url and a photo post's with p_pub_url.

The publish response
{
  "code": 0,
  "message": "Ok",
  "request_id": "20210817034316010245031056097316BA",
  "data": {
    "share_id": "v_pub_url~v1.2345123456789123456"
  }
}

How do you follow the post until it is live?

With GET /business/publish/status/, passing business_id and the share_id as publish_id. status reads PROCESSING_DOWNLOAD while TikTok fetches the file, PUBLISH_COMPLETE once the post has passed moderation, or FAILED with a reason. post_ids arrives with PUBLISH_COMPLETE when the post is publicly viewable, and can lag by up to three minutes. The whole flow in Python:

Publish and follow a video in Python
import os, time, requests

API = "https://business-api.tiktok.com/open_api/v1.3"
HEADERS = {"Access-Token": os.environ["TIKTOK_ACCESS_TOKEN"]}
BUSINESS_ID = os.environ["TIKTOK_BUSINESS_ID"]  # open_id from the token exchange

def call(method, path, **kwargs):
    body = requests.request(method, f"{API}/{path}", headers=HEADERS, timeout=30, **kwargs).json()
    if body.get("code") != 0:  # errors arrive in code, usually with HTTP 200
        raise RuntimeError(f"{body.get('code')}: {body.get('message')}")
    return body["data"]

share_id = call("POST", "business/video/publish/", json={
    "business_id": BUSINESS_ID,
    "video_url": "https://media.example.com/tiktok/launch.mp4",
    "post_info": {"caption": "Our new menu is live #food",
                  "is_brand_organic": False, "is_branded_content": False},
})["share_id"]

for _ in range(30):
    time.sleep(60)  # each check is a call; TikTok's stages take minutes
    s = call("GET", "business/publish/status/",
             params={"business_id": BUSINESS_ID, "publish_id": share_id})
    if s["status"] == "FAILED":
        raise RuntimeError(s.get("reason"))
    if s["status"] == "PUBLISH_COMPLETE" and s.get("post_ids"):
        print("Live:", s["post_ids"])
        break

Can a webhook replace the status checks?

Yes, for an app that subscribes to event_type VIDEO with /business/webhook/update/. TikTok then posts post.publish.failed or post.publish.complete once it has downloaded and checked the file, post.publish.publicly_available with the new post_id once moderation passes, and post.publish.no_longer_publicly_available if the post later leaves public view. Each event names the task in publish_id, the same value as the share_id.

How do you post a video through MCP?

Ask for it in plain words from Claude, ChatGPT or another client connected to https://easycoexistence.com/api/mcp. The assistant calls publish_tiktok_post with the account_id from list_social_accounts, an HTTPS video_url, the caption and, if you want comments off, disable_comment. The result carries TikTok's share_id, and get_tiktok_publish_status, given the account_id and that share_id, returns TikTok's status, post_ids and reason as they stand.

The MCP tool calls and their results
publish_tiktok_post {
  "account_id": "<ACCOUNT_ID>",
  "video_url": "https://media.example.com/tiktok/launch.mp4",
  "caption": "Our new menu is live #food",
  "disable_comment": false
}
=> { "share_id": "v_pub_url~v1.2345123456789123456",
     "note": "TikTok is processing the post. Check it with get_tiktok_publish_status." }

get_tiktok_publish_status { "account_id": "<ACCOUNT_ID>", "share_id": "v_pub_url~v1.2345123456789123456" }
=> { "status": "PUBLISH_COMPLETE", "post_ids": ["<POST_ID>"] }

What does publish_tiktok_post send to TikTok?

A call to the same endpoint, filled in from your request. Your link goes to TikTok as a signed link under easyCoexistence's own verified media route, so it needs no verification of its own; the caption and disable_comment go as you gave them; and is_brand_organic and is_branded_content go as false. The other settings, such as Duet, Stitch, the cover and the AI-generated label, keep TikTok's defaults, and the video is published as a public post, as the endpoint is built to do.

What can you do with credentials from the Partner API?

Call TikTok directly as the account. GET /channels/{id}?credentials=1 on https://easycoexistence.com/api/v1, with your ec_live_ key as a bearer token, returns the channel with a credentials object: api_base, business_id, a current access_token and token_expires_at. Status checks, video lists, comments and insights then run from your own code. Publishing is the part to plan: a direct publish call passes video_url to TikTok untouched, URL properties are added with a developer app's own ID and secret, and the prefix easyCoexistence's app has verified is its media route, which publish_tiktok_post uses.

Credentials from the Partner API, then a direct status check
curl "https://easycoexistence.com/api/v1/channels/$CHANNEL_ID?credentials=1" \
  -H "Authorization: Bearer $EC_API_KEY"

# "credentials": {
#   "platform": "tiktok",
#   "api_base": "https://business-api.tiktok.com/open_api/v1.3",
#   "business_id": "<OPEN_ID>",
#   "access_token": "<ACCESS_TOKEN>",
#   "token_expires_at": "2026-11-01T09:00:00.000Z", ...
# }

curl -G 'https://business-api.tiktok.com/open_api/v1.3/business/publish/status/' \
  -H 'Access-Token: <ACCESS_TOKEN>' \
  --data-urlencode 'business_id=<OPEN_ID>' \
  --data-urlencode 'publish_id=<SHARE_ID>'

How to set it up

  1. Get the token and the account IDExchange the owner's authorization code at /tt_user/oauth2/token/, and keep access_token for the header and open_id for business_id.
  2. Host the videoPut the MP4, MOV or WebM file under a domain or URL prefix verified for your app, where it stays reachable for at least 30 minutes.
  3. Call the publish endpointPOST business_id, video_url and post_info, with the caption, the two brand flags and the engagement switches, to /business/video/publish/.
  4. Keep the share_idStore data.share_id from the response, the ID of this publishing task.
  5. Check the statusEvery few minutes, GET /business/publish/status/ with business_id and the share_id as publish_id, until PUBLISH_COMPLETE or FAILED.
  6. Record the post IDTake it from post_ids, or from post_id in the post.publish.publicly_available webhook, to read the video's metrics later.

Common mistakes

  • Leaving out post_info. TikTok requires the object on every call, even when no setting changes.
  • Looking for a post ID in the publish response. It returns only share_id; post IDs come from the status call or the publicly_available webhook.
  • Repeating a publish call that timed out. The first request may have reached TikTok, so check the account's latest posts before sending it again.
  • Treating code 0 as a live video. It means TikTok accepted the task, and the file can still fail its checks after the download.
Doing this with EasyCoexistence

US$ 9 to US$ 0.75 per connection per month, falling as you add connections, with the first 3 days free.

easyCoexistence is a multichannel API and MCP server that connects AI agents such as Claude and ChatGPT to WhatsApp, Instagram, TikTok, Facebook and more. On WhatsApp it uses Coexistence: the business keeps using its number in the WhatsApp Business app while the AI works through Meta's official API.

Frequently asked questions

Which endpoint posts a video to TikTok?

POST https://business-api.tiktok.com/open_api/v1.3/business/video/publish/, with the account token in the Access-Token header and business_id, video_url and post_info in the JSON body.

Can the TikTok API upload a video file directly?

Not through /business/video/publish/. It takes video_url and fetches the file from there, so the video needs a URL on a verified domain or URL prefix.

How do I get the ID of a video published through the API?

From post_ids in /business/publish/status/ once the status is PUBLISH_COMPLETE and the post is public, or from post_id in the post.publish.publicly_available webhook.

Can I schedule a TikTok video for later through the API?

The publish endpoint posts when it is called and has no time field. easyCoexistence holds scheduled posts in its own queue and calls TikTok at the time you set.

Keep reading

Connect your first channel in two minutes.

No platform reviews to wait for. Connect WhatsApp, Instagram, TikTok or another channel, then ask your AI to post, reply or report, and watch it work.

  • 3 days free
  • Cancel any time
  • Official APIs only
  • Monitored 24/7

Verified on