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

# Analytics

> Read-only endpoints for transactions, volumes, points, and leaderboards.

import { Callout } from 'mintlify';

## Overview

The Monitoring API (`https://kapi.cashmere.exchange`) exposes unauthenticated endpoints backed by the relayer’s PostgreSQL replicas. Use them to power dashboards, points trackers, and internal monitoring in production.

***

## `/transactionsmainnet`

Production transaction feed with cursor pagination.

```
GET https://kapi.cashmere.exchange/transactionsmainnet?limit=100&cursor=<prev_cursor>
```

| Query                | Type   | Description                                               |
| -------------------- | ------ | --------------------------------------------------------- |
| `senders`            | string | Comma-separated sender addresses.                         |
| `addr_or_tx_hash`    | string | Address, ENS (`.eth`), SNS (`.sol`), or transaction hash. |
| `source_domain`      | number | Filter by origin Circle domain.                           |
| `destination_domain` | number | Filter by destination domain.                             |
| `limit`              | number | Page size (max 100).                                      |
| `cursor`             | string | Pagination cursor returned by the previous page.          |
| `start_time`         | number | (Optional) Unix timestamp lower bound.                    |
| `end_time`           | number | (Optional) Unix timestamp upper bound.                    |

```json theme={null}
{
  "transactions": [
    {
      "id": 12345,
      "source_tx_hash": "0xabc...",
      "destination_tx_hash": "0xdef...",
      "gas_drop_tx_hash": null,
      "source_domain": 0,
      "destination_domain": 3,
      "sender": "0xSender",
      "recipient": "0xRecipient",
      "deposit_amount": 100000000,
      "receive_amount": 99500000,
      "relayer_fee": 1500000,
      "gas_drop_amount": 5000000,
      "is_gas_drop_in_native": false,
      "max_fee": 2000000,
      "version": 2,
      "confirmed": true,
      "has_source_tx_error": false,
      "has_attestation_error": false,
      "has_destination_tx_error": false,
      "destination_tx_status": "success",
      "created_at": "2024-09-18T12:34:56Z"
    }
  ],
  "next_cursor": "1726666496_12345",
  "has_more": true
}
```

All numeric amounts use the bridge asset’s base unit (USDC = 6 decimals). `destination_tx_status` values: `pending`, `success`, or `failed`.

***

## `/users/leaderboard`

```
GET https://kapi.cashmere.exchange/users/leaderboard?network=mainnet&limit=50&offset=0&search=fan
```

| Query     | Default   | Notes                                                               |
| --------- | --------- | ------------------------------------------------------------------- |
| `network` | `mainnet` | Use `devnet` for the testnet leaderboard.                           |
| `limit`   | `50`      | Maximum of `100`.                                                   |
| `offset`  | `0`       | Pagination offset.                                                  |
| `search`  | *empty*   | Optional case-insensitive username filter (truncated to 100 chars). |

```json theme={null}
{
  "leaderboard": [
    {
      "user_id": 42,
      "username": "cashmerefan",
      "ref_code": "CASHFAN",
      "total_base_points": 5320.5,
      "domain_multiplier": 2.5,
      "domain_total_multiplied_points": 13301.25,
      "referral_points": 1200,
      "total_points_with_referrals": 14501.25,
      "staked_op_nfts": 3,
      "staked_eth_nfts": 1,
      "wallet_count": 4,
      "domain_rank": 128
    }
  ],
  "total_count": 4827,
  "limit": 50,
  "offset": 0,
  "has_more": true
}
```

***

## `/users`

Two query patterns are active in production:

1. `GET /users?wallets=0xabc_evm,So111_solana` – wallet-level points and multipliers.
2. `GET /users?domains=username.csm` – domain aggregates and per-chain breakdowns.

### Wallet query

```json theme={null}
{
  "username": "cashmerefan",
  "ref_code": "CASHFAN",
  "users": [
    {
      "user_id": 42,
      "username": "cashmerefan",
      "ref_code": "CASHFAN",
      "wallets": [
        {
          "address": "0xabc...",
          "chain_type": "evm",
          "swap_points": 1200,
          "swap_points_mainnet": 400,
          "points_multiplier": 2.5,
          "total_points_multiplied": 3500,
          "total_points_multiplied_mainnet": 2600
        }
      ],
      "max_multiplier": 2.5,
      "testnet_points": 800,
      "nft_points": 120,
      "swap_points": 1200
    }
  ]
}
```

### Domain query

```json theme={null}
{
  "username": "builder.csm",
  "ref_code": "BUILD",
  "binded_wallets": {
    "evm": "0xabc...",
    "sol": "So111...",
    "apt": "",
    "sui": ""
  },
  "leaderboard_rank_mainnet": 128,
  "leaderboard_rank_devnet": 54,
  "domain_total_multiplied_points_mainnet": 4600,
  "domain_total_multiplied_points": 13301.25,
  "evm": {
    "address": "0xabc...",
    "chain_type": "evm",
    "swap_points": 1200,
    "swap_points_mainnet": 400,
    "testnet_points": 800,
    "points_multiplier": 2.5,
    "total_points_multiplied": 3500,
    "total_points_multiplied_mainnet": 2600,
    "staked_eth_nfts": 1,
    "staked_op_nfts": 3,
    "nft_points": 120
  },
  "sol": {
    "address": "So111...",
    "chain_type": "solana",
    "swap_points": 210,
    "points_multiplier": 1.8,
    "testnet_points": 420,
    "total_points_multiplied": 378
  }
}
```

All payloads retain snake\_case keys.

***

## `/users/messages`

One-time message nonce for wallet binding flows. Call this endpoint immediately before `POST /users/verify`.

```http theme={null}
GET https://kapi.cashmere.exchange/users/messages?username=builder.csm&address=0xabc...&chain_type=evm
```

| Query        | Type   | Notes                                   |
| ------------ | ------ | --------------------------------------- |
| `username`   | string | Cashmere username (include `.csm`).     |
| `address`    | string | Wallet address being bound or unbound.  |
| `chain_type` | string | One of `evm`, `solana`, `sui`, `aptos`. |

```json theme={null}
{
  "nonce": "1700000000",
  "expires_at": "2024-09-18T12:35:56Z"
}
```

Sign the canonical message the frontend displays (`Please sign this message… nonce: <nonce>`).

***

## `POST /users/verify`

Bind or unbind a wallet to a Cashmere username. The backend expects a signed message proving wallet control.

```
POST https://kapi.cashmere.exchange/users/verify
Content-Type: application/json
```

```json theme={null}
{
  "username": "builder.csm",
  "address": "0xabc...",
  "chain_type": "evm",
  "type": "bind",
  "signature": "base64-or-hex-signature",
  "public_key": "optional-base64-public-key",
  "message": "Wallet binding request: builder.csm
Nonce: 1700000000"
}
```

* `chain_type` accepts `evm`, `solana`, `sui`, or `aptos`.
* `type` is either `bind` or `unbind`.
* `public_key` is only required for Aptos bindings.
* `message` must exactly match the prompt used for signing (including newline + nonce).
* Always fetch a fresh nonce via `GET /users/messages` before submitting this request.

```json theme={null}
{
  "success": true,
  "username": "builder.csm"
}
```

***

## `/stats/mainnet/volumes`

Provides transfer volumes. Raw amounts (without `_usd`) are returned as 6-decimal USDC integers.

* `GET /stats/mainnet/volumes` – cumulative lifetime volume (`total_volume`).
* `GET /stats/mainnet/volumes?senders=0xabc...,So111...` – cumulative volume for specific wallets (`user_volume`).
* `GET /stats/mainnet/volumes/hourly?limit=24` – last N hourly buckets (`total_volume_usd` floats).
* `GET /stats/mainnet/volumes/daily?limit=30` – last N daily buckets (`total_volume_usd` floats).

```json theme={null}
{
  "total_volume": 315000000000,
  "user_volume": null,
  "volumes": null
}
```

```json theme={null}
{
  "user_volume": 843127000000,
  "volumes": null
}
```

```json theme={null}
{
  "volumes": [
    {
      "bucket_start": "2024-09-18T12:00:00Z",
      "total_volume_usd": 12500.42
    }
  ]
}
```

***

## `/stats/mainnet/fees`

Returns relayer fee totals in USD.

```
GET https://kapi.cashmere.exchange/stats/mainnet/fees?period=daily&limit=7
```

* `period` – `hourly` (default) or `daily`.
* `limit` – number of buckets to return.

```json theme={null}
{
  "fees": [
    {
      "bucket_start": "2024-09-18T00:00:00Z",
      "total_fee_usd": 532.17,
      "total_relayer_fee_usd": 418.03
    }
  ],
  "period_type": "daily",
  "limit": 7,
  "offset": 0
}
```

***

## `/stats/mainnet/transactions`

Returns the total number of transactions processed by Cashmere relayers.

```json theme={null}
{
  "total_transactions": 48271
}
```

***

## `/stats/mainnet/chain-shares`

Breaks down volume share per Circle domain (see CCTP domain ID table for mappings).

```json theme={null}
{
  "chain_shares": [
    {
      "domain": 0,
      "amount": 2750000,
      "total_amount": 5500000
    }
  ]
}
```

Divide `amount` by `total_amount` to derive the percentage for each domain.

***

## `/stats/mainnet/wallets`

Distinct sender count on mainnet (cached in Redis).

```json theme={null}
{
  "unique_senders_count": 18342
}
```

***

## `/stats/wallets`

Distinct sender count on devnet/testnet (cached).

```json theme={null}
{
  "unique_senders_count": 5120
}
```

***

## Caching & Rate Limits

* Several endpoints (`/stats/mainnet/volumes`, `/stats/mainnet/fees`, `/stats/mainnet/wallets`, `/stats/wallets`) cache responses in Redis for short TTLs.
* No formal rate limit headers are emitted; stay below \~120 requests per minute or contact the team for higher throughput.

<Callout type="warning">
  These APIs are read-only. All write operations (transfers, approvals, configuration) occur on-chain.
</Callout>
