Overview
TelemanAI uses two authentication methods depending on the endpoint:- Laravel Sanctum - Token-based authentication for standard API endpoints
- WordPress Integration Token - Custom token authentication for WordPress-integrated endpoints
- SaaS Key - Environment-based authentication for subscription management endpoints
Authentication Methods
Laravel Sanctum Authentication
Sanctum provides token-based authentication for standard API endpoints.Obtaining a Token
Tokens are typically obtained through the Laravel application’s authentication flow. Once authenticated, you’ll receive a bearer token.Using the Token
WordPress Integration Token
WordPress-integrated endpoints use a customuser_token authentication method.
Middleware
Endpoints protected by thewordpress middleware require a valid user_token parameter.
How It Works
Theuser_token is validated against the third_parties table:
- Token is looked up in the
ThirdPartymodel - If valid, the associated user is returned
- If invalid, returns
401 Unauthorized
Using the WordPress Token
SaaS Key Authentication
Subscription and expiry endpoints use thecheck.expiry middleware which validates a saas_key parameter.
Middleware
Thecheck.expiry middleware validates the saas_key against the environment variable SAAS_KEY.
Using the SaaS Key
Error Responses
Unauthorized (401)
Returned when authentication fails:Security Best Practices
- Store tokens securely in environment variables
- Use HTTPS for all API requests
- Rotate tokens periodically
- Implement token expiration policies
- Monitor for suspicious API activity
Next Steps
Campaign API
Learn how to manage campaigns via API
Subscription API
Check subscription status and usage limits