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

# Admin & Enterprise

> Team workspaces, approval workflows, audit logs, and enterprise administration endpoints

# Admin & Enterprise

Enterprise administration endpoints for organization management.

## Team Workspaces

### List Teams

<CodeGroup>
  ```bash curl theme={null}
  curl -H "Authorization: Bearer thig_YOUR_KEY" \
    "https://app.thig.ai/api/admin/teams?includeArchived=false"
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('/api/admin/teams?includeArchived=false', {
    headers: { 'Authorization': 'Bearer thig_YOUR_KEY' }
  });
  const { teams } = await res.json();
  ```
</CodeGroup>

### Create Team

<ParamField body="name" type="string" required>
  Team name (1–100 characters)
</ParamField>

<ParamField body="description" type="string">
  Team description (max 500 characters)
</ParamField>

<ParamField body="color" type="string">
  Hex color code (e.g., "#10B981")
</ParamField>

```bash theme={null}
curl -X POST https://app.thig.ai/api/admin/teams \
  -H "Authorization: Bearer thig_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Mobile Squad", "description": "iOS and Android team", "color": "#10B981"}'
```

### Update / Delete Team

```bash theme={null}
# Update
curl -X PATCH https://app.thig.ai/api/admin/teams/TEAM_ID \
  -H "Authorization: Bearer thig_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "New Name", "isArchived": false}'

# Delete
curl -X DELETE https://app.thig.ai/api/admin/teams/TEAM_ID \
  -H "Authorization: Bearer thig_YOUR_KEY"
```

## Approval Workflows

*Enterprise plan*

### List Workflows

```bash theme={null}
curl -H "Authorization: Bearer thig_YOUR_KEY" \
  https://app.thig.ai/api/admin/approval-workflows
```

### Create Workflow

<ParamField body="name" type="string" required>
  Workflow name
</ParamField>

<ParamField body="triggerType" type="string" required>
  One of: `prd_publish`, `prd_export`, `project_delete`, `template_publish`
</ParamField>

<ParamField body="requiredApprovals" type="number">
  Number of approvals needed (1–10, default: 1)
</ParamField>

<ParamField body="allowSelfApproval" type="boolean">
  Whether requester can approve their own request (default: false)
</ParamField>

<ParamField body="approverIds" type="string[]" required>
  Array of user IDs who can approve
</ParamField>

```bash theme={null}
curl -X POST https://app.thig.ai/api/admin/approval-workflows \
  -H "Authorization: Bearer thig_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "PRD Publish Review",
    "triggerType": "prd_publish",
    "requiredApprovals": 2,
    "approverIds": ["user1", "user2", "user3"]
  }'
```

## IP Allowlist

*Enterprise plan*

### List Entries

```bash theme={null}
curl -H "Authorization: Bearer thig_YOUR_KEY" \
  https://app.thig.ai/api/admin/ip-allowlist
```

### Add IP/CIDR

```bash theme={null}
curl -X POST https://app.thig.ai/api/admin/ip-allowlist \
  -H "Authorization: Bearer thig_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cidr": "10.0.0.0/24", "label": "Office VPN"}'
```

### Remove Entry

```bash theme={null}
curl -X DELETE https://app.thig.ai/api/admin/ip-allowlist \
  -H "Authorization: Bearer thig_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id": "ENTRY_ID"}'
```

## Audit Logs

### List Logs

<ParamField query="action" type="string">
  Filter by action type
</ParamField>

<ParamField query="severity" type="string">
  Filter by severity: `info`, `warning`, `critical`
</ParamField>

<ParamField query="category" type="string">
  Filter by category: `auth`, `project`, `team`, `billing`, etc.
</ParamField>

<ParamField query="startDate" type="string">
  ISO date string for range start
</ParamField>

<ParamField query="endDate" type="string">
  ISO date string for range end
</ParamField>

<ParamField query="summary" type="boolean">
  Set to `true` to get aggregated summary instead of individual logs
</ParamField>

```bash theme={null}
curl -H "Authorization: Bearer thig_YOUR_KEY" \
  "https://app.thig.ai/api/admin/audit-logs?severity=critical&startDate=2026-03-01"
```

### Export Logs

```bash theme={null}
# CSV export
curl -H "Authorization: Bearer thig_YOUR_KEY" \
  "https://app.thig.ai/api/admin/audit-logs/export?format=csv" -o audit.csv

# JSON export
curl -H "Authorization: Bearer thig_YOUR_KEY" \
  "https://app.thig.ai/api/admin/audit-logs/export?format=json" -o audit.json
```

## Template Submissions

### Submit Template for Marketplace

```bash theme={null}
curl -X POST https://app.thig.ai/api/template-submissions \
  -H "Authorization: Bearer thig_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "templateId": "TEMPLATE_ID",
    "notes": "Great for SaaS startups"
  }'
```

### List My Submissions

```bash theme={null}
curl -H "Authorization: Bearer thig_YOUR_KEY" \
  https://app.thig.ai/api/template-submissions
```

## Stakeholder Reviews

### Get Reviews by Share Token

No authentication required — uses the share token from the project sharing system.

```bash theme={null}
curl "https://app.thig.ai/api/stakeholder-review/by-token?token=SHARE_TOKEN"
```

### Submit Review Decision

```bash theme={null}
curl -X POST https://app.thig.ai/api/stakeholder-review/resolve \
  -H "Content-Type: application/json" \
  -d '{
    "token": "SHARE_TOKEN",
    "reviewId": "REVIEW_ID",
    "status": "approved",
    "feedback": "Looks great, approved for development"
  }'
```

Status options: `approved`, `rejected`
