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
Your API key for authentication. Format: Bearer your_api_key_here
Response
Whether an error occurred (always false for successful requests)
Success message confirming API key validity
Unique identifier of the API key being used
User ID associated with the API key
Email address associated with the account
Current account status. Values: active, inactive
Maximum requests per hour for this API key
Remaining requests in the current hour
ISO timestamp when the rate limit resets
List of permissions granted to this API key Example: ["loops:read", "loops:write", "requests:read", "requests:write"]
curl -X GET https://api.hitl.sh/v1/test \
-H "Authorization: Bearer your_api_key_here"
200 Success
401 Invalid API Key
429 Rate Limited
{
"error" : false ,
"msg" : "API key is valid" ,
"data" : {
"api_key_id" : "65f1234567890abcdef12349" ,
"user_id" : "65f1234567890abcdef12346" ,
"email" : "[email protected] " ,
"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
Call this endpoint periodically in production to monitor API key health
Set up alerts if the endpoint returns unexpected responses
Include it in your application’s readiness probes
Check rate limits before making large batch operations
Implement backoff strategies when limits are low
Monitor the reset_at timestamp for planning
Test API keys in each environment (dev, staging, prod)
Verify permissions match expected capabilities
Ensure account status is active before deployment
Handle all possible response codes (200, 401, 429)
Log authentication failures for debugging
Implement retry logic with exponential backoff
Common Issues
If this endpoint fails, check these common issues:
Missing Authorization header - Ensure you’re including Authorization: Bearer your_api_key
Incorrect header format - Don’t include extra spaces or use wrong prefixes
Revoked API key - Check your dashboard if the key was revoked
Network issues - Verify you can reach api.hitl.sh
Rate limits - Wait if you’ve exceeded your hourly limit
Next Steps