curl -X PUT https://api.hitl.sh/v1/loops/65f1234567890abcdef12345 \ -H "Authorization: Bearer your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "name": "Enhanced Content Moderation", "description": "Advanced review system for user-generated content with improved guidelines", "icon": "shield-exclamation" }'
{ "error": false, "msg": "Loop updated successfully", "data": { "loop": { "id": "65f1234567890abcdef12345", "name": "Enhanced Content Moderation", "description": "Advanced review system for user-generated content with improved guidelines", "icon": "shield-exclamation", "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" } ], "member_count": 2, "pending_count": 0, "created_at": "2024-03-15T10:30:00Z", "updated_at": "2024-03-15T14:20:00Z" } } }
Update an existing loop’s name, description, or icon. Only the loop creator can make updates.
Show data
Show loop
{ "name": "Content Review V2" }
{ "description": "Updated workflow for reviewing user submissions with new compliance requirements" }
{ "icon": "shield-alt" }
{ "name": "Premium Content Review", "icon": "star" }
def rebrand_loop(loop_id, new_name, new_icon): url = f"https://api.hitl.sh/v1/loops/{loop_id}" data = { "name": new_name, "icon": new_icon } response = requests.put(url, headers=headers, json=data) if response.status_code == 200: loop_data = response.json()["data"]["loop"] print(f"Successfully rebranded loop to '{loop_data['name']}'") return loop_data else: print(f"Failed to rebrand loop: {response.json()['msg']}") return None
async function improveLoopDescription(loopId, newDescription) { try { const response = await axios.put( `https://api.hitl.sh/v1/loops/${loopId}`, { description: newDescription }, { headers: { 'Authorization': `Bearer ${apiKey, 'Content-Type': 'application/json'}` } } ); console.log('Description updated successfully'); return response.data.data.loop; } catch (error) { console.error('Failed to update description:', error.response?.data?.msg); throw error; } } // Usage await improveLoopDescription( 'loopId', 'Comprehensive content moderation with AI pre-filtering and human oversight for policy violations' );
def standardize_loop_names(loop_prefix="Review"): # Get all loops loops_response = requests.get("https://api.hitl.sh/v1/loops", headers=headers) loops = loops_response.json()["data"]["loops"] updated_loops = [] for loop in loops: # Skip loops that already follow the naming convention if loop["name"].startswith(loop_prefix): continue new_name = f"{loop_prefix} - {loop['name']}" update_response = requests.put( f"https://api.hitl.sh/v1/loops/{loop['id']}", headers=headers, json={"name": new_name} ) if update_response.status_code == 200: updated_loops.append(update_response.json()["data"]["loop"]) return updated_loops
Loop Creators
creator_id
API Key Restrictions
Loop Members
Loop Not Found
{ "error": true, "msg": "Loop not found" }
Access Denied
{ "error": true, "msg": "Access denied to this loop" }
Validation Error
{ "error": true, "msg": "Validation failed", "data": "name must be between 1 and 100 characters" }
Empty Update
{ "error": true, "msg": "At least one field must be provided for update" }
def version_loop_update(loop_id, updates, version=None): if version: if 'name' in updates: updates['name'] = f"{updates['name']} v{version}" updates['description'] = f"{updates.get('description', '')} (Updated to v{version})" return requests.put(f"https://api.hitl.sh/v1/loops/{loop_id}", headers=headers, json=updates)
async function updateLoopGradually(loopId, updates) { const updateOrder = ['description', 'icon', 'name']; // Update description first, name last for (const field of updateOrder) { if (updates[field]) { await axios.put( `https://api.hitl.sh/v1/loops/${loopId}`, { [field]: updates[field] }, { headers: { 'Authorization': `Bearer ${apiKey}` } } ); // Small delay between updates await new Promise(resolve => setTimeout(resolve, 100)); } } }
def safe_loop_update(loop_id, updates): # Get current state current_response = requests.get(f"https://api.hitl.sh/v1/loops/{loop_id}", headers=headers) backup = current_response.json()["data"]["loop"] # Perform update update_response = requests.put( f"https://api.hitl.sh/v1/loops/{loop_id}", headers=headers, json=updates ) if update_response.status_code == 200: return { "success": True, "updated": update_response.json()["data"]["loop"], "backup": backup } else: return { "success": False, "error": update_response.json()["msg"], "backup": backup }