API

JSON over HTTPS. Keys are issued by an admin.

Getting started

  1. 1Create an account
  2. 2Request access from your account page
  3. 3Once approved, create your secret key
curl https://api.fmze.dev/v1/stats \
  -H "X-API-Key: fmze_your_key"

Conventions

Base URL
https://api.fmze.dev/v1
Auth
X-API-Key header or Authorization: Bearer
Amounts
Integers in litoshis (1 LTC = 100000000)
Pages
?page= returns { items, page, pageSize, total }
Errors
{ "error": "..." } with a 4xx or 5xx status
Rate limits
Per key, per minute. Check X-RateLimit-Remaining.

Permissions

explorer
Read blocks, transactions, addresses and network stats
broadcast
Broadcast signed raw transactions
wallet:read
Read wallet balance, addresses and transactions
wallet:receive
Create new receiving addresses
wallet:send
Send LTC from the wallet

Network

GET/statsexplorer

Height, hashrate, difficulty, supply, mempool, fees, price, difficulty adjustment and halving.

GET/feesexplorer

Recommended fee rates in lit/vB to confirm within about 5 minutes (fast), 15 minutes (medium) and an hour (slow), and the minimum nodes relay.

GET/priceexplorer

LTC/USD and the 24 hour change.

GET/difficultyexplorer

Progress to the next difficulty adjustment and the estimated change.

GET/halvingexplorer

Next halving height, blocks left and estimated date.

GET/mining/pools?period=1dexplorer

Blocks found per pool. period is 1d or 1w.

GET/search?q={query}explorer

Finds a block height, block hash, txid or address. Returns { type, id }.

Blocks

GET/blocks?page={n}explorer

Latest blocks, 25 per page.

GET/blocks/tipexplorer

Height, hash and time of the latest block.

GET/blocks/{height|hash}?page={n}explorer

A block with 25 of its transactions per page.

GET/blocks/{height|hash}/txidsexplorer

Every transaction ID in the block.

GET/blocks/{height|hash}/hexexplorer

The raw block.

Transactions

GET/tx/{txid}explorer

Inputs with values, outputs with spent status, fee and confirmations.

GET/tx/{txid}/statusexplorer

Confirmed or not, confirmations and block. Cheap to poll.

GET/tx/{txid}/hexexplorer

The raw transaction.

POST/tx/decodeexplorer

Decodes a raw transaction without sending it.

{ "hex": "0200000001..." }
POST/tx/broadcastbroadcast

Sends a signed transaction. Returns { txid }.

{ "hex": "0200000001..." }

Mempool

GET/mempoolexplorer

Size, total fees, fee rate buckets, the block the node would mine next and the latest transactions.

GET/mempool/txidsexplorer

Every transaction ID waiting in the mempool.

Addresses

GET/address/{address}?page={n}explorer

Balance, totals and history with the change per transaction.

GET/address/{address}/utxosexplorer

Unspent outputs.

GET/address/{address}/validateexplorer

Whether the address is valid, and its type.

POST/addresses/balancesexplorer

Balances for up to 100 addresses.

{ "addresses": ["ltc1q...", "M8T1..."] }

Address watches

GET/watchesexplorer

Addresses this key is watching.

POST/watchesexplorer

Watch an address. Up to 1,000 per key.

{ "address": "ltc1q...", "label": "order-1042" }
DELETE/watches/{id}explorer

Stop watching.

Wallet

GET/walletwallet:read

Spendable, pending and immature balance.

GET/wallet/addresses?page={n}wallet:read

Receiving addresses and what each has received.

POST/wallet/addresseswallet:receive

New receiving address. type is bech32 (default), mweb, p2sh-segwit or legacy.

{ "label": "order-1042", "type": "bech32" }
GET/wallet/transactions?page={n}wallet:read

Wallet transactions, newest first.

GET/wallet/transactions/{txid}wallet:read

One wallet transaction.

GET/wallet/utxoswallet:read

Unspent outputs in the wallet.

POST/wallet/send/estimatewallet:send

The fee a send would pay, without sending. Same body as /wallet/send.

POST/wallet/sendwallet:send

Pays one or more addresses in one transaction. Use an Idempotency-Key header so a retry never pays twice.

{
  "to": [{ "address": "ltc1q...", "amount": 150000000 }],
  "subtractFee": false,
  "feeRate": 10,
  "comment": "payout 77"
}

Webhooks

address.transaction
A watched address sends or receives
wallet.transaction
The key's linked wallet sends or receives
Sent at
0, 1 and 6 confirmations
Signature
X-Fmze-Signature: HMAC-SHA256 of {X-Fmze-Timestamp}.{body}
Retries
Up to 8 times over about 2 hours
{
  "event": "address.transaction",
  "address": "ltc1q...",
  "label": "order-1042",
  "txid": "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",
  "amount": 150000000,
  "confirmations": 1,
  "blockHeight": 3104233
}
import { createHmac, timingSafeEqual } from 'node:crypto';

export function verifyWebhook(rawBody, headers, secret) {
  const expected = 'sha256=' + createHmac('sha256', secret)
    .update(headers['x-fmze-timestamp'] + '.' + rawBody)
    .digest('hex');
  const given = headers['x-fmze-signature'] ?? '';
  return given.length === expected.length &&
    timingSafeEqual(Buffer.from(given), Buffer.from(expected));
}