Authentication
Linktor uses JWT-based authentication for the API and dashboard.
API Authentication
API Keys
The recommended way to authenticate API requests is using API keys:
- Go to Settings → API Keys in the dashboard
- Click Generate New Key
- Copy the key (it won't be shown again)
- Use it in the
Authorizationheader:
curl -X GET http://localhost:8081/api/v1/conversations \
-H "Authorization: Bearer YOUR_API_KEY"
JWT Tokens
For user-based authentication, use JWT tokens:
# Login to get a token
curl -X POST http://localhost:8081/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "your-password"
}'
# Response
{
"token": "eyJhbGciOiJIUzI1NiIs...",
"user": {
"id": "user_123",
"email": "user@example.com",
"role": "admin"
}
}
# Use the token
curl -X GET http://localhost:8081/api/v1/conversations \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."
SDK Authentication
All SDKs support API key authentication:
// TypeScript
import { Linktor } from '@linktor/sdk'
const client = new Linktor({ apiKey: 'YOUR_API_KEY' })
# Python
from linktor import Linktor
client = Linktor(api_key='YOUR_API_KEY')
// Go
client := linktor.New("YOUR_API_KEY")
User Roles
Linktor supports three user roles:
| Role | Permissions |
|---|---|
| Admin | Full access to all features |
| Agent | Handle conversations, view analytics |
| Viewer | Read-only access to dashboards |
Security Best Practices
- Never expose API keys in client-side code
- Rotate keys regularly - generate new keys periodically
- Use environment variables - don't hardcode keys
- Limit key permissions - use the minimum required scope
- Enable HTTPS - always use TLS in production
Rate Limiting
API requests are rate-limited:
| Endpoint | Limit |
|---|---|
| Authentication | 10 req/min |
| Messages | 100 req/min |
| Other endpoints | 60 req/min |
Rate limit headers are included in responses:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1640000000
Next Steps
- API Reference - Explore all endpoints
- SDKs - Use official client libraries