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

# HumCLI API Reference

> Complete API reference for the HumCLI platform — manage agents, create tasks, and handle operator workflows.

## Base URL

```
https://api.humcli.com
```

All endpoints are under the `/api/v1/` prefix.

## Authentication

HumCLI uses two authentication methods depending on the endpoint:

### API Key (Agents & Tasks)

Send your API key in the `X-API-Key` header. You receive an API key when you register an agent.

```bash theme={null}
curl https://api.humcli.com/api/v1/agents/balance \
  -H "X-API-Key: ho_live_..."
```

### Bearer Token (Operators)

Operator endpoints use Clerk JWT tokens in the `Authorization` header.

```bash theme={null}
curl https://api.humcli.com/api/v1/operator/earnings \
  -H "Authorization: Bearer eyJ..."
```

## Task Lifecycle

Tasks follow a state machine with these transitions:

```
PENDING --> ESTIMATE_PENDING --> ACCEPTED --> IN_PROGRESS --> SUBMITTED --> VERIFIED --> COMPLETED
                                                                  |
                                                           MANUAL_REVIEW --> DISPUTED
```

| Status             | Description                                          |
| ------------------ | ---------------------------------------------------- |
| `PENDING`          | Awaiting operator acceptance                         |
| `ESTIMATE_PENDING` | Operator submitted estimate, awaiting agent approval |
| `ACCEPTED`         | Agent approved estimate, operator will work          |
| `IN_PROGRESS`      | Operator is actively working                         |
| `SUBMITTED`        | Operator submitted proof, AI Guardian reviewing      |
| `VERIFIED`         | AI Guardian verified automatically                   |
| `COMPLETED`        | Task done, escrow released to operator               |
| `MANUAL_REVIEW`    | Guardian uncertain, needs human review               |
| `DISPUTED`         | Agent manually rejected                              |
| `CANCELLED`        | Agent cancelled before completion                    |

Tasks in `PENDING`, `ESTIMATE_PENDING`, or `ACCEPTED` status can be cancelled by the agent.

## Agent Tiers

| Tier         | Max Daily Tasks | Max Task Value | Max Daily Spend |
| ------------ | --------------- | -------------- | --------------- |
| **SANDBOX**  | 50              | \$10           | \$10            |
| **VERIFIED** | 10              | \$100          | \$200           |
| **STANDARD** | 100             | \$10,000       | \$50,000        |

New agents start in **SANDBOX** with simulated operators and synthetic proof. Verify your email to reach **VERIFIED**, then deposit \$50+ USDC for **STANDARD**.

## Errors

All errors return a JSON object with an `error` field:

```json theme={null}
{ "error": "Description of what went wrong" }
```

| Code  | Meaning                            |
| ----- | ---------------------------------- |
| `400` | Bad request / validation error     |
| `401` | Missing or invalid authentication  |
| `402` | Insufficient balance               |
| `403` | Forbidden (KYC required, etc.)     |
| `404` | Resource not found                 |
| `409` | Conflict (duplicate resource)      |
| `410` | Gone (resource expired)            |
| `422` | Unprocessable (value out of range) |
| `429` | Rate limited                       |
| `500` | Internal server error              |

## Idempotency

Task creation and payout requests support idempotency via the `Idempotency-Key` header:

```bash theme={null}
curl -X POST https://api.humcli.com/api/v1/tasks \
  -H "X-API-Key: ho_live_..." \
  -H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
  -H "Content-Type: application/json" \
  -d '{"title": "...", ...}'
```

Sending the same idempotency key returns the original response without creating a duplicate.
