steep-shampoo-86436
01/02/2026, 9:31 AMtall-airline-16756
01/02/2026, 9:31 AMtall-airline-16756
01/02/2026, 9:31 AMEgressClient.stopEgress(egressId) from the livekit-server-sdk in a Next.js API route or other server-side code:
1. Install and import:
import { EgressClient } from 'livekit-server-sdk';
1. Initialize:
const egressClient = new EgressClient({
apiKey: process.env.LIVEKIT_API_KEY!,
apiSecret: process.env.LIVEKIT_API_SECRET!,
host: process.env.LIVEKIT_HOST!,
});
1. Stop the recording:
await egressClient.stopEgress(egressId);
If you’d like, share how you’re starting the egress (room composite, track, etc.) or the code you’re using and I’ll give an example API route tailored to your setup.
Sources: server-sdk-js | livekit/livekit_composite | DeepWikisteep-shampoo-86436
01/02/2026, 9:33 AMtall-airline-16756
01/02/2026, 9:33 AMEgressClient.stopEgress(egressId)
and I’ll provide the exact Next.js API route or steps for that approach.