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

# API reference

> Complete reference for all Knot API endpoints

The Knot API provides a REST interface for AI agents to manage wallets, execute transactions, and interact with DeFi protocols on Solana.

## Base URL

```
https://api.useknot.xyz
```

All endpoints are relative to this base URL.

## Authentication

Most endpoints require a JWT token in the `Authorization` header:

```bash theme={null}
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
```

Obtain a token through the [authentication flow](/quickstart#authentication-flow). Tokens expire after 7 days by default. You can configure expiration per-agent via the [policy settings](/api-reference/policy/update).

## Request format

Send all request bodies as JSON. Include the following header:

```bash theme={null}
Content-Type: application/json
```

## Response format

All responses follow a consistent envelope structure:

```json theme={null}
{
  "status": true,
  "statusCode": 200,
  "message": "Operation successful.",
  "data": { ... }
}
```

| Field        | Type    | Description                         |
| ------------ | ------- | ----------------------------------- |
| `status`     | boolean | `true` on success, `false` on error |
| `statusCode` | number  | HTTP status code                    |
| `message`    | string  | Human-readable description          |
| `data`       | object  | Response payload                    |

## Rate limits

| Layer     | Limit          | Window     |
| --------- | -------------- | ---------- |
| Global    | 1,000 requests | per minute |
| Per-IP    | 100 requests   | per minute |
| Per-Agent | 60 requests    | per minute |

Exceeding a limit returns `429 Too Many Requests`.

## Idempotency

For financial operations, include an `Idempotency-Key` header to prevent duplicate transactions:

```bash theme={null}
Idempotency-Key: unique-request-identifier
```

If you repeat a request with the same key, the API returns the original response instead of executing the operation again.

## Endpoint groups

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/api-reference/auth/start">
    OTP authentication and token management
  </Card>

  <Card title="Wallet" icon="wallet" href="/api-reference/wallet/balances">
    Balances, transfers, trades, and history
  </Card>

  <Card title="Policy" icon="shield" href="/api-reference/policy/view">
    View and update agent spending policies
  </Card>

  <Card title="Utility" icon="wrench" href="/api-reference/utility/health">
    Health checks, token lookup, and agent capabilities
  </Card>
</CardGroup>

<Note>
  For liquidity provision and prediction market endpoints, see the feature documentation: [Liquidity provision](/liquidity) and [Prediction markets](/predictions).
</Note>
