TikTok API title: hashtags and mentions need spaces or newlines

In the Direct Post title (2,200 UTF-16 runes) hashtags and mentions are matched or delimited by spaces or new lines. Build the caption with a checked helper.

5 min readSume
All posts

In the Direct Post title field, hashtags (#) and mentions (@) are matched, or delimited, by spaces or new lines, and the whole title is capped at 2,200 UTF-16 runes. So write #one #two with a space between each tag, not #one#two, and count length in UTF-16 units rather than characters.

This is the posted caption, not the text burned into your video. Sume's captions are pixels in the MP4; the title is metadata you send to TikTok yourself.

What does the title field accept?

The Direct Post reference describes title as the video caption, maximum 2,200 UTF-16 runes, and says hashtags and mentions are matched or delimited by spaces or new lines. It does not say how a malformed run such as two tags glued together is parsed, so do not rely on it: put a separator in.

Why count UTF-16 and not characters?

A rune count in UTF-16 units treats an emoji outside the basic plane as two units. A caption of 1,100 such emoji is 2,200 units. Python's len() would call it 1,100 and let it through.

The helper below joins the caption and tags with spaces, strips a leading # you may have already typed, and measures the final string the way the limit is stated.

def utf16_len(s):
    return len(s.encode("utf-16-le")) // 2

def build_title(caption, tags, limit=2200):
    clean = ["#" + t.lstrip("#").strip() for t in tags if t.strip()]
    title = (caption.strip() + " " + " ".join(clean)).strip()
    if utf16_len(title) > limit:
        raise ValueError(f"title is {utf16_len(title)} UTF-16 units, max {limit}")
    return title

print(build_title("New serum drop", ["skincare", "#grwm"]))

Is the burned-in caption the same thing?

No. Video captions burns styled text onto an existing public HTTPS video URL, or you can enable inline captions on an avatar video. Neither writes the TikTok title, and neither reads hashtags out of it.

That separation is useful. The burned captions follow the spoken words, so they change when the script changes. The title carries tags and mentions, so it changes with campaigns. Keep them as two inputs in your pipeline.

What does Sume not do here?

Sume does not post to TikTok, does not suggest hashtags, and does not check a title against TikTok's limits. It also does not validate that a mention exists. If you want a lint step, the helper above is the minimum; run it before any call to Direct Post so a long caption fails locally.

For the broader field list in that same request, see our post on the post_info fields.

Checklist

Before sending a title:

  • One space or new line between every hashtag and mention.
  • Length measured in UTF-16 units, 2,200 at most.
  • No assumption that burned-in captions appear in the title.
  • The AI-generated flag set separately in post_info, not in the text.

Sources

Related posts

More in Integrations

All Integrations posts

Written by Sume