Authentication¶
Versioner uses dual authentication depending on the endpoint:
- API Keys - For event tracking from CI/CD systems
- JWT Tokens - For dashboard and resource management
Authentication Methods¶
API Keys (For CI/CD Integration)¶
API keys are used for event tracking endpoints that receive data from CI/CD systems:
POST /build-events/- Track buildsPOST /deployment-events/- Track deployments
API keys follow this format:
Example:
Parts¶
sk- Prefix indicating this is a secret keymycompany- Your account identifierk1- Key identifier (allows multiple keys per account)abc123...- Random secure string (32+ characters)
JWT Tokens (For Dashboard/CRUD)¶
JWT tokens are used for all other endpoints including:
- Product management (
/products/) - Environment management (
/environments/) - Version queries (
/versions/) - Deployment queries (
/deployments/) - Release management (
/releases/) - Notification configuration (
/notification-channels/,/notification-preferences/) - API key management (
/api-keys/)
JWT tokens are obtained by logging into the Versioner web application via Clerk authentication.
Using API Keys¶
For event tracking endpoints only.
Include your API key in the Authorization header using the Bearer scheme:
Examples¶
import requests
# Event tracking (API key)
headers = {
"Authorization": "Bearer sk_mycompany_k1_abc123def456...",
"Content-Type": "application/json"
}
data = {
"product_name": "my-service",
"version": "1.2.3",
"environment_name": "production",
"status": "success"
}
response = requests.post(
"https://api.versioner.io/deployment-events/",
headers=headers,
json=data
)
// Event tracking (API key)
const response = await fetch('https://api.versioner.io/deployment-events/', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_mycompany_k1_abc123def456...',
'Content-Type': 'application/json'
},
body: JSON.stringify({
product_name: 'my-service',
version: '1.2.3',
environment_name: 'production',
status: 'success'
})
});
Using JWT Tokens¶
For dashboard and CRUD endpoints.
JWT tokens are automatically included when using the Versioner web application. For programmatic access:
Getting a JWT Token¶
- Log in to app.versioner.io
- Open browser developer tools (F12)
- Go to Application → Cookies
- Find the
__sessioncookie - Copy the JWT token value
Examples¶
JWT Tokens for Automation
JWT tokens are not recommended for CI/CD automation because they:
- Expire after a short time (hours/days)
- Are tied to user sessions
- Require manual extraction from browser
Use API keys for CI/CD integration instead.
Managing API Keys¶
Creating Keys¶
Create API keys from the Versioner web application:
- Log in to app.versioner.io
- Go to Settings → Organization tab
- Scroll to API Keys section
- Click Create API Key
- Enter a name and description
- Copy the key (shown only once!)
- Store securely in your CI/CD secrets
Multiple Keys¶
You can have multiple API keys per account:
sk_mycompany_k1_...- Primary keysk_mycompany_k2_...- Secondary keysk_mycompany_k3_...- CI/CD key
This allows:
- Key rotation without downtime
- Different keys for different systems
- Revocation of compromised keys
Rotating Keys¶
To rotate keys:
- Create a new key (k2)
- Update systems to use new key
- Verify new key works
- Revoke old key (k1)
Security Best Practices¶
1. Never Commit Keys¶
❌ Never do this:
✅ Do this instead:
2. Use Environment Variables¶
Store keys in environment variables:
3. Restrict Key Access¶
- Only give keys to systems that need them
- Use different keys for different environments
- Revoke keys when no longer needed
4. Monitor Key Usage¶
Check the last_used_at field to detect:
- Unused keys (can be revoked)
- Unexpected usage (potential compromise)
Authentication Errors¶
401 Unauthorized¶
Cause: API key is invalid, missing, or revoked.
Response:
Solutions:
- Verify API key is correct
- Check key hasn't been revoked
- Ensure Authorization header is present
- Verify Bearer scheme is used
403 Forbidden¶
Cause: API key is valid but doesn't have permission.
Response:
Solutions: - Verify you're accessing resources in your account - Check key has necessary permissions
Rate Limiting¶
Coming Soon
Rate limiting is planned but not yet implemented.
Future rate limits will be:
- 1000 requests per minute per API key
- 10,000 requests per hour per account
Rate limit headers will be included in responses:
Which Authentication to Use?¶
Use API Keys For:¶
✅ CI/CD event tracking - GitHub Actions, Jenkins, GitLab CI, etc. - Build and deployment notifications - Automated workflows
Endpoints:
- POST /build-events/
- POST /deployment-events/
Use JWT Tokens For:¶
✅ Dashboard and resource management - Web application (automatic) - Querying deployment history - Managing products, environments, releases - Configuring notifications
Endpoints:
- All /products/, /environments/, /versions/, /deployments/, /releases/ endpoints
- All /notification-channels/, /notification-preferences/ endpoints
- All /api-keys/ endpoints
No Authentication Required:¶
GET /health- Health checkGET /docs- Interactive API documentationGET /redoc- Alternative API documentationGET /openapi.json- OpenAPI specification
Next Steps¶
- Learn about Event Tracking API
- Explore Event Types
- See Response Codes