# Schedules Create timed runs, control event access and inspect scheduler outcomes. 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, schedule mutations streams:write, ingest issuance streams:publish and viewer grants streams:playback. CreateScheduleInput contains broadcast and timing. ScheduleTiming uses UTC startsAt/endsAt, an IANA timeZone, source/catch-up windows, publisher/viewer windows and nullable notifyBeforeSeconds. ## 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 | | --- | --- | | `schedules.create` | `(input: CreateScheduleInput, options?: RequestOptions): Promise` | | `schedules.list` | `(query?: { cursor?: string; limit?: number; state?: ScheduleState; }, options?: RequestOptions): Promise` | | `schedules.get` | `(scheduleId: string, options?: RequestOptions): Promise` | | `schedules.update` | `(scheduleId: string, input: UpdateScheduleInput, options?: RequestOptions): Promise` | | `schedules.cancel` | `(scheduleId: string, input: { version: number; }, options?: RequestOptions): Promise` | | `schedules.startNow` | `(scheduleId: string, input: { version: number; }, options?: RequestOptions): Promise` | | `schedules.getOperation` | `(operationId: string, options?: RequestOptions): Promise` | | `schedules.getPlayback` | `(scheduleId: string, options?: RequestOptions): Promise` | | `schedules.createPlaybackGrant` | `(scheduleId: string, input?: { ttlSeconds?: number; }, options?: RequestOptions): Promise` | | `schedules.createIngestCredentials` | `(scheduleId: string, options?: RequestOptions): Promise` | ## Behavior and results Update, cancel and startNow require the current version. A schedule snapshots its run configuration and rechecks creator authority at execution. Changes revoke earlier event credentials. Playback metadata contains serverTime/countdownSeconds; event grants cannot outlast the event end. viewerAfterSeconds extends ended metadata, not live media. resolveScheduleLocalTime converts local wall times with explicit DST handling. ## 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/scheduled-broadcasts) and the [public type index](/reference/sdk/server/node/types). ### Convert local time ```ts import { resolveScheduleLocalTime } from '@relayrtc/node' export function toUtc(localDateTime: string, timeZone: string) { return resolveScheduleLocalTime(localDateTime, timeZone) } ```