# Hyperlight API — Getting Started

> Last updated: 2026-03-14

## Overview

Hyperlight is a drop-in API layer for the Lighter perpetual DEX. Swap your base URL and existing code keeps working. Enhanced endpoints are additive.

**API Base URL:** `https://api.hyperlightapi.xyz`
**OpenAPI Spec:** https://hyperlightapi.xyz/openapi.yaml

## Steps

### Step 01: Sign Up

Create a free account in seconds. Your API key (prefixed hlt_) is generated instantly with 75K credits/month included.

### Step 02: Swap Your Base URL

Replace your Lighter API base URL with api.hyperlightapi.xyz. Existing queries still work — no code rewrite needed.

### Step 03: Use Enhanced Endpoints

Access batch queries, enriched streams, historical exports, and backtesting replay — capabilities beyond Lighter’s native API.

### Step 04: Scale as You Grow

Upgrade your plan for higher rate limits, larger batch sizes, more WebSocket connections, and Parquet data lake access.

## Authentication

Hyperlight uses API keys prefixed with `hlt_`. Pass your key via one of:

- **Header (preferred):** `X-Api-Key: hlt_your_key_here`
- **Bearer auth:** `Authorization: Bearer hlt_your_key_here`
- **Query parameter:** `?api_key=hlt_your_key_here`

For dashboard/user endpoints, use JWT:
- **JWT Bearer:** `Authorization: Bearer <jwt_token>`

For WebSocket, authenticate with the first message:
```json
{"type": "auth", "api_key": "hlt_your_key_here"}
```

## Quick Examples

### Batch query 100 accounts

```bash
curl -X POST https://api.hyperlightapi.xyz/api/v1/accounts/batch \
  -H "X-Api-Key: hlt_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"accounts": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}'
```

### Get orderbook for market 0

```bash
curl https://api.hyperlightapi.xyz/api/v1/orderbook/0 \
  -H "X-Api-Key: hlt_your_key_here"
```

### Get trades in a time range

```bash
curl "https://api.hyperlightapi.xyz/api/v1/trades/by-time?market_id=0&start=2026-01-01T00:00:00Z&end=2026-01-02T00:00:00Z" \
  -H "X-Api-Key: hlt_your_key_here"
```

### Subscribe to enriched WebSocket stream

```bash
wscat -c wss://api.hyperlightapi.xyz/stream
> {"type": "auth", "api_key": "hlt_your_key_here"}
> {"type": "subscribe", "channel": "order_book/0"}
```

## Response Format

All responses follow the envelope format:

```json
{
  "success": true,
  "data": { ... },
  "meta": {
    "request_id": "uuid",
    "timestamp": 1706745600000
  }
}
```

## Rate Limits

Rate limits are enforced per API key. Response headers include:
- `X-RateLimit-Limit` — Max requests per minute
- `X-RateLimit-Remaining` — Remaining requests
- `X-RateLimit-Reset` — Reset timestamp

## Next Steps

- Browse the full [OpenAPI Spec](https://hyperlightapi.xyz/openapi.yaml)
- See [all endpoints](https://hyperlightapi.xyz/llm/endpoints.json)
- Check [pricing details](https://hyperlightapi.xyz/llm/pricing.json)
- Read about [all features](https://hyperlightapi.xyz/llm/features.md)