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

# API Overview

> Complete REST API reference for zkTerm backend

## Base URL

All API endpoints are available at:

```
https://zkterm.io/api/
```

## Authentication

Most endpoints require authentication via session cookie. Login first:

```bash theme={null}
POST /api/auth/login
Content-Type: application/json

{
  "username": "your_username",
  "password": "your_password"
}
```

## API Endpoints

### Core APIs

| Route             | Description                                   |
| ----------------- | --------------------------------------------- |
| `/api/auth`       | zkID authentication (register, login, logout) |
| `/api/wallets`    | Wallet management (SOL, Starknet)             |
| `/api/light`      | Light Protocol ZK compression                 |
| `/api/storage`    | zkStorage encrypted file storage              |
| `/api/zk-toolkit` | Cryptographic primitives                      |
| `/api/attest`     | zkAttest privacy attestations                 |

### Blockchain APIs

| Route           | Description                               |
| --------------- | ----------------------------------------- |
| `/api/starknet` | Starknet wallet and transfers             |
| `/api/bridge`   | Cross-chain bridging (ETH/SOL ↔ Starknet) |
| `/api/houdini`  | HoudiniSwap privacy swaps                 |
| `/api/transfer` | ZK proof-based transfers                  |
| `/api/proofs`   | ZK proof history                          |

### Utility APIs

| Route              | Description                |
| ------------------ | -------------------------- |
| `/api/rewards`     | Trade-to-Earn rewards      |
| `/api/ai`          | zkAI chat assistant        |
| `/api/bug-reports` | Bug report submission      |
| `/api/init`        | Environment initialization |

## Response Format

Success response:

```json theme={null}
{
  "success": true,
  "data": { ... }
}
```

Error response:

```json theme={null}
{
  "error": "Error message",
  "message": "Human readable description"
}
```

## Rate Limits

| Endpoint Group | Limit   |
| -------------- | ------- |
| Auth           | 20/min  |
| Light Protocol | 50/min  |
| zkToolkit      | 200/min |
| zkStorage      | 30/min  |
| zkAttest       | 30/min  |

## Quick Examples

### Poseidon Hash

```bash theme={null}
curl -X POST https://zkterm.io/api/zk-toolkit/hash/poseidon \
  -H "Content-Type: application/json" \
  -d '{"input": "hello world"}'
```

### Create Commitment

```bash theme={null}
curl -X POST https://zkterm.io/api/zk-toolkit/commit/create \
  -H "Content-Type: application/json" \
  -d '{"value": "secret_data"}'
```

### Field Arithmetic

```bash theme={null}
curl -X POST https://zkterm.io/api/zk-toolkit/field/add \
  -H "Content-Type: application/json" \
  -d '{"a": "5", "b": "7"}'
```
