Freigent uses API keys for authentication. All API requests must include a valid API key in the Authorization header.
Getting Your API Key
-
Log into Your Account
- Visit app.freigent.ai
- Sign in with your credentials
-
Navigate to API Settings
- Go to Settings → API Keys
- Click Generate New Key
-
Configure Key Permissions
- Select the appropriate permissions for your use case
- Choose an expiration date (optional)
- Add a description for easy identification
Using API Keys
Header Authentication
Include your API key in the Authorization header of all requests:
curl -H "Authorization: Bearer your_api_key_here" \
https://api.freigent.ai/v1/loads
JavaScript/Node.js Example
const apiKey = 'your_api_key_here';
const response = await fetch('https://api.freigent.ai/v1/loads', {
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
});
const data = await response.json();
Python Example
import requests
api_key = 'your_api_key_here'
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
response = requests.get(
'https://api.freigent.ai/v1/loads',
headers=headers
)
data = response.json()
Security Best Practices
Environment Variables
Never hardcode API keys in your source code. Use environment variables:
# .env
FREIGENT_API_KEY=your_api_key_here
const apiKey = process.env.FREIGENT_API_KEY;
HTTPS Only
Always use HTTPS when making API requests. HTTP requests will be rejected.
Testing Your Authentication
Use this endpoint to verify your API key is working:
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.freigent.ai/v1/auth/verify
Success response:
{
"authenticated": true,
"user_id": "user_123",
"permissions": ["read", "write"]
}