API

Hyperliquid Spot Prices API

RESTful API for real-time cryptocurrency prices

Overview

The Hyperliquid Spot Prices API provides real-time cryptocurrency spot prices and market data from the Hyperliquid exchange. This API is free to use and requires no authentication.

REST API
JSON Response
CORS Enabled
No Auth Required
Memory Cached

Base URL:

https://your-domain.com/api
Performance & Caching

This API uses intelligent memory caching to provide fast responses even under high load:

  • Memory Cache: Data is cached in server memory for instant responses
  • Auto-Update: Cache is automatically updated every 30 seconds
  • Cache Headers: Response includes cache age and status information
  • Fallback: If cache is empty, API fetches fresh data immediately

Cache Status Headers: Check X-Cache-Age and X-Cache-Status headers to monitor cache performance.

Authentication

No authentication is required to use this API. All endpoints are publicly accessible.

Endpoints
GET
/api/spots

Get all spot prices or filter by specific criteria

Query Parameters
ParameterTypeDescriptionExample
symbolstringFilter by specific token symbolBTC
limitnumberLimit number of results10
sortBystringSort by: price, name, change, changePercentprice
orderstringSort order: asc, descdesc
Response Format
{
  "success": true,
  "data": [
    {
      "name": "BTC",
      "price": 45000.5,
      "prevPrice": 44500.0,
      "change": 500.5,
      "changePercent": 1.12,
      "szDecimals": 5,
      "logoUrl": "https://app.hyperliquid.xyz/coins/BTC_USDC.svg",
      "maxLeverage": 50,
      "onlyIsolated": false,
      "lastUpdated": "2024-01-01T12:00:00.000Z"
    }
  ],
  "meta": {
    "total": 1,
    "timestamp": "2024-01-01T12:00:00.000Z",
    "source": "Hyperliquid API",
    "cached": true,
    "cacheAge": 15,
    "lastCacheUpdate": "2024-01-01T11:59:45.000Z"
  }
}
Code Examples
// 获取所有现货价格
fetch('https://your-domain.com/api/spots')
  .then(response => response.json())
  .then(data => {
    console.log('Spot prices:', data.data);
    console.log('Cache age:', data.meta.cacheAge, 'seconds');
  })
  .catch(error => {
    console.error('Error:', error);
  });

// 获取特定代币价格
fetch('https://your-domain.com/api/spots?symbol=BTC')
  .then(response => response.json())
  .then(data => {
    console.log('BTC price:', data.data[0]);
  });

// 获取前10个代币,按涨跌幅排序
fetch('https://your-domain.com/api/spots?limit=10&sortBy=changePercent&order=desc')
  .then(response => response.json())
  .then(data => {
    console.log('Top gainers:', data.data);
  });
Rate Limits

To ensure fair usage and optimal performance, the following rate limits apply:

  • 100 requests per minute per IP address
  • 1000 requests per hour per IP address
  • Data is cached for 30 seconds to improve performance
  • Cache is updated automatically every 30 seconds

Note: Thanks to memory caching, most requests will be served instantly from cache, reducing the load on upstream APIs and improving response times.

OpenAPI Specification

Download the complete OpenAPI 3.0 specification for this API. You can use this with tools like Postman, Insomnia, or generate client SDKs.

{
  "openapi": "3.0.3",
  "info": {
    "title": "Hyperliquid Spot Prices API",
    "description": "RESTful API for real-time cryptocurrency spot prices from Hyperliquid exchange",
    "version": "1.0.0",
    "contact": {
      "name": "API Support",
      "url": "https://your-domain.com/api-docs"
    },
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    }
  },
  "servers": [
    {
      "url": "https://your-domain.com/api",
      "description": "Production server"
    }
  ],
  "paths": {
    "/spots": {
      "get": {
        "summary": "Get spot prices",
        "description": "Retrieve real-time cryptocurrency spot prices and market data",
        "parameters": [
          {
            "name": "symbol",
            "in": "query",
            "description": "Filter by specific token symbol",
            "required": false,
            "schema": {
              "type": "string",
              "example": "BTC"
            }
          },
       ...
OpenAPI 3.0.3
JSON Format
Complete Schema
Try It Out

Test the API directly in your browser: