Skip to main content
The official JavaScript and TypeScript SDK for the VidNavigator API. Responses are parsed into typed model classes, and long-running work such as speech-to-text, extraction, tweet analysis and TikTok scraping runs as background jobs, so media of any length works with a single await. npm version License

npm package

vidnavigator 2.1.0 on the npm registry.

GitHub repository

Source code, issues and changelog.
This page documents version 2.1.0. Coming from 1.x? See Upgrading from 1.x.

Installation

Requirements: Node.js 16+ (18+ for the examples that use the global fetch). The only runtime dependencies are axios and form-data. Full TypeScript types ship with the package.
The SDK is for server-side use. It reads local files for uploads and schema files, and your API key must never be shipped to a browser.

Initialization

Get your API key in the Developer Dashboard.

Configuration

axiosConfig.timeout limits each HTTP request. How long the SDK waits for a background job is set per call with timeoutMs (see Background jobs).

Supported platforms

Transcript = fast extraction of the platform’s own captions. Transcribe = speech-to-text by AI models, for when captions are unavailable.

Transcripts

Captions from any platform

getTranscript auto-detects the platform from the URL. Instagram has no captions, so use transcribe for it.
Common options: video_url, language, metadata_only, fallback_to_metadata, transcript_text (full transcript as one string), include_usage.
getYouTubeTranscript() still works but is deprecated: it forwards to getTranscript() and logs a warning.

Speech-to-text

vn.transcribe() runs speech-to-text as a background job and resolves with the result, whatever the video length.
For TikTok, X, Vimeo, Facebook, Dailymotion and Loom you can use either getTranscript (captions, fast) or transcribe (speech-to-text).

Instagram carousels

Select one video by index, or transcribe every video in the post:

AI analysis

Get a summary, the people, places and key subjects, and a direct answer to a natural-language question. query is optional.
See the Analyzing Videos guide for billing details.

Structured extraction

Define a schema and get back structured data extracted from any video or file transcript. See the Data Extraction guide for schema design tips.

From an online video

extractVideoData() runs as a background job, so videos of any length work. With transcribe: true (the default), a video without captions is transcribed first. The result has the extracted data, the video’s video_info (a VideoInfo), and usage when requested. vn.extractVideo() and job.result() on vn.extractVideo.submit() return the same shape.
video_info on extraction results requires 2.1.0. In 2.0.0 it is always undefined.

From an uploaded file

From a schema file

For larger schemas, pass a JSON or YAML file. It is sent as multipart form-data.
Schema rules: every field needs type and description. Supported types are String, Number, Boolean, Integer, Object, Array and Enum. Array fields need items, Object fields list sub-fields in properties (up to 10), and Enum fields list allowed values in enum. At most 10 top-level fields and 3 levels of nesting. An invalid schema is rejected with a BadRequestError before anything runs.

Tweet claim analysis

Pass a tweet ID (not the full URL). Attached media of any length is transcribed, so this also runs as a background job.
See the Tweet Claim Analysis guide.

Background jobs

Transcription, structured extraction, tweet analysis and TikTok scraping run as background jobs on VidNavigator. The SDK always uses the async endpoints, so video length is never a problem. Each operation comes in two shapes:
The 1.x methods transcribeVideo(), extractVideoData() and getTweetStatement() still work with the same arguments. They are now wrappers around the operations above.

Start many at once

.submit() returns a Job right away. Each job has a task_id, status() (checks once), result() (waits, then returns the result) and wait() (waits, then returns the final task without throwing on failure):

Come back later

A job keeps running even if your process stops waiting, and its result stays available for 1 hour after it finishes. Keep the task_id and reattach with .resume():

Timeouts

The one-liners and result() wait up to 30 minutes by default, then throw a TaskTimeoutError that carries the task_id. The job is not lost:
Pass these to the one-liner or to result() / wait():
transcribe → same shape as transcribeVideo(); extractVideo → { data, video_info, usage? }; tweetStatement → TweetStatement; tiktokProfile / tiktokSearch → the completed task with every page of videos / results.

Failures

When a job fails, result() and the one-liners throw the same error class as any other API error (for example NotFoundError for a missing video), built from the job’s error details and carrying the task_id. wait() returns the failed task instead, with task.error set. When a job can’t start, submitting throws right away and no job is created:
  • InsufficientCreditsError (402): not enough credits. A job can also run out of credits while it runs; result() then throws the same error, so handle it in both places.
  • TooManyActiveJobsError (429): too many of your jobs are already running. Wait for some to finish and retry.

Large batches

Your account can only run a limited number of jobs at once, so Promise.all over hundreds of URLs will hit TooManyActiveJobsError. Keep a fixed number in flight:

Progress and restarts

Save each task_id as soon as you submit, so a crash or deploy doesn’t lose the work:

Webhooks

Pass webhook_url to any job operation (transcription, extraction, tweet analysis, TikTok profile and search), or set an account-wide default in Studio → API. A per-job webhook_url overrides the default, and webhook_url: '' turns it off for one job. Webhooks are optional: waiting with result() works the same either way and remains the source of truth.
Verify each delivery with constructWebhookEvent(), passing the raw request body:
  • event.data.result holds the raw result for transcription, extraction and tweet events, unless it was over 256 KB (result_truncated: true). For TikTok events it is only a summary. resume(task_id).result() always gets the full parsed result.
  • For extract_video.completed events, event.data.video_info holds the raw video metadata. It is sent even when the result was truncated.
  • verifyWebhookSignature(rawBody, signatureHeader, secret) returns true or false instead of throwing.
  • Deliveries older than 5 minutes are rejected by default. Change this with { toleranceSeconds }; 0 turns the check off.
  • (await job.refresh()).webhook shows the delivery status: { status, attempts, response_status, last_error, delivered_at }.
See Webhooks for the full delivery contract.

TikTok

Profile scraping

vn.tiktokProfile() scrapes a public profile in the background and returns the finished task with every matching video (the SDK fetches all result pages for you):
Options: max_posts, after_datetime, before_datetime, min_likes, max_likes, webhook_url. Datetimes accept YYYY-MM-DD or full ISO strings with a timezone. To read the results one page at a time, or grab them as a single JSON file, submit the job and use the page-level method:
Then feed each video into the transcript or extraction APIs:
For large profiles, process videos sequentially or with a small concurrency limit so you do not exhaust credits or hit rate limits. vn.tiktokSearch() works the same way and returns the finished task with every result:
  • Without sort_by, results come back newest first. Without published_within, an after_datetime more than 24 hours ago picks the smallest window that covers it.
  • parallel_search_slices (2 to 4) runs several search chains in parallel to go past TikTok’s single-chain limit (about 115 to 140 items). Billing grows with the number of slices.
  • Other filters: after_datetime, before_datetime, min_likes, max_likes, min_views, max_views, webhook_url. Page through results with getTikTokSearch(task_id, { cursor, limit }).
See the Searching TikTok guide.

Search YouTube

Other options: use_enhanced_search (default true), start_year, end_year, duration.
searchVideos() still works but is deprecated: it forwards to searchYouTube() and logs a warning.

Search your uploaded files


Files

Supported formats: mp4, webm, mov, avi, wmv, flv, mkv, m4a, mp3, mpeg, mpga, wav.

Upload and analyze

Upload without waiting

Without wait_for_completion, the upload returns right away (status: 'accepted') while the file is processed. Check on it with getFile():

Manage files

Namespaces


Usage and billing

Per-call usage

Pass include_usage: true to getTranscript, analyzeVideo, analyzeFile, extractVideoData, extractFileData, searchYouTube or searchFiles to receive a usage block describing what the request cost. For background jobs, pass it in the options: vn.transcribe(url, { include_usage: true }). A failed job has all its charges reverted.
Meters: standard_request, residential_request, transcription_hour, analysis_request, search_request, scene_analysis_hour. See Usage & Costs.

Account usage

vn.healthCheck() returns the API status and needs no authentication.

Error handling

Every API error is mapped to a specific class, all extending VidNavigatorError:
Every error exposes status_code, error_code, error_message and details, and errors raised while waiting for a job also have task_id. See Errors for every API error code.

TypeScript models

All API responses are parsed into typed classes with static fromJSON() constructors.

What’s new in 2.1.0

  • video_info on extraction: extractVideoData(), vn.extractVideo() and job.result() on vn.extractVideo.submit() now return the video’s metadata as video_info. The task snapshot from job.refresh() / job.wait() has it too, and extract_video.completed webhook events carry it in event.data.video_info.
No other changes are needed to upgrade from 2.0.0.

Upgrading from 1.x

Transcription, structured extraction and tweet analysis now always run as background jobs, so they work on videos of any length. Existing calls keep working with the same arguments, with these differences:
  • getTweetStatement() no longer returns statement_query, which was never part of the documented API.
  • searchVideos() and getYouTubeTranscript() are deprecated in favor of searchYouTube() and getTranscript().
New in 2.0: vn.transcribe, vn.extractVideo, vn.tweetStatement, vn.tiktokProfile and vn.tiktokSearch, each with .submit() and .resume(), plus the webhook signature helpers and the InsufficientCreditsError, TooManyActiveJobsError and TaskTimeoutError classes.

Resources

npm

Package page and release history.

GitHub

Source code and issue tracker.

Python SDK

The same API for Python.

API Reference

Every endpoint, parameter and response field.