Destinations
Save RTMP output settings and rotate credentials for future runs.
On this page
These methods run on your backend and require a compatible API/SDK build; see installation.
Import and client
Set RELAYRTC_API_URL and RELAYRTC_SECRET_KEY in your backend environment. Keep the secret key on the server.
import { RelayServer } from '@relayrtc/node'
const relay = new RelayServer({
apiUrl: process.env.RELAYRTC_API_URL!,
apiKey: process.env.RELAYRTC_SECRET_KEY!,
})Authorization and inputs
Reads require streams:read; mutations require streams:write. CreateDestinationInput takes name, endpoint and streamKey, plus optional profile and enabled. The endpoint is a public RTMP/RTMPS application URL without userinfo, query or fragment. Profiles are remux, 720p or 1080p.
Methods
All methods return promises. Their final argument is optional RequestOptions. Input and result names are public imports from @relayrtc/node.
| Method | Signature |
|---|---|
streams.destinations.create | (streamId: string, input: CreateDestinationInput, options?: RequestOptions): Promise<StreamDestination> |
streams.destinations.list | (streamId: string, query?: { cursor?: string; limit?: number; }, options?: RequestOptions): Promise<DestinationPage> |
streams.destinations.get | (streamId: string, destinationId: string, options?: RequestOptions): Promise<StreamDestination> |
streams.destinations.update | (streamId: string, destinationId: string, input: UpdateDestinationInput, options?: RequestOptions): Promise<StreamDestination> |
streams.destinations.delete | (streamId: string, destinationId: string, options?: RequestOptions): Promise<{ id: string; deleted: true; }> |
streams.destinations.rotateSecret | (streamId: string, destinationId: string, input: RotateDestinationSecretInput, options?: RequestOptions): Promise<StreamDestination> |
Behavior and results
Update and rotateSecret require the current destination version. Reads expose host, protocol, port, profile, version and secretConfigured, never the saved URL/key. A broadcast keeps its destination snapshot even if the definition is later disabled, deleted or rotated. Stop the run to disconnect that output.
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. A canceled HTTP request does not undo committed server work.
Failures throw RelayApiError. Reload resources after version conflicts; inspect asynchronous operation/processing states before reporting completion.
See REST parameters, defaults and errors and the public type index.