Skip to content

CallsTurnKey

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.CallsTurnKey("turn", {});

TURN key with an explicit name

const turnKey = yield* Cloudflare.CallsTurnKey("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>