API Key Authentication
JobHive uses API key authentication to secure all API endpoints. Your API key must be included in the Authorization header of every request.
Getting Your API Key
Navigate to API Settings
Go to Settings → API Keys in the main navigation
Generate New Key
Click “Generate New API Key” and provide a descriptive name for identification
Copy and Store Securely
Copy your API key immediately - it will only be shown once. Store it securely in your environment variables.
Include your API key in the Authorization header using the Bearer token format:
Authorization: Bearer YOUR_API_KEY
Example Requests
curl -X GET "https://backend.jobhive.ai/v1/interviews" \
-H "Authorization: Bearer jh_live_abc123def456ghi789" \
-H "Content-Type: application/json"
API Key Types & Environments
JobHive API keys follow a consistent format for easy identification:
Environment Format Example Development jh_dev_*jh_dev_abc123def456Production jh_live_*jh_live_xyz789ghi012Test Mode jh_test_*jh_test_mno345pqr678
Environment Separation
Development Keys
Production Keys
Test Mode Keys
Purpose : Local development and testingFeatures :
Access to sandbox environment
Unlimited test interviews
No billing or credit consumption
Separate data isolation
Limitations :
Cannot create production interviews
Results not stored permanently
Limited to development features
Purpose : Live application integrationFeatures :
Full platform access
Real interview creation and processing
Production-grade SLA and support
Complete feature access
Usage :
Consumes account credits/quota
Results stored permanently
Used for actual candidate interviews
Purpose : Integration testing without consuming creditsFeatures :
Production environment access
No credit consumption
Realistic API responses
Safe for automated testing
Behavior :
Interviews marked as test mode
No candidate notifications sent
Results available but flagged as test
Security Best Practices
API Key Management
Secure Storage Do’s
Store in environment variables
Use secret management systems
Rotate keys regularly (quarterly)
Use different keys per environment
Usage Protection Don’ts
Never commit keys to version control
Don’t expose in client-side code
Avoid logging keys in application logs
Don’t share keys via email or chat
Environment Variable Setup
# JobHive API Configuration
JOBHIVE_API_KEY = jh_live_your_production_key_here
JOBHIVE_WEBHOOK_SECRET = whsec_your_webhook_secret_here
JOBHIVE_ENVIRONMENT = production
# Development overrides
# JOBHIVE_API_KEY=jh_dev_your_development_key_here
# JOBHIVE_ENVIRONMENT=development
Key Rotation
Regular API key rotation is a security best practice:
Generate New Key
Create a new API key in your dashboard before the current one expires
Update Applications
Deploy the new key to all applications and environments
Monitor Usage
Verify that all systems are using the new key successfully
Revoke Old Key
Delete the old API key from your dashboard once migration is complete
Error Handling
Authentication Errors
401 Unauthorized - Missing API Key
401 Unauthorized - Invalid API Key
401 Unauthorized - Expired API Key
403 Forbidden - Insufficient Permissions
{
"success" : false ,
"error" : {
"code" : "AUTHENTICATION_REQUIRED" ,
"message" : "API key is required. Include 'Authorization: Bearer YOUR_API_KEY' header." ,
"details" : {
"header_missing" : "Authorization"
}
}
}
Handling Authentication Errors
async function makeAuthenticatedRequest ( url , options = {}) {
const response = await fetch ( url , {
... options ,
headers: {
'Authorization' : `Bearer ${ process . env . JOBHIVE_API_KEY } ` ,
'Content-Type' : 'application/json' ,
... options . headers
}
});
if ( response . status === 401 ) {
const error = await response . json ();
switch ( error . error . code ) {
case 'AUTHENTICATION_REQUIRED' :
throw new Error ( 'API key is missing from request' );
case 'INVALID_API_KEY' :
throw new Error ( 'API key is invalid - check your environment variables' );
case 'API_KEY_EXPIRED' :
throw new Error ( 'API key has expired - generate a new one' );
default :
throw new Error ( `Authentication failed: ${ error . error . message } ` );
}
}
return response ;
}
API Key Permissions
Permission Scopes
API keys can be configured with specific permission scopes to limit access:
Permission Description Example Usage interviews:readView interview data and results Dashboard analytics interviews:writeCreate and update interviews Scheduling system interviews:deleteCancel and delete interviews Admin operations webhooks:readView webhook configurations Integration status webhooks:writeCreate and manage webhooks Event handling setup analytics:readAccess aggregate analytics Reporting systems
Creating Scoped Keys
Navigate to API Keys
Go to Settings → API Keys in your dashboard
Click Advanced Options
Select “Create Key with Custom Permissions” instead of default key
Select Permissions
Choose only the permissions your application needs
Set Expiration
Optionally set an expiration date for additional security
Rate Limiting & Quotas
All API responses include rate limiting information:
X-RateLimit-Limit : 300
X-RateLimit-Remaining : 299
X-RateLimit-Reset : 1640995200
X-RateLimit-Retry-After : 60
Handling Rate Limits
async function makeRateLimitedRequest ( url , options ) {
const response = await fetch ( url , options );
if ( response . status === 429 ) {
const retryAfter = response . headers . get ( 'X-RateLimit-Retry-After' );
console . log ( `Rate limited. Retrying after ${ retryAfter } seconds` );
await new Promise ( resolve => setTimeout ( resolve , retryAfter * 1000 ));
return makeRateLimitedRequest ( url , options ); // Retry
}
return response ;
}
Testing Authentication
Verify API Key
Test your API key with a simple request:
curl -X GET "https://backend.jobhive.ai/v1/account/profile" \
-H "Authorization: Bearer YOUR_API_KEY"
Expected successful response:
{
"success" : true ,
"data" : {
"company_name" : "Your Company" ,
"plan" : "Professional" ,
"api_key_permissions" : [ "interviews:read" , "interviews:write" ],
"rate_limit" : {
"requests_per_minute" : 300 ,
"current_usage" : 1
}
}
}
Security Tip : Always test API keys in development before deploying to production. Use the account profile endpoint to verify both authentication and permissions.
Important : API keys provide full access to your JobHive account. Treat them like passwords and follow security best practices to protect your data and prevent unauthorized usage.