Skip to main content

Search TikTok Music

Searches TikTok's Commercial Music Library (CML) by song title or artist and returns the same track objects as Get TikTok Trending Music. The id of a track is what you pass as tiktok_music_id when uploading.

What is actually searched

TikTok does not expose a music search endpoint: the only catalogue it publishes is the trending chart for a given genre, country and period (100 tracks per combination). Upload-Post caches those charts and runs the text match over them, so this endpoint searches the trending charts, not TikTok's entire catalogue. A song that is not trending in any chart you have loaded will not be found.

  • Method: GET
  • Endpoint: /api/uploadposts/tiktok/music/search
  • Authentication:
    • API Key in the Authorization header.
      • Authorization: Apikey <YOUR_API_KEY>

Query Parameters

ParameterTypeRequiredDescriptionDefault
profilestringYesThe profile's username. Must have a TikTok account connected.-
qstringNoText to match against track titles and artists. Case- and accent-insensitive (arvore matches Árvore da vida); every word must match, so bad bunny does not return every track containing bad. Max 80 characters. Omit it to get the chart in trending order.""
genrestringNoSame genre values as the trending endpoint. Restricts the search to that genre.ALL
country_codestringNoISO 3166-1 alpha-2 code choosing which country's chart is searched (e.g. US, ES, GB). A value that is not two letters falls back to US.US
date_rangestringNoChart window: 1DAY, 7DAY, 30DAY, 90DAY.7DAY
limitintegerNoMaximum tracks to return, capped at 100.50

Example Request

curl -G 'https://api.upload-post.com/api/uploadposts/tiktok/music/search' \
-H 'Authorization: Apikey your-api-key-here' \
-d 'profile=your_profile' \
-d 'q=milky chance' \
-d 'country_code=US' \
-d 'limit=5'

Successful Response (200 OK)

{
"success": true,
"query": "milky chance",
"genre": "ALL",
"country_code": "US",
"date_range": "7DAY",
"limit": 5,
"total": 1,
"tracks": [
{
"id": "7363314838511175697",
"commercial_music_id": "7363314838511175000",
"title": "Ok I Like It",
"artist": "Milky Chance",
"duration": 29,
"rank": 3,
"genres": ["POP"],
"cover_url": "https://p16-sign.tiktokcdn.com/....jpeg",
"preview_url": "https://sf16-cml.tiktokcdn.com/....mp3"
}
],
"catalog": {
"tracks_indexed": 442,
"genres_indexed": ["ALL", "ELECTRONIC", "JAZZ", "LATIN", "POP"],
"cached": true
}
}

The objects in tracks are identical to the ones the trending endpoint returns — see its field reference — so a client can use both endpoints interchangeably.

FieldDescription
totalHow many tracks matched, before limit was applied.
catalog.tracks_indexedHow many tracks the search actually ran against.
catalog.genres_indexedThe genre charts currently loaded for this country_code / date_range.
catalog.cachedfalse when this request had to load a chart from TikTok, true when everything was already cached.

Ranking and coverage

  • Matches on the title rank above matches on the artist; ties are broken by the track's position in the trending chart.
  • The corpus grows as charts are loaded. Requesting a genre loads that genre's chart, so the more genres your integration browses for a given country and period, the more tracks a later search can match. catalog.tracks_indexed tells you how large the corpus was for the request you just made.
  • Charts are refreshed a few times a day. If TikTok is unreachable and a cached chart exists, the cached one is served rather than failing the request.

Error Responses

  • 400 Bad Requestprofile was not sent, or q is longer than 80 characters.
{ "success": false, "message": "q must be at most 80 characters" }
  • 404 Not Found — no profile with that username exists under your API key.
  • 400 Bad Request — the profile's TikTok connection lacks the music capability ("error_code": "tiktok_reconnect_required"). Reconnect the account.
  • 409 Conflict — the TikTok token expired and the account must be reconnected ("reauth_required": true).
  • 502 Bad Gateway — TikTok rejected the request and no cached chart was available to fall back on.

An unknown genre, date_range or country_code is not a 400: the value falls back to ALL, 7DAY and US respectively.

Using a result on an upload

curl -X POST https://api.upload-post.com/api/upload \
-H 'Authorization: Apikey your-api-key-here' \
-F 'user=your_profile' \
-F 'platform[]=tiktok' \
-F 'title=Golden hour 🌇' \
-F 'video=@/path/to/video.mp4' \
-F 'tiktok_music_id=7363314838511175697' \
-F 'tiktok_music_volume=60' \
-F 'tiktok_original_sound_volume=40'

Send the id, never commercial_music_id — TikTok rejects the latter on public posts. See the full field reference in Upload Video → TikTok.