RelayrtcDocs
Get started
Documentation
Node SDK

Node SDK

Administer RelayRTC rooms and resources from a Node.js server.

On this page

Install

Shell
pnpm add @relayrtc/node

The package requires Node.js 22 or newer. See installation for setup instructions.

Create a client

TypeScript
import { RelayServer } from '@relayrtc/node'
 
const relay = new RelayServer({
  apiUrl: process.env.RELAYRTC_API_URL!,
  apiKey: process.env.RELAYRTC_SECRET_KEY!,
})

Use a secret API key. The client normalizes the API URL to include /v1.

Create a room and token

TypeScript
const room = await relay.rooms.create({ name: 'Team call' })
const issued = await relay.tokens.create(room.id, {
  participantName: 'Alice',
  permissions: ['room:join', 'audio:publish', 'video:publish'],
})

Send issued.token to that authenticated user. The browser joins with the React or browser SDK.

Resources

Client resourcePurpose
context()Read API key context.
roomsCreate, list, read and end rooms; inspect cleanup.
tokensIssue and renew participant tokens.
participantsList, read, remove and inspect cleanup.
turnCreate temporary TURN credentials.
usageRead public usage categories.
webhooksManage endpoints and signing secrets.
webhooks.deliveriesRead delivery logs and replay.
streamsConfigure sources, ingest credentials, playback grants and source operations.
broadcastsCreate runs, inspect outputs and retry failed destinations.
destinationsSave external platform settings and rotate stream keys.
recordings and assetsCapture programs and issue private playback/download grants.
schedulesPlan events and issue event-scoped access.
external sourcesProbe and control approved upstream inputs.
clipsConfigure buffers, render intervals and publish highlights.
DVRManage rolling retention and inspect run windows.
mixersSave and activate server-rendered scenes.
guest stagesManage invitations, moderation and scoped stage grants.

The Node SDK does not capture a camera or join a media call. It wraps the public management REST API.

Request behavior

Successful data objects are returned directly. Errors throw RelayApiError.

Only GET requests retry automatically. Create, update, delete, secret rotation and replay requests are attempted once.

See RelayServer options and request options.

Streaming resources

Stream management and operation methods add typed source configuration, encoder credentials and private playback grants. Use compatible API/SDK builds; see installation. Streaming commands generate idempotency keys unless an explicit application command ID is supplied.

Room access and audit history

Use participants.getAccess, participants.updateAccess and rooms.audit to administer versioned room roles, permission restrictions and immutable room history. Mutations require the new participants:write scope.