Developer docs / Viral video replication
Stream a viral-video replication prompt
Stream a reusable replication prompt from a public video URL or an uploaded file. Concatenate result from streaming events in order; if a done event arrives, use its result as the complete prompt.
POST
/v1/material/analysisTask/stream- Authentication:
- Request header x-api-key: <YOUR_API_KEY>; keep the key on the server and never expose it in client code, logs or shared files.
- Success criteria:
- Decide success from the SSE events and concatenate the streaming chunks; use the complete result from the done event. On errors, check the HTTP status and message instead of JSON code=0.
Request body fields
| Field | Type | Required | Description |
|---|---|---|---|
type | REPLICATION | Yes | Always send REPLICATION; ANALYSIS is reserved and not covered here |
url | string(uri) | Conditional | Public video URL; send this or businessId. Supports TikTok, Douyin, Xiaohongshu, WeChat Channels, Instagram, YouTube, and Bilibili |
businessId | string | Conditional | Uploaded file or material ID; send this or url. Upload a local file first, then pass the fileId as a string |
businessType | FILE | MATERIAL | Conditional | Required with businessId; use FILE for uploaded files and MATERIAL for library assets |
A successful response uses Content-Type text/event-stream. Do not judge success by JSON code === 0.
Each SSE line is data:<json> with status, result, thinking, and a task id. The id stays constant for one request.
Concatenate result from status=streaming events in arrival order. If status=done arrives, use that result as the complete prompt.
Failures return a JSON error body instead of SSE. Read the HTTP status and message.
For a local MP4, call /v1/file/presign and /v1/file/confirm first, then send businessId with businessType=FILE.
The assembled prompt is usually Markdown with title, subjects, scene, timestamped script, and notes, and can feed AI video generation.
Request example · Replicate a public video URL
{
"type": "REPLICATION",
"url": "https://www.tiktok.com/@creator/video/7123456789012345678"
}Request example · Replicate an uploaded file
{
"type": "REPLICATION",
"businessId": "591",
"businessType": "FILE"
}Response example · Prompt delta
{
"status": "streaming",
"result": "**Video Script Title**\nA clean product reveal with a slow camera push-in.\n",
"thinking": null,
"id": 2066122904659169300
}Response example · Full prompt
{
"status": "done",
"result": "**Video Script Title**\nA clean product reveal with a slow camera push-in.\n\n**Characters / Main Subjects**\nA seller presenting a summer product against a bright studio backdrop.\n\n**Scene / Environment**\nBright studio lighting, close-up product shots, and a final call to action.\n\n**Script**\n00:00-00:02 Hook the viewer with the product in hand.\n00:02-00:08 Show the key selling points in short cuts.\n00:08-00:10 End with a clear purchase CTA.\n\n**Notes**\nKeep the pacing tight and preserve the original hook-to-CTA structure.",
"thinking": null,
"id": 2066122904659169300
}Response and errors
Main response fields come from the published contract; see the JSON Schema. Required refers to the constraint in the containing object.
| Field | Type | Required | Description |
|---|---|---|---|
status | string | Yes | streaming carries a prompt delta; when the server sends the terminal event, done carries the full prompt.; Allowed values: streaming, done |
result | string | Yes | Prompt delta in streaming events and the full prompt in the done event. |
thinking | string | null | No | — |
id | integer | No | Analysis task ID; it stays the same for every chunk of one request. |
HTTP 400The request parameters or body are invalid. Fix them and retry.HTTP 401The API key is missing or invalid. Check x-api-key.HTTP 403The API key has no permission to call this endpoint.HTTP 429Too many requests. Retry with exponential backoff.HTTP 500The server failed. Retry transient failures with exponential backoff.
Fix parameter, permission or authorization errors before retrying. If task creation times out, query existing tasks first and do not submit duplicates after an interrupted poll.
Last updated · 2026-11-16