When building conversational agents, you may need to restrict access to certain agents or conversations. ElevenLabs provides multiple authentication mechanisms to ensure only authorized users can interact with your agents.
ElevenLabs offers two primary methods to secure your conversational agents:
Generate temporary authenticated URLs for secure client-side connections without exposing API keys.
Restrict access to specific domains or hostnames that can connect to your agent.
Signed URLs are the recommended approach for client-side applications. This method allows you to authenticate users without exposing your API key.
The guides below uses the JS client and Python SDK.
To obtain a signed URL, make a request to the get_signed_url endpoint with your agent ID:
The curl response has the following format:
Retrieve the server generated signed URL from the client and use the signed URL to connect to the websocket.
Signed URLs are valid for 15 minutes. The conversation session can last longer, but the conversation must be initiated within the 15 minute window.
Allowlists provide a way to restrict access to your conversational agents based on the origin domain. This ensures that only requests from approved domains can connect to your agent.
Allowlists are configured as part of your agent’s authentication settings. You can specify up to 10 unique hostnames that are allowed to connect to your agent.
Open your agent in the dashboard and navigate to the Security tab. Add each approved hostname (e.g., example.com, app.example.com, localhost:3000) to the allowlist.
Configure one authentication method per agent:
enable_auth) for authenticated client sessions.allowlist) for hostname-based access control.Do not configure signed URLs and allowlists together on the same agent. Choose the method that matches your deployment model.
Use enable_auth without an allowlist:
Use allowlist without enabling signed URLs:
This is possible but we recommend generating a new signed URL for each user session.
If the signed URL expires (after 15 minutes), any WebSocket connection created with that signed url will not be closed, but trying to create a new connection with that signed URL will fail.
The signed URL mechanism only verifies that the request came from an authorized source. To restrict access to specific users, implement user authentication in your application before requesting the signed URL.
There is no specific limit on the number of signed URLs you can generate.
Allowlists perform exact matching on hostnames. If you want to allow both a domain and its subdomains, you need to add each one separately (e.g., “example.com” and “app.example.com”).
No. Configure either signed URLs or an allowlist for each agent. For client-side applications, signed URLs are the recommended default.
Beyond signed URLs and allowlists, consider implementing: