Docs menu

TikTok videos using a song

Beta GET /v1/tiktok/song/videos

GET /v1/tiktok/song/videos

TikTok videos using a song.

  • 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_days to reuse them for free.
  • Timeout: A request still running after about 25 seconds answers 202 with a job to poll (Batch and jobs).

Parameters#

NameTypeRequiredDescription
idstringone ofSound (music) id. Also accepted as clipId, music_id.
urlURLone ofSound 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: true for a smaller response without null fields and extra.
  • raw: true to also get the platform's original object as raw.
  • 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/videos" \
  -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/videos",
    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/videos");
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 videos using a song",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "method": "GET",
        "url": "https://api.socialscrape.io/v1/tiktok/song/videos",
        "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, lists and long text are shortened. Status 200.

{
  "ok": true,
  "credits_charged": 1,
  "credits_remaining": 4999,
  "cached": false,
  "cached_at": null,
  "request_id": "req_2309c949e55be159981fbbe5",
  "data": {
    "object": "list",
    "items": [
      {
        "object": "post",
        "platform": "tiktok",
        "id": "7022393040451030278",
        "url": "https://www.tiktok.com/@therock/video/7022393040451030278",
        "type": "video",
        "author": {
          "id": "6745191554350760966",
          "handle": "therock",
          "name": "The Rock",
          "url": "https://www.tiktok.com/@therock",
          "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...",
          "verified": true
        },
        "title": null,
        "text": "#FACEOFFCHALLENGE IS ON🔥🔥🔥Show us what someone says, does or encourages that sends you into OVERdrive👊🏾💪🏾 #faceoff #strangemusicinc",
        "published_at": "2021-10-23T22:31:32Z",
        "duration_seconds": 66.0,
        "language": "en",
        "hashtags": [
          "faceoffchallenge",
          "faceoff",
          "strangemusicinc"
        ],
        "mentions": null,
        "stats": {
          "views": 107700000,
          "likes": 17100000,
          "comments": 214300,
          "shares": 275400,
          "saves": 584275,
          "dislikes": null
        },
        "media": {
          "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...",
          "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...",
          "audio_url": null,
          "image_urls": null,
          "width": 576,
          "height": 1024
        },
        "song": {
          "id": "7016547803243022337",
          "title": "Face Off - Dwayne Johnson",
          "artist": "Tech N9ne & Joey Cool & King Iso & Dwayne Johnson",
          "url": "https://www.tiktok.com/music/Face-Off-Dwayne-Johnson-7016547803243022337"
        },
        "location": null,
        "is_pinned": null,
        "is_sponsored": false,
        "extra": {
          "ai_label_shown": false,
          "author_followers": 80200000,
          "category_type": 101,
          "comments_disabled": false,
          "duet_enabled": true,
          "is_private": false,
          "music_is_original": false,
          "reposts": 0,
          "stitch_enabled": true,
          "video_definition": "540p"
        }
      },
      {
        "object": "post",
        "platform": "tiktok",
        "id": "7039385772222319878",
        "url": "https://www.tiktok.com/@thebadp1ace/video/7039385772222319878",
        "type": "video",
        "author": {
          "id": "6911054760808875014",
          "handle": "thebadp1ace",
          "name": "ale",
          "url": "https://www.tiktok.com/@thebadp1ace",
          "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...",
          "verified": false
        },
        "title": null,
        "text": "it’s about drive #thebadp1ace",
        "published_at": "2021-12-08T17:32:01Z",
        "duration_seconds": 14.0,
        "language": "en",
        "hashtags": [
          "thebadp1ace"
        ],
        "mentions": null,
        "stats": {
          "views": 77200000,
          "likes": 16400000,
          "comments": 62300,
          "shares": 172100,
          "saves": 733226,
          "dislikes": null
        },
        "media": {
          "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&...",
          "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...",
          "audio_url": null,
          "image_urls": null,
          "width": 576,
          "height": 1024
        },
        "song": {
          "id": "7016547803243022337",
          "title": "Face Off - Dwayne Johnson",
          "artist": "Tech N9ne & Joey Cool & King Iso & Dwayne Johnson",
          "url": "https://www.tiktok.com/music/Face-Off-Dwayne-Johnson-7016547803243022337"
        },
        "location": null,
        "is_pinned": null,
        "is_sponsored": false,
        "extra": {
          "ai_label_shown": false,
          "author_followers": 320500,
          "category_type": 101,
          "comments_disabled": false,
          "is_private": false,
          "music_is_original": false,
          "reposts": 0,
          "video_definition": "540p"
        }
      }
    ],
    "cursor": null,
    "has_more": false,
    "parent": null
  },
  "cursor": null,
  "has_more": false
}

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.

CodeHTTPRetryMeaning
invalid_params400noA parameter is missing, unknown or has the wrong type.
unsupported_url400noThe URL is not one this endpoint accepts (wrong platform or form).
not_found404noThe 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.