> For the complete documentation index, see [llms.txt](https://gitbook.pumpleverage.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.pumpleverage.fun/api-reference/overview/vault-data-api.md).

# Vault Data API

The PLX API exposes real-time vault state, oracle composites, rebalance events, and reward distributions. All endpoints return JSON; signed actions (deposit/mint/burn/withdraw) require a wallet signature. Use REST for snapshots and **WebSockets** for streams.

**Base URLs**

* REST: `https://api.plx.fi/v1`
* WS: `wss://stream.plx.fi`
* GraphQL: `https://api.plx.fi/graphql`

**Auth**

* Header: `Authorization: Bearer <API_KEY>`
* Signed actions include an **ed25519** wallet signature in payload (`signature`) and the `x-plx-ts` timestamp header.

**Rate limits**

* Default: `500 req/min/IP` (burst 100)
* WS: up to `10 msgs/sec` (free tier)

#### Quick test (no auth needed)

```bash
curl -s https://api.plx.fi/v1/health
```

```json
{"status":"ok","network":"solana-mainnet","ts":1735698123}
```

#### Minimal TypeScript client (fetch)

```ts
const BASE = "https://api.plx.fi/v1";
const headers = (key?: string) => ({
  "Content-Type": "application/json",
  ...(key ? { Authorization: `Bearer ${key}` } : {}),
});

export async function api(path: string, key?: string, init?: RequestInit) {
  const res = await fetch(`${BASE}${path}`, {headers: headers(key), ...init});
  if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
  return res.json();
}
```

Query live vaults (e.g., **SOL2X**, **SOL5X**, **PUMP2X**, **PUMP5X**, **CHILLGUY2X**) and global stats.

**Endpoints**

* `GET /vaults` — list vaults
* `GET /vaults/{symbol}` — detail (e.g., `/vaults/SOL5X`)
* `GET /vaults/stats/global` — aggregate metrics

#### curl

```bash
curl -s https://api.plx.fi/v1/vaults
```

```json
[
  {"symbol":"SOL2X","tvl":1720948.21,"leverage":2,"apy":34.2,"price":187.54,"status":"active"},
  {"symbol":"SOL5X","tvl":2739482.91,"leverage":5,"apy":35.1,"price":188.54,"status":"active"},
  {"symbol":"PUMP2X","tvl":409322.12,"leverage":2,"apy":41.0,"price":0.0231,"status":"active"}
]
```

```bash
curl -s https://api.plx.fi/v1/vaults/SOL5X
```

```json
{
  "symbol":"SOL5X",
  "price":188.54,
  "leverage":5,
  "target_ratio":5.0,
  "current_ratio":4.97,
  "tvl":2739482.91,
  "apy":35.1,
  "rebalance_count_24h":16,
  "drift":0.0062,
  "collateral":"JitoSOL",
  "oracle_variance":0.0021,
  "status":"active",
  "updated_at":1735698123
}
```

```bash
curl -s https://api.plx.fi/v1/vaults/stats/global
```

```json
{
  "vaults":5,
  "tvl_total":4874321.24,
  "rebalances_24h":58,
  "avg_apy":34.9,
  "avg_oracle_variance":0.0028,
  "epoch":"2025-10-31T00:00:00Z"
}
```

#### TypeScript

```ts
import { api } from "./plx-api";

const key = process.env.PLX_API_KEY;

const all = await api("/vaults", key);
const sol5x = await api("/vaults/SOL5X", key);
const global = await api("/vaults/stats/global", key);

console.log(all.length, sol5x.current_ratio, global.tvl_total);
```
