Node SDK
Administer RelayRTC rooms and resources from a Node.js server.
On this page
Install
pnpm add @relayrtc/nodeThe package requires Node.js 22 or newer. See installation for setup instructions.
Create a client
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
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 resource | Purpose |
|---|---|
context() | Read API key context. |
rooms | Create, list, read and end rooms; inspect cleanup. |
tokens | Issue and renew participant tokens. |
participants | List, read, remove and inspect cleanup. |
turn | Create temporary TURN credentials. |
usage | Read public usage categories. |
webhooks | Manage endpoints and signing secrets. |
webhooks.deliveries | Read delivery logs and replay. |
| streams | Configure sources, ingest credentials, playback grants and source operations. |
| broadcasts | Create runs, inspect outputs and retry failed destinations. |
| destinations | Save external platform settings and rotate stream keys. |
| recordings and assets | Capture programs and issue private playback/download grants. |
| schedules | Plan events and issue event-scoped access. |
| external sources | Probe and control approved upstream inputs. |
| clips | Configure buffers, render intervals and publish highlights. |
| DVR | Manage rolling retention and inspect run windows. |
| mixers | Save and activate server-rendered scenes. |
| guest stages | Manage 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.