# External sources Register, probe and operate approved HLS pulls or monitored push encoders. 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 Reads require streams:read; source mutations require streams:write; start also requires streams:publish. CreateRestreamSourceInput requires streamId, name, protocol and redistributionAuthorized: true. Only hls_pull accepts endpoint/authorization; it attaches to an RTMP stream. rtmp_push and whip_push attach to matching stream kinds. ## 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 | | --- | --- | | `restreamSources.create` | `(input: CreateRestreamSourceInput, options?: RequestOptions): Promise` | | `restreamSources.list` | `(query?: { cursor?: string; limit?: number; }, options?: RequestOptions): Promise<{ data: RestreamSource[]; nextCursor: string \| null; }>` | | `restreamSources.get` | `(sourceId: string, options?: RequestOptions): Promise` | | `restreamSources.update` | `(sourceId: string, input: UpdateRestreamSourceInput, options?: RequestOptions): Promise` | | `restreamSources.delete` | `(sourceId: string, options?: RequestOptions): Promise<{ id: string; deleted: true; }>` | | `restreamSources.probe` | `(sourceId: string, options?: RequestOptions): Promise` | | `restreamSources.start` | `(sourceId: string, options?: RequestOptions): Promise` | | `restreamSources.stop` | `(sourceId: string, options?: RequestOptions): Promise` | ## Behavior and results Update requires the current version. Stream/protocol bindings are immutable. Stop the active session before editing. Probe is asynchronous: read state until ready or failed before starting a pull. RestreamDetail includes the current session, safe recent health transitions and observed fetch/processing usage. Pull hosts must be explicitly allowed by the deployment. ## 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/restream-sources) and the [public type index](/reference/sdk/server/node/types).