copy Copy chevron-down
Getting Started Authentication Learn how to authenticate your requests to the Halfred API using API keys, manage them securely, and follow security best practices.
All requests to the Halfred API require authentication using an API key. API keys are associated with your account and allow you to track usage, and see recent logs status.
Getting an API Key
First Time Login
When you log in to your Halfred dashboardarrow-up-right for the first time:
Halfred automatically creates a default project for you
Your API key is automatically generated and displayed
Copy and store your API key securely - you'll need it for your integration
⚠️ Important : Store your API key safely. While you can regenerate it later, any applications using the old key will stop working.
Regenerating Your API Key
If you lose your API key or need to revoke it for security reasons:
Navigate to the "Your Key" section
Click the three dots menu (⋮)
Select "Revoke Key & Get New One"
Copy your new API key immediately
⚠️ Warning : Revoking your key is immediate. Update all applications using the old key to avoid service interruption.
Halfred API keys follow this format:
All keys start with the halfred_ prefix followed by a unique identifier.
HTTP Header Authentication
Include your API key in the Authorization header using the Bearer scheme:
Node.js (Halfred SDK)
Python (Halfred SDK)
JavaScript (fetch)
Environment Variables
Store your API keys in environment variables instead of hardcoding them.
The SDK automatically reads the HALFRED_API_KEY environment variable. You can also explicitly provide the API key:
Security Best Practices
Store keys securely : Use environment variables or secret management services
Rotate keys regularly : Generate new keys periodically and revoke old ones
Monitor usage : Check your dashboard for unusual activity
Use server-side only : Never expose API keys in client-side code or mobile apps
Don't commit to version control : Never add API keys to Git repositories
Don't hardcode keys : Avoid putting keys directly in source code
Don't expose in browsers : Never include keys in frontend JavaScript
Don't log keys : Avoid logging API keys in application logs
Managing API Keys
Viewing Your Keys
In your project dashboard:
Navigate to the Your Key section
Note : For security, only few characters of key are displayed.
If a key is compromised or no longer needed:
Navigate to the "Your Key" section
Click the three dots menu (⋮)
Select "Revoke Key & Get New One"
Copy your new API key immediately
⚠️ Warning : Revoking a key is immediate and irreversible. Any applications using that key will stop working.
Troubleshooting
Authentication Failed (401)
Error Message : "Invalid API key" or "Authentication failed"
Solutions :
Verify you've included the full API key with the halfred_ prefix
Check that the key hasn't been revoked
Ensure you're using the correct Authorization: Bearer header format
Confirm the key belongs to the correct project
Error Message : "API key not found"
Solution : The key may have been revoked. Generate a new key in your dashboard.
Testing Authentication
Test your API key with a simple request:
If successful, you'll receive a list of available models. If authentication fails, you'll see an error message.
For authentication issues:
Dashboard : Check your project's API Keys section
Next Steps : Now that you understand authentication, explore our SDK Integration guides or REST API Reference .
Last updated 3 months ago