TikTok videos using a song API
TikTok videos using a song: GET /v1/tiktok/song/videos. 1 credit per request.
GET /v1/tiktok/song/videos
GET /v1/tiktok/song/videos
TikTok videos using a song.
- Cost: 1 credit
- 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:
cursor: the cursor from the previous page (Pagination).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).
1curl -G "https://api.socialscrape.dev/v1/tiktok/song/videos" \2 -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3 --data-urlencode "id=7016547803243022337"1import os2import requests34params = {5 "id": "7016547803243022337",6}7res = requests.get(8 "https://api.socialscrape.dev/v1/tiktok/song/videos",9 headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},10 params=params,11)12body = res.json()1314if body["ok"]:15 print(body["data"])16else:17 print(body["error"]["code"], body["error"]["message"])1const url = new URL("https://api.socialscrape.dev/v1/tiktok/song/videos");2url.search = new URLSearchParams({3 "id": "7016547803243022337"4}).toString();5const res = await fetch(url, {6 headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },7});8const body = await res.json();910if (body.ok) {11 console.log(body.data);12} else {13 console.error(body.error.code, body.error.message);14}1{2 "nodes": [3 {4 "name": "SocialScrape TikTok videos using a song",5 "type": "n8n-nodes-base.httpRequest",6 "typeVersion": 4.2,7 "position": [8 0,9 010 ],11 "parameters": {12 "method": "GET",13 "url": "https://api.socialscrape.dev/v1/tiktok/song/videos",14 "sendQuery": true,15 "queryParameters": {16 "parameters": [17 {18 "name": "id",19 "value": "7016547803243022337"20 }21 ]22 },23 "sendHeaders": true,24 "headerParameters": {25 "parameters": [26 {27 "name": "x-api-key",28 "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"29 }30 ]31 }32 }33 }34 ],35 "connections": {}36}Example response#
This is a sample from a recorded response, lists and long text are shortened. Status 200.
1{2 "ok": true,3 "credits_charged": 1,4 "credits_remaining": 4999,5 "cached": false,6 "cached_at": null,7 "request_id": "req_2309c949e55be159981fbbe5",8 "data": {9 "object": "list",10 "items": [11 {12 "object": "post",13 "platform": "tiktok",14 "id": "7022393040451030278",15 "url": "https://www.tiktok.com/@therock/video/7022393040451030278",16 "type": "video",17 "author": {18 "id": "6745191554350760966",19 "handle": "therock",20 "name": "The Rock",21 "url": "https://www.tiktok.com/@therock",22 "avatar_url": "https://p16-common-sign.tiktokcdn-us.com/tos-maliva-avt-0068/7310325298631802885~tplv-tiktokx-cropcenter:100:100.jpeg?dr=9640&refresh_token=0256d6e1&x-expires=1793498400&x-signature=9kVTLBZEa3xEoUeiQZhoi%2FH8ZSo%3D&t=4d5b0474&ps=13740610&sh...",23 "verified": true24 },25 "title": null,26 "text": "#FACEOFFCHALLENGE IS ON🔥🔥🔥Show us what someone says, does or encourages that sends you into OVERdrive👊🏾💪🏾 #faceoff #strangemusicinc",27 "published_at": "2021-10-23T22:31:32Z",28 "duration_seconds": 66.0,29 "language": "en",30 "hashtags": [31 "faceoffchallenge",32 "faceoff",33 "strangemusicinc"34 ],35 "mentions": null,36 "stats": {37 "views": 107700000,38 "likes": 17100000,39 "comments": 214300,40 "shares": 275400,41 "saves": 584275,42 "dislikes": null43 },44 "media": {45 "thumbnail_url": "https://p19-common-sign.tiktokcdn-us.com/tos-maliva-p-0068/35765ea83a8c40b895db7b88dad96cad_1635028296~tplv-tiktokx-origin.image?dr=9636&x-expires=1793498400&x-signature=dwOpgJRKpeLnAFnaJGUSkeUKsgs%3D&t=4d5b0474&ps=13740610&shp=81f88b70&shc...",46 "video_url": "https://v16-webapp-prime.us.tiktok.com/video/tos/useast5/tos-useast5-ve-0068c003-tx/98c9878e94444351bfa7bc91d583e63a/?a=1988&bti=ODszNWYuMDE6&&bt=1459&ft=4KJMyMzm8Zmo0eSSla4jVWibdpWrKsd.&mime_type=video_mp4&rc=ODY0OGg1N2g5ZGU0OjgzOEBpamxtO2...",47 "audio_url": null,48 "image_urls": null,49 "width": 576,50 "height": 102451 },52 "song": {53 "id": "7016547803243022337",54 "title": "Face Off - Dwayne Johnson",55 "artist": "Tech N9ne & Joey Cool & King Iso & Dwayne Johnson",56 "url": "https://www.tiktok.com/music/Face-Off-Dwayne-Johnson-7016547803243022337"57 },58 "location": null,59 "is_pinned": null,60 "is_sponsored": false,61 "extra": {62 "ai_label_shown": false,63 "author_followers": 80200000,64 "category_type": 101,65 "comments_disabled": false,66 "duet_enabled": true,67 "is_private": false,68 "music_is_original": false,69 "reposts": 0,70 "stitch_enabled": true,71 "video_definition": "540p"72 }73 },74 {75 "object": "post",76 "platform": "tiktok",77 "id": "7039385772222319878",78 "url": "https://www.tiktok.com/@thebadp1ace/video/7039385772222319878",79 "type": "video",80 "author": {81 "id": "6911054760808875014",82 "handle": "thebadp1ace",83 "name": "ale",84 "url": "https://www.tiktok.com/@thebadp1ace",85 "avatar_url": "https://p16-common-sign.tiktokcdn-us.com/tos-useast5-avt-0068-tx/7310268423383023658~tplv-tiktokx-cropcenter:100:100.jpeg?dr=9640&refresh_token=0cd2a2c0&x-expires=1793498400&x-signature=L%2B3S4Almuz0ZeMCp2P0ZdNzRYG8%3D&t=4d5b0474&ps=1374061...",86 "verified": false87 },88 "title": null,89 "text": "it’s about drive #thebadp1ace",90 "published_at": "2021-12-08T17:32:01Z",91 "duration_seconds": 14.0,92 "language": "en",93 "hashtags": [94 "thebadp1ace"95 ],96 "mentions": null,97 "stats": {98 "views": 77200000,99 "likes": 16400000,100 "comments": 62300,101 "shares": 172100,102 "saves": 733226,103 "dislikes": null104 },105 "media": {106 "thumbnail_url": "https://p16-common-sign.tiktokcdn-us.com/tos-maliva-p-0068/501bfa17e705479b8ffc192bed4d6a31~tplv-tiktokx-origin.image?dr=9636&x-expires=1793498400&x-signature=MYgdbAgvYGdp36OJSNEuwXbZTug%3D&t=4d5b0474&ps=13740610&shp=81f88b70&shcp=43f4a2f9&...",107 "video_url": "https://v16-webapp-prime.us.tiktok.com/video/tos/useast5/tos-useast5-pve-0068-tx/bfb9ccd779444fc0ad5193bbc5dcf832/?a=1988&bti=ODszNWYuMDE6&&bt=2330&ft=4KJMyMzm8Zmo0eSSla4jVWibdpWrKsd.&mime_type=video_mp4&rc=NDc4OTllNTY3Mzw5aTs0aEBpM2Vva2U6Z...",108 "audio_url": null,109 "image_urls": null,110 "width": 576,111 "height": 1024112 },113 "song": {114 "id": "7016547803243022337",115 "title": "Face Off - Dwayne Johnson",116 "artist": "Tech N9ne & Joey Cool & King Iso & Dwayne Johnson",117 "url": "https://www.tiktok.com/music/Face-Off-Dwayne-Johnson-7016547803243022337"118 },119 "location": null,120 "is_pinned": null,121 "is_sponsored": false,122 "extra": {123 "ai_label_shown": false,124 "author_followers": 320500,125 "category_type": 101,126 "comments_disabled": false,127 "is_private": false,128 "music_is_original": false,129 "reposts": 0,130 "video_definition": "540p"131 }132 }133 ],134 "cursor": null,135 "has_more": false,136 "parent": null137 },138 "cursor": null,139 "has_more": false140}Response#
A list of Post objects in data.items, with data.cursor and data.has_more.
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.
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)