Overview
The CodeThreat API uses API keys to authenticate requests. You can generate and manage your API keys from your organization settings in the CodeThreat dashboard.Getting Your API Key
1
Navigate to Settings
Log into your CodeThreat dashboard and go to Organization Settings → API Keys.
2
Generate New Key
Click Generate API Key and provide a descriptive name (e.g., “CI/CD Pipeline”, “Development”).
3
Copy and Store Securely
Copy the generated API key immediately. For security, it won’t be shown again.
4
Configure Your Requests
Include the API key in the
X-API-Key header of all API requests.Making Authenticated Requests
Include your API key in theX-API-Key header:
Environment Variables
Store API keys as environment variables for security:Error Responses
401 Unauthorized
Missing or invalid API key:403 Forbidden
Valid API key but insufficient permissions:API Key Best Practices
Rotate Regularly
Rotate API keys every 90 days or when team members leave
Use Descriptive Names
Name keys by purpose: “Production CI/CD”, “Staging Environment”
Scope Appropriately
Use the minimum required permissions for each key
Monitor Usage
Track API key usage in your audit logs
