# turn.createCredentials Create temporary STUN/TURN ICE server credentials. ## Import and client ```ts import { RelayServer } from '@relayrtc/node' const relay = new RelayServer({ apiUrl: process.env.RELAYRTC_API_URL!, apiKey: process.env.RELAYRTC_SECRET_KEY!, }) ``` ## Requirements A secret key with `tokens:create`. The requested resource must belong to that key's project environment. ## Parameters | Option | Type | Default / requirement | Purpose | | --- | --- | --- | --- | | roomId | string | Optional with sessionId | Room of the active session. | | sessionId | string | Optional with roomId | Active participant session. | Every method accepts [RequestOptions](/reference/sdk/server/node/request-options) as its final argument. ## Example ```ts const roomId = 'room_example' const sessionId = 'session_example' const result = await relay.turn.createCredentials({ roomId, sessionId }) ``` ## Returns `Promise`. Returns [TURN credentials](/reference/api/v1/schemas/turn-credentials). URLs, username, lifetime and password depend on the deployment. ## Behavior Supply both IDs for session-bound credentials or send `{}` for environment-scoped credentials. A browser joining through the SDK receives initial TURN credentials from signaling. Keep the secret API key on the backend when renewing them. ## REST equivalent [`POST /v1/turn/credentials`](/reference/api/v1/turn/create-credentials). Failures throw [RelayApiError](/reference/sdk/server/node/RelayApiError).