curl -X GET https://api.hitl.sh/v1/loops/65f1234567890abcdef12345 \ -H "Authorization: Bearer your_api_key_here"
{ "error": false, "msg": "Loop retrieved successfully", "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" }, { "user_id": "65f1234567890abcdef12347", "email": "reviewer1@example.com", "status": "active", "joined_at": "2024-03-15T11:45:00Z" }, { "user_id": "65f1234567890abcdef12348", "email": "reviewer2@example.com", "status": "pending", "joined_at": null } ], "member_count": 3, "pending_count": 1, "created_at": "2024-03-15T10:30:00Z", "updated_at": "2024-03-15T11:45:00Z" } } }
Retrieve detailed information about a specific loop including members, statistics, and current status
Show data
Show loop
Show member
Loop Creators
Loop Members
API Key Access
def check_loop_health(loop_id, min_active_members=2): response = requests.get(f"https://api.hitl.sh/v1/loops/{loop_id}", headers=headers) loop_data = response.json()["data"]["loop"] active_members = loop_data["member_count"] - loop_data["pending_count"] if active_members < min_active_members: print(f"Warning: Loop only has {active_members} active members") return False return True
function checkPendingInvitations(loopData) { const pendingMembers = loopData.members.filter(member => member.status === 'pending'); if (pendingMembers.length > 0) { console.log(`${pendingMembers.length} pending invitations:`); pendingMembers.forEach(member => { console.log(`- ${member.email} (invited but not joined)`); }); } return pendingMembers; }
from datetime import datetime def calculate_join_rate(loop_data): total_members = len(loop_data["members"]) active_members = sum(1 for m in loop_data["members"] if m["status"] == "active") if total_members == 0: return 0 join_rate = (active_members / total_members) * 100 return round(join_rate, 2) # Usage loop_data = response.json()["data"]["loop"] join_rate = calculate_join_rate(loop_data) print(f"Member join rate: {join_rate}%")
Loop Not Found
{ "error": true, "msg": "Loop not found" }
Invalid Loop ID Format
{ "error": true, "msg": "Invalid loop ID format" }
65f1234567890abcdef12345
Access Denied
{ "error": true, "msg": "Access denied to this loop" }
def get_loop_dashboard(): # Get all loops loops_response = requests.get("https://api.hitl.sh/v1/loops", headers=headers) loops = loops_response.json()["data"]["loops"] dashboard = [] for loop in loops: # Get detailed info for each loop detail_response = requests.get(f"https://api.hitl.sh/v1/loops/{loop['id']}", headers=headers) loop_detail = detail_response.json()["data"]["loop"] dashboard.append({ "name": loop_detail["name"], "id": loop_detail["id"], "active_members": loop_detail["member_count"] - loop_detail["pending_count"], "pending_members": loop_detail["pending_count"], "created": loop_detail["created_at"], "health": "healthy" if (loop_detail["member_count"] - loop_detail["pending_count"]) >= 2 else "needs_attention" }) return dashboard
async function followUpPendingMembers(loopId) { const response = await fetch(`https://api.hitl.sh/v1/loops/${loopId}`, { headers: { 'Authorization': `Bearer ${apiKey}` } }); const loopData = await response.json(); const loop = loopData.data.loop; const pendingMembers = loop.members.filter(member => member.status === 'pending'); for (const member of pendingMembers) { // Send reminder email (implement your email service) await sendReminderEmail({ to: member.email, subject: `Reminder: Join ${loop.name} loop`, loopName: loop.name, joinUrl: `https://app.hitl.sh/join/${loop.invite_code}` }); } return `Sent reminders to ${pendingMembers.length} pending members`; }