API Keys
API keys are your secure credentials for integrating HITL.sh with your applications, workflows, and third-party tools. They authenticate your requests and ensure only authorized systems can interact with your loops and data.Understanding API Keys
API keys in HITL.sh serve as your application’s identity and provide secure access to:- Loop Management: Create, read, update, and delete loops
- Request Operations: Submit requests and retrieve responses
- Loop Members: Add and remove reviewers from loops
- Webhook Configuration: Set up event notifications
- Request Feedback: Add feedback to completed requests
Keep your API keys secure and never expose them in client-side code or public repositories. Treat them like passwords.
Generating Your First API Key
1
Log In to Dashboard
Visit my.hitl.sh and log in to your account.
2
Navigate to API Keys
Go to Settings → API Keys from the main navigation menu.
3
Create New API Key
Click the “Create New API Key” button to generate a new key.
4
Copy and Store Securely
Copy the generated API key immediately and store it securely in environment variables. The key is only shown once for security reasons.
API keys are shown only once when created. Store them immediately in a secure location like environment variables or a secrets manager.
API Key Management
Viewing Active Keys
Your dashboard shows all active API keys with their:- Name: Descriptive label for easy identification
- Permissions: Access level granted to the key
- Created Date: When the key was generated
- Last Used: Most recent activity timestamp
- Status: Active, suspended, or expired
API Key Permissions
API keys have specific permissions based on your account and plan:Loop Operations
Loop Operations
- Create, read, update, and delete loops
- Manage loop members (add/remove reviewers)
- View loop statistics and activity
Request Operations
Request Operations
- Create requests in loops you own
- View and cancel your requests
- Add feedback to completed requests
- Access request history and responses
Webhook Configuration
Webhook Configuration
- Set up webhook endpoints for real-time notifications
- Configure webhook events and filters
- View webhook delivery logs and status
Security Best Practices
Environment Variables
Store API keys in environment variables, never hardcode them in your source code.
Key Rotation
Regularly rotate your API keys to minimize the impact of potential compromises.
Scope Permissions
Grant only the minimum permissions necessary for each integration.
Monitor Usage
Regularly review API key usage to detect unauthorized access.
Using API Keys
Authentication Header
Include your API key in theAuthorization
header of all API requests:
Testing Your API Key
Use the test endpoint to verify your API key is working correctly:Rate Limits
API keys have usage limits to ensure fair usage:Current Rate Limits
- 100 requests per hour per API key
- Rate limits reset hourly from the first request
- Rate limit information included in response headers
Handling Rate Limits
Integration Examples
Creating Your First Loop
Submitting a Request
Troubleshooting
Common Issues
401 Unauthorized - Invalid API Key
401 Unauthorized - Invalid API Key
403 Forbidden - Insufficient Permissions
403 Forbidden - Insufficient Permissions
Symptoms:
{"error": true, "msg": "Access denied to this resource"}
Solutions:- Verify your API key has the required permissions
- Check if you’re trying to access resources you don’t own
- Ensure your account has the necessary features enabled
429 Rate Limited
429 Rate Limited
Symptoms:
{"error": true, "msg": "API rate limit exceeded"}
Solutions:- Wait for the rate limit to reset (check
X-RateLimit-Reset
header) - Implement exponential backoff in your retry logic
- Use the
/test
endpoint to check your current rate limit status - Consider batching requests to optimize usage
Network or Connection Issues
Network or Connection Issues
Symptoms: Connection timeouts or network errorsSolutions:
- Verify you can reach
api.hitl.sh
from your network - Check if you’re behind a corporate firewall blocking the API
- Ensure you’re using HTTPS (not HTTP) for all requests
- Try from a different network to isolate connectivity issues