Reference / API reference

API reference

Every public endpoint, generated from the API's own OpenAPI description.

The SDK is the shorter path

Cursor walking, checkpointing, and reorg rewind are already solved in @secondlayer/sdk — reach for HTTP when you're not writing TypeScript. Envelope, cursor, and filter grammar live in REST API.

Base URL https://api.secondlayer.tools · spec version 1.0.0

index

Decoded chain events (transfers, mints/burns, prints, stacking)

GET/v1/indexbearer

Index discovery

Responses: 200400

GET/v1/index/eventsno key

Decoded events by event_type

ParameterTypeNotes
event_typerequiredft_transfer · nft_transfer · stx_transfer · stx_mint · stx_burn · stx_lock · ft_mint · ft_burn · nft_mint · nft_burn · print
limitintegerPage size; capped at 1000.
cursorstring
from_cursorstring
from_heightinteger
to_heightinteger
contract_idstringContract principal, or a comma-separated set of up to 20 (e.g. `SP1.sbtc-token,SP1.sbtc-registry`). Mutually exclusive with `trait`.
asset_identifierstring
senderstring
recipientstring

Responses: 200400401429503

GET/v1/index/ft-transfersno key

Fungible token transfers

ParameterTypeNotes
limitintegerPage size; capped at 1000.
cursorstring
from_cursorstring
from_heightinteger
to_heightinteger
contract_idstring
senderstring
recipientstring

Responses: 200400401429503

GET/v1/index/nft-transfersno key

NFT transfers

ParameterTypeNotes
limitintegerPage size; capped at 1000.
cursorstring
from_cursorstring
from_heightinteger
to_heightinteger
contract_idstring
asset_identifierstring
senderstring
recipientstring

Responses: 200400401429503

GET/v1/index/contract-callsno key

Decoded contract-call transactions

ParameterTypeNotes
limitintegerPage size; capped at 1000.
cursorstring
from_cursorstring
from_heightinteger
to_heightinteger
contract_idstringContract principal, or a comma-separated set of up to 20 (e.g. `SP1.sbtc-token,SP1.sbtc-registry`). Mutually exclusive with `trait`.
function_namestring
senderstring

Responses: 200400401429503

GET/v1/index/canonicalno key

Canonical block-hash map

ParameterTypeNotes
limitintegerPage size; capped at 1000.
cursorstring
from_cursorstring
from_heightinteger
to_heightinteger

Responses: 200400401429503

GET/v1/index/blocksno key

Canonical blocks

ParameterTypeNotes
limitintegerPage size; capped at 1000.
cursorstring
from_cursorstring
from_heightinteger
to_heightinteger

Responses: 200400401429503

GET/v1/index/blocks/{height_or_hash}no key

Block by height or hash

ParameterTypeNotes
height_or_hashrequiredstringPath segment

Responses: 200400

GET/v1/index/transactionsno key

Full transaction documents

ParameterTypeNotes
limitintegerPage size; capped at 1000.
cursorstring
from_cursorstring
from_heightinteger
to_heightinteger
typestring
senderstring
contract_idstring

Responses: 200400401429503

GET/v1/index/transactions/{tx_id}no key

Transaction by tx_id

ParameterTypeNotes
tx_idrequiredstringPath segment

Responses: 200400

GET/v1/index/stackingno key

PoX-4 stacking actions

ParameterTypeNotes
limitintegerPage size; capped at 1000.
cursorstring
from_cursorstring
from_heightinteger
to_heightinteger
function_namestring
stackerstring
callerstring

Responses: 200400401429503

GET/v1/index/sbtc/eventsno key

sBTC peg events (decoded)

Decoded sBTC peg protocol-state events Hiro declined to filter (SBA #1709): completed-deposit, withdrawal-create/accept/reject, key-rotation, update-protocol-contract.

ParameterTypeNotes
limitintegerPage size; capped at 1000.
cursorstring
from_cursorstring
from_heightinteger
to_heightinteger
confirmedboolean
topicstring
senderstring
request_idinteger
bitcoin_txidstring

Responses: 200400401429503

GET/v1/index/sbtc/depositsno key

sBTC peg-ins (completed deposits)

ParameterTypeNotes
limitintegerPage size; capped at 1000.
cursorstring
from_cursorstring
from_heightinteger
to_heightinteger
confirmedboolean
senderstring
bitcoin_txidstring

Responses: 200400401429503

GET/v1/index/sbtc/withdrawalsno key

sBTC peg-outs (lifecycle, one per request_id)

Peg-outs rolled up per request_id with derived status (REQUESTED→ACCEPTED|REJECTED) and the committed BTC sweep_txid. Never immutably cached (status mutates as later events land).

ParameterTypeNotes
limitintegerPage size; capped at 1000.
cursorstring
from_cursorstring
from_heightinteger
to_heightinteger
confirmedboolean
statusstring
senderstring
request_idinteger
settlement_confirmedboolean

Responses: 200400401429503

GET/v1/index/sbtc/withdrawals/{request_id}no key

sBTC peg-out lifecycle by request_id

ParameterTypeNotes
request_idrequiredintegerPath segment

Responses: 200400

GET/v1/index/sbtc/deposits/{bitcoin_txid}no key

sBTC peg-in by Bitcoin txid

ParameterTypeNotes
bitcoin_txidrequiredstringPath segment

Responses: 200400

GET/v1/index/sbtc/summaryno key

sBTC peg summary scoreboard

One scalar aggregate over the whole bridge: lifecycle counts, net peg flow, locked sats, and circulating sBTC supply (mints − burns). All-time canonical totals; no params.

Responses: 200400

GET/v1/index/mempoolno key

Pending (unconfirmed) transactions

ParameterTypeNotes
limitintegerPage size; capped at 1000.
cursorstring
from_cursorstring
senderstring
typestring

Responses: 200400401429503

GET/v1/index/mempool/{tx_id}no key

Pending transaction by tx_id

ParameterTypeNotes
tx_idrequiredstringPath segment

Responses: 200400

GET/v1/index/contracts/{contract_id}/print-schemano key

Empirical per-topic print payload schemas for a contract

ParameterTypeNotes
contract_idrequiredstringPath segment

Responses: 200400

streams

Raw firehose, bearer

GET/v1/streamsbearer

Streams discovery

Responses: 200400

GET/v1/streams/eventsbearer

Raw event firehose

ParameterTypeNotes
limitintegerPage size; capped at 1000.
cursorstring
from_cursorstring
from_heightinteger
to_heightinteger
typesstring
contract_idstring

Responses: 200400401429503

GET/v1/streams/reorgsbearer

Chain reorg history

ParameterTypeNotes
sincestring
limitintegerPage size; capped at 1000.

Responses: 200400

GET/v1/streams/canonical/{height}bearer

Canonical block by height

ParameterTypeNotes
heightrequiredintegerPath segment

Responses: 200400

GET/v1/streams/tipbearer

Current chain tip

Responses: 200400

subgraphs

Deployed subgraph reads — public anon, private bearer

GET/v1/subgraphsbearer

List readable subgraphs (public + your own with a bearer key)

Responses: 200400

GET/v1/subgraphs/{name}bearer

Subgraph metadata: tables, columns, sync tip, doc links

ParameterTypeNotes
namerequiredstringPath segment

Responses: 200400

GET/v1/subgraphs/{name}/openapi.jsonno key

Generated OpenAPI spec for one subgraph

ParameterTypeNotes
namerequiredstringPath segment

Responses: 200400

GET/v1/subgraphs/{name}/schema.jsonno key

Generated agent schema for one subgraph

ParameterTypeNotes
namerequiredstringPath segment

Responses: 200400

GET/v1/subgraphs/{name}/docs.mdno key

Generated markdown docs for one subgraph

ParameterTypeNotes
namerequiredstringPath segment

Responses: 200400

GET/v1/subgraphs/{name}/{table}no key

Rows, cursor-paginated by _id ({ rows, next_cursor, tip }). Column filters via col.op=value, _limit, _fields, _order=asc|desc.

ParameterTypeNotes
namerequiredstringPath segment
tablerequiredstringPath segment
limitintegerPage size; capped at 1000.
cursorstring
_orderstring
_fieldsstring

Responses: 200400401404429

GET/v1/subgraphs/{name}/{table}/countbearer

Count rows matching filters

ParameterTypeNotes
namerequiredstringPath segment
tablerequiredstringPath segment

Responses: 200400

GET/v1/subgraphs/{name}/{table}/aggregatebearer

Scalar aggregates (_count/_countDistinct/_sum/_min/_max) over filtered rows

ParameterTypeNotes
namerequiredstringPath segment
tablerequiredstringPath segment

Responses: 200400

GET/v1/subgraphs/{name}/{table}/streambearer

SSE tail of new rows (?since=<block> to replay)

ParameterTypeNotes
namerequiredstringPath segment
tablerequiredstringPath segment

Responses: 200400

other

GET/v1bearer

Surface discovery

Responses: 200400

GET/v1/x402/supportedbearer

x402 pay-per-call capability advertisement

Scheme, network (CAIP-2), priced surfaces, accepted assets, free-quota/session metadata, and the per-call USD floor for the pay-per-call rail. Public, no auth.

POST/v1/subgraphs/deploy-paidbearer

x402-paid subgraph deploy (actual path: POST /v1/subgraphs)

Accountless deploy: pay the subgraph-deploy quote via x402 and the subgraph is owned by the paying wallet principal — live indexing from deploy (forward-only), expires in 7 days unless renewed (POST /v1/subgraphs/{name}/renew, subgraph-renew quote) or the account is claimed. Managed plane only.

POST/v1/batchbearer

Batch public reads

Up to 10 public /v1 reads in one round trip. Body: { requests: [{ path, params? }] }. Each item keeps its own auth/quota/pay-per-call semantics; forwarded credentials apply to every item; results return in order with per-item status.

POST/v1/x402/depositbearer

Load a prepaid x402 tab

Pay once on-chain (?usd=<amount>, $0.25–$100, confirmed tier) and receive a PAYMENT-BALANCE token; subsequent Index/Streams calls carrying it debit the tab instantly. Responses report X-BALANCE-REMAINING-USD.

GET/v1/x402/balancebearer

Read a prepaid tab

Current balance for the PAYMENT-BALANCE token presented.

GET/v1/openapi.jsonbearer

This document

Responses: 200400