> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hitl.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Loop

> Create a new human review loop with automatic creator membership, invite code, QR code, and join URL generation

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

**Authorization** `string` *required*

Your API key for authentication

## Body

**name** `string` *required*

Name of the loop (1-100 characters)

**description** `string`

Description of the loop's purpose (max 500 characters)

**icon** `string` *required*

Icon identifier for the loop (max 100 characters, e.g., "shield-check", "eye", "thumbs-up")

## Response

**error** `boolean`

Whether an error occurred

**msg** `string`

Success message

**data** `object`

**data**

**loop** `object`

The created loop object with member counts

**loop**

**id** `string`

Unique identifier for the loop

**name** `string`

Name of the loop

**description** `string`

Description of the loop

**icon** `string`

Icon identifier

**creator\_id** `string`

ID of the loop creator

**members** `array`

Array of loop members

**member\_count** `integer`

Total number of members

**pending\_count** `integer`

Number of pending invitations

**created\_at** `string`

ISO timestamp of creation

**updated\_at** `string`

ISO timestamp of last update

**invite\_code** `string`

Generated invite code for joining the loop

**qr\_code\_base64** `string`

Base64 encoded QR code image

**qr\_code\_url** `string`

URL to access the QR code image

**join\_url** `string`

Direct URL for joining the loop

```bash cURL theme={null}
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"
  }'
```

```python Python theme={null}
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())
```

```javascript Node.js theme={null}
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);
```

```json Response theme={null}
{
  "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:

```json theme={null}
{
  "name": "Content Moderation",
  "description": "Review flagged posts and comments for policy violations",
  "icon": "shield-exclamation"
}
```

### Document Approval

Create a loop for business document approvals:

```json theme={null}
{
  "name": "Contract Review",
  "description": "Legal review of customer contracts and agreements",
  "icon": "document-check"
}
```

### Quality Assurance

Create a loop for AI output validation:

```json theme={null}
{
  "name": "AI Content QA",
  "description": "Quality assurance for AI-generated content and responses",
  "icon": "beaker"
}
```

## Next Steps

After creating a loop:

1. **Share the invite code** or QR code with your team members
2. **Create your first request** using the [Create Request](https://docs.hitl.sh/api-reference/requests/create-request.md) endpoint
3. **Set up webhooks** to receive notifications when requests are completed

> [card] [Create Your First Request](https://docs.hitl.sh/api-reference/requests/create-request.md)
>
> Learn how to create requests within your newly created loop.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.