Skip to main content

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:
  • Create, read, update, and delete loops
  • Manage loop members (add/remove reviewers)
  • View loop statistics and activity
  • Create requests in loops you own
  • View and cancel your requests
  • Add feedback to completed requests
  • Access request history and responses
  • 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 the Authorization header of all API requests:

Testing Your API Key

Use the test endpoint to verify your API key is working correctly:
Expected Response:

Rate Limits

API keys have usage limits to ensure fair usage:

Current Rate Limits

  • 100 requests per hour per API key
  • Rate limits reset at the top of each hour (e.g., 1:00 PM, 2:00 PM, not rolling 60 minutes)
  • Rate limit information included in response headers
  • X-RateLimit-Reset header shows the exact UTC timestamp when the limit resets
Rate Limit Headers:

Handling Rate Limits

Integration Examples

Creating Your First Loop

Submitting a Request

Troubleshooting

Common Issues

Symptoms: {"error": true, "msg": "Invalid authorization token"}Solutions:
  • Verify the API key is copied correctly without extra spaces
  • Check if the key has been revoked in your dashboard
  • Ensure you’re using the Bearer format: Authorization: Bearer YOUR_API_KEY
  • Confirm you’re not including extra characters or line breaks
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
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
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

Debug Authentication

Use this debug script to troubleshoot API key issues:

Next Steps

Now that you have your API key set up, you’re ready to:

Test Your API Key

Verify your API key is working with the test endpoint.

Create Your First Loop

Set up a human-in-the-loop workflow using the API.

Submit Your First Request

Send content for human review and get responses.

API Reference

Explore all available endpoints and integration options.