# Process video with TypeScript

Use @rendobar/sdk to call Rendobar's FFmpeg API, Compose API and every other job type from Node 18+, Bun, Deno or Workers. It waits for the output and verifies webhook signatures.

Official, built by Rendobar · 11,445 downloads · v5.17.0 · MIT · Node 18+, Bun, Deno, Workers, browser

Page: https://rendobar.com/integrations/typescript-sdk/ · View on npm: https://www.npmjs.com/package/@rendobar/sdk · Read the docs: https://rendobar.com/docs/sdk

```
npm install @rendobar/sdk
```

- Type: TypeScript SDK
- Built by: Rendobar
- Package: `@rendobar/sdk`
- Version: 5.17.0, MIT licence
- Runs on: Node 18 or later, Bun, Deno, Cloudflare Workers, the browser
- Pricing: Free
- Category: Code

## Overview

Install @rendobar/sdk and every Rendobar job becomes a typed call from your code: [FFmpeg commands](https://rendobar.com/ffmpeg/), [timeline videos](https://rendobar.com/compose/), captions and AI images. `rb.jobs.create` submits a job and `rb.jobs.wait` polls until it completes, fails or is cancelled. With no timeout set, the wait follows the job's own time limit from your plan. Local files go up with `rb.uploads.create`, and `verifyWebhook` checks a delivery's signature from its own entry point with no runtime dependencies. The client retries 429 and 5xx responses twice by default, on Node 18+, Bun, Deno, Workers and the browser.

## transcode.ts

```ts
import { createClient, outputUrl } from "@rendobar/sdk";

const rb = createClient({ apiKey: process.env.RENDOBAR_API_KEY });

// Each input name is a file the command reads with -i.
const job = await rb.jobs.create({
  type: "ffmpeg",
  inputs: { "source.mp4": "https://cdn.rendobar.com/assets/examples/sample.mp4" },
  params: { command: "ffmpeg -i source.mp4 -vf scale=1280:-2 -c:v libx264 -crf 23 out.mp4" },
});

// Polls until the job ends. Throws JobFailedError if it fails.
const done = await rb.jobs.wait(job.id, { throwOnFailure: true });

console.log(outputUrl(done)); // signed URL of out.mp4
```

## Set up

1. **Install.** Add the package and put a [new API key](https://app.rendobar.com/api-keys?create=1&name=SDK) in `RENDOBAR_API_KEY`.

```bash
npm install @rendobar/sdk
```

2. **Create a client.** Make one client and reuse it. It retries 429 and 5xx responses twice by default.

```ts
const rb = createClient({ apiKey: process.env.RENDOBAR_API_KEY });
```

3. **Submit and wait.** `rb.jobs.create` sends the job and `rb.jobs.wait` returns it once it completes, fails or is cancelled.

```ts
const done = await rb.jobs.wait(job.id, { throwOnFailure: true });
```


## Reference

### Package

- @rendobar/sdk 5.17.0, MIT
- Exports: @rendobar/sdk, @rendobar/sdk/webhooks
- Runs on Node 18+, Bun, Deno, Workers, the browser
- ESM and CommonJS, full types

### Client

- createClient({ apiKey, timeout, maxRetries, orgId, app })
- timeout defaults to 30000 ms per request
- maxRetries defaults to 2, for 429, 500, 502, 503 and 504

### Jobs

- rb.jobs.create({ type, inputs, params, idempotencyKey, destinations, callback })
- rb.jobs.wait(id, { timeout, onProgress, signal, throwOnFailure })
- rb.jobs.run(params, options): create plus wait, throws on failure by default
- rb.jobs.get, list, listAll, cancel, download, logs, types

### Results

- outputUrl(job): the headline file URL, or undefined
- jobData<T>(job): the structured data of a complete job, or null
- Errors: ApiError (isApiError), JobFailedError, WaitTimeoutError

### Also

- rb.uploads.create(bytes, { filename, persist })
- verifyWebhook(rawBody, headers, secret) and verifyCallback from @rendobar/sdk/webhooks
- rb.webhooks, rb.storage, rb.realtime.subscribeJob, rb.compose.validate

## Questions

### Which runtimes does @rendobar/sdk support?

Node 18 or later, Bun, Deno, Cloudflare Workers and the browser. It ships ESM and CommonJS with full types.

### How long does jobs.wait keep polling?

With no timeout it follows the job's own time limit from your plan, plus two minutes of grace for the upload, and never less than five minutes. Pass timeout to set your own bound. It throws WaitTimeoutError when the bound runs out, and returns a failed job unless you pass throwOnFailure: true.

### How do I send a local file with the SDK?

Call `rb.uploads.create` with the file's bytes and a filename. It returns an asset, and asset.url goes into inputs like any other URL. Uploads are kept for 24 hours unless you pass persist: true.

### How do I verify a Rendobar webhook in TypeScript?

Import `verifyWebhook` from `@rendobar/sdk/webhooks` and pass it the raw body, the headers and your secret. It rejects deliveries older than 5 minutes.

## Resources

- [Docs](https://rendobar.com/docs/sdk): Every method, client option and error type, with examples.
- [npm](https://www.npmjs.com/package/@rendobar/sdk): @rendobar/sdk, the published package and its version history.
- [OpenAPI spec](https://api.rendobar.com/openapi.json): The OpenAPI 3.1 contract for the REST API the SDK calls.

## More

- [Run FFmpeg from Node.js](https://rendobar.com/ffmpeg/nodejs/)
- [FFmpeg recipes](https://rendobar.com/ffmpeg/recipes/)