Bitcoin Data REST Endpoints

Query Bitcoin price data, balances, and market information.

Bitcoin Price Endpoints

These endpoints provide real-time Bitcoin price data from Uniswap V3 WBTC/USDC pool.

get-bitcoin-price

Get the current Bitcoin price in USD.

Endpoint: POST /get-bitcoin-price

POST /v4/api/get-bitcoin-price
Get the current BTC price in USD.
Click "Run" to execute the request...

get-bitcoin-market-weekly

Get 52-week high/low and current price data.

Endpoint: POST /get-bitcoin-market-weekly

POST /v4/api/get-bitcoin-market-weekly
Get 52-week high, low, and current price.
Click "Run" to execute the request...

get-bitcoin-markets

Get market summary with volume and trust score.

Endpoint: POST /get-bitcoin-markets

POST /v4/api/get-bitcoin-markets
Get market data including 24h volume.
Click "Run" to execute the request...

get-bitcoin-market-chart

Get historical price data.

Endpoint: POST /get-bitcoin-market-chart

Parameters:

  • days (string) - Number of days of data ("1", "7", "30", "365")
POST /v4/api/get-bitcoin-market-chart
Get historical price, market cap, and volume data.
Click "Run" to execute the request...

JavaScript Example

class BitcoinClient {
  constructor(network = 'mainnet') {
    this.baseUrl = `https://${network}.subfrost.io/v4/api`;
  }

  async post(endpoint, body = {}) {
    const response = await fetch(`${this.baseUrl}${endpoint}`, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(body)
    });
    const data = await response.json();
    if (data.statusCode !== 200) throw new Error(data.error);
    return data.data;
  }

  async getPrice() {
    const data = await this.post('/get-bitcoin-price');
    return data.bitcoin.usd;
  }

  async getMarketData() {
    return this.post('/get-bitcoin-market-weekly');
  }

  async getPriceHistory(days = '7') {
    return this.post('/get-bitcoin-market-chart', { days });
  }
}

// Usage
const btc = new BitcoinClient();

const price = await btc.getPrice();
console.log(`Current BTC price: $${price.toLocaleString()}`);

const { market_data } = await btc.getMarketData();
console.log(`52-week high: $${market_data.high_52w.usd.toLocaleString()}`);
console.log(`52-week low: $${market_data.low_52w.usd.toLocaleString()}`);

const history = await btc.getPriceHistory('30');
console.log(`Got ${history.prices.length} price points`);

Response Formats

get-bitcoin-price Response

{
  "statusCode": 200,
  "data": {
    "bitcoin": {
      "usd": 97500.25
    }
  }
}

get-bitcoin-market-weekly Response

{
  "statusCode": 200,
  "data": {
    "market_data": {
      "current_price": { "usd": 97500.25 },
      "high_52w": { "usd": 135000.00 },
      "low_52w": { "usd": 42000.00 }
    }
  }
}

get-bitcoin-markets Response

{
  "statusCode": 200,
  "data": [
    {
      "base": "BTC",
      "target": "USD",
      "name": "Uniswap V3 (WBTC/USDC)",
      "last": 97500.25,
      "volume": 45000000000,
      "trust_score": "green"
    }
  ]
}

get-bitcoin-market-chart Response

{
  "statusCode": 200,
  "data": {
    "prices": [[1699123456000, 97500.25], ...],
    "market_caps": [[1699123456000, 1900000000000], ...],
    "total_volumes": [[1699123456000, 45000000000], ...]
  }
}