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

# API Overview

> REST API for quotes, swaps, pools, tokens, and pricing

# API Overview

The Kroko DEX provides a REST API for swap routing, price quotes, pool data, and token information. The API handles complex routing logic off-chain and returns ready-to-use transaction calldata.

## Base URL

<Tabs>
  <Tab title="Mainnet">
    ```
    https://krokoswap.io/swap-api
    ```
  </Tab>

  <Tab title="Testnet">
    ```
    https://testnet.krokoswap.io/swap-api
    ```
  </Tab>
</Tabs>

All endpoints below are relative to the base URL above.

## Authentication

No authentication is required. The API is currently publicly accessible.

<Info>
  Authentication may be introduced in the future. If you are building a long-lived integration, check back here periodically for updates.
</Info>

## Common Patterns

### Request Format

* `GET` endpoints use query parameters
* `POST` endpoints accept JSON body with `Content-Type: application/json`

### Response Format

Successful responses return JSON directly. Error responses follow this format:

```json theme={null}
{
  "error": "Human-readable error message"
}
```

### Token Amounts

All token amounts are in **raw units** (wei). For a token with 18 decimals:

| Human Amount | Raw Amount              |
| ------------ | ----------------------- |
| 1.0          | `1000000000000000000`   |
| 0.5          | `500000000000000000`    |
| 100          | `100000000000000000000` |

Convert with: `rawAmount = humanAmount × 10^decimals`

### Token Addresses

Always use **checksummed or lowercase** ERC-20 addresses. For native KAS, use the **WKAS address** (not the zero address).

## Endpoints

| Method | Endpoint                        | Description                         |
| ------ | ------------------------------- | ----------------------------------- |
| `GET`  | [`/api/v1/quote`](/api/quote)   | Get swap quote with optimal routing |
| `POST` | [`/api/v1/swap`](/api/swap)     | Generate Universal Router calldata  |
| `GET`  | [`/api/v1/pools`](/api/pools)   | List pools                          |
| `GET`  | [`/api/v1/tokens`](/api/tokens) | List tokens                         |

## Rate Limits

There are currently no rate limits. This may change in the future — please use reasonable request frequencies.
