Skip to main content

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 at https://api.hitl.sh/v1.

Getting Your API Key

  1. Log in to your HITL.sh dashboard
  2. Navigate to Settings → API Keys
  3. Click “Create New API Key”
  4. Copy the generated key (shown only once)
  5. Store securely in your environment variables

Using API Keys

Include your API key in the Authorization 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-Reset shows exact UTC timestamp of next reset
Rate limit headers:

API Key Permissions

API keys have specific permissions based on your account:
  • 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
  • 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

Solutions:
  • Include the Authorization header in your request
  • Use the correct format: Authorization: Bearer your_api_key_here
Solutions:
  • Ensure header starts with “Bearer ” (with a space after it)
  • Check for typos in the header format
  • Don’t use quotes around the API key value
Solutions:
  • Verify API key is correct (no typos or extra spaces)
  • Check if key has been revoked or deleted
  • Regenerate a new API key if needed
  • Ensure you’re not using an old/expired key
Solutions:
  • Check API key status in your dashboard
  • Reactivate the key if it was disabled
  • Generate a new API key if needed
Solutions:
  • Check API key permissions
  • Verify resource ownership
  • Contact support for permission updates
Solutions:
  • 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.

Webhooks

Use callback URLs to receive notifications when requests complete.