TikTok song details
Beta GET /v1/tiktok/song
GET /v1/tiktok/song
A sound by its clip id (the number at the end of a tiktok.com/music/... URL).
- Cost: 1 credit
- Status: Beta. Built and tested against recorded responses; the shape may still gain fields.
- Cache: Results are kept up to 30 days; send
max_age_daysto reuse them for free. - Timeout: A request still running after about 25 seconds answers
202with a job to poll (Batch and jobs).
Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
id | string | one of | Sound (music) id. Also accepted as clipId, music_id. |
url | URL | one of | Sound URL (tiktok.com/music/...). Accepted hosts: tiktok.com. |
Send at least one of id, url. If you send several, the first listed is used and the rest are ignored.
Every request also accepts:
trim:truefor a smaller response withoutnullfields andextra.raw:trueto also get the platform's original object asraw.max_age_days: accept a cached result up to this many days old, for 0 credits (Caching).
Example request#
Set your key in the environment first (see Authentication).
curl
curl -G "https://api.socialscrape.io/v1/tiktok/song" \
-H "x-api-key: $SOCIALSCRAPE_API_KEY" \
--data-urlencode "id=7016547803243022337"Python
import os
import requests
params = {
"id": "7016547803243022337",
}
res = requests.get(
"https://api.socialscrape.io/v1/tiktok/song",
headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
params=params,
)
body = res.json()
if body["ok"]:
print(body["data"])
else:
print(body["error"]["code"], body["error"]["message"])TypeScript
const url = new URL("https://api.socialscrape.io/v1/tiktok/song");
url.search = new URLSearchParams({
"id": "7016547803243022337"
}).toString();
const res = await fetch(url, {
headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();
if (body.ok) {
console.log(body.data);
} else {
console.error(body.error.code, body.error.message);
}n8n
{
"nodes": [
{
"name": "SocialScrape TikTok song details",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
0,
0
],
"parameters": {
"method": "GET",
"url": "https://api.socialscrape.io/v1/tiktok/song",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "id",
"value": "7016547803243022337"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
}
]
}
}
}
],
"connections": {}
}Example response#
This is a sample from a recorded response. Status 200.
{
"ok": true,
"credits_charged": 1,
"credits_remaining": 4999,
"cached": false,
"cached_at": null,
"request_id": "req_93185fa69b5182ad7cd7ac57",
"data": {
"object": "song",
"platform": "tiktok",
"id": "7016547803243022337",
"url": "https://www.tiktok.com/music/Face-Off-Dwayne-Johnson-7016547803243022337",
"title": "Face Off - Dwayne Johnson",
"artists": [
"Tech N9ne",
"Joey Cool",
"Lương Thị Ngọc Nhung"
],
"album": "Face Off - Dwayne Johnson",
"duration_seconds": 60.0,
"cover_url": "https://p19-common.tiktokcdn-us.com/tos-alisg-v-2774/o8ea8AmF1GG4KxwI1fLl7IALGeAvIAFjfsAAhK~tplv-tiktokx-cropcenter:720:720.jpeg?dr=9584&t=4d5b0474&ps=933b5bde&shp=08d74b56&shcp=81f88b70&idc=useast8",
"preview_url": "https://sf16.tiktokcdn-us.com/obj/tos-alisg-ve-2774/oULlPria4KO2Gj7dInUfNmfFAvxeYwfL1gqAQG",
"released_at": null,
"isrc": null,
"explicit": null,
"is_original": false,
"stats": {
"plays": null,
"uses": 727900,
"likes": null
},
"extra": {
"author_name": "Joey Cool & Lương Thị Ngọc Nhung & Tech N9ne",
"is_commerce_music": false,
"is_copyrighted": true,
"is_private": false,
"shoot_duration": 60
}
},
"cursor": null,
"has_more": null
}Response#
A Song object in data.
See Data models for every field. The envelope around data is described in Responses.
Errors#
Failures are free: credits_charged is 0. Branch on error.code, never on the message.
| Code | HTTP | Retry | Meaning |
|---|---|---|---|
invalid_params | 400 | no | A parameter is missing, unknown or has the wrong type. |
unsupported_url | 400 | no | The URL is not one this endpoint accepts (wrong platform or form). |
not_found | 404 | no | The platform says this profile, post or item does not exist. |
Every request can also fail with the account and platform errors listed on the Errors page.
Example error:
{
"ok": false,
"error": {
"code": "not_found",
"message": "The platform says this profile, post or item does not exist.",
"retryable": false
},
"credits_charged": 0,
"request_id": "req_d4b7a4ff46eedaf49a6202d7"
}Related endpoints#
- TikTok profile (
GET /v1/tiktok/profile) - TikTok profile videos (
GET /v1/tiktok/profile/videos) - TikTok collection videos (
GET /v1/tiktok/collection/videos) - TikTok video details (
GET /v1/tiktok/video) - TikTok video transcript (
GET /v1/tiktok/video/transcript) - TikTok video comments (
GET /v1/tiktok/video/comments) - TikTok comment replies (
GET /v1/tiktok/video/comment/replies) - TikTok user search (
GET /v1/tiktok/search/users)