# Recordings and assets Capture a program and authorize retained media without exposing storage credentials. These methods run on your backend and require a compatible API/SDK build; see [installation](/installation). ## Import and client Set `RELAYRTC_API_URL` and `RELAYRTC_SECRET_KEY` in your backend environment. Keep the secret key on the server. ```ts import { RelayServer } from '@relayrtc/node' const relay = new RelayServer({ apiUrl: process.env.RELAYRTC_API_URL!, apiKey: process.env.RELAYRTC_SECRET_KEY!, }) ``` ## Authorization and inputs Recording reads and asset playback use recordings:read; capture, policy and deletion controls use recordings:create. StartRecordingInput accepts an explicit broadcastId and policy. Supply the storage region, retention and duration in seconds, partial-output/export choices, and consentAcknowledged: true only after obtaining consent. ## Methods All methods return promises. Their final argument is optional [RequestOptions](/reference/sdk/server/node/request-options). Input and result names are public imports from `@relayrtc/node`. | Method | Signature | | --- | --- | | `streams.recordings.start` | `(streamId: string, input: StartRecordingInput, options?: RequestOptions): Promise` | | `streams.recordings.list` | `(streamId: string, query?: { cursor?: string; limit?: number; }, options?: RequestOptions): Promise` | | `streams.recordings.getPolicy` | `(streamId: string, options?: RequestOptions): Promise<{ policy: RecordingPolicy \| null; version: number; }>` | | `streams.recordings.setPolicy` | `(streamId: string, input: { policy: RecordingPolicy; version: number; }, options?: RequestOptions): Promise<{ policy: RecordingPolicy; version: number; }>` | | `recordings.list` | `(query?: { cursor?: string; limit?: number; }, options?: RequestOptions): Promise` | | `recordings.get` | `(recordingId: string, options?: RequestOptions): Promise` | | `recordings.stop` | `(recordingId: string, options?: RequestOptions): Promise` | | `recordings.getPlayback` | `(recordingId: string, options?: RequestOptions): Promise` | | `recordings.delete` | `(recordingId: string, options?: RequestOptions): Promise` | | `assets.get` | `(assetId: string, options?: RequestOptions): Promise` | | `assets.createAccessGrant` | `(assetId: string, input?: { action?: "playback" \| "download"; ttlSeconds?: number; audience?: "preview" \| "viewer"; }, options?: RequestOptions): Promise` | | `assets.delete` | `(assetId: string, options?: RequestOptions): Promise` | ## Behavior and results Policies require the current version. Automatic policy applies to subsequently created runs. Stop initiates finalization; wait for recording.state ready before issuing playback or download grants. Asset grants distinguish playback from download and preview from viewer. Viewer clip grants require publication. Deletion revokes access before physical cleanup completes. ## Requests and errors Streaming commands generate an idempotency key when omitted. Use an explicit stable key when retrying an uncertain application command; reuse its payload and target. Mutations do not retry automatically. Read retries and cancellation follow [RequestOptions](/reference/sdk/server/node/request-options). A canceled HTTP request does not undo committed server work. Failures throw [RelayApiError](/reference/sdk/server/node/RelayApiError). Reload resources after version conflicts; inspect asynchronous operation/processing states before reporting completion. See [REST parameters, defaults and errors](/reference/api/v1/recordings) and the [public type index](/reference/sdk/server/node/types). Asset delivery and link revocation routes are detailed in [assets](/reference/api/v1/assets). The current SDK has no dedicated asset link-revocation method; use the REST route from your backend.