Quick Start

Get started with the Subfrost API in just a few minutes.

Prerequisites

  • A Subfrost account (sign up at api.subfrost.io)
  • An API key from your dashboard
  • Basic familiarity with JSON-RPC

Getting Started

  1. Sign Up - Create an account at api.subfrost.io/auth/signup
  2. Verify Email - Confirm your email address
  3. Create API Key - Generate your first API key from your dashboard
  4. Start Building - Make your first API request using the examples below

Networks

Choose the network for your application:

  • Mainnet: https://mainnet.subfrost.io
  • Signet: https://signet.subfrost.io
  • Regtest: https://regtest.subfrost.io

Try It Live

Get the current Bitcoin block height:

btc_getblockcount
Returns the current block height of the Bitcoin blockchain.
Click "Run" to execute the request...

Making Your First Request

Using cURL

curl -X POST https://mainnet.subfrost.io/v4/jsonrpc \
  -H "Content-Type: application/json" \
  -H "x-subfrost-api-key: YOUR_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "method": "btc_getblockcount",
    "params": [],
    "id": 1
  }'

Using JavaScript

const response = await fetch('https://mainnet.subfrost.io/v4/jsonrpc', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-subfrost-api-key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    jsonrpc: '2.0',
    method: 'btc_getblockcount',
    params: [],
    id: 1
  })
});

const data = await response.json();
console.log('Block height:', data.result);

Using Python

import requests

response = requests.post(
    'https://mainnet.subfrost.io/v4/jsonrpc',
    headers={
        'Content-Type': 'application/json',
        'x-subfrost-api-key': 'YOUR_API_KEY'
    },
    json={
        'jsonrpc': '2.0',
        'method': 'btc_getblockcount',
        'params': [],
        'id': 1
    }
)

data = response.json()
print(f"Block height: {data['result']}")

Common Operations

Get Address UTXOs

esplora_address::utxo
Get all unspent transaction outputs for a Bitcoin address.
Click "Run" to execute the request...

Get Inscription Details

ord_inscription
Get details about an Ordinal inscription by ID.
Click "Run" to execute the request...

Get Rune Information

ord_rune
Get information about a Rune by name.
Click "Run" to execute the request...

Get Block Hash by Height

btc_getblockhash
Get the block hash at a specific height.
Click "Run" to execute the request...

Get Fee Estimates

esplora_fee-estimates
Get current fee rate estimates for different confirmation targets.
Click "Run" to execute the request...

Execute a Lua Script

Run custom server-side scripts with full RPC access:

lua_evalscript
Execute a Lua script that combines multiple RPC calls.
Click "Run" to execute the request...

Error Handling

The API returns standard JSON-RPC error responses:

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "Method not found"
  },
  "id": 1
}

Common error codes:

  • -32700 - Parse error (invalid JSON)
  • -32600 - Invalid request (malformed JSON-RPC)
  • -32601 - Method not found
  • -32602 - Invalid params
  • -32603 - Internal error

Next Steps