Permanently delete a loop and all its associated data including members, requests, and history. This is a destructive operation that cannot be undone.
This action permanently deletes the loop and all associated data including:
All loop members and their membership history
All requests created within the loop
All responses and feedback from reviewers
All analytics and performance data
This operation cannot be undone.
Authentication
Your API key for authentication
Path Parameters
The unique identifier of the loop to delete
Response
Whether an error occurred
Success message confirming deletion
ID of the deleted loop for confirmation
ISO timestamp when the loop was deleted
Summary of what was deleted Number of members removed
Number of requests deleted
Number of responses deleted
curl -X DELETE https://api.hitl.sh/v1/api/loops/65f1234567890abcdef12345 \
-H "Authorization: Bearer your_api_key_here"
{
"error" : false ,
"msg" : "Loop deleted successfully" ,
"data" : {
"loop_id" : "65f1234567890abcdef12345" ,
"deleted_at" : "2024-03-15T15:30:00Z" ,
"deleted_data" : {
"members_removed" : 5 ,
"requests_deleted" : 23 ,
"responses_deleted" : 18
}
}
}
Pre-Deletion Considerations
What Gets Deleted
When you delete a loop, the following data is permanently removed:
Loop name, description, and icon
Creation and update timestamps
Loop creator information
All loop settings and metadata
All member relationships
Member join dates and status
Member activity history within the loop
Invitation records and pending invitations
All requests created within the loop
Request content, priority, and configuration
Request status and lifecycle information
Broadcast and notification history
All reviewer responses and decisions
Response timestamps and metadata
Feedback and rating information
Performance analytics and metrics
Data That Survives Deletion
User accounts of loop members remain intact. Only the membership relationship is removed.
Your overall API usage statistics are preserved for billing and analytics.
High-level audit logs may be retained for security and compliance purposes.
Safety Checks
Before Deleting a Loop
Implement these safety checks in your code:
def safe_delete_loop ( loop_id , require_confirmation = True ):
"""Safely delete a loop with pre-flight checks"""
# Get loop information first
response = requests.get( f "https://api.hitl.sh/v1/api/loops/ { loop_id } " , headers = headers)
if response.status_code != 200 :
return { "error" : True , "msg" : "Loop not found or inaccessible" }
loop_data = response.json()[ "data" ][ "loop" ]
# Check for active members
active_members = loop_data[ "member_count" ] - loop_data[ "pending_count" ]
if active_members > 1 : # More than just the creator
print ( f "Warning: Loop has { active_members } active members" )
# Check for recent activity (optional: get requests)
requests_response = requests.get( f "https://api.hitl.sh/v1/api/loops/ { loop_id } /requests" , headers = headers)
if requests_response.status_code == 200 :
requests_data = requests_response.json()[ "data" ][ "requests" ]
recent_requests = [r for r in requests_data if r[ "status" ] in [ "pending" , "claimed" ]]
if recent_requests:
print ( f "Warning: Loop has { len (recent_requests) } active requests" )
# Confirmation
if require_confirmation:
confirmation = input ( f "Delete loop ' { loop_data[ 'name' ] } '? This cannot be undone. (yes/no): " )
if confirmation.lower() != 'yes' :
return { "error" : False , "msg" : "Deletion cancelled by user" }
# Proceed with deletion
delete_response = requests.delete( f "https://api.hitl.sh/v1/api/loops/ { loop_id } " , headers = headers)
return delete_response.json()
Bulk Operations
Delete Multiple Loops
Handle multiple loop deletions with error handling:
def bulk_delete_loops ( loop_ids , dry_run = True ):
"""Delete multiple loops with safety checks"""
results = []
for loop_id in loop_ids:
try :
if dry_run:
# Just check if we can access the loop
response = requests.get( f "https://api.hitl.sh/v1/api/loops/ { loop_id } " , headers = headers)
if response.status_code == 200 :
loop_data = response.json()[ "data" ][ "loop" ]
results.append({
"loop_id" : loop_id,
"name" : loop_data[ "name" ],
"members" : loop_data[ "member_count" ],
"status" : "ready_to_delete" if dry_run else "deleted"
})
else :
results.append({
"loop_id" : loop_id,
"error" : response.json()[ "msg" ],
"status" : "error"
})
else :
# Actually delete the loop
response = requests.delete( f "https://api.hitl.sh/v1/api/loops/ { loop_id } " , headers = headers)
if response.status_code == 200 :
results.append({
"loop_id" : loop_id,
"status" : "deleted" ,
"deleted_at" : response.json()[ "data" ][ "deleted_at" ]
})
else :
results.append({
"loop_id" : loop_id,
"error" : response.json()[ "msg" ],
"status" : "error"
})
except Exception as e:
results.append({
"loop_id" : loop_id,
"error" : str (e),
"status" : "exception"
})
return results
# Usage
loop_ids = [ "65f1234567890abcdef12345" , "65f1234567890abcdef12346" ]
# Dry run first
print ( "Dry run results:" )
dry_results = bulk_delete_loops(loop_ids, dry_run = True )
for result in dry_results:
print ( f " { result } " )
# Actual deletion (uncomment to execute)
# print("\nActual deletion:")
# actual_results = bulk_delete_loops(loop_ids, dry_run=False)
Access Control
Who Can Delete Loops
Only the user who created the loop can delete it. This is strictly enforced by checking the creator_id
.
API keys can only delete loops created by the same user account that owns the API key.
No Member Deletion Rights
Loop members cannot delete loops, even if they are administrators in the mobile app.
Error Handling
Common Error Scenarios
{
"error" : true ,
"msg" : "Loop not found"
}
Causes:
Invalid loop ID
Loop already deleted
User doesn’t own the loop
{
"error" : true ,
"msg" : "Access denied to this loop"
}
Cause: Only loop creators can delete loops.
{
"error" : true ,
"msg" : "Cannot delete loop with active requests"
}
Cause: Some implementations may prevent deletion of loops with pending or claimed requests.
Solution: Cancel or complete all active requests first.
Alternatives to Deletion
Archive Instead of Delete
Consider these alternatives before permanent deletion:
def archive_loop ( loop_id ):
"""Archive a loop by updating its name instead of deleting"""
# Get current loop data
response = requests.get( f "https://api.hitl.sh/v1/api/loops/ { loop_id } " , headers = headers)
loop_data = response.json()[ "data" ][ "loop" ]
# Update with archived naming
archived_name = f "[ARCHIVED] { loop_data[ 'name' ] } "
archived_description = f "ARCHIVED on { datetime.now().strftime( '%Y-%m- %d ' ) } - { loop_data.get( 'description' , '' ) } "
update_response = requests.put(
f "https://api.hitl.sh/v1/api/loops/ { loop_id } " ,
headers = headers,
json = {
"name" : archived_name,
"description" : archived_description
}
)
return update_response.json()
Recovery Options
No Recovery Available
Once a loop is deleted, there is no way to recover the data. The deletion is immediate and permanent.
Prevention Strategies
Export Data First : Before deletion, export important data
Use Staging Loops : Test with non-production loops
Archive Instead : Consider archiving rather than deleting
Team Review : Have deletions reviewed by team members
Next Steps
Create New Loop Create a new loop to replace the deleted one if needed.
Export Data Learn how to export request and response data before deletion.
Loop Management Return to loop management and view your remaining loops.