Developers

ELYVX API

A public REST API for structured market data, NAV, simulation, risk and preview execution. JSON over HTTPS, with no API key required for public endpoints.

Conventions

Base URL: https://www.elyvx.com

Every response uses the same envelope. meta.provenance says whether data is live, on-chain, estimated, simulated or preview. meta.stale is true when the provider is serving a last-good snapshot.

Decimal amounts such as pUSD, shares and NAV in quotes and ledger records are strings with up to 6 decimal places. Analytics values are JSON numbers.

success
{
  "ok": true,
  "data": { ... },
  "meta": { "timestamp": 1796049908730, "provenance": "live", "source": "Hyperliquid Info API", "stale": false }
}
error
{
  "ok": false,
  "error": { "code": "VALIDATION_ERROR", "message": "Request validation failed", "details": [ { "path": "amountUsd", "message": "..." } ] }
}

Authentication

Public endpoints need no authentication. Preview portfolio endpoints need a session, carried in the httpOnly elyvx_session cookie. There are two ways to get one:

  • In the app: sign in with Privy (email, Google or wallet). The app exchanges the Privy access token at POST /api/auth/privy for the session cookie.
  • Scripts and the SDK: POST /api/auth/nonce, sign the returned message with personal_sign, then call POST /api/auth/verify. Signing costs no gas and authorizes nothing.

Server-side clients must keep cookies between requests, for example with a cookie jar.

Rate limits

TierLimitApplies to
read120 / minGET endpoints
compute30 / minSimulations and quotes
write20 / minSettlement, auth and saving

Limits are per client IP and use fixed one-minute windows. Every response includes x-ratelimit-limit, x-ratelimit-remaining and x-ratelimit-reset. A 429 response includes retry-after in seconds.

Endpoints

Markets

GET/api/marketsauth: Nonetier: read

All structured markets with live NAV, change since UTC close, trailing returns, volatility, funding and sparkline.

request
curl https://www.elyvx.com/api/markets
response
{ "ok": true, "data": { "markets": [ { "slug": "crypto-bull", "ticker": "CBULL", "nav": 22.74, "change24h": -0.0142, "return30d": -0.45, "volatilityAnnual": 1.03, "fundingAnnual": 0.199, "riskLabel": "Elevated", "legs": [...], "sparkline": [...] } ], "unavailable": [] }, "meta": { "timestamp": 1796049908730, "provenance": "estimate", "source": "Hyperliquid Info API", "stale": false } }
GET/api/markets/{id}auth: Nonetier: read

Product definition, summary, live NAV, composition, risk metrics and maximum supported leverage.

Params · id: ai-bull | crypto-bull | crypto-bear | hype-bull | macro | market-neutral

request
curl https://www.elyvx.com/api/markets/ai-bull
response
{ "ok": true, "data": { "product": {...}, "summary": {...}, "nav": {...}, "composition": [...], "risk": {...}, "maxSupportedLeverage": 10 }, "meta": {...} }
GET/api/markets/{id}/navauth: Nonetier: read

Live NAV estimate (decimal string with 6 dp), previous close NAV and source price timestamp.

request
curl https://www.elyvx.com/api/markets/macro/nav
response
{ "ok": true, "data": { "slug": "macro", "nav": "72.489120", "navNumber": 72.48912, "previousCloseNav": 74.18, "change24h": -0.0228, "asOf": 1796049908730, "priceAsOf": 1796049908342, "provenance": "estimate", "stale": false }, "meta": {...} }
GET/api/markets/{id}/historyauth: Nonetier: read

Simulated daily NAV series with a static 1x reference, drawdown, returns, costs, rebalance events and assumptions.

Params · days (query): 7–365, default 365

request
curl "https://www.elyvx.com/api/markets/hype-bull/history?days=90"
response
{ "ok": true, "data": { "points": [ { "t": 1788393600000, "nav": 100, "reference": 100, "drawdown": 0 } ], "totalReturn": -0.41, "annualizedReturn": -0.41, "volatilityDecay": -0.22, "rebalances": 364, "liquidated": false, "assumptions": [...] }, "meta": { "provenance": "simulation" } }
GET/api/markets/{id}/compositionauth: Nonetier: read

Legs with target weight, signed exposure, live price, 24h change and hourly funding.

request
curl https://www.elyvx.com/api/markets/market-neutral/composition
response
{ "ok": true, "data": { "leverage": 1, "rebalance": "threshold", "legs": [ { "assetId": "BTC", "direction": "long", "targetWeight": 0.3, "exposure": 0.3, "price": 59404.5, "fundingHourly": 0.0000125 } ] } }
GET/api/markets/{id}/riskauth: Nonetier: read

Risk metrics, stress scenarios and volatility decay.

request
curl https://www.elyvx.com/api/markets/crypto-bear/risk
response
{ "ok": true, "data": { "metrics": { "volatilityAnnual": 1.03, "maxDrawdown": 0.41, "var95Daily": 0.08, "riskScore": 61, "riskLabel": "Elevated", ... }, "stress": [ { "id": "crypto-crash", "basketMove": 0.5 } ], "volatilityDecay": -0.12 } }

Market data

GET/api/assetsauth: Nonetier: read

Verified asset registry with live availability and venue maximum leverage.

request
curl https://www.elyvx.com/api/assets
response
{ "ok": true, "data": { "assets": [ { "id": "NVDA", "symbol": "xyz:NVDA", "assetClass": "equity", "venue": "hyperliquid-hip3", "available": true, "maxLeverage": 10 } ] } }
GET/api/pricesauth: Nonetier: read

Live quotes: mark, mid, oracle, 24h change, funding, open interest, volume and impact prices.

Params · ids (query, optional): comma-separated asset IDs

request
curl "https://www.elyvx.com/api/prices?ids=BTC,NVDA,GOLD"
response
{ "ok": true, "data": { "quotes": { "BTC": { "markPx": 59405, "midPx": 59404.5, "oraclePx": 59419, "fundingHourly": 0.0000125, "dayVolumeUsd": 4124670295 } }, "fetchedAt": 1796049908342 }, "meta": { "provenance": "live" } }
GET/api/wallet/{address}auth: Nonetier: read

Read-only native HYPE balances on Elysium and HyperEVM, the kHYPE balance and HyperCore account state.

request
curl https://www.elyvx.com/api/wallet/0x0000000000000000000000000000000000000000
response
{ "ok": true, "data": { "address": "0x…", "balances": [ { "chain": "Elysium", "symbol": "HYPE", "balance": "0" } ], "hypercore": { "perpAccountValue": 0, ... }, "errors": [] }, "meta": { "provenance": "onchain" } }
GET/api/protocol/statsauth: Nonetier: read

Product and asset counts, underlying venue volume and open interest (not ELYVX volume), and preview ledger counters. tvlUsd is always null in the preview.

request
curl https://www.elyvx.com/api/protocol/stats
response
{ "ok": true, "data": { "products": 6, "supportedAssets": 30, "underlyingVolume24hUsd": 6.1e9, "preview": { "portfolios": 12, "mints": 30, "redeems": 4, "store": "redis" }, "tvlUsd": null } }
GET/api/healthauth: Nonetier: read

Market data and chain connectivity, persistence mode and version. Returns HTTP 207 when degraded.

request
curl https://www.elyvx.com/api/health
response
{ "ok": true, "data": { "status": "ok", "marketData": { "mode": "live", "ok": true }, "chains": [ { "chainId": 99901, "ok": true, "blockNumber": "13752353" } ] } }

Simulation

POST/api/baskets/simulateauth: Nonetier: compute

Full analysis of a custom basket: simulation, risk, stress tests, composition, live NAV and a rebalance plan for 10,000 USD.

Params · body: { basket: BasketConfig, days?: 30–365 }

request
curl -X POST https://www.elyvx.com/api/baskets/simulate \
  -H 'content-type: application/json' \
  -d '{"basket":{"name":"Semis vs Index","leverage":1.5,"rebalance":"weekly","legs":[{"assetId":"NVDA","direction":"long","weight":50},{"assetId":"AMD","direction":"long","weight":25},{"assetId":"SP500","direction":"short","weight":25}]}}'
response
{ "ok": true, "data": { "simulation": { "points": [...], "totalReturn": 0.18, ... }, "risk": {...}, "stress": [...], "rebalance": {...} }, "meta": { "provenance": "simulation" } }
POST/api/rebalance/simulateauth: Nonetier: compute

Rebalance plan from live drift for a listed market or a custom basket, plus recent simulated rebalance history.

Params · body: { slug } or { basket }, plus equityUsd?: number (default 10000)

request
curl -X POST https://www.elyvx.com/api/rebalance/simulate -H 'content-type: application/json' -d '{"slug":"macro","equityUsd":25000}'
response
{ "ok": true, "data": { "plan": { "maxDrift": 0.031, "turnoverUsd": 1520.4, "estCostUsd": 0.61, "needed": false, "legs": [...] }, "history": [...], "totalRebalances": 52 } }

Authentication

POST/api/auth/nonceauth: Nonetier: write

Returns a server-generated EIP-4361 message for the address. Its hash is pinned in an httpOnly cookie for 5 minutes.

Params · body: { address, chainId?: number (default 99901) }

request
curl -c jar -X POST https://www.elyvx.com/api/auth/nonce -H 'content-type: application/json' -d '{"address":"0xYourAddress"}'
response
{ "ok": true, "data": { "message": "elyvx.com wants you to sign in…", "expiresAt": 1796050208000 } }
POST/api/auth/verifyauth: Nonetier: write

Verifies the signature (EOA or ERC-1271/6492), consumes the nonce and sets the session cookie.

Params · body: { address, message, signature }

request
curl -b jar -c jar -X POST https://www.elyvx.com/api/auth/verify -H 'content-type: application/json' -d '{"address":"0x…","message":"…","signature":"0x…"}'
response
{ "ok": true, "data": { "kind": "wallet", "address": "0x…", "expiresAt": 1796654709000 } }
GET/api/auth/sessionauth: Nonetier: read

Current session state.

request
curl -b jar https://www.elyvx.com/api/auth/session
response
{ "ok": true, "data": { "authenticated": true, "kind": "wallet", "address": "0x3f5c…a91e", "expiresAt": 1796654709000 } }
DELETE/api/auth/sessionauth: Nonetier: write

Signs out by clearing the session cookie.

request
curl -b jar -X DELETE https://www.elyvx.com/api/auth/session
response
{ "ok": true, "data": { "authenticated": false } }

Preview portfolio

GET/api/portfolioauth: Sessiontier: read

Preview portfolio valued at live NAV: cash, holdings, P&L, exposure by asset and class, hypothetical 30-day history and transactions.

request
curl -b jar https://www.elyvx.com/api/portfolio
response
{ "ok": true, "data": { "session": { "kind": "wallet" }, "portfolio": { "cashUsd": 7500, "totalValueUsd": 9997.28, "holdings": [...], "transactions": [...] } }, "meta": { "provenance": "preview" } }
POST/api/quotes/mintauth: Sessiontier: compute

Signed mint quote, valid for 30 s. Refused with STALE_PRICES when market data is older than 30 s.

Params · body: { slug, amountUsd: decimal string, 10–1,000,000 }

request
curl -b jar -X POST https://www.elyvx.com/api/quotes/mint -H 'content-type: application/json' -d '{"slug":"crypto-bull","amountUsd":"2500"}'
response
{ "ok": true, "data": { "id": "796c…", "kind": "mint", "amountUsd": "2500.000000", "fee": "2.500000", "slippage": "0.216807", "nav": "22.743995", "shares": "109.799672", "exp": 1796049939982, "token": "eyJ…", "allocation": [...] } }
POST/api/quotes/redeemauth: Sessiontier: compute

Signed redeem quote for a number of shares, valid for 30 s.

Params · body: { slug, shares: decimal string }

request
curl -b jar -X POST https://www.elyvx.com/api/quotes/redeem -H 'content-type: application/json' -d '{"slug":"crypto-bull","shares":"50"}'
response
{ "ok": true, "data": { "kind": "redeem", "grossUsd": "1137.199750", "fee": "1.137200", "amountUsd": "1135.96…", "token": "eyJ…" } }
POST/api/preview/mintauth: Sessiontier: write

Settles a mint quote on the preview ledger. Returns 201 on settlement and 200 with replayed: true if the quote was already settled.

Params · body: { quote: token, idempotencyKey: [A-Za-z0-9_-]{8,64} }

request
curl -b jar -X POST https://www.elyvx.com/api/preview/mint -H 'content-type: application/json' -d '{"quote":"eyJ…","idempotencyKey":"9f2c1e7a44d0"}'
response
{ "ok": true, "data": { "transaction": { "type": "mint", "slug": "crypto-bull", "shares": "109.799672", "status": "settled-preview" }, "replayed": false }, "meta": { "provenance": "preview" } }
POST/api/preview/redeemauth: Sessiontier: write

Settles a redeem quote on the preview ledger.

Params · body: { quote, idempotencyKey }

request
curl -b jar -X POST https://www.elyvx.com/api/preview/redeem -H 'content-type: application/json' -d '{"quote":"eyJ…","idempotencyKey":"0b4e6d1f99aa"}'
response
{ "ok": true, "data": { "transaction": { "type": "redeem", "amountUsd": "1135.96…" }, "replayed": false } }
GET/api/basketsauth: Sessiontier: read

Baskets saved by the current session.

request
curl -b jar https://www.elyvx.com/api/baskets
response
{ "ok": true, "data": { "baskets": [ { "id": "q8Zr2bLx0aA", "config": {...}, "createdAt": 1796049910112 } ] } }
POST/api/baskets/createauth: Sessiontier: write

Saves a basket configuration and returns a share URL (configuration encoded in the URL) and a saved URL (by ID).

Params · body: BasketConfig

request
curl -b jar -X POST https://www.elyvx.com/api/baskets/create -H 'content-type: application/json' -d '{"name":"Gold + BTC","leverage":1,"rebalance":"weekly","legs":[{"assetId":"GOLD","direction":"long","weight":50},{"assetId":"BTC","direction":"long","weight":50}]}'
response
{ "ok": true, "data": { "basket": {...}, "shareUrl": "…/app/builder?b=eyJ…", "savedUrl": "…/app/builder?id=q8Zr2bLx0aA" } }
GET/api/baskets/{id}auth: Nonetier: read

Public read of a saved basket configuration. Ownership is not exposed.

request
curl https://www.elyvx.com/api/baskets/q8Zr2bLx0aA
response
{ "ok": true, "data": { "id": "q8Zr2bLx0aA", "config": {...}, "createdAt": 1796049910112 } }
DELETE/api/baskets/{id}auth: Sessiontier: write

Deletes a basket owned by the current session.

request
curl -b jar -X DELETE https://www.elyvx.com/api/baskets/q8Zr2bLx0aA
response
{ "ok": true, "data": { "deleted": true } }

Error codes

CodeHTTPMeaning
VALIDATION_ERROR400Request body or query failed schema validation. Field issues are listed in details.
BAD_REQUEST400Malformed JSON body.
UNAUTHENTICATED401Endpoint requires a session. Sign in first.
SIGNATURE_INVALID401Sign-in signature, nonce or message failed verification.
FORBIDDEN403Quote was issued to a different session.
NOT_FOUND404Unknown market or basket.
QUOTE_EXPIRED409Quote is older than 30 seconds. Request a new quote.
CONFLICT409Concurrent ledger update could not be applied. Retry.
INVALID_QUOTE400Quote signature or type is invalid.
INSUFFICIENT_BALANCE400Not enough pUSD for the mint.
INSUFFICIENT_SHARES400Not enough shares for the redemption.
PAYLOAD_TOO_LARGE413Body exceeds 32 KB.
ASSET_UNAVAILABLE422An underlying asset is delisted or has no history.
LEVERAGE_UNSUPPORTED422Requested leverage exceeds the lowest venue maximum among the legs.
RATE_LIMITED429Too many requests. Honour the retry-after header.
STALE_PRICES503Live prices are older than 30 seconds, so quoting is paused.
UPSTREAM_UNAVAILABLE503Hyperliquid API unreachable and no cached snapshot is available.
INTERNAL_ERROR500Unexpected server error.

TypeScript client

The repository includes a dependency-free typed client at src/lib/sdk/client.ts. It covers every endpoint and throws ElyvxApiError with code, status and details when a response has ok: false.

It runs in browsers, Node.js 18+, Bun and edge runtimes. Requests use credentials: "include", so browser sessions work automatically.

example.ts
import { ElyvxClient, ElyvxApiError } from "@/lib/sdk/client";

const elyvx = new ElyvxClient({ baseUrl: "https://www.elyvx.com" });

// Public data
const { markets } = await elyvx.markets();
const risk = await elyvx.risk("ai-bull");

// Simulate a custom basket
const sim = await elyvx.simulateBasket({
  name: "Gold vs Crypto",
  leverage: 1,
  rebalance: "threshold",
  driftThreshold: 0.1,
  legs: [
    { assetId: "GOLD", direction: "long", weight: 50 },
    { assetId: "BTC", direction: "short", weight: 50 },
  ],
});

// Preview mint (signed in with a wallet signature, see above)
try {
  const quote = await elyvx.mintQuote("crypto-bull", "1000");
  const { transaction } = await elyvx.previewMint(quote.token);
  console.log(transaction.shares, transaction.status); // "settled-preview"
} catch (e) {
  if (e instanceof ElyvxApiError && e.code === "STALE_PRICES") {
    // retry shortly
  }
}