Skip to content

TypeScript SDK

The official Node.js & TypeScript client for the Teradek REST API. Control your Prism encoders with full type safety and automatic OAuth token management.

@teradek/sdkFull TypeScript typesAuto OAuthESM + CJS

Installation

Install the SDK from npm:

$npm install @teradek/sdk

Quick Start

Create a client and start controlling your encoder in just a few lines:

TypeScript
import { Teradek } from "@teradek/sdk";

const device = new Teradek({
  host: "192.168.1.100",
  password: "your-device-password",
  rejectUnauthorized: false,
});

// Get device info
const info = await device.system.info();
console.log(info.settings["Device Model"]); // "Prism-855"

// Start a stream
await device.streams.start(0);

The client automatically handles OAuth token acquisition and refresh. All responses follow the ApiResponse shape:

Response
{
  "status": "Success",
  "message": "",
  "timestamp": 1740000000,
  "settings": {
    "Device Model": "Prism-855",
    "Serial": "12855XXXXX",
    "Firmware Version": "2.25.20260122"
  }
}

Constructor Options

Configure the client with TeradekOptions:

OptionTypeDefaultDescription
hoststringDevice IP address or hostname
passwordstringDevice admin password (for auto token grant)
accessTokenstringPre-existing access token (skip password grant)
refreshTokenstringPre-existing refresh token
httpsbooleantrueUse HTTPS for API requests
rejectUnauthorizedbooleantrueVerify TLS certificates (set to false for self-signed)
onTokenRefreshfunctionCallback fired when tokens are refreshed
TypeScript
const device = new Teradek({
  host: "192.168.1.100",
  password: "admin-password",
  https: true,
  rejectUnauthorized: false,
  onTokenRefresh: (tokens) => {
    // Persist tokens for next session
    saveTokens(tokens.access_token, tokens.refresh_token);
  },
});

Resources

The SDK organizes the API into typed resource namespaces. Each resource maps to a section of the REST API.

device.system

4 methods

Device info, firmware check, and firmware settings.

await device.system.info()
await device.system.firmware.check()

device.encoders

10 methods

Video/audio settings, metadata, recording, and snapshots.

await device.encoders.info()
await device.encoders.video.getSettings()

device.decoders

11 methods

Video ingest mode, audio output, metadata, recording, and snapshots.

await device.decoders.info()
await device.decoders.video.getMode()

device.streams

12 methods

Start, stop, configure, and monitor live streams.

await device.streams.start(0)
await device.streams.info(0)

device.network

4 methods

Wired ports, Wi-Fi settings, and cellular modems.

await device.network.wired(0)
await device.network.wifi.getSettings()

device.settingsSync

2 methods

Import settings and push to other devices.

await device.settingsSync.import(data)
await device.settingsSync.push(payload)

Filtering & Describing Settings

All getSettings() and describeSettings() methods accept an optional settings array to filter the response to specific keys. This reduces payload size when you only need a subset of fields.

Filter to specific keys

Pass a settings array to retrieve only those keys. The SDK maps this to the ?settings=key1,key2 query parameter.

TypeScript
// Only fetch codec and bitrate — skips the rest of the video settings
const res = await device.encoders.video.getSettings({
  settings: ["codec", "bitrate_list"],
});

console.log(res.settings.codec);        // "h264"
console.log(res.settings.bitrate_list); // 20000

Describe settings

Use describeSettings() to fetch metadata about each setting — its type, default value, and allowed values — instead of the current values. The SDK sends ?command=description under the hood.

TypeScript
const res = await device.encoders.video.describeSettings();

// Each key returns a descriptor instead of a value
console.log(res.settings.codec);
// { type: "string", default: "h264", choices: ["h264", "hevc"] }

console.log(res.settings.bitrate_list);
// { type: "integer", default: 20000, minimum: 100, maximum: 80000 }

Combine filtering with descriptions

Both options can be used together to describe only a subset of keys.

TypeScript
const res = await device.encoders.video.describeSettings({
  settings: ["codec", "bitrate_list"],
});

Supported resources

ResourcegetSettings()describeSettings()
device.system.firmware
device.encoders.video
device.encoders.audio
device.encoders.metadata
device.encoders.record
device.decoders.video
device.decoders.audio
device.decoders.audio.channel(n)
device.decoders.metadata
device.decoders.record
device.streams
device.network.wifi

Error Handling

The SDK throws typed error classes for different HTTP status codes, making it easy to handle specific failure modes:

TypeScript
import {
  Teradek,
  AuthenticationError,
  RateLimitError,
} from "@teradek/sdk";

try {
  const info = await device.system.info();
} catch (err) {
  if (err instanceof AuthenticationError) {
    // 401 — token expired or invalid password
    console.error("Auth failed:", err.message);
  } else if (err instanceof RateLimitError) {
    // 429 — back off and retry
    console.error("Rate limited, retry after:", err.retryAfter);
  } else {
    throw err;
  }
}
Error ClassStatusWhen
AuthenticationError401Invalid or expired credentials
BadRequestError400Invalid request parameters
RateLimitError429Too many requests
ServerError500Internal device error

Next Steps

Need help with integration?

Our team can help with API questions, troubleshooting, and custom workflows.

Contact Us