GET
/
v1
/
test
curl -X GET https://api.hitl.sh/v1/test \
  -H "Authorization: Bearer your_api_key_here"
{
  "error": false,
  "msg": "API key is valid",
  "data": {
    "api_key_id": "65f1234567890abcdef12349",
    "user_id": "65f1234567890abcdef12346",
    "email": "user@example.com",
    "account_status": "active",
    "rate_limit": {
      "limit": 100,
      "remaining": 95,
      "reset_at": "2024-03-15T15:00:00Z"
    },
    "permissions": [
      "loops:read",
      "loops:write", 
      "requests:read",
      "requests:write"
    ]
  }
}
Verify your API key is working correctly and get information about your account, rate limits, and permissions. This is the first endpoint you should call when integrating with HITL.sh.
This endpoint is perfect for debugging authentication issues and monitoring your API usage.

Authentication

Authorization
string
required
Your API key for authentication. Format: Bearer your_api_key_here

Response

error
boolean
Whether an error occurred (always false for successful requests)
msg
string
Success message confirming API key validity
data
object
curl -X GET https://api.hitl.sh/v1/test \
  -H "Authorization: Bearer your_api_key_here"
{
  "error": false,
  "msg": "API key is valid",
  "data": {
    "api_key_id": "65f1234567890abcdef12349",
    "user_id": "65f1234567890abcdef12346",
    "email": "user@example.com",
    "account_status": "active",
    "rate_limit": {
      "limit": 100,
      "remaining": 95,
      "reset_at": "2024-03-15T15:00:00Z"
    },
    "permissions": [
      "loops:read",
      "loops:write", 
      "requests:read",
      "requests:write"
    ]
  }
}

Use Cases

Integration Testing

Use this endpoint in your CI/CD pipeline to verify API key setup:
def test_api_key_setup():
    """Test that API key is properly configured"""
    response = requests.get(
        "https://api.hitl.sh/v1/test", 
        headers={"Authorization": f"Bearer {os.environ['HITL_API_KEY']}"}
    )
    
    assert response.status_code == 200
    data = response.json()
    assert data["error"] == False
    assert data["data"]["account_status"] == "active"
    
    print("✅ API key configuration verified")

Rate Limit Monitoring

Check your rate limit status before making batch requests:
async function checkRateLimits() {
    const response = await axios.get('https://api.hitl.sh/v1/test', { headers });
    const rateLimit = response.data.data.rate_limit;
    
    if (rateLimit.remaining < 10) {
        console.warn(`Low rate limit: ${rateLimit.remaining}/${rateLimit.limit} remaining`);
        console.log(`Resets at: ${rateLimit.reset_at}`);
    }
    
    return rateLimit;
}

Health Check Endpoint

Use in your application’s health checks:
def health_check():
    """Application health check including HITL.sh API"""
    try:
        response = requests.get(
            "https://api.hitl.sh/v1/test",
            headers={"Authorization": f"Bearer {HITL_API_KEY}"},
            timeout=5
        )
        
        if response.status_code == 200 and not response.json()["error"]:
            return {"hitl_api": "healthy"}
        else:
            return {"hitl_api": "unhealthy", "error": response.json()}
            
    except Exception as e:
        return {"hitl_api": "unhealthy", "error": str(e)}

Debugging Authentication Issues

When experiencing authentication problems, this endpoint provides detailed information:
def debug_auth_issues():
    """Debug authentication problems"""
    try:
        response = requests.get("https://api.hitl.sh/v1/test", headers=headers)
        
        if response.status_code == 200:
            data = response.json()["data"]
            print("🔍 Authentication Debug Info:")
            print(f"   API Key ID: {data['api_key_id']}")
            print(f"   Account Status: {data['account_status']}")
            print(f"   Permissions: {', '.join(data['permissions'])}")
            print(f"   Rate Limit: {data['rate_limit']['remaining']}/{data['rate_limit']['limit']}")
            
        elif response.status_code == 401:
            print("❌ Invalid API key - check your authorization header")
            
        elif response.status_code == 429:
            print("⏰ Rate limit exceeded - wait before retrying")
            
    except requests.exceptions.RequestException as e:
        print(f"🌐 Network error: {e}")

Best Practices

Common Issues

If this endpoint fails, check these common issues:
  1. Missing Authorization header - Ensure you’re including Authorization: Bearer your_api_key
  2. Incorrect header format - Don’t include extra spaces or use wrong prefixes
  3. Revoked API key - Check your dashboard if the key was revoked
  4. Network issues - Verify you can reach api.hitl.sh
  5. Rate limits - Wait if you’ve exceeded your hourly limit

Next Steps