Authentication
The Nexus API uses API keys to authenticate requests. This guide covers everything you need to know about authentication, from generating keys to implementing security best practices.API Key Overview
API keys are JWT (JSON Web Token) based credentials that:- Uniquely identify your integration
- Contain your organization and agent information
- Can be revoked or regenerated at any time
- Should be kept secure and never exposed publicly
Generating API Keys
1
Navigate to Integrations
Log in to your Nexus dashboard and go to the Integrations section
2
Create API Integration
Click Add Integration and select API as the integration type
3
Configure Integration
- Give your integration a descriptive name
- Select the AI agent to connect
- Click Create Integration
4
Generate Key
Click Generate API Key and securely store the key
Using API Keys
Request Headers
Include your API key in the request headers:Example Implementations
Security Best Practices
1. Environment Variables
Never hardcode API keys in your source code. Use environment variables:2. Server-Side Only
Always make API calls from your backend:3. Key Rotation
Regularly rotate your API keys to maintain security:- Generate a new API key
- Update your application to use the new key
- Verify the new key is working
- Revoke the old key
4. Monitor Usage
Regularly review your API usage to detect any unusual activity:- Check request patterns
- Monitor rate limit hits
- Review error logs
- Set up alerts for anomalies
Authentication Errors
401 Unauthorized
This error occurs when:- API key is missing from headers
- API key is invalid or malformed
- API key has been revoked
- Verify the API key is included in headers
- Check the key hasn’t been revoked
- Ensure no extra spaces or characters
- Generate a new key if needed
403 Forbidden
This error occurs when:- API key lacks required permissions
- Integration is disabled
- Agent access is restricted
- Check integration permissions
- Verify agent is active
- Contact support if issues persist
API Key Management
Viewing Keys
You can view your API keys in the dashboard:- Navigate to Integrations
- Click on your integration
- View key metadata (not the full key)
Revoking Keys
To revoke a compromised key:- Go to your integration settings
- Click Revoke Key
- Generate a new key immediately
- Update your application
Multiple Keys
You can have multiple API keys for different environments:- Development key with limited rate limits
- Staging key for testing
- Production key with full access
Advanced Authentication
JWT Claims
Your API key is a JWT containing:Custom Headers
For additional security, you can include custom headers:Troubleshooting
Common Issues
API key not working
API key not working
- Verify the key is copied correctly 2. Check for extra spaces or line breaks 3. Ensure the key hasn’t expired 4. Confirm the integration is active
Getting 401 errors
Getting 401 errors
- Check header name is exactly
api-key2. Verify the key format 3. Ensure no “Bearer” prefix 4. Test with a fresh key
Intermittent authentication failures
Intermittent authentication failures
- Check for rate limiting 2. Verify server time sync 3. Review network connectivity 4. Monitor for key rotation issues