> ## 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.

# zkCompression API

> API reference for Light Protocol compression operations

## Compress SOL

Compress native SOL to ZK compressed SOL.

```bash theme={null}
POST /api/light/compress-sol
```

**Request:**

```json theme={null}
{
  "walletId": "wallet_uuid",
  "amount": 1.5
}
```

**Response:**

```json theme={null}
{
  "success": true,
  "txHash": "5abc...",
  "compressedAmount": "1500000000",
  "decimals": 9
}
```

***

## Decompress SOL

Decompress ZK compressed SOL back to native SOL.

```bash theme={null}
POST /api/light/decompress-sol
```

**Request:**

```json theme={null}
{
  "walletId": "wallet_uuid",
  "amount": 1.5
}
```

**Response:**

```json theme={null}
{
  "success": true,
  "txHash": "6def...",
  "decompressedAmount": "1500000000"
}
```

***

## Compress Token

Compress regular SPL tokens to ZK compressed tokens.

```bash theme={null}
POST /api/light/compress-token
```

**Request:**

```json theme={null}
{
  "walletId": "wallet_uuid",
  "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "amount": 100
}
```

**Response:**

```json theme={null}
{
  "success": true,
  "txHash": "7ghi...",
  "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "compressedAmount": "100000000",
  "decimals": 6
}
```

***

## Decompress Token

Decompress ZK compressed tokens back to regular SPL tokens.

```bash theme={null}
POST /api/light/decompress-token
```

**Request:**

```json theme={null}
{
  "walletId": "wallet_uuid",
  "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "amount": 50
}
```

**Response:**

```json theme={null}
{
  "success": true,
  "txHash": "8jkl...",
  "decompressedAmount": "50000000"
}
```

***

## Get Compressed Balance

Get balance of compressed SOL.

```bash theme={null}
GET /api/light/compressed-balance/:walletId
```

**Response:**

```json theme={null}
{
  "success": true,
  "balance": "1500000000",
  "formatted": "1.5",
  "decimals": 9
}
```

***

## Get Compressed Token Balance

Get balance of a specific compressed token.

```bash theme={null}
GET /api/light/compressed-token-balance/:walletId/:mint
```

**Response:**

```json theme={null}
{
  "success": true,
  "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "balance": "100000000",
  "formatted": "100.00",
  "decimals": 6
}
```

***

## Transfer Compressed Tokens

Transfer compressed tokens to another wallet.

```bash theme={null}
POST /api/light/transfer
```

**Request:**

```json theme={null}
{
  "walletId": "wallet_uuid",
  "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "to": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
  "amount": 50
}
```

**Response:**

```json theme={null}
{
  "success": true,
  "txHash": "9mno...",
  "from": "dujNoX4...",
  "to": "9WzDXwB...",
  "amount": "50000000"
}
```

***

## Create Compressed Token

Create a new compressed SPL token mint.

```bash theme={null}
POST /api/light/create-token
```

**Request:**

```json theme={null}
{
  "walletId": "wallet_uuid",
  "decimals": 6
}
```

**Response:**

```json theme={null}
{
  "success": true,
  "mintAddress": "NewMint123...",
  "txHash": "abc..."
}
```

***

## Error Codes

| Code                   | Description                                |
| ---------------------- | ------------------------------------------ |
| `INSUFFICIENT_BALANCE` | Not enough tokens to compress/decompress   |
| `INVALID_MINT`         | Invalid token mint address                 |
| `RPC_ERROR`            | Solana RPC connection error                |
| `INDEXER_SYNC`         | RPC indexer not synced (retry after delay) |
| `WALLET_LOCKED`        | Wallet mutex lock failed                   |
