Authentication¶
Learn how to authenticate your API requests to Vectorcache.
API Keys¶
Vectorcache uses API keys for authentication. Each API key is associated with a specific project.
Creating an API Key¶
- Log in to your dashboard
- Navigate to your project
- Go to the API Keys tab
- Click Create API Key
- Give it a descriptive name
- Copy the key immediately - you won't see it again!
API Key Format¶
API keys follow this format:
- Prefix:
vc_ - 32 hexadecimal characters
Using API Keys¶
HTTP Header¶
Include your API key in the Authorization header using Bearer authentication:
Example Requests¶
Security Best Practices¶
1. Store Keys Securely¶
❌ Never hardcode API keys:
✅ Use environment variables:
2. Use Environment Variables¶
.env file:
Never commit .env files to git:
3. Rotate Keys Regularly¶
- Create a new API key
- Update your application to use the new key
- Revoke the old key once migration is complete
4. Use Different Keys per Environment¶
# .env.development
VECTORCACHE_API_KEY=vc_dev_key123...
# .env.production
VECTORCACHE_API_KEY=vc_prod_key456...
5. Limit Key Exposure¶
- Use separate keys for different applications
- Revoke keys when they're no longer needed
- Monitor key usage in the dashboard
Managing API Keys¶
Viewing API Keys¶
- Go to your project dashboard
- Navigate to API Keys tab
- View all active and revoked keys
You'll see:
- Key prefix (e.g., vc_1234...)
- Key name
- Creation date
- Last used date
- Status (Active/Revoked)
Revoking API Keys¶
To revoke a key:
- Go to API Keys tab
- Find the key to revoke
- Click Revoke
- Confirm the action
⚠️ Warning: Revoking a key immediately disables it. Any applications using that key will receive 401 errors.
Key Usage Tracking¶
Monitor your API key usage:
- Last Used: When the key was last used
- Request Count: Total requests made with this key
- Usage Metrics: Available in the Analytics tab
Authentication Errors¶
401 Unauthorized¶
Missing or invalid API key:
Causes: - API key not provided - Invalid API key format - Key has been revoked - Key doesn't exist
Solution:
- Verify your API key is correct
- Check if the key is active in your dashboard
- Ensure the Authorization header is properly formatted
403 Forbidden¶
API key doesn't have permission:
Causes: - Using an API key from a different project - Key permissions have been restricted
Solution: - Use the correct API key for this project - Check key permissions in the dashboard
API Key Scopes (Coming Soon)¶
Future releases will support scoped API keys with granular permissions:
cache:read- Read from cache onlycache:write- Write to cache onlycache:*- Full cache accessanalytics:read- View analyticskeys:manage- Manage API keys
Next Steps¶
- Cache Endpoints - Use the cache API
- Error Handling - Handle authentication errors
- Best Practices - Production security tips