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

# REST API Overview

> Read-only market data and user data via HTTP

The Decibel REST API provides read-only access to market data and user data. Use it to fetch prices, orderbook snapshots, positions, and historical data.

**All endpoints require authentication.** See [Authentication](/api-reference/rest/authentication) for how to get and use your API key.

## Base URL

| Network | Base URL                                    |
| ------- | ------------------------------------------- |
| Testnet | `https://api.testnet.aptoslabs.com/decibel` |
| Mainnet | `https://api.mainnet.aptoslabs.com/decibel` |

## Request Format

All endpoints are `GET` requests under `/api/v1/` with query parameters. No request body is needed.

### Example Request

```bash theme={null}
curl -H "Origin: https://netna-app.decibel.trade/trade" \
     -H "Authorization: Bearer <KEY>" \
     "https://api.testnet.aptoslabs.com/decibel/api/v1/prices"
```

### Example Response

```json theme={null}
[
  {
    "market": "0x...",
    "oracle_px": 97250.5,
    "mark_px": 97248.3,
    "mid_px": 97249.0,
    "funding_rate_bps": 0.12,
    "is_funding_positive": true,
    "transaction_unix_ms": 1718000000000,
    "open_interest": 5200000.0
  }
]
```

## Available Endpoints

### Market Data

| Endpoint                   | Description                                      |
| -------------------------- | ------------------------------------------------ |
| `GET /api/v1/markets`      | List all available markets                       |
| `GET /api/v1/candlesticks` | OHLCV candlestick data                           |
| `GET /api/v1/prices`       | Current prices, funding rates, and open interest |
| `GET /api/v1/trades`       | Recent trades for a market                       |
| `GET /api/v1/dex`          | DEX-level summary                                |

### Account Data

| Endpoint                        | Description                          |
| ------------------------------- | ------------------------------------ |
| `GET /api/v1/account_positions` | Open positions for an account        |
| `GET /api/v1/open_orders`       | Currently open orders                |
| `GET /api/v1/orders`            | Orders (open and recent)             |
| `GET /api/v1/account_overviews` | Account equity, margin, and balances |
| `GET /api/v1/subaccounts`       | Trading Accounts for a user          |

### History

| Endpoint                           | Description                    |
| ---------------------------------- | ------------------------------ |
| `GET /api/v1/trade_history`        | Historical trades              |
| `GET /api/v1/order_history`        | Historical orders              |
| `GET /api/v1/funding_rate_history` | Historical funding rates       |
| `GET /api/v1/account_fund_history` | Deposit and withdrawal history |
| `GET /api/v1/asset_contexts`       | Asset context snapshots        |

### TWAP

| Endpoint                   | Description        |
| -------------------------- | ------------------ |
| `GET /api/v1/active_twaps` | Active TWAP orders |
| `GET /api/v1/twap_history` | TWAP order history |

### Bulk Orders

| Endpoint                        | Description             |
| ------------------------------- | ----------------------- |
| `GET /api/v1/bulk_orders`       | Active bulk orders      |
| `GET /api/v1/bulk_order_fills`  | Bulk order fill history |
| `GET /api/v1/bulk_order_status` | Bulk order status       |

### Vaults

| Endpoint                                | Description                      |
| --------------------------------------- | -------------------------------- |
| `GET /api/v1/vaults`                    | List all vaults                  |
| `GET /api/v1/account_owned_vaults`      | Vaults owned by an account       |
| `GET /api/v1/account_vault_performance` | Vault performance for an account |

### Analytics

| Endpoint                      | Description               |
| ----------------------------- | ------------------------- |
| `GET /api/v1/leaderboard`     | Trading leaderboard       |
| `GET /api/v1/portfolio_chart` | Portfolio value over time |
| `GET /api/v1/delegations`     | Delegation information    |

## SDK Alternative

For most use cases, the TypeScript SDK provides a more ergonomic interface. See [TypeScript SDK Overview](/typescript-sdk/overview).

## Next Steps

<CardGroup cols={2}>
  <Card title="Authentication" href="/api-reference/rest/authentication">
    Required for all API access
  </Card>

  <Card title="Error Handling" href="/api-reference/rest/errors">
    Common errors and how to handle them
  </Card>
</CardGroup>
