How to kill a egress that's active
# ask-ai
f
How to kill a egress that's active
t
Thanks for reaching out, Ayush. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm here to help you stop an active egress in LiveKit! You can easily do this using the
StopEgress
API by providing the
egressId
of the session you'd like to end. Let me walk you through some simple examples: • Using LiveKit CLI:
lk egress stop --id <egress_id>
Feel free to specify multiple IDs if you want to stop several egresses at once. • Using Python SDK:
Copy code
from livekit.api import LiveKitAPI
lkapi = LiveKitAPI()
await lkapi.egress.stop_egress(StopEgressRequest(egress_id="<egress_id>"))
• Using Node.js SDK:
await egress.stopEgress('');
Just a quick note: the egress can only be stopped if it's currently active (
EGRESS_STARTING
or
EGRESS_ACTIVE
). If it has already finished or failed, stopping it won't be possible. If you have any questions along the way, I'm here to help! ◦
egress.stop_egress('')
Sources: Egress API | LiveKit Docs | cmd/lk/egress.go | pkg/service/egress.go