Authentication
How to authenticate with the Lavarage API.
API Key Authentication
The Lavarage API uses API keys passed via the x-api-key HTTP header.
curl https://api.lavarage.xyz/api/v1/positions \
-H "x-api-key: YOUR_API_KEY"
Public Endpoints (No Key Required)
These endpoints are freely accessible:
| Endpoint | Description |
|---|---|
GET /health | Service health check |
GET /api/v1/offers | Browse liquidity pools |
GET /api/v1/offers/utilization | Pool utilization metrics |
GET /api/v1/offers/:publicKey | Single offer details |
GET /api/v1/tokens | Token list with prices |
GET /api/v1/tokens/:address | Single token details |
POST /api/v1/offers/match | Match best offer for token pair |
GET /api/v1/offers/top | Top tokens by activity |
GET /api/v1/offers/latest | Latest tokens |
POST /api/v1/offers/resolve-feed | Resolve Switchboard oracle feed |
GET /api/v1/referral/* | Referral read endpoints |
Protected Endpoints (Key Required)
All position, order, staking, and partner management endpoints require a valid API key.
Getting an API Key
- Contact the team at lavarage.io to get a partner account
- Use the Partners API to generate additional keys:
curl -X POST https://api.lavarage.xyz/api/v1/partners/keys \
-H "x-api-key: YOUR_EXISTING_KEY"
The raw key is only returned once — store it securely.
Key Management
- List keys:
GET /api/v1/partners/keys - Revoke a key:
DELETE /api/v1/partners/keys/:id
Revoking a key is permanent and immediate.
Security Best Practices
- Never expose API keys in client-side code
- Use environment variables for key storage
- Rotate keys periodically using the Partners API
- Revoke compromised keys immediately
Wallet Signature Authentication
Some endpoints (orders, referral) require wallet signature authentication via 3 headers:
| Header | Value |
|---|---|
x-wallet-address | Your Solana wallet address (base58) |
x-wallet-signature | Ed25519 signature of the message (base58) |
x-wallet-message | The signed message: lavarage:<wallet>:<timestamp_ms> |
Message Format
```
lavarage:<wallet_address>:<timestamp_ms>
```
TypeScript Example
```typescript
import nacl from 'tweetnacl';
import bs58 from 'bs58';
const wallet = keypair; // Your Solana Keypair
const timestamp = Date.now().toString();
const message = `lavarage:${wallet.publicKey.toBase58()}:${timestamp}`;
const messageBytes = new TextEncoder().encode(message);
const signature = nacl.sign.detached(messageBytes, wallet.secretKey);
const headers = {
'x-wallet-address': wallet.publicKey.toBase58(),
'x-wallet-signature': bs58.encode(signature),
'x-wallet-message': message,
};
```
Updated 22 days ago