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

# Crypto

> Real-time and historical cryptocurrency data - prices, markets, charts, trends, and more.

# Crypto

**Base URL:** `https://drain.lat/api/v1/crypto`

<AccordionGroup>
  <Accordion title="GET /price" icon="dollar-sign">
    Get current price and market data for one or more coins.

    ```
    GET /api/v1/crypto/price
    ```

    <ParamField query="ids" type="string" required>
      Comma-separated coin IDs (e.g. `bitcoin,ethereum,solana`).
    </ParamField>

    <ParamField query="currencies" type="string" required>
      Comma-separated currency codes (e.g. `usd,eur,gbp`).
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/crypto/price?ids=bitcoin,ethereum&currencies=usd,eur" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch(
        "https://drain.lat/api/v1/crypto/price?ids=bitcoin,ethereum&currencies=usd,eur",
        { headers: { "x-api-key": "YOUR_API_KEY" } }
      );
      const data = await res.json();
      ```

      ```python Python theme={null}
      import requests

      res = requests.get(
          "https://drain.lat/api/v1/crypto/price",
          params={"ids": "bitcoin,ethereum", "currencies": "usd,eur"},
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "data": {
        "bitcoin": {
          "usd": 62400,
          "usd_market_cap": 1230000000000,
          "usd_24h_vol": 28000000000,
          "usd_24h_change": 2.4,
          "last_updated_at": 1714900000
        }
      },
      "scrapedAt": "2026-05-05T12:00:00.000Z"
    }
    ```
  </Accordion>

  <Accordion title="GET /markets" icon="chart-line">
    Get top coins ranked by market cap with full market data.

    ```
    GET /api/v1/crypto/markets
    ```

    <ParamField query="currency" type="string">
      Target currency. Default `usd`.
    </ParamField>

    <ParamField query="page" type="number">
      Page number. Default `1`.
    </ParamField>

    <ParamField query="per_page" type="number">
      Results per page. Max `250`. Default `50`.
    </ParamField>

    <ParamField query="category" type="string">
      Filter by category (e.g. `defi`, `layer-1`).
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/crypto/markets?currency=usd&per_page=10" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch(
        "https://drain.lat/api/v1/crypto/markets?currency=usd&per_page=10",
        { headers: { "x-api-key": "YOUR_API_KEY" } }
      );
      const data = await res.json();
      ```

      ```python Python theme={null}
      import requests

      res = requests.get(
          "https://drain.lat/api/v1/crypto/markets",
          params={"currency": "usd", "per_page": 10},
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    ```json Response theme={null}
    [
      {
        "id": "bitcoin",
        "symbol": "btc",
        "name": "Bitcoin",
        "currentPrice": 62400,
        "marketCap": 1230000000000,
        "marketCapRank": 1,
        "priceChangePct24h": 2.4,
        "priceChangePct7d": 5.1,
        "circulatingSupply": 19700000,
        "ath": 73750,
        "lastUpdated": "2026-05-05T12:00:00.000Z"
      }
    ]
    ```
  </Accordion>

  <Accordion title="GET /coin/:id" icon="circle-info">
    Get full details for a specific coin including description, links, and social stats.

    ```
    GET /api/v1/crypto/coin/:id
    ```

    <ParamField path="id" type="string" required>
      CoinGecko coin ID (e.g. `bitcoin`, `ethereum`, `solana`).
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/crypto/coin/bitcoin" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/crypto/coin/bitcoin", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

      ```python Python theme={null}
      import requests

      res = requests.get(
          "https://drain.lat/api/v1/crypto/coin/bitcoin",
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "id": "bitcoin",
      "symbol": "btc",
      "name": "Bitcoin",
      "description": "Bitcoin is the first successful internet money...",
      "links": {
        "homepage": ["https://bitcoin.org"],
        "twitter": "bitcoin",
        "reddit": "https://www.reddit.com/r/Bitcoin/"
      },
      "currentPrice": { "usd": 62400 },
      "ath": { "usd": 73750 },
      "circulatingSupply": 19700000,
      "maxSupply": 21000000,
      "communityData": {
        "twitterFollowers": 6800000,
        "redditSubscribers": 5900000
      },
      "scrapedAt": "2026-05-05T12:00:00.000Z"
    }
    ```
  </Accordion>

  <Accordion title="GET /coin/:id/chart" icon="chart-area">
    Get historical price, market cap, and volume data for a coin.

    ```
    GET /api/v1/crypto/coin/:id/chart
    ```

    <ParamField path="id" type="string" required>
      CoinGecko coin ID.
    </ParamField>

    <ParamField query="days" type="string">
      Time range. Options: `1`, `7`, `14`, `30`, `90`, `180`, `365`, `max`. Default `7`.
    </ParamField>

    <ParamField query="currency" type="string">
      Target currency. Default `usd`.
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/crypto/coin/bitcoin/chart?days=7&currency=usd" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch(
        "https://drain.lat/api/v1/crypto/coin/bitcoin/chart?days=7&currency=usd",
        { headers: { "x-api-key": "YOUR_API_KEY" } }
      );
      const data = await res.json();
      ```

      ```python Python theme={null}
      import requests

      res = requests.get(
          "https://drain.lat/api/v1/crypto/coin/bitcoin/chart",
          params={"days": 7, "currency": "usd"},
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "prices": [[1714600000000, 61200], [1714686400000, 62400]],
      "marketCaps": [[1714600000000, 1205000000000], [1714686400000, 1230000000000]],
      "totalVolumes": [[1714600000000, 26000000000], [1714686400000, 28000000000]]
    }
    ```
  </Accordion>

  <Accordion title="GET /trending" icon="fire">
    Get the top trending coins and NFTs in the last 24 hours.

    ```
    GET /api/v1/crypto/trending
    ```

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/crypto/trending" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/crypto/trending", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

      ```python Python theme={null}
      import requests

      res = requests.get(
          "https://drain.lat/api/v1/crypto/trending",
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "coins": [
        {
          "id": "pepe",
          "name": "Pepe",
          "symbol": "PEPE",
          "marketCapRank": 28,
          "priceChangePct24h": 14.2
        }
      ],
      "nfts": [
        {
          "id": "pudgy-penguins",
          "name": "Pudgy Penguins",
          "nativeCurrencyPriceChange24h": 8.4
        }
      ],
      "scrapedAt": "2026-05-05T12:00:00.000Z"
    }
    ```
  </Accordion>

  <Accordion title="GET /global" icon="globe">
    Get global crypto market stats.

    ```
    GET /api/v1/crypto/global
    ```

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/crypto/global" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/crypto/global", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

      ```python Python theme={null}
      import requests

      res = requests.get(
          "https://drain.lat/api/v1/crypto/global",
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "activeCryptocurrencies": 13200,
      "markets": 1042,
      "totalMarketCap": 2340000000000,
      "totalVolume24h": 98000000000,
      "btcDominance": 52.4,
      "ethDominance": 17.1,
      "marketCapChangePct24h": 1.8,
      "scrapedAt": "2026-05-05T12:00:00.000Z"
    }
    ```
  </Accordion>

  <Accordion title="GET /exchange-rates" icon="arrows-rotate">
    Get BTC exchange rates against 30+ currencies.

    ```
    GET /api/v1/crypto/exchange-rates
    ```

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/crypto/exchange-rates" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/crypto/exchange-rates", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

      ```python Python theme={null}
      import requests

      res = requests.get(
          "https://drain.lat/api/v1/crypto/exchange-rates",
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "rates": {
        "usd": { "name": "US Dollar", "unit": "USD", "value": 62400, "type": "fiat" },
        "eur": { "name": "Euro", "unit": "EUR", "value": 57800, "type": "fiat" },
        "eth": { "name": "Ether", "unit": "ETH", "value": 20.0, "type": "crypto" }
      },
      "scrapedAt": "2026-05-05T12:00:00.000Z"
    }
    ```
  </Accordion>

  <Accordion title="GET /search" icon="magnifying-glass">
    Search for coins and exchanges by name or symbol.

    ```
    GET /api/v1/crypto/search
    ```

    <ParamField query="q" type="string" required>
      Search term (coin name or symbol).
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/crypto/search?q=solana" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/crypto/search?q=solana", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

      ```python Python theme={null}
      import requests

      res = requests.get(
          "https://drain.lat/api/v1/crypto/search",
          params={"q": "solana"},
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "coins": [
        {
          "id": "solana",
          "name": "Solana",
          "symbol": "SOL",
          "marketCapRank": 5,
          "thumb": "https://assets.coingecko.com/coins/images/4128/thumb/solana.png"
        }
      ],
      "exchanges": [],
      "scrapedAt": "2026-05-05T12:00:00.000Z"
    }
    ```
  </Accordion>

  <Accordion title="GET /movers" icon="arrow-trend-up">
    Get the top 10 gainers and top 10 losers in the last 24 hours.

    ```
    GET /api/v1/crypto/movers
    ```

    <ParamField query="currency" type="string">
      Target currency. Default `usd`.
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/crypto/movers?currency=usd" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/crypto/movers?currency=usd", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

      ```python Python theme={null}
      import requests

      res = requests.get(
          "https://drain.lat/api/v1/crypto/movers",
          params={"currency": "usd"},
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    ```json Response theme={null}
    {
      "gainers": [
        {
          "id": "pepe",
          "name": "Pepe",
          "symbol": "PEPE",
          "currentPrice": 0.0000142,
          "priceChangePct24h": 42.8,
          "marketCap": 5980000000
        }
      ],
      "losers": [
        {
          "id": "some-token",
          "name": "Some Token",
          "symbol": "SMT",
          "currentPrice": 0.0021,
          "priceChangePct24h": -18.4,
          "marketCap": 120000000
        }
      ],
      "scrapedAt": "2026-05-05T12:00:00.000Z"
    }
    ```
  </Accordion>

  <Accordion title="GET /categories" icon="tags">
    Get the top 30 coin categories ranked by market cap.

    ```
    GET /api/v1/crypto/categories
    ```

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/crypto/categories" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/crypto/categories", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

      ```python Python theme={null}
      import requests

      res = requests.get(
          "https://drain.lat/api/v1/crypto/categories",
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    ```json Response theme={null}
    [
      {
        "id": "layer-1",
        "name": "Layer 1 (L1)",
        "marketCap": 1840000000000,
        "marketCapChange24h": 2.1,
        "volume24h": 48000000000,
        "topCoins": ["bitcoin", "ethereum", "solana", "bnb", "avalanche-2"]
      }
    ]
    ```
  </Accordion>
</AccordionGroup>
