Authentication
API Authentication
Section titled “API Authentication”Authentication Methods
Section titled “Authentication Methods”Tellexa API supports two authentication methods:
1. API Keys
Section titled “1. API Keys”Best for server-to-server communication and scripts.
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://api.tellexa.ai/v1/assistantsCharacteristics:
- Simple to implement
- Long-lived credentials
- Best for backend services
- Can be scoped to specific permissions
2. OAuth 2.0
Section titled “2. OAuth 2.0”Best for user-facing applications.
Authorization: Bearer ACCESS_TOKENCharacteristics:
- User-delegated access
- Short-lived tokens (1 hour)
- Refresh tokens available
- Best for web/mobile apps
API Keys
Section titled “API Keys”Creating an API Key
Section titled “Creating an API Key”- Go to Settings → API
- Click Create API Key
- Name your key (e.g., “Production Server”)
- Select permissions/scopes
- Copy and securely store the key
Key Permissions
Section titled “Key Permissions”| Permission | Description |
|---|---|
read | Read-only access to data |
write | Create and update records |
admin | Full administrative access |
messages | Send and receive messages |
integrations | Manage integrations |
Revoking Keys
Section titled “Revoking Keys”If a key is compromised:
- Go to Settings → API
- Find the key in the list
- Click Revoke
- Generate a new key if needed
OAuth 2.0
Section titled “OAuth 2.0”Authorization Flow
Section titled “Authorization Flow”- Redirect to authorize:
GET https://auth.tellexa.ai/oauth/authorize ?client_id=YOUR_CLIENT_ID &redirect_uri=https://yourapp.com/callback &response_type=code &scope=read+messages- Exchange code for token:
POST https://auth.tellexa.ai/oauth/tokenContent-Type: application/x-www-form-urlencoded
grant_type=authorization_code&code=AUTHORIZATION_CODE&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&redirect_uri=https://yourapp.com/callback- Token response:
{ "access_token": "eyJ...", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "dGVzdC...", "scope": "read messages"}Refreshing Tokens
Section titled “Refreshing Tokens”POST https://auth.tellexa.ai/oauth/tokenContent-Type: application/x-www-form-urlencoded
grant_type=refresh_token&refresh_token=YOUR_REFRESH_TOKEN&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRETBest Practices
Section titled “Best Practices”Secure Storage
Section titled “Secure Storage”- ✅ Use environment variables
- ✅ Use secrets managers (Vault, AWS Secrets)
- ✅ Encrypt at rest
- ❌ Don’t commit to version control
- ❌ Don’t log credentials
Key Rotation
Section titled “Key Rotation”- Rotate API keys periodically (every 90 days recommended)
- Use multiple keys for different environments
- Monitor key usage for anomalies
Least Privilege
Section titled “Least Privilege”- Grant only necessary permissions
- Use read-only keys where possible
- Create separate keys per application
Questions? Contact API support →