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:
Using the API Playground: When testing endpoints in the documentation playground, enter your API key in the format:
Bearer your_api_key_here (including the word “Bearer” and a space before your key).API Key Rate Limits
Each API key has the following limits:Rate Limits
- 100 requests per hour per API key
- Resets at the top of each hour (e.g., 1:00 PM, 2:00 PM)
- Rate limit headers included in all responses
X-RateLimit-Resetshows exact UTC timestamp of next reset
API Key Permissions
API keys have specific permissions based on your account:Loop Management
Loop Management
- Create new loops
- View loops you created or are a member of
- Update and delete loops you created (creator only)
- Add/remove members from loops you created (creator only)
- View loop statistics and member lists
Request Operations
Request Operations
- Create requests in loops you created
- View requests in loops you’re a member of
- Cancel your own requests
- Add feedback to completed requests you created
- Access request history and response data
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 - Missing Authorization Header
401 Unauthorized - Missing Authorization Header
401 Unauthorized - Invalid Header Format
401 Unauthorized - Invalid Header Format
401 Unauthorized - Invalid API Key
401 Unauthorized - Invalid API Key
401 Unauthorized - Inactive API Key
401 Unauthorized - Inactive API Key
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.