Authentication
HITL.sh uses API key authentication for secure access to the API. All requests must include your API key in the Authorization header using the Bearer token format.API Key Authentication
API keys are designed for server-to-server communication and automated workflows. They provide access to the HITL.sh API athttps://api.hitl.sh/v1
.
Getting Your API Key
- Log in to your HITL.sh dashboard
- Navigate to Settings → API Keys
- Click “Create New API Key”
- Copy the generated key (shown only once)
- Store securely in your environment variables
Using API Keys
Include your API key in theAuthorization
header with the Bearer
prefix:
API Key Rate Limits
Each API key has the following limits:Rate Limits
- 100 requests per hour per API key
- Resets every hour from first request
- Rate limit headers included in all responses
API Key Permissions
API keys have specific permissions based on your account:Loop Management
Loop Management
- Create, read, update, and delete loops
- Manage loop members (add/remove)
- View loop statistics and analytics
Request Operations
Request Operations
- Create requests in loops you own
- View and cancel your requests
- Add feedback to completed requests
- Access request history and analytics
Webhook Configuration
Webhook Configuration
- Set up webhook endpoints
- Configure webhook events
- View webhook delivery logs
Security Best Practices
API Key Security
1
Environment Variables
Store API keys in environment variables, never in code:
2
Key Rotation
Rotate API keys regularly:
- Set up automatic rotation (recommended: every 90 days)
- Have a backup key ready before rotating
- Update all systems using the old key
3
Least Privilege
Use separate API keys for different environments:
- Development keys with limited permissions
- Production keys with full access
- Testing keys for CI/CD pipelines
4
Monitor Usage
Track API key usage in your dashboard:
- Monitor request patterns for anomalies
- Set up alerts for unusual activity
- Review access logs regularly
Secure Headers
Always use HTTPS and proper security headers:Error Handling
Authentication Errors
401 Unauthorized - Invalid API Key
401 Unauthorized - Invalid API Key
401 Unauthorized - Missing Authorization Header
401 Unauthorized - Missing Authorization Header
403 Forbidden - Insufficient Permissions
403 Forbidden - Insufficient Permissions
- Check API key permissions
- Verify resource ownership
- Contact support for permission updates
429 Rate Limit Exceeded
429 Rate Limit Exceeded
- Wait for rate limit reset
- Implement exponential backoff
- Upgrade to higher tier if needed
Retry Logic
Implement robust retry logic for authentication failures:Testing Authentication
API Key Testing
Use the dedicated test endpoint to verify your API key:The
/test
endpoint provides detailed information about your API key, including rate limits and permissions. Use this for debugging and monitoring.Debug Authentication Issues
Use verbose curl to debug authentication problems:Environment-Specific Testing
Test across different environments:Next Steps
Create Your First Loop
Start using your API key to create loops and manage workflows.
Error Handling Guide
Learn how to handle and debug authentication errors effectively.
Rate Limiting
Understand rate limits and how to optimize your API usage.
Webhooks
Set up webhooks to receive real-time notifications from HITL.sh.