Loops
Create Loop
Create a new human review loop with automatic creator membership, invite code, QR code, and join URL generation
POST
/
v1
/
api
/
loops
curl -X POST https://api.hitl.sh/v1/api/loops \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Content Moderation Review",
"description": "Review user-generated content for community guidelines compliance",
"icon": "shield-check"
}'
import requests
url = "https://api.hitl.sh/v1/api/loops"
headers = {
"Authorization": "Bearer your_api_key_here",
"Content-Type": "application/json"
}
data = {
"name": "Content Moderation Review",
"description": "Review user-generated content for community guidelines compliance",
"icon": "shield-check"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const axios = require('axios');
const response = await axios.post('https://api.hitl.sh/v1/api/loops', {
name: 'Content Moderation Review',
description: 'Review user-generated content for community guidelines compliance',
icon: 'shield-check'
}, {
headers: {
'Authorization': 'Bearer your_api_key_here',
'Content-Type': 'application/json'
}
});
console.log(response.data);
{
"error": false,
"msg": "Loop created successfully with QR code",
"data": {
"loop": {
"id": "65f1234567890abcdef12345",
"name": "Content Moderation Review",
"description": "Review user-generated content for community guidelines compliance",
"icon": "shield-check",
"creator_id": "65f1234567890abcdef12346",
"members": [
{
"user_id": "65f1234567890abcdef12346",
"email": "creator@example.com",
"status": "active",
"joined_at": "2024-03-15T10:30:00Z"
}
],
"member_count": 1,
"pending_count": 0,
"created_at": "2024-03-15T10:30:00Z",
"updated_at": "2024-03-15T10:30:00Z"
},
"invite_code": "ABC123DEF",
"qr_code_base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"qr_code_url": "https://api.hitl.sh/qr/ABC123DEF.png",
"join_url": "https://my.hitl.sh/join/ABC123DEF"
}
}
Create a new loop to route human review requests. When you create a loop, you automatically become a member and receive an invite code with QR code for sharing with other reviewers.
Authentication
string
required
Your API key for authentication
Body
string
required
Name of the loop (1-100 characters)
string
Description of the loop’s purpose (max 500 characters)
string
required
Icon identifier for the loop (max 100 characters, e.g., “shield-check”, “eye”, “thumbs-up”)
Response
boolean
Whether an error occurred
string
Success message
object
Show data
Show data
object
The created loop object with member counts
Show loop
Show loop
string
Unique identifier for the loop
string
Name of the loop
string
Description of the loop
string
Icon identifier
string
ID of the loop creator
array
Array of loop members
integer
Total number of members
integer
Number of pending invitations
string
ISO timestamp of creation
string
ISO timestamp of last update
string
Generated invite code for joining the loop
string
Base64 encoded QR code image
string
URL to access the QR code image
string
Direct URL for joining the loop
curl -X POST https://api.hitl.sh/v1/api/loops \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Content Moderation Review",
"description": "Review user-generated content for community guidelines compliance",
"icon": "shield-check"
}'
import requests
url = "https://api.hitl.sh/v1/api/loops"
headers = {
"Authorization": "Bearer your_api_key_here",
"Content-Type": "application/json"
}
data = {
"name": "Content Moderation Review",
"description": "Review user-generated content for community guidelines compliance",
"icon": "shield-check"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const axios = require('axios');
const response = await axios.post('https://api.hitl.sh/v1/api/loops', {
name: 'Content Moderation Review',
description: 'Review user-generated content for community guidelines compliance',
icon: 'shield-check'
}, {
headers: {
'Authorization': 'Bearer your_api_key_here',
'Content-Type': 'application/json'
}
});
console.log(response.data);
{
"error": false,
"msg": "Loop created successfully with QR code",
"data": {
"loop": {
"id": "65f1234567890abcdef12345",
"name": "Content Moderation Review",
"description": "Review user-generated content for community guidelines compliance",
"icon": "shield-check",
"creator_id": "65f1234567890abcdef12346",
"members": [
{
"user_id": "65f1234567890abcdef12346",
"email": "creator@example.com",
"status": "active",
"joined_at": "2024-03-15T10:30:00Z"
}
],
"member_count": 1,
"pending_count": 0,
"created_at": "2024-03-15T10:30:00Z",
"updated_at": "2024-03-15T10:30:00Z"
},
"invite_code": "ABC123DEF",
"qr_code_base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"qr_code_url": "https://api.hitl.sh/qr/ABC123DEF.png",
"join_url": "https://my.hitl.sh/join/ABC123DEF"
}
}
Use Cases
Content Moderation
Create a loop for reviewing flagged user content:{
"name": "Content Moderation",
"description": "Review flagged posts and comments for policy violations",
"icon": "shield-exclamation"
}
Document Approval
Create a loop for business document approvals:{
"name": "Contract Review",
"description": "Legal review of customer contracts and agreements",
"icon": "document-check"
}
Quality Assurance
Create a loop for AI output validation:{
"name": "AI Content QA",
"description": "Quality assurance for AI-generated content and responses",
"icon": "beaker"
}
Next Steps
After creating a loop:- Share the invite code or QR code with your team members
- Create your first request using the Create Request endpoint
- Set up webhooks to receive notifications when requests are completed
Create Your First Request
Learn how to create requests within your newly created loop.
⌘I
curl -X POST https://api.hitl.sh/v1/api/loops \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Content Moderation Review",
"description": "Review user-generated content for community guidelines compliance",
"icon": "shield-check"
}'
import requests
url = "https://api.hitl.sh/v1/api/loops"
headers = {
"Authorization": "Bearer your_api_key_here",
"Content-Type": "application/json"
}
data = {
"name": "Content Moderation Review",
"description": "Review user-generated content for community guidelines compliance",
"icon": "shield-check"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const axios = require('axios');
const response = await axios.post('https://api.hitl.sh/v1/api/loops', {
name: 'Content Moderation Review',
description: 'Review user-generated content for community guidelines compliance',
icon: 'shield-check'
}, {
headers: {
'Authorization': 'Bearer your_api_key_here',
'Content-Type': 'application/json'
}
});
console.log(response.data);
{
"error": false,
"msg": "Loop created successfully with QR code",
"data": {
"loop": {
"id": "65f1234567890abcdef12345",
"name": "Content Moderation Review",
"description": "Review user-generated content for community guidelines compliance",
"icon": "shield-check",
"creator_id": "65f1234567890abcdef12346",
"members": [
{
"user_id": "65f1234567890abcdef12346",
"email": "creator@example.com",
"status": "active",
"joined_at": "2024-03-15T10:30:00Z"
}
],
"member_count": 1,
"pending_count": 0,
"created_at": "2024-03-15T10:30:00Z",
"updated_at": "2024-03-15T10:30:00Z"
},
"invite_code": "ABC123DEF",
"qr_code_base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"qr_code_url": "https://api.hitl.sh/qr/ABC123DEF.png",
"join_url": "https://my.hitl.sh/join/ABC123DEF"
}
}