TikTok Keyword Search
Start an asynchronous TikTok keyword search task and return a task_id immediately. Poll GET /tiktok/search/{task_id} for cursor-paginated results. Results are retained for ~1 hour.
Results are returned sorted by published_at descending (newest first) across pagination, full retrieval, and the signed download_url payload, unless sort_by is set, in which case that order is kept.
The search returns TikTok's results for country (default gb); us is rejected because TikTok asks US visitors to log in.
parallel_search_slices: by default (1), the search runs a single paginated query chain and is naturally capped at roughly 115-140 items by TikTok. Setting parallel_search_slices to 2..4 runs that many concurrent chains in parallel and dedups by video id, lifting the effective ceiling. Extra slices add the most on searches without a date window; with published_within set, every slice searches the same window and can return largely the same videos. parallel_search_slices is not a time filter — use published_within, after_datetime or before_datetime for time windows.
Usage disclosure: this endpoint does not accept include_usage; pass include_usage=true on GET /tiktok/search/{task_id} once task_status=completed.
Start an asynchronous TikTok keyword search and get a task_id back immediately.
Overview
This endpoint runs an actual keyword search across TikTok (not a single profile) and returns multiple matching videos. It is asynchronous: the search runs in a background worker, and you poll GET /tiktok/search/{task_id} for cursor-paginated results. Results are retained for ~1 hour.
Results are returned sorted by published_at descending (newest first) across pagination, full retrieval, and the signed download_url payload — unless you set sort_by, in which case that order is kept.
Results are localized to country (default gb): pass fr, de, jp, ... to get the TikTok results of that country. us is not supported, because TikTok asks US visitors to log in before searching.
This is different from the TikTok Profile scrape, which walks a single account's videos, and from TikTok LIVE Search, which finds LIVE rooms broadcasting now. Use this endpoint to discover videos across TikTok by keyword.
Billing
Charges happen in the background worker and are disclosed on the polling endpoint (see below), not here.
- 1
residential_requestper 30 results returned (stats.results_count), minimum 1 per search and 1 per 5 TikTok pages read (stats.pages_fetched): 3 results cost the same as 30, and 31 to 60 cost 2. The page floor applies to searches that read many pages to return few results (strict like, view or date filters). Videos your filters drop are not billed. - No
search_requestis billed for TikTok keyword search. parallel_search_slicesraises coverage and cost together. By default (1) the search runs a single paginated query chain, naturally capped at roughly 115–140 items by TikTok. Setting it to2..4runs that many concurrent chains and dedups by video id, lifting the ceiling; you pay for the extra videos it returns. Extra slices help most on searches without a date window: withpublished_withinset, every slice searches the same window and can return largely the same videos.
Usage disclosure: this endpoint does not accept include_usage. Because billing happens after the 202 response is sent, there is nothing to disclose at submit time. Pass include_usage=true on GET /tiktok/search/{task_id} instead — it replays the final charges once task_status=completed.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Keyword phrase to search on TikTok (min length 2). |
max_results | integer | No | Upper bound on results the task will try to collect. 0 (default) or omitted means unlimited — pagination stops only when TikTok has no more results or the page cap is reached (~115–140 items per slice: ~5 pages of ~30 items). No hard server-side cap is enforced; you are billed per 30 results returned, and at least 1 per 5 pages read. |
parallel_search_slices | integer | No | How many concurrent paginated query chains to run and dedup (1–4, default 1). Higher values lift the result ceiling at up to ~N× the cost of a single search. With published_within set, keep 1 unless you have measured a gain. Not a time filter — use published_within, after_datetime or before_datetime for time windows. |
sort_by | string | No | Sort order applied by TikTok itself (same as the app's search Filters): relevance, most_liked or newest. See Sorting and date windows. |
published_within | string | No | Publication window applied by TikTok itself: all, past_24_hours, this_week, this_month, last_3_months or last_6_months. Windows are rolling (this_week = the last 7 days). |
after_datetime | string | No | Only include videos published on or after this boundary. Accepts YYYY-MM-DD or an ISO datetime with timezone. Unless sort_by or published_within is set, it also makes the search run newest first and stop once it passes this boundary. |
before_datetime | string | No | Only include videos published on or before this boundary. Accepts YYYY-MM-DD or an ISO datetime with timezone. |
country | string | No | Two-letter country code (ISO 3166-1 alpha-2, lowercase) whose TikTok results you get. Default gb. us is not supported. The request schema above lists the accepted codes. The first search for a country other than gb can take 10–20 s longer. |
min_likes | integer | No | Only include videos with at least this many likes. |
max_likes | integer | No | Only include videos with at most this many likes. |
min_views | integer | No | Only include videos with at least this many views. |
max_views | integer | No | Only include videos with at most this many views. |
webhook_url | string | No | Where to POST a notification when the task finishes. Overrides the account default set in Studio → API; pass "" to opt this task out of the default. Must be a public https URL. The event carries stats and points you to check_status_url for the results. See Webhooks. |
Diminishing returns on slices: on a representative query without a date window, 2 slices yield ~+43% unique items, 3 slices ~+22%, and 4 slices ~+13% — so 4 already saturates TikTok's natural ~480-item dedup ceiling for most queries.
Sorting and date windows
sort_by and published_within are applied by TikTok itself, before VidNavigator's own filters (after_datetime, min_likes, …). Using them well returns more matching videos per billed page.
sort_by | Order |
|---|---|
relevance | TikTok's own ranking |
most_liked | By like count |
newest | By publish date, newest first |
When sort_by is omitted, results are returned newest first, and the search is ordered to fit your filters:
after_datetimeorbefore_datetimeset → the search runs newest first and stops once it passesafter_datetime- only
min_likesormin_viewsset → the search runs most liked first
When published_within is omitted and after_datetime is more than 24 hours ago, the smallest window that covers after_datetime is selected automatically. The window actually used is reported in stats.published_within on the result endpoint.
{
"query": "ai tools",
"sort_by": "most_liked",
"published_within": "this_week",
"min_views": 10000
}Example Usage
curl -X POST "https://api.vidnavigator.com/v1/tiktok/search" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "ai tools",
"parallel_search_slices": 2,
"after_datetime": "2024-01-01T00:00:00Z",
"min_likes": 1000
}'Success Response (202 Accepted)
{
"status": "success",
"data": {
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"task_status": "processing",
"query": "ai tools",
"country": "gb",
"max_results": 0,
"parallel_search_slices": 2,
"filters": {
"sort_by": null,
"published_within": null,
"after_datetime": "2024-01-01T00:00:00.000Z",
"before_datetime": null,
"min_likes": 1000,
"max_likes": null,
"min_views": null,
"max_views": null
},
"expires_at": "2026-04-26T13:00:00.000Z",
"check_status_url": "/v1/tiktok/search/550e8400-e29b-41d4-a716-446655440000",
"webhook_url": null,
"message": "Search started. Poll check_status_url for results."
}
}Get the result
GET /tiktok/search/{task_id} — poll this endpoint with the task_id (or the check_status_url) returned above, or wait for the webhook notification. Polling does not consume credits.
The playground above only covers the submit request. Call the result endpoint with cURL or your HTTP client.
Request Parameters
| Parameter | In | Required | Description |
|---|---|---|---|
task_id | path | Yes | Task ID returned by POST /tiktok/search |
cursor | query | No | Opaque pagination cursor from a previous response |
limit | query | No | Maximum number of items to return, between 1 and 500. Default is 50. |
include_usage | query | No | When true and task_status=completed, attach a usage block describing the charges the background worker recorded (1 residential_request per 30 results_count, minimum 1 and 1 per 5 pages_fetched; no search_request for TikTok keyword search). |
Usage Disclosure
Because billing happens in the background worker, the submit endpoint cannot disclose usage. Instead, pass include_usage=true here:
- Returned only when
task_status=completed(processing tasks haven't finished billing; failed tasks have all charges refunded). - Charges are 1
residential_requestper 30stats.results_count, minimum 1 and 1 per 5stats.pages_fetched. Nosearch_requestis billed for TikTok keyword search.
Polling Lifecycle
The task_status field will be one of:
processing: the search is still runningcompleted: the search finished and results are readyfailed: the search ended with an error (all charges refunded)
While processing, results will be empty and download_url will usually be null.
Example Requests
curl "https://api.vidnavigator.com/v1/tiktok/search/tt_search_abc123?limit=25&include_usage=true" \
-H "X-API-Key: YOUR_API_KEY"Example Completed Response
{
"status": "success",
"data": {
"task_id": "tt_search_abc123",
"task_status": "completed",
"query": "ai tools",
"country": "gb",
"parallel_search_slices": 2,
"filters": {
"sort_by": null,
"published_within": null,
"after_datetime": "2024-01-01T00:00:00.000Z",
"before_datetime": null,
"min_likes": 1000,
"max_likes": null,
"min_views": null,
"max_views": null
},
"stats": {
"pages_fetched": 18,
"videos_fetched": 520,
"results_count": 172,
"next_search_cursor": null,
"parallel_search_slices": 2,
"sort_by": "newest",
"published_within": "all",
"country": "gb",
"items_examined": 520,
"items_filtered_out": 301,
"items_deduplicated": 47
},
"results": [
{
"id": "7351234567890123456",
"item_type": 1,
"description": "Top AI tools you should try",
"timestamp": 1712345678,
"published_at": "2024-04-05T19:34:38Z",
"author": {
"id": "6789",
"unique_id": "creator",
"nickname": "Creator Name",
"sec_uid": "MS4wLjAB..."
},
"stats": {
"views": 250000,
"likes": 22000,
"comments": 950,
"shares": 120,
"collects": 340
},
"music": {
"id": "1122",
"title": "Original sound",
"author_name": "creator",
"duration": 30
},
"duration": 28,
"hashtags": ["ai", "tools", "productivity"],
"url": "https://www.tiktok.com/@creator/video/7351234567890123456"
}
],
"pagination": {
"limit": 25,
"offset": 0,
"total_items": 172,
"has_next": true,
"has_prev": false,
"next_cursor": "eyJvZmZzZXQiOjI1fQ==",
"prev_cursor": null
},
"download_url": "https://storage.example.com/api/tiktok_searches/user/task.json?X-Amz-Signature=...",
"error_message": null,
"error": null,
"webhook": null,
"created_at": "2026-04-26T12:00:00.000Z",
"completed_at": "2026-04-26T12:01:40.235Z",
"expires_at": "2026-04-26T13:00:00.000Z"
},
"usage": {
"charges": [
{ "service_type": "residential_request", "quantity": 18, "credits": 0.09 }
],
"total_credits": 0.09
}
}The usage block appears only when include_usage=true and task_status=completed.
Understanding the Response
stats
videos_fetched: distinct videos TikTok returned, including those your filters dropped. Reported for information: billing followsresults_count(1residential_requestper 30) andpages_fetched(at least 1 per 5).pages_fetched: number of TikTok pages fetchedresults_count: total normalized items collectedparallel_search_slices: slice count the search ran withcountry: same ascountryitems_examined/items_filtered_out: only when filters were set — videos checked against them, and videos they droppeditems_deduplicated: only withparallel_search_slices> 1 — videos several slices returned, counted oncenext_search_cursor: internal upstream cursor, ornullwhen exhaustedsort_by: sort order the search ran with (relevancewhensort_bywas omitted)published_within: date window the search ran with — shows the window chosen fromafter_datetimewhenpublished_withinwas omitted;allmeans no window
results
Each item is a normalized TikTok video with id, description, timestamp, published_at (UTC ISO 8601), author, stats (views/likes/comments/shares/collects), music, duration, hashtags, and url. Items are sorted by published_at descending (items without a timestamp go last), unless sort_by was set, in which case TikTok's order is kept.
download_url
When present, a short-lived signed URL pointing to the full search result as one JSON file (same shape as the paginated results, but unsliced). null when the task hasn't finished or the full result wasn't archived — paginate through results instead.
error
Present when task_status is failed: an object with error (a code you can branch on), message and http_status. See Errors.
error_message is deprecated. It is kept for existing integrations, but new code should read error.error / error.message instead.
webhook
Delivery state of the task's webhook notification (status, attempts, response_status, last_error_code, last_error, delivered_at), or null when no webhook applies.
Error Cases
400: invalid request (invalid_parameter, e.g. an unsupportedcountry;invalid_cursorfor a bad cursor)404: task does not exist, expired, or does not belong to the current user
Tips
- poll every few seconds while
task_statusisprocessing - switch to
download_urlfor large completed jobs - tasks expire after about 1 hour — use
expires_atto avoid polling expired tasks - call the endpoint again later if you need a freshly minted
download_url
API reference
ApiKeyAuthX-API-Key<token>API key authentication. Include your VidNavigator API key in the X-API-Key header.
application/json- body
query*stringKeyword phrase to search on TikTok.
2 <= lengthcountry?stringCountry whose TikTok results you get (ISO 3166-1 alpha-2, lowercase or uppercase). Default gb. us is not supported: TikTok asks US visitors to log in before searching. The first search for a country other than gb can take 10-20 s longer.
"gb""ae""af""al""am""ao""ar""at""au""az""ba""bd""be""bf""bg""bh""bj""bo""br""bw""by""ca""cd""ch""ci""cl""cm""co""cr""cy""cz""de""dk""do""dz""ec""ee""eg""es""et""fi""fj""fr""gb""ge""gh""gr""gt""hn""hr""ht""hu""id""ie""il""iq""is""it""jm""jp""ke""kg""kh""kr""kw""kz""la""lb""lk""lt""lu""lv""ly""ma""md""me""mg""mk""ml""mm""mn""mt""mu""mw""mx""my""mz""na""ne""ng""ni""nl""no""np""nz""om""pa""pe""pg""ph""pk""pl""pt""py""qa""ro""rs""rw""sa""sd""se""sg""si""sk""sn""so""sv""tg""th""tj""tn""tr""tt""tw""tz""ua""ug""uy""ve""vn""ye""za""zm""zw"max_results?integerOptional upper bound on results the background task will try to collect. 0 (the default) or omitted means unlimited — pagination only stops when TikTok has no more results or the page cap is reached. With parallel_search_slices=1 that naturally yields ~115-140 items (TikTok serves ~5 pages of ~30 items per chain); with parallel_search_slices=4 up to ~480 unique items. A positive integer caps the merged result count. No hard server-side cap is enforced — a caller asking for 3000 receives whatever TikTok delivers.
0 <= value0parallel_search_slices?integerHow many concurrent paginated query chains to run and dedup by video id. 1 (the default) is a single chain naturally capped at roughly 115-140 items. 2..4 runs that many additional chains in parallel, lifting the effective ceiling. Diminishing returns: 2 slices yield ~+43% unique items, 3 slices ~+22%, 4 slices ~+13% on a representative query without a date window, so 4 already saturates TikTok's natural ~480-item dedup ceiling for most queries. With published_within set, every slice searches the same window and extra slices can return largely the same videos, so keep 1 unless you have measured a gain. parallel_search_slices is not a time filter — use published_within, after_datetime or before_datetime for time windows.
1 <= value <= 41sort_by?stringSort order applied by TikTok itself (the same control as the app's search Filters sheet). relevance returns results in TikTok's ranking, most_liked by like count, newest by publish date, newest first. When omitted, results are returned newest first, and the search itself is ordered to fit your filters: newest first when after_datetime or before_datetime is set (stopping once it passes after_datetime), most liked first when only min_likes or min_views is set. That returns more matching videos per page.
"relevance""most_liked""newest"published_within?stringPublication window applied by TikTok itself. Windows are rolling (this_week = the last 7 days). When omitted and after_datetime is more than 24 hours ago, the smallest window that covers after_datetime is selected automatically.
"all""past_24_hours""this_week""this_month""last_3_months""last_6_months"after_datetime?stringOnly include videos published on or after this boundary. Accepts YYYY-MM-DD or ISO datetime with timezone. Unless sort_by or published_within is set, it also makes the search run newest first and stop once it passes this boundary, so more results in range come back per page.
before_datetime?stringOnly include videos published on or before this boundary. Accepts YYYY-MM-DD or ISO datetime with timezone.
min_likes?integer0 <= valuemax_likes?integer0 <= valuemin_views?integer0 <= valuemax_views?integer0 <= valuewebhook_url?stringWhere to POST the result when the task finishes. Overrides the account-level default configured in Studio → API; pass an empty string to opt this task out of that default. Must be a publicly reachable https URL. The event is a notification, not the payload: a search can hold hundreds of videos, so it carries stats and tells you to read the result from check_status_url. See https://docs.vidnavigator.com/webhooks
uriTask accepted and queued.
application/json- response
status?"success""success"data?curl -X POST 'https://api.vidnavigator.com/v1/tiktok/search' \ -H 'Content-Type: application/json' \ -d '{ "query": "ai tools"}'{ "status": "success", "data": { "task_id": "string", "task_status": "processing", "query": "string", "country": "gb", "max_results": 0, "parallel_search_slices": 1, "filters": {}, "expires_at": "2019-08-24T14:15:22Z", "check_status_url": "/v1/tiktok/search/550e8400-e29b-41d4-a716-446655440000", "message": "string", "webhook_url": "string" }}