# Pools

## GET /pool/by-id/{id}

> Returns the pool and its latest state

```json
{"openapi":"3.1.0","info":{"title":"Saturn Indexer API","version":"0.1.0"},"tags":[{"name":"pool","description":"Fetch details of Saturn swap pools"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local testing"}],"paths":{"/pool/by-id/{id}":{"get":{"tags":["pool"],"description":"Returns the pool and its latest state","operationId":"find_one","parameters":[{"name":"id","in":"path","description":"Pool ID as hex string","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Swap pool","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentifiableLiquidityPool"}}}},"400":{"description":"Invalid pubkey format"},"404":{"description":"Pool not found"}}}}},"components":{"schemas":{"IdentifiableLiquidityPool":{"allOf":[{"$ref":"#/components/schemas/LiquidityPool"},{"type":"object","required":["shards","token0Amount","token1Amount","liquidity","price"],"properties":{"shards":{"type":"array","items":{"$ref":"#/components/schemas/IdentifiableLiquidityPoolShard"}},"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"liquidity":{"type":"string"},"price":{"type":"string"}}}]},"LiquidityPool":{"type":"object","required":["id","feeRate","config","assetPair","createdBlockHeight"],"properties":{"id":{"type":"string"},"feeRate":{"type":"integer","format":"int32"},"config":{"$ref":"#/components/schemas/LiquidityPoolConfig"},"assetPair":{"$ref":"#/components/schemas/AssetPair"},"createdBlockHeight":{"type":"string"}}},"LiquidityPoolConfig":{"type":"object","required":["feeTier","shards","token0","token1"],"properties":{"feeTier":{"type":"integer","format":"int32","minimum":0},"shards":{"type":"integer","format":"int32","minimum":0},"token0":{"type":"string"},"token1":{"type":"string"}}},"AssetPair":{"type":"object","required":["token0Id","token1Id"],"properties":{"token0Id":{"type":"string"},"token1Id":{"type":"string"}}},"IdentifiableLiquidityPoolShard":{"allOf":[{"$ref":"#/components/schemas/LiquidityPoolShardJson"},{"type":"object","required":["pubkey","utxo"],"properties":{"pubkey":{"type":"string"},"utxo":{"type":"string"}}}]},"LiquidityPoolShardJson":{"type":"object","required":["poolPubkey","btcUtxos","liquidity","protocolFeeOwed","kLast","kLastCounter","swapBalance"],"properties":{"poolPubkey":{"type":"string"},"runeUtxo":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UtxoInfoJson","description":"UTXO holding runes for this shard"}]},"btcUtxos":{"type":"array","items":{"$ref":"#/components/schemas/UtxoInfoJson"},"description":"UTXOs holding BTC for this shard"},"liquidity":{"type":"string","description":"Liquidity held in this shard"},"protocolFeeOwed":{"type":"string","description":"How much BTC has accumulated as fees in this shard"},"kLast":{"type":"string"},"kLastCounter":{"type":"string"},"swapBalance":{"$ref":"#/components/schemas/SwapBalance"}}},"UtxoInfoJson":{"type":"object","required":["txid","vout","value","runes","needsConsolidation"],"properties":{"txid":{"type":"string"},"vout":{"type":"integer","format":"int32","minimum":0},"value":{"type":"string"},"runes":{"type":"array","items":{"$ref":"#/components/schemas/RuneAmountJson"}},"needsConsolidation":{"$ref":"#/components/schemas/NeedsConsolidation"}}},"RuneAmountJson":{"type":"object","required":["id","amount"],"properties":{"id":{"type":"string","format":"token"},"amount":{"type":"string"}}},"NeedsConsolidation":{"oneOf":[{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["no"]}}},{"type":"object","description":"Internal f64 represents mempool fee rate at moment of creation.","required":["value","type"],"properties":{"value":{"type":"number","format":"double","description":"Internal f64 represents mempool fee rate at moment of creation."},"type":{"type":"string","enum":["yes"]}}}]},"SwapBalance":{"type":"object","required":["blockHeight","zeroToOneSwaps","oneToZeroSwaps"],"properties":{"blockHeight":{"type":"integer","format":"int64","minimum":0},"zeroToOneSwaps":{"type":"integer","format":"int32","minimum":0},"oneToZeroSwaps":{"type":"integer","format":"int32","minimum":0}}}}}}
```

## GET /pool/by-token-names

> Returns a list of pool details with its current state where the token names match. Search is case-insensitive and will find pools where either token matches any of the given ones

```json
{"openapi":"3.1.0","info":{"title":"Saturn Indexer API","version":"0.1.0"},"tags":[{"name":"pool","description":"Fetch details of Saturn swap pools"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local testing"}],"paths":{"/pool/by-token-names":{"get":{"tags":["pool"],"description":"Returns a list of pool details with its current state where the token names match. Search is case-insensitive and will find pools where either token matches any of the given ones","operationId":"find_many_by_token_names","parameters":[{"name":"token0","in":"query","required":true,"schema":{"type":"string"}},{"name":"token1","in":"query","required":true,"schema":{"type":"string"}},{"name":"feeTier","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int32"}}],"responses":{"200":{"description":"Swap pools","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/IdentifiableLiquidityPool"}}}}},"404":{"description":"No matching pools found"}}}}},"components":{"schemas":{"IdentifiableLiquidityPool":{"allOf":[{"$ref":"#/components/schemas/LiquidityPool"},{"type":"object","required":["shards","token0Amount","token1Amount","liquidity","price"],"properties":{"shards":{"type":"array","items":{"$ref":"#/components/schemas/IdentifiableLiquidityPoolShard"}},"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"liquidity":{"type":"string"},"price":{"type":"string"}}}]},"LiquidityPool":{"type":"object","required":["id","feeRate","config","assetPair","createdBlockHeight"],"properties":{"id":{"type":"string"},"feeRate":{"type":"integer","format":"int32"},"config":{"$ref":"#/components/schemas/LiquidityPoolConfig"},"assetPair":{"$ref":"#/components/schemas/AssetPair"},"createdBlockHeight":{"type":"string"}}},"LiquidityPoolConfig":{"type":"object","required":["feeTier","shards","token0","token1"],"properties":{"feeTier":{"type":"integer","format":"int32","minimum":0},"shards":{"type":"integer","format":"int32","minimum":0},"token0":{"type":"string"},"token1":{"type":"string"}}},"AssetPair":{"type":"object","required":["token0Id","token1Id"],"properties":{"token0Id":{"type":"string"},"token1Id":{"type":"string"}}},"IdentifiableLiquidityPoolShard":{"allOf":[{"$ref":"#/components/schemas/LiquidityPoolShardJson"},{"type":"object","required":["pubkey","utxo"],"properties":{"pubkey":{"type":"string"},"utxo":{"type":"string"}}}]},"LiquidityPoolShardJson":{"type":"object","required":["poolPubkey","btcUtxos","liquidity","protocolFeeOwed","kLast","kLastCounter","swapBalance"],"properties":{"poolPubkey":{"type":"string"},"runeUtxo":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UtxoInfoJson","description":"UTXO holding runes for this shard"}]},"btcUtxos":{"type":"array","items":{"$ref":"#/components/schemas/UtxoInfoJson"},"description":"UTXOs holding BTC for this shard"},"liquidity":{"type":"string","description":"Liquidity held in this shard"},"protocolFeeOwed":{"type":"string","description":"How much BTC has accumulated as fees in this shard"},"kLast":{"type":"string"},"kLastCounter":{"type":"string"},"swapBalance":{"$ref":"#/components/schemas/SwapBalance"}}},"UtxoInfoJson":{"type":"object","required":["txid","vout","value","runes","needsConsolidation"],"properties":{"txid":{"type":"string"},"vout":{"type":"integer","format":"int32","minimum":0},"value":{"type":"string"},"runes":{"type":"array","items":{"$ref":"#/components/schemas/RuneAmountJson"}},"needsConsolidation":{"$ref":"#/components/schemas/NeedsConsolidation"}}},"RuneAmountJson":{"type":"object","required":["id","amount"],"properties":{"id":{"type":"string","format":"token"},"amount":{"type":"string"}}},"NeedsConsolidation":{"oneOf":[{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["no"]}}},{"type":"object","description":"Internal f64 represents mempool fee rate at moment of creation.","required":["value","type"],"properties":{"value":{"type":"number","format":"double","description":"Internal f64 represents mempool fee rate at moment of creation."},"type":{"type":"string","enum":["yes"]}}}]},"SwapBalance":{"type":"object","required":["blockHeight","zeroToOneSwaps","oneToZeroSwaps"],"properties":{"blockHeight":{"type":"integer","format":"int64","minimum":0},"zeroToOneSwaps":{"type":"integer","format":"int32","minimum":0},"oneToZeroSwaps":{"type":"integer","format":"int32","minimum":0}}}}}}
```

## GET /pool/by-token-ids

> Returns a list of pool details with its current state, where the provided ids match exactly and are optionally filtered by the fee tier

```json
{"openapi":"3.1.0","info":{"title":"Saturn Indexer API","version":"0.1.0"},"tags":[{"name":"pool","description":"Fetch details of Saturn swap pools"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local testing"}],"paths":{"/pool/by-token-ids":{"get":{"tags":["pool"],"description":"Returns a list of pool details with its current state, where the provided ids match exactly and are optionally filtered by the fee tier","operationId":"find_many_by_token_ids","parameters":[{"name":"token0","in":"query","required":true,"schema":{"type":"string"}},{"name":"token1","in":"query","required":true,"schema":{"type":"string"}},{"name":"feeTier","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int32"}}],"responses":{"200":{"description":"Swap pools","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/IdentifiableLiquidityPool"}}}}},"404":{"description":"No matching pools found"}}}}},"components":{"schemas":{"IdentifiableLiquidityPool":{"allOf":[{"$ref":"#/components/schemas/LiquidityPool"},{"type":"object","required":["shards","token0Amount","token1Amount","liquidity","price"],"properties":{"shards":{"type":"array","items":{"$ref":"#/components/schemas/IdentifiableLiquidityPoolShard"}},"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"liquidity":{"type":"string"},"price":{"type":"string"}}}]},"LiquidityPool":{"type":"object","required":["id","feeRate","config","assetPair","createdBlockHeight"],"properties":{"id":{"type":"string"},"feeRate":{"type":"integer","format":"int32"},"config":{"$ref":"#/components/schemas/LiquidityPoolConfig"},"assetPair":{"$ref":"#/components/schemas/AssetPair"},"createdBlockHeight":{"type":"string"}}},"LiquidityPoolConfig":{"type":"object","required":["feeTier","shards","token0","token1"],"properties":{"feeTier":{"type":"integer","format":"int32","minimum":0},"shards":{"type":"integer","format":"int32","minimum":0},"token0":{"type":"string"},"token1":{"type":"string"}}},"AssetPair":{"type":"object","required":["token0Id","token1Id"],"properties":{"token0Id":{"type":"string"},"token1Id":{"type":"string"}}},"IdentifiableLiquidityPoolShard":{"allOf":[{"$ref":"#/components/schemas/LiquidityPoolShardJson"},{"type":"object","required":["pubkey","utxo"],"properties":{"pubkey":{"type":"string"},"utxo":{"type":"string"}}}]},"LiquidityPoolShardJson":{"type":"object","required":["poolPubkey","btcUtxos","liquidity","protocolFeeOwed","kLast","kLastCounter","swapBalance"],"properties":{"poolPubkey":{"type":"string"},"runeUtxo":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UtxoInfoJson","description":"UTXO holding runes for this shard"}]},"btcUtxos":{"type":"array","items":{"$ref":"#/components/schemas/UtxoInfoJson"},"description":"UTXOs holding BTC for this shard"},"liquidity":{"type":"string","description":"Liquidity held in this shard"},"protocolFeeOwed":{"type":"string","description":"How much BTC has accumulated as fees in this shard"},"kLast":{"type":"string"},"kLastCounter":{"type":"string"},"swapBalance":{"$ref":"#/components/schemas/SwapBalance"}}},"UtxoInfoJson":{"type":"object","required":["txid","vout","value","runes","needsConsolidation"],"properties":{"txid":{"type":"string"},"vout":{"type":"integer","format":"int32","minimum":0},"value":{"type":"string"},"runes":{"type":"array","items":{"$ref":"#/components/schemas/RuneAmountJson"}},"needsConsolidation":{"$ref":"#/components/schemas/NeedsConsolidation"}}},"RuneAmountJson":{"type":"object","required":["id","amount"],"properties":{"id":{"type":"string","format":"token"},"amount":{"type":"string"}}},"NeedsConsolidation":{"oneOf":[{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["no"]}}},{"type":"object","description":"Internal f64 represents mempool fee rate at moment of creation.","required":["value","type"],"properties":{"value":{"type":"number","format":"double","description":"Internal f64 represents mempool fee rate at moment of creation."},"type":{"type":"string","enum":["yes"]}}}]},"SwapBalance":{"type":"object","required":["blockHeight","zeroToOneSwaps","oneToZeroSwaps"],"properties":{"blockHeight":{"type":"integer","format":"int64","minimum":0},"zeroToOneSwaps":{"type":"integer","format":"int32","minimum":0},"oneToZeroSwaps":{"type":"integer","format":"int32","minimum":0}}}}}}
```

## POST /pool/stats/by-filter

> Returns a paginated list of pool statistics matching the provided filter criteria

```json
{"openapi":"3.1.0","info":{"title":"Saturn Indexer API","version":"0.1.0"},"tags":[{"name":"pool","description":"Fetch details of Saturn swap pools"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local testing"}],"paths":{"/pool/stats/by-filter":{"post":{"tags":["pool"],"description":"Returns a paginated list of pool statistics matching the provided filter criteria","operationId":"find_by_filter","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PoolSearchFilter"}}},"required":true},"responses":{"200":{"description":"swap pool","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginationResponse_Vec_PoolStats"}}}},"404":{"description":"no matching pools found"}}}}},"components":{"schemas":{"PoolSearchFilter":{"type":"object","properties":{"name":{"type":["array","null"],"items":{"type":"string"}},"minTvl":{"type":["integer","null"],"format":"int64"},"minVolume":{"type":["integer","null"],"format":"int64"},"sort":{"type":["array","null"],"items":{"$ref":"#/components/schemas/SortField_SortFieldPool"}},"limit":{"type":["integer","null"],"format":"int32"},"offset":{"type":["integer","null"],"format":"int32"},"userAddress":{"type":["string","null"]}}},"SortField_SortFieldPool":{"type":"object","required":["field","order"],"properties":{"field":{"type":"string","enum":["token0_name","token1_name","tvl_now","tvl_24h_ago","tvl_diff","volume_24h","volume_7d","volume_diff_24h","fees_24h","fees_7d","smaller_24h_apy","larger_24h_apy","smaller_7d_apy","larger_7d_apy"]},"order":{"$ref":"#/components/schemas/SortOrder"}}},"SortOrder":{"type":"string","enum":["ASC","DESC"]},"PaginationResponse_Vec_PoolStats":{"type":"object","required":["response","offset"],"properties":{"response":{"type":"array","items":{"type":"object","required":["poolId","token0","token1","token0Amount","token1Amount","liquidity","price","feeRate"],"properties":{"poolId":{"type":"string"},"token0":{"$ref":"#/components/schemas/Collection"},"token1":{"$ref":"#/components/schemas/Collection"},"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"liquidity":{"type":"string"},"price":{"type":"string"},"tvlNow":{"type":["string","null"]},"tvl24hAgo":{"type":["string","null"]},"tvlDiff":{"type":["string","null"]},"volume24h":{"type":["string","null"]},"volumePrev24h":{"type":["string","null"]},"volumeDiff24h":{"type":["string","null"]},"fees24h":{"type":["string","null"]},"apy24h":{"type":["string","null"]},"volume7d":{"type":["string","null"]},"fees7d":{"type":["string","null"]},"apy7d":{"type":["string","null"]},"feeRate":{"type":"integer","format":"int32","minimum":0}}}},"offset":{"type":"integer","format":"int32"}}},"Collection":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/BTCCollection"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["btc"]}}}]},{"allOf":[{"$ref":"#/components/schemas/RuneCollection"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["rune"]}}}]}]},"BTCCollection":{"type":"object","required":["id","name","displayName","divisibility","supply","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"type":"string"},"symbol":{"type":["string","null"]},"divisibility":{"type":"integer","format":"int32","minimum":0},"supply":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"RuneCollection":{"type":"object","required":["id","name","displayName","divisibility","supply","verified","premined","burned","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"type":"string"},"symbol":{"type":["string","null"]},"divisibility":{"type":"integer","format":"int32","minimum":0},"supply":{"type":"string"},"verified":{"type":"boolean"},"icon":{"type":["string","null"]},"premined":{"type":"string"},"burned":{"type":"string"},"transactionId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}}
```

## GET /pool/stats/by-ids

> Returns a list of detailed statistics for pools matching the provided IDs, including token information, TVL, volume, fees, and APY data.

```json
{"openapi":"3.1.0","info":{"title":"Saturn Indexer API","version":"0.1.0"},"tags":[{"name":"pool","description":"Fetch details of Saturn swap pools"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local testing"}],"paths":{"/pool/stats/by-ids":{"get":{"tags":["pool"],"description":"Returns a list of detailed statistics for pools matching the provided IDs, including token information, TVL, volume, fees, and APY data.","operationId":"find_by_ids","parameters":[{"name":"poolIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}},"explode":false}],"responses":{"200":{"description":"swap pools","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PoolStats"}}}}},"404":{"description":"No matching pools found"}}}}},"components":{"schemas":{"PoolStats":{"type":"object","required":["poolId","token0","token1","token0Amount","token1Amount","liquidity","price","feeRate"],"properties":{"poolId":{"type":"string"},"token0":{"$ref":"#/components/schemas/Collection"},"token1":{"$ref":"#/components/schemas/Collection"},"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"liquidity":{"type":"string"},"price":{"type":"string"},"tvlNow":{"type":["string","null"]},"tvl24hAgo":{"type":["string","null"]},"tvlDiff":{"type":["string","null"]},"volume24h":{"type":["string","null"]},"volumePrev24h":{"type":["string","null"]},"volumeDiff24h":{"type":["string","null"]},"fees24h":{"type":["string","null"]},"apy24h":{"type":["string","null"]},"volume7d":{"type":["string","null"]},"fees7d":{"type":["string","null"]},"apy7d":{"type":["string","null"]},"feeRate":{"type":"integer","format":"int32","minimum":0}}},"Collection":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/BTCCollection"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["btc"]}}}]},{"allOf":[{"$ref":"#/components/schemas/RuneCollection"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["rune"]}}}]}]},"BTCCollection":{"type":"object","required":["id","name","displayName","divisibility","supply","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"type":"string"},"symbol":{"type":["string","null"]},"divisibility":{"type":"integer","format":"int32","minimum":0},"supply":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"RuneCollection":{"type":"object","required":["id","name","displayName","divisibility","supply","verified","premined","burned","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"type":"string"},"symbol":{"type":["string","null"]},"divisibility":{"type":"integer","format":"int32","minimum":0},"supply":{"type":"string"},"verified":{"type":"boolean"},"icon":{"type":["string","null"]},"premined":{"type":"string"},"burned":{"type":"string"},"transactionId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}}
```

## POST /pool/stats/by-token-filter

> Returns a paginated list of token pairs with aggregated pool statistics filtered by the provided criteria

```json
{"openapi":"3.1.0","info":{"title":"Saturn Indexer API","version":"0.1.0"},"tags":[{"name":"pool","description":"Fetch details of Saturn swap pools"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local testing"}],"paths":{"/pool/stats/by-token-filter":{"post":{"tags":["pool"],"description":"Returns a paginated list of token pairs with aggregated pool statistics filtered by the provided criteria","operationId":"find_by_token_filter","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PoolSearchFilter"}}},"required":true},"responses":{"200":{"description":"swap pools","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginationResponse_Vec_PoolsStatsByTokens"}}}},"404":{"description":"no matching pools found"}}}}},"components":{"schemas":{"PoolSearchFilter":{"type":"object","properties":{"name":{"type":["array","null"],"items":{"type":"string"}},"minTvl":{"type":["integer","null"],"format":"int64"},"minVolume":{"type":["integer","null"],"format":"int64"},"sort":{"type":["array","null"],"items":{"$ref":"#/components/schemas/SortField_SortFieldPool"}},"limit":{"type":["integer","null"],"format":"int32"},"offset":{"type":["integer","null"],"format":"int32"},"userAddress":{"type":["string","null"]}}},"SortField_SortFieldPool":{"type":"object","required":["field","order"],"properties":{"field":{"type":"string","enum":["token0_name","token1_name","tvl_now","tvl_24h_ago","tvl_diff","volume_24h","volume_7d","volume_diff_24h","fees_24h","fees_7d","smaller_24h_apy","larger_24h_apy","smaller_7d_apy","larger_7d_apy"]},"order":{"$ref":"#/components/schemas/SortOrder"}}},"SortOrder":{"type":"string","enum":["ASC","DESC"]},"PaginationResponse_Vec_PoolsStatsByTokens":{"type":"object","required":["response","offset"],"properties":{"response":{"type":"array","items":{"type":"object","required":["token0","token1","tvlNow","tvl24hAgo","tvlDiff","pools"],"properties":{"token0":{"$ref":"#/components/schemas/Collection"},"token1":{"$ref":"#/components/schemas/Collection"},"volume24h":{"type":["string","null"]},"volumeDiff24h":{"type":["string","null"]},"volume7d":{"type":["string","null"]},"fees24h":{"type":["string","null"]},"tvlNow":{"type":"string"},"tvl24hAgo":{"type":"string"},"tvlDiff":{"type":"string"},"smaller24hApy":{"type":["string","null"]},"larger24hApy":{"type":["string","null"]},"smaller7dApy":{"type":["string","null"]},"larger7dApy":{"type":["string","null"]},"pools":{"type":"array","items":{"$ref":"#/components/schemas/GroupedPoolStat"}}}}},"offset":{"type":"integer","format":"int32"}}},"Collection":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/BTCCollection"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["btc"]}}}]},{"allOf":[{"$ref":"#/components/schemas/RuneCollection"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["rune"]}}}]}]},"BTCCollection":{"type":"object","required":["id","name","displayName","divisibility","supply","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"type":"string"},"symbol":{"type":["string","null"]},"divisibility":{"type":"integer","format":"int32","minimum":0},"supply":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"RuneCollection":{"type":"object","required":["id","name","displayName","divisibility","supply","verified","premined","burned","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"type":"string"},"symbol":{"type":["string","null"]},"divisibility":{"type":"integer","format":"int32","minimum":0},"supply":{"type":"string"},"verified":{"type":"boolean"},"icon":{"type":["string","null"]},"premined":{"type":"string"},"burned":{"type":"string"},"transactionId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"GroupedPoolStat":{"type":"object","required":["id","tvlNow","tvl24hAgo","tvlDiff","price","token0Amount","token1Amount","liquidity","feeRate"],"properties":{"id":{"type":"string"},"tvlNow":{"type":"string"},"tvl24hAgo":{"type":"string"},"tvlDiff":{"type":"string"},"volume24h":{"type":["string","null"]},"volumeDiff24h":{"type":["string","null"]},"fees24h":{"type":["string","null"]},"apy24h":{"type":["number","null"],"format":"double"},"volume7d":{"type":["string","null"]},"fees7d":{"type":["string","null"]},"apy7d":{"type":["number","null"],"format":"double"},"price":{"type":"string"},"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"liquidity":{"type":"string"},"feeRate":{"type":"integer","format":"int32"}}}}}}
```

## GET /pool

> Paginated list of swap pools stats matched by the filter

```json
{"openapi":"3.1.0","info":{"title":"Saturn Indexer API","version":"0.1.0"},"tags":[{"name":"pool","description":"Fetch details of Saturn swap pools"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local testing"}],"paths":{"/pool":{"get":{"tags":["pool"],"description":"Paginated list of swap pools stats matched by the filter","operationId":"find","parameters":[{"name":"name","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"sortVolume","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"sortFeeGenerated","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int32"}},{"name":"offset","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int32"}}],"responses":{"200":{"description":"swap pools","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginationResponse_Vec_PoolStats"}}}}}}}},"components":{"schemas":{"PaginationResponse_Vec_PoolStats":{"type":"object","required":["response","offset"],"properties":{"response":{"type":"array","items":{"type":"object","required":["poolId","token0","token1","token0Amount","token1Amount","liquidity","price","feeRate"],"properties":{"poolId":{"type":"string"},"token0":{"$ref":"#/components/schemas/Collection"},"token1":{"$ref":"#/components/schemas/Collection"},"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"liquidity":{"type":"string"},"price":{"type":"string"},"tvlNow":{"type":["string","null"]},"tvl24hAgo":{"type":["string","null"]},"tvlDiff":{"type":["string","null"]},"volume24h":{"type":["string","null"]},"volumePrev24h":{"type":["string","null"]},"volumeDiff24h":{"type":["string","null"]},"fees24h":{"type":["string","null"]},"apy24h":{"type":["string","null"]},"volume7d":{"type":["string","null"]},"fees7d":{"type":["string","null"]},"apy7d":{"type":["string","null"]},"feeRate":{"type":"integer","format":"int32","minimum":0}}}},"offset":{"type":"integer","format":"int32"}}},"Collection":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/BTCCollection"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["btc"]}}}]},{"allOf":[{"$ref":"#/components/schemas/RuneCollection"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["rune"]}}}]}]},"BTCCollection":{"type":"object","required":["id","name","displayName","divisibility","supply","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"type":"string"},"symbol":{"type":["string","null"]},"divisibility":{"type":"integer","format":"int32","minimum":0},"supply":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"RuneCollection":{"type":"object","required":["id","name","displayName","divisibility","supply","verified","premined","burned","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"type":"string"},"symbol":{"type":["string","null"]},"divisibility":{"type":"integer","format":"int32","minimum":0},"supply":{"type":"string"},"verified":{"type":"boolean"},"icon":{"type":["string","null"]},"premined":{"type":"string"},"burned":{"type":"string"},"transactionId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.saturnbtc.io/builders/saturn-api/indexer-api/pools.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
