TypeScript SDK Guide
The Sync TypeScript SDK (@sync.so/sdk) provides typed methods for Node.js 18+ applications. It wraps the full Sync API surface for creating lip sync generations, polling status, and retrieving results from any TypeScript/JavaScript runtime.
Installation
Requires Node.js 18+. The SDK ships with both ESM and CommonJS builds, so it works with any module system.
Authentication
The SDK reads your API key from the SYNC_API_KEY environment variable automatically.
Create a key from the API Keys page in your dashboard.
You can also pass the key explicitly:
Never expose your API key in client-side code. The SDK is designed for server-side use only. See Framework Integration for details.
Quick Start
Create a lip sync generation, poll for completion, and get the output URL:
Run it with:
Core Operations
Creating Generations
Video + Audio
The most common pattern. Provide a source video and an audio track — Sync generates lip movements matching the audio.
Video + Text-to-Speech
Use the built-in ElevenLabs integration to go from text to lip-synced video in a single call:
Enable the ElevenLabs integration from your Integrations settings before using the TTS input type.
Polling vs Webhooks
The quick start above uses polling. For production systems, webhooks are more efficient — you receive a POST notification when the job finishes instead of making repeated API calls.
Listing Generations
Retrieve your recent generations:
Getting Generation Details
Fetch a specific generation by ID:
Cost Estimation
Estimate the cost of a generation before submitting it:
Working with Files
URL Inputs
The simplest approach. Provide publicly accessible URLs for your video and audio files:
Uploading Files via the Assets API
If your files are not hosted at public URLs, use the Assets API to upload them first. Then reference the returned URLs in your generation request.
For direct file uploads, use the create with files endpoint.
Error Handling
The SDK throws SyncError for API errors. Wrap calls in try/catch to handle failures gracefully.
Common error scenarios:
See the Error Handling guide for the full list of error codes.
TypeScript Types
The SDK is fully typed. Import types directly for use in your own functions and interfaces:
The SDK exports types for all request and response objects, so you get autocomplete and compile-time checks across your entire codebase.
Framework Integration
The Sync SDK is server-side only. Never import it in client-side code — doing so would expose your API key.
Next.js (App Router)
Use the SDK in Server Components, Route Handlers, or Server Actions:
Express
Store your SYNC_API_KEY in environment variables or a secrets manager. Do not hardcode it in your source files.
Next Steps
- API Reference — Full endpoint documentation with request/response schemas
- Python SDK Guide — Overview of both SDKs
- Video Dubbing API Guide — Build a dubbing pipeline
- Text-to-Speech Lip Sync Guide — Combine TTS with lip sync
- Webhooks — Set up real-time status notifications
- Error Handling — Complete error code reference
- GitHub Repository — Source code and issues
Frequently Asked Questions
What Node.js version is required?
The Sync TypeScript SDK requires Node.js 18 or later. It ships with both ESM and CommonJS builds, so it works with any module system. The SDK is designed for server-side use only — never import it in client-side code as this would expose your API key.
Can I use the SDK in the browser?
No. The SDK is server-side only. Using it in the browser would expose your API key to end users. Instead, create a server-side endpoint that calls the Sync API and have your frontend communicate with your server. See the Framework Integration section for examples.
How do I handle errors?
The SDK throws SyncError for API errors. Wrap your calls in try/catch blocks and inspect the statusCode and body properties. For transient errors like 500 or 429, implement retry logic with exponential backoff. Check the Error Handling guide for the full list of error codes.

