Skip to content

Cloudflare.Calls reference

Source: src/Cloudflare/Calls/App.ts

A Cloudflare Realtime (formerly “Calls”) SFU application.

An app is the unit of isolation for Cloudflare’s WebRTC SFU: clients connect to sessions scoped to the app’s auto-assigned appId, and your backend authenticates management calls with the create-only secret (a bearer token). The only configurable property is the human-readable name, which is mutable in place.

App with a generated name

const app = yield* Cloudflare.Calls.App("realtime", {});

App with an explicit name

const app = yield* Cloudflare.Calls.App("realtime", {
name: "my-realtime-app",
});
// appId is public — it appears in client session URLs:
const appId = app.appId;
// The secret is redacted — use it server-side as a bearer token
// against https://rtc.live.cloudflare.com/v1/apps/{appId}/...
const secret = app.secret; // Redacted<string>

Source: src/Cloudflare/Calls/TurnKey.ts

A Cloudflare Realtime (formerly “Calls”) TURN key.

A TURN key authenticates your backend against Cloudflare’s managed TURN service: you exchange the create-only key (a bearer token) for short-lived TURN credentials that WebRTC clients use to relay traffic through Cloudflare’s network. The only configurable property is the human-readable name, which is mutable in place.

TURN key with a generated name

const turnKey = yield* Cloudflare.Calls.TurnKey("turn", {});

TURN key with an explicit name

const turnKey = yield* Cloudflare.Calls.TurnKey("turn", {
name: "my-turn-key",
});
// keyId is public — it appears in the credential-minting URL:
const keyId = turnKey.keyId;
// The key is redacted — POST it as a bearer token to
// https://rtc.live.cloudflare.com/v1/turn/keys/{keyId}/credentials/generate
const apiToken = turnKey.key; // Redacted<string>