Search videos
Introduction
POST /v1/generations with Authorization: Bearer <ANYCAP_API_KEY>. Use type=social, model for the platform and input.operation for the query. Parameters and examples follow.
| Platform | Query | model | input.operation |
|---|---|---|---|
| TikTok | Video search | tiktok | fetch_video_search_result |
TikTok · Video search
Replace the key and sample parameters with your own. Use a new Idempotency-Key for each new lookup and reuse it for the same submission. The catalog workbench uses your signed-in session and active workspace.
curl -sS -X POST 'https://api.anycap.io/v1/generations' \ -H 'Authorization: Bearer ANYCAP_API_KEY' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: YOUR_UNIQUE_LOOKUP_ID' \ -d '{"type":"social","model":"tiktok","input":{"operation":"fetch_video_search_result","keyword":"city walk","offset":0,"count":20,"sort_type":0,"publish_time":0,"region":"US"}}'| Input field | Type | Required / default | Description |
|---|---|---|---|
keyword | string | Required | Search keyword. |
offset | integer | 0 | Result offset. |
count | integer | 20 | Number of items per page. |
sort_type | integer | 0 | 0 relevance, 1 most likes. |
publish_time | integer | 0 | 0 means any time. 1, 7, 30, 90, and 180 specify lookback days. |
region | string | US | TikTok region code or ISO 3166-1 alpha-2 country code. |
Read the original video search results in call.data. Use offset to select another page.
On HTTP 200 with call.state=succeeded, read call.data. The business payload retains its original fields, nesting and JSON types. If the data value is a string, call.data is a string.
On HTTP 202, replace CALL_ID with call.id and use the same connection key to read the saved call. started means running, and unknown means awaiting reconciliation. Each page is a separate lookup.
curl -sS 'https://api.anycap.io/v1/generations/CALL_ID' \ -H 'Authorization: Bearer ANYCAP_API_KEY'If submission fails, read error.code and error.message. When execution was recorded, error.details includes call_id, state, error_code, and error_message. On a saved call, use call.state, call.error_code, and call.error_message. The example shows a rejected upstream query.
{ "error": { "code": "social_lookup_rejected", "message": "The data source rejected the query parameters. Check the account identifier or filters.", "details": { "call_id": "00000000-0000-4000-8000-000000000001", "state": "failed", "error_code": "social_lookup_rejected", "error_message": "The data source rejected the query parameters. Check the account identifier or filters.", "charged_microcredits": "0" } }}