Documentation Index
Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
Use this file to discover all available pages before exploring further.
Authentication
The Telnyx WebRTC SDK supports three authentication methods. Use JWT for all production applications.Overview
| Method | IClientOptions | Use Case | Security | Identity |
|---|---|---|---|---|
| JWT | login_token | Production | Token expires in 24h | Per-user |
| Credential | login + password | Development only | Long-lived, no rotation | Per-credential |
| Anonymous | anonymous_login (object) | AI assistant connections | No SIP identity | Per-assistant |
Use JWT (
login_token) for all production applications. Credentials (login + password) are long-lived with no automatic rotation. JWTs expire after 24 hours and can be refreshed via TOKEN_EXPIRING_SOON.Method 1: JWT (Recommended)
JWT is the most secure authentication method. You generate a short-lived token on your backend and pass it to the SDK.How It Works
Step 1: Create a Credential Connection
Create a SIP Credential Connection in the Telnyx Portal or via API:Step 2: Create a Telephony Credential
Each user needs their own credential. Never share one credential across multiple users.Step 3: Generate a JWT
Generate the JWT on your backend — never on the client. This requires your API key.Step 4: Use JWT in the SDK
Token Refresh
JWTs expire after 24 hours. Handle theTOKEN_EXPIRING_SOON warning to refresh without dropping the connection:
Start refreshing tokens at least 1 hour before expiry. The
TOKEN_EXPIRING_SOON warning fires ~1 hour before expiration.Method 2: Credential (Development Only)
Uselogin + password for local development and testing only.
- Local development and testing
- Quick prototyping before setting up JWT infrastructure
- Production applications
- Multi-user scenarios where each user needs their own identity
- Any environment where you need automatic token rotation
login value is the sip_username from a Telephony Credential (e.g., gencrednb4ADiBVjsvgvxem0OwkeNfryiIwhaUSJMJXjiwY3Y). The password is set when creating the credential.
Method 3: Anonymous (AI Assistants)
Connect to an AI assistant without requiring a credential. Theanonymous_login option accepts an object specifying the target:
- Click-to-call widgets connecting users directly to an AI assistant
- Embedding voice AI in web apps without managing credentials
- Cannot receive inbound calls
- No SIP identity — calls are outbound to the specified AI assistant only
- Limited call control features
Continue a conversation
Pass aconversation_id to resume an existing conversation with the AI assistant:
Credential Hierarchy
Understanding how Telnyx auth resources relate to each other:- Credential Connection — SIP-level configuration (transport, codecs, webhook)
- Telephony Credential — Individual identity (one per user)
- JWT — Short-lived token generated from a credential
One credential per user. Never share a credential across multiple users. Each user should have their own credential and their own JWT. Sharing credentials causes registration conflicts — only the most recently connected device receives inbound calls.
Common Mistakes
| Don’t | Do |
|---|---|
Use login + password in production | Use login_token (JWT) |
| Share one credential across users | Create one credential per user |
| Generate JWT on the client side | Generate JWT on your backend |
| Ignore token expiry | Handle TOKEN_EXPIRING_SOON |
| Hardcode JWTs in source code | Fetch JWTs from your backend at runtime |
| Store API keys in client code | Keep API keys server-side only |
Server-Side Token Generation
Here’s a complete Node.js/Express endpoint for generating JWTs:See Also
- IClientOptions — Full client configuration
- Quickstart — Get started in 5 minutes
- Credential Connections API — Create connections via API
- Telephony Credentials API — Manage credentials via API
- Create Access Token API — Generate JWTs via API
- Best Practices — Security best practices