Overview
RegPilot uses API keys to authenticate requests. Your API keys carry many privileges, so be sure to keep them secure and never share them publicly.API Key Types
RegPilot offers different types of API keys for different use cases:Gateway Keys
Purpose: AI Gateway API requests (
/api/ai/*)Prefix: sk_Permissions: Chat completions, AI model access, Governor validationProject Keys
Purpose: Compliance management APIsPrefix:
pk_Permissions: Violations, models registry, compliance dataCreating API Keys
1
Navigate to AI Gateway
Go to your project dashboard and select AI Gateway → Overview
2
Click Manage Keys
Click the “Manage Keys” button to open the API keys panel
3
Create New Key
Click “Create New Key”, give it a descriptive name, and save it immediately
4
Copy and Store Securely
Copy the key to your password manager or environment variables
Authentication Methods
Method 1: X-API-Key Header (Recommended)
The preferred method for authenticating API requests:Method 2: Authorization Bearer Token
Alternative authentication using the Authorization header:Method 3: SDK Authentication
When using the official RegPilot SDK, authentication is handled automatically:Environment-Specific Keys
Use different API keys for different environments:- Development
- Staging
- Production
.env.development
- Lower rate limits
- Verbose logging enabled
- Test mode activated
Security Best Practices
Use Environment Variables
Use Environment Variables
Never hardcode API keys in your source code:
Server-Side Only
Server-Side Only
Only use API keys in server-side code, never in client-side JavaScript:
Rotate Keys Regularly
Rotate Keys Regularly
Rotate your API keys periodically:
- Create a new API key
- Update your environment variables
- Deploy the changes
- Delete the old key after verification
Use Least Privilege
Use Least Privilege
Create separate API keys for different services:
- Frontend API route: Gateway key for chat
- Backend service: Project key for compliance data
- CI/CD pipeline: Read-only key for testing
Monitor Usage
Monitor Usage
Regularly review API key usage in your dashboard:
- Check for unusual activity
- Monitor request patterns
- Review error rates
- Verify geographic locations
Managing API Keys
Viewing API Keys
View all your API keys in AI Gateway → Overview → Manage Keys:- Name: Descriptive key name
- Key Prefix: First/last characters for identification
- Created: When the key was created
- Last Used: Most recent usage timestamp
- Status: Active or inactive
Deactivating Keys
Temporarily disable a key without deleting it:- Go to AI Gateway → Overview → Manage Keys
- Find the key you want to deactivate
- Click the “Deactivate” button
- Confirm the action
Deactivated keys will return
401 Unauthorized errors until reactivated.Deleting Keys
Permanently remove an API key:- Go to AI Gateway → Overview → Manage Keys
- Find the key you want to delete
- Click the “Delete” button
- Confirm the action
Testing Authentication
Verify your API key is working correctly:Error Responses
Common authentication errors and how to resolve them:| Status Code | Error | Solution |
|---|---|---|
401 | Missing API key | Include X-API-Key header in your request |
401 | Invalid or inactive API key | Check that your API key is correct and active |
403 | API key lacks required permissions | Use a key with appropriate permissions |
429 | Rate limit exceeded | Wait before retrying or upgrade your plan |
Rate Limits
API key rate limits depend on your plan:- Free Tier
- Pro Plan
- Enterprise
- Requests: 1,000 per day
- Burst: 10 requests per second
- Governor: Not available
Rate limits are tracked per API key. Distribute load across multiple keys if needed.