TikTok

Options for posting via the API to TikTok

TikTok API Endpoints

Overview

Ayrshare now offers direct publishing of TikTok videos, comments, and advanced analytics.

TikTok asynchronously process video, so the JSON response will be status: "pending" for both immediate and scheduled posts. Once TikTok has completed processing, your registered Scheduled Action webhook will be called.

TikTok Video Post

JSON for a basic TikTok video post that is directly published:

{
    "post": "The best TikTok \n video ever #bestvideo", // Max 2,200 characters with a line break
    "mediaUrls": ["https://img.ayrshare.com/012/tiktok.mp4"],
    "platforms": ["tiktok"]
}

Example JSON post response:

{
    "status": "success",
    "errors": [],
    "postIds": [
        {
            "status": "success",
            "idShare": "video.7088122496758679353.nzLqBWbf",
            "id": "pending",
            "platform": "tiktok"
        }
    ],
    "id": "lb42orDhySAZmLWtj6b6",
    "refId": "23a9da9e0df1184a7a6a1fc2c60b8023aa9a32a1",
    "post": "The best TikTok video ever #bestvideo"
}

TikTok does not currently support line breaks in the post text. Included line breaks will be ignored.

TikTok Processing

TikTok asynchronically processes videos, so the response will have the id field set to "pending". After TikTok completes their processing, usually within 1 - 2 minutes, the id field will be updated with the TikTok video id and a postUrl will be added.

If an error occurs, such as TikTok was unable to process the video or Ayrshare internal tests failed, the id field will be set to "failed" and the errors field will contain the error details.

You can retrieve the final status of the TikTok post using webhooks or the /history endpoint.

*The idShare is used for internal referencing the pending video.

TikTok Video Requirements

  • The video must end in a known video extension such as mp4. Please either reverse proxy the URL, add on a vanity URL with a CDN, or use the /media endpoint.

  • TikTok's post text character limit is 2,200.

  • TikTok also supports sending media without post text. If you do not want post text included send and empty String post: ""

  • The status of the TikTok post can be retrieved with the history endpoint or via a webhook and usually takes up to a minute to be available.

  • When the user publishes the video in the TikTok mobile app, a "scheduled" webhook will be sent with the subAction: "tikTokPublished"

TikTok limits the API video publishing to 2 videos per minute with an upper limit of 20 per day.

Additional TikTok Options

When posting a TikTok video additional options are available, such as disable comments, disable duet, and disable stitch:

{
    ...
    "tikTokOptions": {
        "disableComments": true, // Default false. Disable comments on the published video.
        "disableDuet": true,     // Default false. Disable duets on the published video.
        "disableStitch": true   // Default false. Disable stitches on the published video.
    }
}

Video Thumbnail

Set a thumbnail for a TikTok video by selecting an offset frame. TikTok does not support uploaded images for thumbnails.

{
    ...
    "tikTokOptions": {
        "thumbNailOffset": 30000    // milliseconds of offset image
    }
}

The offset is the location in milliseconds of the thumbnail frame. Default value is 0, which is the first frame of the video or reel.

TikTok Mentions

Mention another TikTok handle by adding @handle in the post text. For example:

{
    "post": "Love the @ayrshare social media api"
}

Please review the important rules on mentions.

Legacy TikTok Posting

Note that async posting is only used by older linked account that have not relinked TikTok.

TikTok does asynchronous processing of videos. They require that after uploading the video your user open their mobile TikTok app to finalize the processing.

Please see details on the TikTok process:

pageTikTok Linking (legacy)

Additional examples on using the TikTok API.

Last updated