REST API Overview
The Subfrost REST API provides high-level endpoints for alkanes, AMM pools, and blockchain data. These endpoints are part of the alkanes-data-api service.
Base URLs
Choose the network for your application:
- Mainnet:
https://mainnet.subfrost.io/v4/api - Signet:
https://signet.subfrost.io/v4/api - Regtest:
https://regtest.subfrost.io/v4/api
OPI (BRC-20 Indexer) Base URL:
https://mainnet.subfrost.io/v4/opi
With API key authentication:
https://mainnet.subfrost.io/v4/{api_key}(Standard API)https://mainnet.subfrost.io/v4/{api_key}/opi(OPI API)
Authentication
REST endpoints can be accessed via:
- Public endpoint -
/v4/api/{route}(with CORS from registered domain) - API key in path -
/v4/{api_key}/{route} - API key header -
/v4/api/{route}withx-subfrost-api-keyheader
Request Format
All endpoints accept POST requests with JSON bodies:
curl -X POST https://mainnet.subfrost.io/v4/api/get-bitcoin-price \
-H "Content-Type: application/json" \
-d '{}'
Or with API key:
curl -X POST https://mainnet.subfrost.io/v4/a1b2c3d4e5f67890a1b2c3d4e5f67890/get-bitcoin-price \
-H "Content-Type: application/json" \
-d '{}'
Response Format
All responses follow this structure:
{
"statusCode": 200,
"data": { /* response data */ }
}
Error responses:
{
"statusCode": 400,
"error": "Invalid request parameters"
}
Endpoint Categories
Alkanes
Query alkane tokens and contracts.
POST /get-alkanes- List all alkanesPOST /get-alkanes-by-address- Alkanes for an addressPOST /get-alkane-details- Specific alkane infoPOST /get-alkanes-utxo- Alkane UTXOsPOST /global-alkanes-search- Search alkanes
Pools & AMM
Liquidity pools and AMM operations.
POST /get-pools- List all poolsPOST /get-pool-details- Pool detailsPOST /get-all-pools-details- All pool detailsPOST /address-positions- Liquidity positionsPOST /get-all-token-pairs- All token pairsPOST /get-token-pairs- Pairs for a token
Bitcoin/UTXOs
Bitcoin balance and UTXO queries.
POST /get-address-balance- Address balancePOST /get-taproot-balance- Taproot balancePOST /get-address-utxos- Address UTXOsPOST /get-account-utxos- Account UTXOs
History
Transaction history for AMM operations.
POST /get-pool-swap-history- Pool swap historyPOST /get-token-swap-history- Token swap historyPOST /get-pool-mint-history- Liquidity addsPOST /get-pool-burn-history- Liquidity removesPOST /get-address-swap-history-for-pool- Address swaps
Bitcoin Price
Real-time BTC price from Uniswap V3 WBTC/USDC pool.
POST /get-bitcoin-price- Current BTC price in USDPOST /get-bitcoin-market-chart- Historical price dataPOST /get-bitcoin-market-weekly- 52-week high/lowPOST /get-bitcoin-markets- Market summary
OPI (BRC-20)
Standard OPI endpoints for BRC-20 indexing (via /v4/opi base).
GET /v1/brc20/balance- Get balanceGET /v1/brc20/history- Get historyGET /v1/brc20/token_summary- Token info
Health Check
GET https://mainnet.subfrost.io/v4/api/health
Response:
{
"status": "ok",
"timestamp": 1699123456
}
Try It Live
Get Bitcoin Price
POST /v4/api/get-bitcoin-price
Get the current Bitcoin price in USD from Uniswap V3 WBTC/USDC pool.
Click "Run" to execute the request...
Get Bitcoin Market Data
POST /v4/api/get-bitcoin-market-weekly
Get 52-week high/low and current price.
Click "Run" to execute the request...
JavaScript Example
const API_BASE = 'https://mainnet.subfrost.io/v4/api';
async function getAlkanesByAddress(address) {
const response = await fetch(`${API_BASE}/get-alkanes-by-address`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ address })
});
const data = await response.json();
if (data.statusCode !== 200) {
throw new Error(data.error);
}
return data.data;
}
const alkanes = await getAlkanesByAddress('bc1p...');
console.log('Alkane holdings:', alkanes);
Next Steps
- Alkanes Endpoints - Token queries
- Pools & AMM - Liquidity operations
- Bitcoin Data - Balance and UTXOs
- History - Transaction history