Skip to content
MirageCHATEngagePublishGrow
Back

Publishing API: find a TikTok sound, see its videos, post with it

4 min readFor developers with a publishing keyUpdated

On this page
  1. Before you start
  2. 1. Find a sound
  3. 2. See the videos trending with it
  4. 3. Post with it
  5. When it says no
  6. Without the API

In short

Your own software can pick a TikTok sound the way Instant Post’s Use this sound does: GET /music lists the sounds, GET /music/{id}/videos shows the TikTok videos trending with one, and "sound": { "tiktok": "<id>" } on POST /posts puts it on the post. Every call is in the Publishing API reference.

Before you start

  • A publishing key — on Pro, made in Security › Developer; a reseller makes one in Reseller › Settings — API keys. A read-only publishing key may call both lists.
  • For the videos of a sound: a TikTok account connected in the workspace, with TikTok for Business — Connect TikTok.

1. Find a sound

GET /api/ext/v1/music?platform=tiktok answers a list of sounds, each with its id, title, artist, duration_s, genre, trending, commercial_ok, preview_url (a short audio of the track, to listen to it before you choose; TikTok only) and cover_url. Narrow it with:

ParameterWhat it does
trending=trueOnly the sounds trending in the country today.
country=USThe country, as a two-letter code.
genre=POPOne of TikTok’s genres.
q=summerSearches the titles and artists — at least 2 letters.
limit=50From 1 to 100 sounds; 50 when you leave it out.

Every TikTok sound here comes from TikTok’s Commercial Music Library, so commercial_ok is true: a business account may post with it.

2. See the videos trending with it

GET /api/ext/v1/music/{id}/videos?country=US answers the sound and up to 20 TikTok videos trending with it, each with its url, an embed_url that plays it in TikTok’s own player, and the author, cover_url and title when TikTok gives them. Nothing is downloaded.

  • Without country, the workspace’s country is used. When a country has none, the United States answers, and requested_country names the one you asked for.
  • account_id (optional) names one of your TikTok accounts to ask TikTok with.
  • A list is kept for 6 hours, so asking again soon gives the same videos.

3. Post with it

Send the sound’s id in sound on POST /posts — for example "sound": { "tiktok": "6850124243225544705" }. The TikTok post then follows the route your key allows — TikTok routes.

When it says no

AnswerWhat to do
409 tiktok_not_connectedConnect a TikTok account in the workspace — Channels › TikTok, with TikTok for Business — then ask again.
409 tiktok_reconnectThe workspace’s TikTok account has to be connected again, in Channels.
404 not_foundThe sound is not in the list any more. Pick another one from GET /music.
503 service_unavailableTikTok is not answering for this right now. Try again later.
400 validation_failedA value is not right; problems names each one.

Without the API

In Instant Post, on the web and in the app, the same sounds and videos are a tap away: press a TikTok sound’s name, or ▶ videos under it, then Use this sound — how.

Ready?

Opens MirageCHAT in this tab. Sign in first if you’re not already.

Open Security › Developer

Related guides

Still stuck? Write to info@miragechat.io with your workspace name. Never send passwords or codes.

Try MirageCHAT free for 14 days

No credit card is required, and then Free — 2 accounts, the inbox and Instant Post. Provider charges such as WhatsApp or SMS stay on your own provider account.

Start free trial