Your own system can pick a TikTok sound for a video it posts through the Publishing API: find the sound, look at the TikTok videos trending with it, then send its id with the post. It is part of the Publishing API of the Pro package. Reading sounds needs a key with the publish:read or publish scope; posting needs publish.
- Find sounds with GET /music?platform=tiktok. Add trending=true for only the sounds in the country’s TikTok list today, country=US (any two-letter code; the United States when you leave it out), genre=POP (one of TikTok’s own genre values), q=summer (2 to 60 letters, searched in the titles and artists we know) and limit (1 to 100, 50 when left out). Without trending or q you get the sounds your workspace used, then the ones other businesses use, then the country’s trending ones.
- Each sound comes back as id, platform, title, artist, duration_s, genre, trending (in that country’s list today), commercial_ok, preview_url (a short audio of the track on TikTok’s CDN, to listen to it before you choose; empty for Instagram) and cover_url. Every TikTok sound here comes from TikTok’s Commercial Music Library, cleared for business posts.
- See how a sound is used with GET /music/{id}/videos?country=US. The answer names the sound and lists up to 20 videos TikTok says are trending with it, each with url, embed_url (TikTok’s own player), author, cover_url and title — the last three are empty when TikTok gives none.
- Leave country out and your workspace’s country is asked (the United States when none is set). When a country has no videos, the United States answers and requested_country names the one you asked for. Add account_id (a TikTok account id from GET /capabilities) to ask TikTok with that account first. Each list is kept for 6 hours.
- Post with POST /posts: format reel or video, the TikTok account in account_ids, and "sound": { "tiktok": "<id>" } with the id exactly as GET /music returned it.
What TikTok asks
- A TikTok sound goes out through TikTok Business, which posts to Everyone. The account needs TikTok Business turned on (in Channels, Turn on on its TikTok card), and the post must go to Everyone: the owner chooses it in Waiting for you, or a direct request sends privacy_level PUBLIC_TO_EVERYONE.
- A photo, carousel or story with a TikTok sound, or a sound on the drafts route, is refused with unsupported_by_platform before anything is queued.
- If TikTok refuses the sound for an account when it publishes, the video goes out once more without it.
Good to know
- GET /music/{id}/videos answers 404 not_found for a sound that has left our list, 409 tiktok_not_connected or tiktok_reconnect when the workspace’s TikTok has to be connected (again) in Channels, and 503 service_unavailable when TikTok does not answer — try again in a minute.
- A filter that is not right answers 400 validation_failed, with problems naming each field.
- 60 requests a minute per key. Full reference: miragechat.io/developers/publishing/