English
Trending Sounds & Licensed Music
Attaching official TikTok sound IDs prevents copyright audio muting and significantly boosts your reach in the For You Page (FYP) algorithm.
1. Search Music (POST /api/tiktok/music/search)
- Endpoint:
POST /api/tiktok/music/search - Credit Cost: 1 Credit per search.
Payload Parameters:
json
{
"keyword": "trending remix",
"cursor": 0,
"count": 10,
"onlyCommerce": true
}keyword(String, Required): Track title, artist name, or sound keyword.count(Number, Optional, Default: 20): Results per page (max 50).cursor(Number, Optional, Default: 0): Pagination cursor offset.onlyCommerce(Boolean, Optional, Default: false): Filter only tracks cleared for commercial use (isCommerceMusic: true).
Essential for TikTok Shop & Shoppable Videos
When publishing videos with product showcase anchors or TikTok Shop links, TikTok policy strictly mandates commercial music. Using regular consumer audio on commercial posts causes TikTok to automatically mute the audio. Always set "onlyCommerce": true when selecting music for e-commerce, affiliate, or promotional content!
Code Examples:
bash
curl -X POST https://api.stackvid.dev/api/tiktok/music/search \
-H "X-API-Key: tk_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"keyword": "trending remix",
"count": 5,
"onlyCommerce": true
}'typescript
import axios from 'axios';
const res = await axios.post(
'https://api.stackvid.dev/api/tiktok/music/search',
{
keyword: 'trending remix',
count: 5,
onlyCommerce: true,
},
{ headers: { 'X-API-Key': 'tk_live_YOUR_API_KEY' } }
);
console.log(res.data.music_list);python
import requests
resp = requests.post(
'https://api.stackvid.dev/api/tiktok/music/search',
headers={'X-API-Key': 'tk_live_YOUR_API_KEY'},
json={
'keyword': 'trending remix',
'count': 5,
'onlyCommerce': True
}
)
print(resp.json())Sample Response:
json
{
"music_list": [
{
"id": "7189283746591028374",
"title": "Summer Vibes",
"author": "Top Artist",
"duration": 60,
"play_url": "https://sf16-ies-music.tiktokcdn.com/...",
"user_count": 894000,
"isCommerceMusic": true
}
],
"has_more": true,
"cursor": 5
}2. Attach Music ID When Publishing
Pass the id from search results into soundId when calling POST /api/tiktok/upload:
json
{
"videoUrl": "https://cdn.yourdomain.com/videos/summer-fashion.mp4",
"text": "Enjoying the summer breeze! #summer #music",
"soundId": "7189283746591028374"
}