Use this API endpoint to extract structured data from videos hosted on YouTube, TikTok, Instagram, X (Twitter), Facebook or a public file URL. Supadata uses AI to analyze the video and return data matching your prompt or schema.
import { Supadata } from '@supadata/js';const supadata = new Supadata({ apiKey: 'YOUR_API_KEY',});// Start extract jobconst job = await supadata.extract({ url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', prompt: 'How many times does a dog appear in this video? Describe each appearance.',});console.log(job.jobId);
The schema parameter accepts a JSON Schema object that defines the expected structure of the extracted data. This is useful for building pipelines that need consistent, predictable output formats.
Prompt only: When only prompt is provided, the AI automatically generates a JSON Schema based on the prompt. The generated schema is returned in the schema field of the response, so you can reuse it for future requests to get consistent outputs.
Schema only: When only schema is provided, the AI extracts data structured exactly according to the schema.
Both prompt and schema: The schema defines the output structure, while the prompt guides what content to extract. This gives you maximum control over the extraction.
{ "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", "schema": { "type": "object", "properties": { "totalAppearances": { "type": "number", "description": "Total number of times a dog appears" }, "appearances": { "type": "array", "items": { "type": "object", "properties": { "timestamp": { "type": "string", "description": "Timestamp of the appearance" }, "description": { "type": "string", "description": "What the dog is doing" } }, "required": ["timestamp", "description"] }, "description": "Each individual dog appearance" } }, "required": ["totalAppearances", "appearances"] }}
Start with just a prompt to let the AI generate a schema, then reuse the returned schema in subsequent requests for consistent outputs across multiple videos.
Poll the job status endpoint until the status is either “completed” or
“failed”. The data field will contain the extracted data when status is
“completed”, or the error field will contain error details when status is
“failed”.
Polling interval: We recommend polling every 1 second
Job expiry: Job results are available for 1 hour after completion. After that, the endpoint will return a 404 Not Found error. Make sure to retrieve and store results promptly after the job completes.
Age-restricted videos - Content with age verification requirements
Heavily geoblocked videos - Videos available only in specific countries
To verify if a video is accessible, try opening it in a browser incognito/private window without signing in. If you can watch the video, it can be processed.
If the video is not accessible, the API will return:
404 Not Found - Video does not exist or is private
403 Forbidden - Video requires authentication or is restricted
Extraction always involves AI processing and returns a job ID (HTTP 202) for asynchronous handling. Processing time is correlated with video duration - the longer the video, the longer the extraction takes.
Consider this latency when implementing time-outs and UX in your project. Always implement the asynchronous polling pattern to retrieve results.