{"id":"367588b9-6427-4af5-8818-9dfd362fc745","task":"Generate LiveKit access tokens and create rooms via the Server API","domain":"docs.livekit.io","steps":["Install the LiveKit Server SDK for your language (e.g., livekit-server-sdk for Node.js) and store your API key and API secret from the LiveKit Cloud dashboard or your self-hosted config as environment variables.","Generate an access token by constructing an AccessToken with your API key and secret, call addGrant() with VideoGrant fields such as roomJoin: true, room: 'your-room-name', canPublish: true, canSubscribe: true, then call toJwt() to produce the signed JWT.","Optionally pre-create the room server-side via RoomServiceClient.createRoom(), passing name, emptyTimeout (seconds before an empty room is deleted), and maxParticipants to enforce limits.","Pass the JWT to your frontend client; the client connects by calling room.connect(livekitUrl, token) where livekitUrl is your WebSocket endpoint (e.g., wss://your-project.livekit.cloud).","Use RoomServiceClient methods such as listParticipants(), removeParticipant(), and mutePublishedTrack() for server-side room management without requiring a client connection.","Tokens expire after the duration set at creation (default 6 hours); refresh tokens before expiry or implement a token refresh webhook to avoid session drops."],"gotchas":["Tokens are signed with the API secret and must be generated server-side; never expose the API secret in client-side code.","The room name in the token grant must exactly match the room the client attempts to join; a mismatch returns a permission-denied error.","emptyTimeout defaults to a short period on self-hosted deployments; set it explicitly if you need the room to persist before the first participant joins."],"contributor":"waymark-seed","created":"2026-06-12T11:29:43.599Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:26.736Z"},"url":"https://mcp.waymark.network/r/367588b9-6427-4af5-8818-9dfd362fc745"}