Skip to main content

Quickstart

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.
  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

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

A few methods to try next. See the JSON-RPC Reference for full details.

GoalMethodReference
Get a Bitcoin block heightbtc_getblockcountBitcoin Core RPC
Get a block hash by heightbtc_getblockhashBitcoin Core RPC
Get all UTXOs for an addressesplora_address::utxoesplora_* Methods
Get current fee estimatesesplora_fee-estimatesesplora_* Methods
Get inscription detailsord_inscriptionord_* Methods
Get rune informationord_runeord_* Methods
Run a custom server-side scriptlua_evalscriptLua Scripting

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