does livekit automatically choose nearest region?
# ask-ai
a
does livekit automatically choose nearest region?
t
Thanks for reaching out, Shajahan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Regarding automatic region selection: yes — LiveKit will by default route clients to the nearest/lowest-latency region. For realtime SDK clients a region- and load-aware node selector routes users based on latency or geographic proximity (when using a geo-aware DNS). SIP calls are routed to the region closest to the SIP trunk endpoint; outgoing SIP calls originate from the region where the API request is made. If you need traffic fixed to a specific region (for compliance or other reasons), you can use region pinning. Would you like guidance on checking which region a client is using or how to enable region pinning? Sources: SIP cloud and region pinning | LiveKit docs | Distributed Setup | LiveKit docs
a
yes please
t
Great — I'll walk you through how to (1) check which region a client is connected to and (2) enable region pinning. 1) Check a client's region • Use the Analytics API to retrieve session/participant details; each participant record includes a
region
field. • Example:
Copy code
curl -H "Authorization: Bearer $TOKEN" "cloud-api.livekit.io/api/project/$PROJECT_ID/sessions/$SESSION_ID"
• Look for the
region
value on the participant object to see which region they're connected to. 2) Enable region pinning (restrict traffic to specific region(s)) • Region pinning is available for customers on the Scale plan or higher and must be enabled by LiveKit Cloud support. • Once enabled: ◦ You can configure pinned regions via the LiveKit Cloud dashboard or API. ◦ Protocol-based region pinning forces clients to connect only to the allowed regions; connections from other regions will be rejected. ◦ For SIP, use region-specific endpoints (e.g., region subdomains) so traffic stays in the chosen region. • Note: region pinning disables automatic cross-region failover during outages. Would you like: • the exact Analytics API response fields to look for, or • steps to request region pinning and the dashboard/API path to configure it? Sources: LiveKit Cloud Architecture | LiveKit docs | Analytics API | LiveKit docs | Region pinning | LiveKit docs | SIP cloud and region pinning | LiveKit docs