TikTok videos by hashtag API
Videos under a hashtag, with the hashtag (its video and view counts) as parent.
- Cost
- 1 credit
- Cached repeats
- 0 creditssend max_age_days, results kept 30 days
- Failed requests
- 0 credits
- Status
- Betashape may still gain fields
TikTok may return duplicates.
You send hashtag.
Request
Send your key in the x-api-key header.
curl -G "https://api.socialscrape.io/v1/tiktok/search/hashtag" \
-H "x-api-key: $SOCIALSCRAPE_API_KEY" \
--data-urlencode 'hashtag=booktok'import os
import requests
params = {
"hashtag": "booktok",
}
res = requests.get(
"https://api.socialscrape.io/v1/tiktok/search/hashtag",
headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
params=params,
timeout=60,
)
body = res.json()
if body["ok"]:
print(body["data"])
else:
print(body["error"]["code"], body["error"]["message"])const url = new URL("https://api.socialscrape.io/v1/tiktok/search/hashtag");
url.search = new URLSearchParams({
hashtag: "booktok",
}).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);
}{
"nodes": [
{
"name": "SocialScrape TikTok videos by hashtag",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
0,
0
],
"parameters": {
"method": "GET",
"url": "https://api.socialscrape.io/v1/tiktok/search/hashtag",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "hashtag",
"value": "booktok"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
}
]
}
}
}
],
"connections": {}
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
hashtag | string | yes | Hashtag, with or without #. |
cursor | string | Opaque cursor from the previous page; pass it back unchanged. Also accepted as continuationToken, continuation_token, next_max_id, max_id, max_cursor, min_time, after, page_token, pageToken, paginationToken, next_page_id, page. | |
region | string | Two-letter country code (ISO 3166-1) for results that vary by country. Also accepted as country, geo. |
Every request also accepts trim, raw and max_age_days.
Response
Sample from a recorded response, shortened. Values are public data, not yours.
{
"ok": true,
"credits_charged": 1,
"credits_remaining": 4999,
"cached": false,
"cached_at": null,
"request_id": "req_49afe33dffbc45a5543ead4e",
"data": {
"object": "list",
"items": [
{
"object": "post",
"platform": "tiktok",
"id": "7223827494913215786",
"url": "https://www.tiktok.com/@jenna_bushhager/video/7223827494913215786",
"type": "video",
"author": {
"id": "6915876645917082629",
"handle": "jenna_bushhager",
"name": "Jenna Bush Hager",
"url": "https://www.tiktok.com/@jenna_bushhager",
"avatar_url": "https://p16-common-sign.tiktokcdn-us.com/tos-useast8-avt-0068-tx2/0707efff51851e19e5e88f36bd87a298~tplv-tiktokx-cropcenter:100:100.jpeg?dr=9640&refresh_token...",
"verified": true
},
"title": null,
"text": "#WorldBookDay is 4/23, and I've joined the #BookTok community to share our favorite books with you all! Duet to share your favorite read! #PassTheBook",
"published_at": "2023-04-19T18:20:30Z",
"duration_seconds": 82,
"language": "en",
"hashtags": [
"worldbookday",
"booktok",
"passthebook"
],
"mentions": null,
"stats": {
"views": 39200,
"likes": 997,
"comments": 34,
"shares": 36,
"saves": 134,
"dislikes": null
},
"media": {
"thumbnail_url": "https://p16-common-sign.tiktokcdn-us.com/tos-useast5-p-0068-tx/ce0ee016ff8a483e8271ed4b4faebb3a~tplv-tiktokx-origin.image?dr=9636&x-expires=1793498400&x-sign...",
"video_url": "https://v16-webapp-prime.us.tiktok.com/video/tos/useast5/tos-useast5-pve-0068-tx/oYkCgfIAkEiPzzfwArwjfy27IJH4AwHIAhgRyG/?a=1988&bti=ODszNWYuMDE6&&bt=1083&ft=...",
"audio_url": null,
"image_urls": null,
"width": 708,
"height": 1262
},
"song": {
"id": "7223827501163006766",
"title": "original sound",
"artist": "Jenna Bush Hager",
"url": "https://www.tiktok.com/music/original-sound-7223827501163006766"
},
"location": null,
"is_pinned": null,
"is_sponsored": false,
"extra": {
"ai_label_shown": true,
"author_followers": 223900,
"caption_languages": [
"eng-US"
],
"category_type": 120,
"comments_disabled": false,
"duet_enabled": true
}
},
{
"object": "post",
"platform": "tiktok",
"id": "7211513837298781483",
"url": "https://www.tiktok.com/@oprahsbookclub/video/7211513837298781483",
"type": "video",
"author": {
"id": "7194562071920690219",
"handle": "oprahsbookclub",
"name": "Oprah’s Book Club",
"url": "https://www.tiktok.com/@oprahsbookclub",
"avatar_url": "https://p19-common-sign.tiktokcdn-us.com/tos-useast8-avt-0068-tx2/944d9f8fe6d976884002d17e0a651363~tplv-tiktokx-cropcenter:100:100.jpeg?dr=9640&refresh_token...",
"verified": true
},
"title": null,
"text": "Drew Barrymore and Maria Shriver are now a part of Oprah’s Book Club! #booktok #hellobeautiful #fyp",
"published_at": "2023-03-17T13:57:03Z",
"duration_seconds": 22,
"language": "en",
"hashtags": [
"booktok",
"hellobeautiful",
"fyp"
],
"mentions": null,
"stats": {
"views": 556400,
"likes": 32400,
"comments": 490,
"shares": 542,
"saves": 1532,
"dislikes": null
},
"media": {
"thumbnail_url": "https://p19-common-sign.tiktokcdn-us.com/tos-useast5-p-0068-tx/5e637949d05948ca9dfce4bdf11cca0a_1679061424~tplv-tiktokx-dmt-logom:tos-useast5-i-0068-tx/4730a...",
"video_url": "https://v16-webapp-prime.us.tiktok.com/video/tos/useast5/tos-useast5-ve-0068c001-tx/40ee8547970e4e68bca692a6504b5681/?a=1988&bti=ODszNWYuMDE6&&bt=2057&ft=4KJ...",
"audio_url": null,
"image_urls": null,
"width": 720,
"height": 1280
},
"song": {
"id": "7211513809272507182",
"title": "original sound",
"artist": "Oprah’s Book Club",
"url": "https://www.tiktok.com/music/original-sound-7211513809272507182"
},
"location": null,
"is_pinned": null,
"is_sponsored": false,
"extra": {
"ai_label_shown": true,
"author_followers": 156900,
"caption_languages": [
"eng-US"
],
"category_type": 101,
"comments_disabled": false,
"duet_enabled": true
}
}
],
"cursor": null,
"has_more": false,
"parent": {
"object": "collection",
"platform": "tiktok",
"id": "1622962893630470",
"url": "https://www.tiktok.com/tag/BookTok",
"kind": "topic",
"title": "#BookTok",
"description": "Calling all book creators! Share your favorite reads, recommendations, reviews, reactions, reading journeys, book hauls, literary insights, or creative takes...",
"owner": null,
"item_count": 88646803,
"cover_url": null,
"updated_at": null,
"extra": {
"is_commerce": false,
"view_count": 562657233676
}
}
},
"cursor": null,
"has_more": false
}Fields
A page of results. Each entry in items is a Post. cursor and has_more page through the rest.
A field the platform does not give is null, never made up. Extra platform details are in extra.
| Field | Type | Always | Notes |
|---|---|---|---|
object | "post" | ||
platform | Platform | yes | |
id | string | yes | |
url | string or null | ||
type | "video" or "short" or "reel" or "image" or "carousel" or "story" or "live" or "clip" or "text" or "link" or "tweet" or "pin" or "community_post" or "episode" or "unknown" | ||
author | Author or null | ||
title | string or null | ||
text | string or null | ||
published_at | string (ISO 8601 date-time) or null | ||
duration_seconds | number or null | ||
language | string or null | ||
hashtags | string[] or null | ||
mentions | string[] or null | ||
stats | Stats |
Show the other 6 fields
Full field list in the reference for this endpoint and the data models. Errors are listed under Errors.
Questions
Which errors can it return?
invalid_params (do not retry), not_found (do not retry). Account and platform errors from the errors list can also happen. A failure always costs 0 credits.
How do I get more than one page?
Send the same request with cursor set to the cursor you received, until has_more is false. Each page costs its own price. See pagination.
Is there an SDK call for it?
The preview Python client has client.tiktok.search_hashtag(...) and the TypeScript client client.tiktok.searchHashtag(). Both return the same envelope as the HTTP API. The packages are not published yet; plain HTTP works today in any language.
Can an AI agent call it?
Yes. The MCP server reaches every built endpoint, with the same prices.