curl -X GET https://api.hitl.sh/v1/requests/65f1234567890abcdef12348 \
-H "Authorization: Bearer your_api_key_here"
{
"error": false,
"msg": "Request retrieved successfully",
"data": {
"request": {
"id": "65f1234567890abcdef12348",
"loop_id": "65f1234567890abcdef12345",
"creator_id": "65f1234567890abcdef12346",
"api_key_id": "65f1234567890abcdef12349",
"processing_type": "time-sensitive",
"type": "markdown",
"priority": "high",
"request_text": "Please review this user-generated content for community guidelines compliance.",
"image_url": null,
"context": {
"user_id": "user123",
"post_id": "post456",
"automated_flags": ["potential_spam"]
},
"platform": "api",
"platform_version": "1.0.0",
"response_type": "single_select",
"response_config": {
"options": ["Approve", "Reject", "Needs Changes"]
},
"default_response": "Approve",
"timeout_at": "2024-03-15T11:30:00Z",
"callback_url": "https://example.com/webhook/response",
"broadcasted_to": [
{
"user_id": "65f1234567890abcdef12350",
"email": "reviewer1@example.com",
"role": "member",
"notification_sent": true,
"notification_error": null
},
{
"user_id": "65f1234567890abcdef12351",
"email": "reviewer2@example.com",
"role": "member",
"notification_sent": true,
"notification_error": null
}
],
"broadcasted_at": "2024-03-15T10:30:00Z",
"status": "pending",
"response_by": null,
"response_at": null,
"response_data": null,
"response_time_seconds": null,
"created_at": "2024-03-15T10:30:00Z",
"updated_at": "2024-03-15T10:30:00Z"
}
}
}
Retrieve detailed information about a specific request including status, response data, and broadcast results
curl -X GET https://api.hitl.sh/v1/requests/65f1234567890abcdef12348 \
-H "Authorization: Bearer your_api_key_here"
{
"error": false,
"msg": "Request retrieved successfully",
"data": {
"request": {
"id": "65f1234567890abcdef12348",
"loop_id": "65f1234567890abcdef12345",
"creator_id": "65f1234567890abcdef12346",
"api_key_id": "65f1234567890abcdef12349",
"processing_type": "time-sensitive",
"type": "markdown",
"priority": "high",
"request_text": "Please review this user-generated content for community guidelines compliance.",
"image_url": null,
"context": {
"user_id": "user123",
"post_id": "post456",
"automated_flags": ["potential_spam"]
},
"platform": "api",
"platform_version": "1.0.0",
"response_type": "single_select",
"response_config": {
"options": ["Approve", "Reject", "Needs Changes"]
},
"default_response": "Approve",
"timeout_at": "2024-03-15T11:30:00Z",
"callback_url": "https://example.com/webhook/response",
"broadcasted_to": [
{
"user_id": "65f1234567890abcdef12350",
"email": "reviewer1@example.com",
"role": "member",
"notification_sent": true,
"notification_error": null
},
{
"user_id": "65f1234567890abcdef12351",
"email": "reviewer2@example.com",
"role": "member",
"notification_sent": true,
"notification_error": null
}
],
"broadcasted_at": "2024-03-15T10:30:00Z",
"status": "pending",
"response_by": null,
"response_at": null,
"response_data": null,
"response_time_seconds": null,
"created_at": "2024-03-15T10:30:00Z",
"updated_at": "2024-03-15T10:30:00Z"
}
}
}
Show data
Show request
time-sensitive
, deferred
)markdown
, image
)low
, medium
, high
, critical
)pending
, claimed
, completed
, timeout
, cancelled
)curl -X GET https://api.hitl.sh/v1/requests/65f1234567890abcdef12348 \
-H "Authorization: Bearer your_api_key_here"
{
"error": false,
"msg": "Request retrieved successfully",
"data": {
"request": {
"id": "65f1234567890abcdef12348",
"loop_id": "65f1234567890abcdef12345",
"creator_id": "65f1234567890abcdef12346",
"api_key_id": "65f1234567890abcdef12349",
"processing_type": "time-sensitive",
"type": "markdown",
"priority": "high",
"request_text": "Please review this user-generated content for community guidelines compliance.",
"image_url": null,
"context": {
"user_id": "user123",
"post_id": "post456",
"automated_flags": ["potential_spam"]
},
"platform": "api",
"platform_version": "1.0.0",
"response_type": "single_select",
"response_config": {
"options": ["Approve", "Reject", "Needs Changes"]
},
"default_response": "Approve",
"timeout_at": "2024-03-15T11:30:00Z",
"callback_url": "https://example.com/webhook/response",
"broadcasted_to": [
{
"user_id": "65f1234567890abcdef12350",
"email": "reviewer1@example.com",
"role": "member",
"notification_sent": true,
"notification_error": null
},
{
"user_id": "65f1234567890abcdef12351",
"email": "reviewer2@example.com",
"role": "member",
"notification_sent": true,
"notification_error": null
}
],
"broadcasted_at": "2024-03-15T10:30:00Z",
"status": "pending",
"response_by": null,
"response_at": null,
"response_data": null,
"response_time_seconds": null,
"created_at": "2024-03-15T10:30:00Z",
"updated_at": "2024-03-15T10:30:00Z"
}
}
}
response_data
field.default_response
was used as the final response.import time
import requests
def poll_request_status(request_id, api_key, max_attempts=120):
"""Poll request status for up to 1 hour (120 * 30 seconds)"""
url = f"https://api.hitl.sh/v1/requests/{request_id}"
headers = {"Authorization": f"Bearer {api_key}"}
for attempt in range(max_attempts):
response = requests.get(url, headers=headers)
data = response.json()
if data["data"]["request"]["status"] in ["completed", "cancelled", "timeout"]:
return data["data"]["request"]
time.sleep(30) # Wait 30 seconds before next poll
return None # Timeout reached
import time
import requests
def poll_with_backoff(request_id, api_key):
"""Poll with exponential backoff"""
url = f"https://api.hitl.sh/v1/requests/{request_id}"
headers = {"Authorization": f"Bearer {api_key}"}
intervals = [5, 10, 30, 60, 120, 300] # seconds
for interval in intervals:
response = requests.get(url, headers=headers)
data = response.json()
status = data["data"]["request"]["status"]
if status in ["completed", "cancelled", "timeout"]:
return data["data"]["request"]
time.sleep(interval)
return None
{
"response_data": "Approve"
}
{
"response_data": ["Policy Violation", "Spam"]
}
{
"response_data": 4
}
{
"response_data": "The content looks good but could benefit from better formatting."
}
{
"response_data": true
}