{
  "openapi": "3.1.0",
  "info": {
    "title": "ORD20 API",
    "version": "1.5.11",
    "description": "Read API of the ORD20 token protocol on Bitcoin SV (ord20.io). All amounts: sats as integer strings; token amounts (units) in sats of that id (1 token = 100 sats); price_per_unit_sats = sats per token-sat, 18 decimals (also the backing reference 1.000000000000000000); price_per_token_sats = ×100. Prices without a trade are the backing (1 token = 100 sats) and carry price_source \"backing\". Data is derived from the ORDnet ORD20 indexer (ruleset 0.2.18); times come from block headers. Times are block-header times of the indexed chain (not wall-clock execution time). 24h/7d/30d volumes are time windows on block time with an explicit as_of; block-window analyses are labelled as such. Prices are exact pairs {price_sats, units} plus an 18-decimal ratio.\n\n**1.5.4 (exacte marktdata, review Astra M2-DATA-01…04):** (1) 24h/7d/30d per trade exact op de eigen bloktijd (`as_of − venster ≤ tijd ≤ as_of`, as_of = bloktijd van de indexertip); ontbreekt een tijd, dan `coverage.complete = false` en vensterwaarden `null` — geen blokbenadering meer. (2) `base_volume` = som van de verhandelde units / 100. (3) Elk antwoord uit één database-snapshot met `snapshot {height, hash}`; cursors (v2) binden route, filters, sortering en tip hoogte+hash — na een reorg `409 cursor_stale`, bij een wijziging tijdens het antwoord `503 snapshot_moved`; listings zijn de stand op de tip van de cursor. (4) Prijzen exact: per eenheid en per token 18 decimalen (was per token 6), BSV-prijzen in `public/*` 26 decimalen — een positieve prijs wordt nooit 0; depth/floor/candles via het gehele paar (`price_ratio`, `floor_price`, `*_price`); candles gesorteerd op tijd, en bij een trade zonder tijd `complete = false` zonder candles. Nieuwe velden: `base_units_24h`, `base_units_7d`, `base_units_all`, `coverage`, `snapshot`, `tip_hash`. v2-klaar: `fee_sats` en `lock_ver` van een verkoop komen uit het sold-event (ruleset 0.3.0).\n\n**1.5.5 (review Astra API154-SNAPSHOT/LIST/TIME/V2):** samengestelde antwoorden (`market/tokens`, `market/stats`, `public/*`) lezen alle databasefeiten in één transactie; listinghistorie per outpoint en input (`closed_vin`; status `sold`/`cancelled`/`closed`), alleen geldige lock-outputs (rol R); een bloktijd telt alleen als geldige unix-seconde (anders onbekend/onvolledig); `lock_ver` en `lock_version` komen uit historie/profiel (schema 2, ruleset 0.3.0), `fee_volume_all_sats` uit de werkelijk geheven v2-fees. Antwoorden dragen `ruleset`."
  },
  "servers": [
    {
      "url": "https://api.ord20.io/v1/ord20"
    }
  ],
  "paths": {
    "/status": {
      "get": {
        "summary": "Indexer and node status",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/tokens": {
      "get": {
        "summary": "All tokens (paged)",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "1-based"
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "symbol or id prefix"
          },
          {
            "name": "mintable",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "1 = open public mint only"
          }
        ]
      }
    },
    "/tokens/{id}": {
      "get": {
        "summary": "One token with card, counters and active mint state",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/tokens/{id}/mint-state": {
      "get": {
        "summary": "Active mint state",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/tokens/{id}/mint-head": {
      "get": {
        "summary": "Current mint-state head, confirmed or unconfirmed (addendum WA-1)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MintHead"
                }
              }
            }
          },
          "404": {
            "description": "unknown token"
          },
          "502": {
            "description": "node unavailable"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/tokens/{id}/mint-head/chain": {
      "get": {
        "summary": "The mint head plus every unconfirmed link from the confirmed base (chain_links)",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/tokens/{id}/icon": {
      "get": {
        "summary": "Token icon (image) from the deploy transaction, or an off-chain courtesy icon",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/tokens/{id}/transfers": {
      "get": {
        "summary": "Transfers",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/tokens/{id}/holders": {
      "get": {
        "summary": "Holders",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/tokens/{id}/mints": {
      "get": {
        "summary": "Mints",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/tokens/{id}/listings": {
      "get": {
        "summary": "Open listings of one token",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/tokens/{id}/trades": {
      "get": {
        "summary": "Sales of one token",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/address/{pkh}/utxos": {
      "get": {
        "summary": "Token outputs of an address",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "pkh",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/address/{pkh}/listings": {
      "get": {
        "summary": "Open and closed listings of an address",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "pkh",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/address/{pkh}/trades": {
      "get": {
        "summary": "Purchases and sales of an address",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "pkh",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/funding/{address}": {
      "get": {
        "summary": "Plain P2PKH outputs of an address (from the ORDnet address index)",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "description": "Confirmed P2PKH outputs of a BSV address from the ORDnet address index. Since 1.5.3 every output is checked with the ORDnet node (gettxouts, mempool included): spent_in_mempool, spent_by, node_missing; plus mempool_checked, free_sats (confirmed and not spent in the mempool) and pending_spend (a confirmed output of this address is spent by an unconfirmed transaction). When the node cannot be asked, mempool_checked is false and free_sats/pending_spend are null."
      },
      "parameters": [
        {
          "name": "address",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/outpoint/{txid}/{vout}": {
      "get": {
        "summary": "One output as the node sees it",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "txid",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "vout",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/outpoint/{txid}/{vout}/spend": {
      "get": {
        "summary": "Who spent this outpoint, and in which block (1.5.9)",
        "description": "1.5.9 (agreement v1.19 §4a H2): which confirmed transaction spent this outpoint. Read from the indexer table ord20_spends joined to ord20_blocks in one snapshot, then checked independently against the ORDnet node (getrawtransaction): same txid, this exact outpoint on input spend.vin, in a block with the same hash, at least 1 confirmation. confirmed_spend is true only when both agree (node_check.result = match). spend = null means no spend is known to the index; it is NOT evidence that the output is unspent (plain funding spent by a non-ORD20 transaction is not indexed). A reorg removes the row together with its block, so wallets must re-check a superseded attempt. Never cached (Cache-Control: no-store). 1.5.10: node answers count only as a complete HTTP 200 JSON-RPC reply carrying this call's own id; anything else is node_check unavailable (reason protocol/transport/rpc_error), never evidence. 1.5.11: the reply must also carry \"error\": null; a reply without an error key is protocol.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OutpointSpend"
                }
              }
            }
          },
          "400": {
            "description": "invalid_id"
          },
          "503": {
            "description": "not_ready, index_inconsistent or snapshot_moved"
          }
        }
      },
      "parameters": [
        {
          "name": "txid",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "vout",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/tx/{txid}": {
      "get": {
        "summary": "Transaction status",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "txid",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/broadcast": {
      "post": {
        "summary": "Broadcast a raw transaction through the ORDnet node",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "description": "1.5.1 (WA-1 §5): a rejection is 400 broadcast_rejected with error.class ∈ {mint_state_conflict, mint_state_missing, funding_spent, funding_missing, other}, error.txid and error.inputs[{vin, outpoint, status (spent|missing), spent_by, mint_state}]. Each input is checked with the node; 'missing inputs' alone is never read as a mint race. A transaction the node already knows is answered 200 {txid, accepted: true, already_known: true}, so resending the same bytes is safe. 502 node_unavailable = outcome unknown: look the txid up before doing anything else."
      }
    },
    "/market/listings": {
      "get": {
        "summary": "All open listings, all tokens",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Listing"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "fee_bps": {
                      "type": "integer"
                    },
                    "fee_model": {
                      "type": "string",
                      "enum": [
                        "v1",
                        "v2"
                      ]
                    },
                    "lock_version": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "72-hex id"
          },
          {
            "name": "seller",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "address or pkh"
          },
          {
            "name": "min_price_sats",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "max_price_sats",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "price (default) | height | units"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "≤ 500"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "opaque keyset cursor from next_cursor"
          }
        ]
      }
    },
    "/market/listings/{outpoint}": {
      "get": {
        "summary": "One listing with its history (open | sold | cancelled)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListingDetail"
                }
              }
            }
          },
          "404": {
            "description": "not found"
          }
        }
      },
      "parameters": [
        {
          "name": "outpoint",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/market/trades": {
      "get": {
        "summary": "All sales (sold events)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Trade"
                      }
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "snapshot_tip": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "trades are paged within this indexed height; the cursor carries it"
                    },
                    "fee_model": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "buyer",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "seller",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "since_height",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "asc | desc"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "≤ 500"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "until_height",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "snapshot height (default: current tip)"
          }
        ]
      }
    },
    "/market/tokens": {
      "get": {
        "summary": "Market table per token: floor, last price, reference price (trade or backing), market cap, volumes, holders",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/MarketToken"
                      }
                    },
                    "tip": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "block time of the indexed tip (unix)"
                    },
                    "windows": {
                      "type": "object",
                      "properties": {
                        "h24": {
                          "$ref": "#/components/schemas/Window"
                        },
                        "d7": {
                          "$ref": "#/components/schemas/Window"
                        },
                        "d30": {
                          "$ref": "#/components/schemas/Window"
                        }
                      }
                    },
                    "time_basis": {
                      "type": "string"
                    },
                    "usd_per_bsv": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "price_stale": {
                      "type": "boolean"
                    },
                    "fee_bps": {
                      "type": "integer"
                    },
                    "fee_model": {
                      "type": "string"
                    },
                    "lock_version": {
                      "type": "integer"
                    },
                    "analytics_version": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/market/tokens/{id}/candles": {
      "get": {
        "summary": "OHLCV from sales, bucketed by blocks",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token_id": {
                      "type": "string"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "time",
                        "blocks"
                      ]
                    },
                    "interval_seconds": {
                      "type": "integer"
                    },
                    "interval_blocks": {
                      "type": "integer"
                    },
                    "time_basis": {
                      "type": "string"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Candle"
                      }
                    },
                    "analytics_version": {
                      "type": "string"
                    }
                  },
                  "description": "items[].first_height en last_height: hoogte van de eerste en de laatste verkoop in de bucket (first_height hersteld in 1.5.7, gelijk aan 1.5.3)."
                }
              }
            }
          },
          "400": {
            "description": "invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "1h | 1d (UTC buckets on block time) | blocks:N (block buckets)"
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "height"
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "height"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/market/tokens/{id}/depth": {
      "get": {
        "summary": "Ask side of the book grouped by price per unit (ORD/locked has no bids)",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ]
    },
    "/market/stats": {
      "get": {
        "summary": "Global market totals",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/price": {
      "get": {
        "summary": "BSV/USD reference rate (server-side, cached)",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/public/assets": {
      "get": {
        "summary": "Asset list in exchange-integration form (CoinMarketCap / CoinGecko)",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "description": "Per asset o.a. icon (URL van /v1/ord20/tokens/{id}/icon), explorer (https://ord20.io/token/{id}), holders (aantal unieke houders, tekst), chain ('BSV') en standard ('ORD20') — hersteld in 1.5.7, gelijk aan 1.5.3."
      }
    },
    "/public/tickers": {
      "get": {
        "summary": "Tickers <SYM>_<id12>_BSV; last_price empty without trades, backing_price always",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/public/summary": {
      "get": {
        "summary": "Same as tickers",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/public/orderbook": {
      "get": {
        "summary": "Order book per ticker_id (asks only)",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "parameters": [
          {
            "name": "ticker_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          }
        ]
      }
    },
    "/public/historical_trades": {
      "get": {
        "summary": "Trades per ticker_id",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "parameters": [
          {
            "name": "ticker_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          }
        ],
        "description": "Contract (hersteld in 1.5.7, gelijk aan 1.5.3): per verkoop trade_id (txid:seq), price, base_volume, target_volume, trade_timestamp = bloktijd van de verkoop in SECONDEN sinds de Unix-epoch, als tekst (null bij onbekende/ongeldige bloktijd), type = 'sell' (vaste waarde voor een verkoop in de ORD20-marktplaats: de listing van de verkoper wordt afgenomen), txid, height, units_sats en price_sats (tekst). Dit is het bestaande ORD20-contract, geen claim van conformiteit met een externe aggregatorspecificatie."
      }
    }
  },
  "components": {
    "schemas": {
      "Price": {
        "type": "object",
        "properties": {
          "price_sats": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "units": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "per_unit_sats": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]{18}$",
            "description": "sats per token-sat, 18 decimals (exact)"
          },
          "per_token_sats": {
            "type": "string"
          }
        },
        "required": [
          "price_sats",
          "units",
          "per_unit_sats"
        ]
      },
      "Ask": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "sats",
              "token"
            ]
          },
          "price_sats": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          }
        }
      },
      "Listing": {
        "type": "object",
        "properties": {
          "outpoint": {
            "type": "string"
          },
          "token_id": {
            "type": "string"
          },
          "sym": {
            "type": [
              "string",
              "null"
            ]
          },
          "units": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "ask": {
            "$ref": "#/components/schemas/Ask"
          },
          "price": {
            "$ref": "#/components/schemas/Price"
          },
          "price_per_unit_sats": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]{18}$",
            "description": "sats per token-sat, 18 decimals (exact)"
          },
          "price_per_token_sats": {
            "type": "string"
          },
          "seller": {
            "type": [
              "string",
              "null"
            ]
          },
          "seller_pkh": {
            "type": "string"
          },
          "lock_ver": {
            "type": "integer"
          },
          "listed_txid": {
            "type": "string"
          },
          "listed_vout": {
            "type": "integer"
          },
          "listed_height": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "listed_time": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "open",
              "sold",
              "cancelled"
            ]
          }
        },
        "required": [
          "outpoint",
          "token_id",
          "units",
          "ask",
          "price",
          "seller_pkh",
          "listed_txid",
          "listed_height",
          "status"
        ]
      },
      "ListingDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Listing"
          },
          {
            "type": "object",
            "properties": {
              "closed_txid": {
                "type": "string"
              },
              "closed_height": {
                "type": "string",
                "pattern": "^[0-9]+$",
                "description": "integer as decimal string"
              },
              "buyer": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "buyer_pkh": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "history": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "txid": {
                      "type": "string"
                    },
                    "height": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "description": "integer as decimal string"
                    },
                    "time": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "Trade": {
        "type": "object",
        "properties": {
          "txid": {
            "type": "string"
          },
          "trade_id": {
            "type": "string",
            "description": "txid:seq — stable identity"
          },
          "token_id": {
            "type": "string"
          },
          "sym": {
            "type": [
              "string",
              "null"
            ]
          },
          "units": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "price_sats": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "price": {
            "$ref": "#/components/schemas/Price"
          },
          "fee_sats": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "fee_bps": {
            "type": "integer"
          },
          "lock_ver": {
            "type": "integer"
          },
          "buyer": {
            "type": [
              "string",
              "null"
            ]
          },
          "buyer_pkh": {
            "type": "string"
          },
          "seller": {
            "type": [
              "string",
              "null"
            ]
          },
          "seller_pkh": {
            "type": [
              "string",
              "null"
            ]
          },
          "lock_outpoint": {
            "type": [
              "string",
              "null"
            ]
          },
          "listed_txid": {
            "type": [
              "string",
              "null"
            ]
          },
          "listed_height": {
            "type": [
              "string",
              "null"
            ]
          },
          "height": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "time": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "txid",
          "trade_id",
          "token_id",
          "units",
          "price_sats",
          "price",
          "buyer_pkh",
          "height"
        ]
      },
      "Window": {
        "type": "object",
        "properties": {
          "seconds": {
            "type": "integer"
          },
          "from_height": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "MarketToken": {
        "type": "object",
        "properties": {
          "token_id": {
            "type": "string"
          },
          "sym": {
            "type": "string"
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "mint_status": {
            "type": "string"
          },
          "holders": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "supply_units": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "cap_units": {
            "type": [
              "string",
              "null"
            ]
          },
          "minted_units": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "backed_sats": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "floor_price_per_unit_sats": {
            "type": [
              "string",
              "null"
            ]
          },
          "open_listings": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "listed_units": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "last_price": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Price"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_price_per_unit_sats": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_trade_txid": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_price_per_unit_sats": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]{18}$",
            "description": "sats per token-sat, 18 decimals (exact)"
          },
          "price_source": {
            "type": "string",
            "enum": [
              "trade",
              "backing"
            ]
          },
          "market_cap_sats": {
            "type": [
              "string",
              "null"
            ]
          },
          "fdv_sats": {
            "type": [
              "string",
              "null"
            ]
          },
          "volume_24h_sats": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "volume_7d_sats": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "volume_30d_sats": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "volume_all_sats": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "trades_24h": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "trades_7d": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "trades_all": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "fee_bps": {
            "type": "integer"
          }
        },
        "required": [
          "token_id",
          "sym",
          "supply_units",
          "backed_sats",
          "reference_price_per_unit_sats",
          "price_source"
        ]
      },
      "Candle": {
        "type": "object",
        "properties": {
          "start_time": {
            "type": "string"
          },
          "end_time": {
            "type": "string"
          },
          "start_height": {
            "type": "string"
          },
          "end_height": {
            "type": "string"
          },
          "open": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]{18}$",
            "description": "sats per token-sat, 18 decimals (exact)"
          },
          "high": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]{18}$",
            "description": "sats per token-sat, 18 decimals (exact)"
          },
          "low": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]{18}$",
            "description": "sats per token-sat, 18 decimals (exact)"
          },
          "close": {
            "type": "string",
            "pattern": "^[0-9]+\\.[0-9]{18}$",
            "description": "sats per token-sat, 18 decimals (exact)"
          },
          "volume_sats": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "volume_units": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "trades": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "first_height": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          },
          "last_height": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "description": "integer as decimal string"
          }
        },
        "required": [
          "open",
          "high",
          "low",
          "close",
          "volume_sats",
          "volume_units",
          "trades"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "MintHead": {
        "type": "object",
        "description": "Addendum WA-1 §4: the current head of a token's mint state, confirmed or unconfirmed. Never cached (Cache-Control: no-store). An observation, not a reservation. head.parent_txid = de transactie die het head-outpoint heeft gemaakt (bij een bevestigde kop, depth 0: de txid van dat outpoint), niet de voorgaande minttransactie; sinds 1.5.7 onafhankelijk van de procesgeschiedenis. chain_links[].created_by volgt dezelfde betekenis.",
        "required": [
          "token_id",
          "status",
          "complete",
          "base",
          "head",
          "state",
          "observed_at"
        ],
        "properties": {
          "token_id": {
            "type": "string"
          },
          "network": {
            "type": "string"
          },
          "ruleset": {
            "type": "string"
          },
          "addendum": {
            "type": "string",
            "example": "WA-1/1.0"
          },
          "status": {
            "type": "string",
            "enum": [
              "usable",
              "not_activated",
              "cap_exhausted",
              "closed",
              "state_lost",
              "unresolved"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              null,
              "node_ahead_of_indexer",
              "base_missing",
              "base_not_a_mint_state",
              "base_not_this_token",
              "classification_deferred",
              "walk_limit",
              "rpc_unavailable",
              "rpc_unexpected",
              "inconsistent_view"
            ]
          },
          "complete": {
            "type": "boolean",
            "description": "false whenever status is unresolved; then head is null and nothing may be built"
          },
          "retry_after_ms": {
            "type": "integer"
          },
          "base": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "height": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "blockhash": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "outpoint": {
                "type": "string",
                "description": "internal 72-hex outpoint (txid LE + vout LE)"
              }
            }
          },
          "head": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "outpoint": {
                "type": "string"
              },
              "txid": {
                "type": "string"
              },
              "vout": {
                "type": "integer"
              },
              "value": {
                "type": "string"
              },
              "script_hex": {
                "type": "string"
              },
              "confirmed": {
                "type": "boolean"
              },
              "parent_txid": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "state": {
            "type": [
              "object",
              "null"
            ],
            "description": "same shape as active_mint_state, plus whitelist_root; counters are decimal integer strings; minted_total is the indexer field (no 'minted' alias)"
          },
          "depth_unconfirmed": {
            "type": [
              "string",
              "null"
            ],
            "description": "number of unconfirmed mint transitions between base and head; NOT the ancestor count of a candidate (funding may add ancestors)"
          },
          "chain": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "count": {
                "type": "string"
              },
              "first_txid": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "last_txid": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "terminal_txid": {
            "type": "string"
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "limits": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "ancestor": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "cpfp_group": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "OutpointSpend": {
        "type": "object",
        "required": [
          "outpoint",
          "spend",
          "index_tip",
          "index_confirmations",
          "node_check",
          "confirmed_spend"
        ],
        "properties": {
          "outpoint": {
            "type": "object",
            "properties": {
              "txid": {
                "type": "string",
                "description": "64 hex, display order"
              },
              "vout": {
                "type": "integer"
              },
              "id": {
                "type": "string",
                "description": "internal 72-hex outpoint (txid LE + vout LE)"
              }
            }
          },
          "spend": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "txid": {
                "type": "string"
              },
              "vin": {
                "type": "integer"
              },
              "block_height": {
                "type": "string"
              },
              "block_hash": {
                "type": "string"
              },
              "tx_index": {
                "type": "integer"
              },
              "class": {
                "type": "string",
                "description": "indexer class of the spent output (e.g. known_valid, plain_context)"
              }
            }
          },
          "index_tip": {
            "type": "object",
            "properties": {
              "height": {
                "type": "string"
              },
              "hash": {
                "type": "string"
              }
            }
          },
          "index_confirmations": {
            "type": [
              "string",
              "null"
            ]
          },
          "node_check": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "result": {
                "type": "string",
                "enum": [
                  "match",
                  "mismatch",
                  "unavailable"
                ]
              },
              "reason": {
                "type": "string",
                "enum": [
                  "node_does_not_know_tx",
                  "txid",
                  "input",
                  "block",
                  "confirmations",
                  "rpc_error",
                  "protocol",
                  "transport"
                ],
                "description": "mismatch: node_does_not_know_tx (RPC -5), txid, input, block, confirmations. unavailable (1.5.10): rpc_error (any other RPC refusal), protocol (no complete HTTP 200 answer bound to this call's id), transport."
              },
              "confirmations": {
                "type": "string"
              }
            }
          },
          "confirmed_spend": {
            "type": "boolean"
          }
        }
      }
    }
  }
}