> ## Documentation Index
> Fetch the complete documentation index at: https://composio-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Bitquery

> Bitquery provides historical and real-time indexed data for over 40 blockchains through GraphQL APIs, Websockets, SQL, and cloud providers.

![Bitquery logo](https://mintcdn.com/composio-preview/6S5R4NszqpnVIZRD/images/toolkits/bitquery.svg?fit=max\&auto=format\&n=6S5R4NszqpnVIZRD\&q=85\&s=755ba975dc433f048e191ac9b30bd6f8)

* **Category:** analytics
* **Auth:** API\_KEY
* **Composio-managed OAuth available?** N/A
* **Tools:** 10
* **Triggers:** 0
* **Slug:** `BITQUERY`
* **Version:** 20261101\_00

## Tools

> [accordion] Archive Database Query
>
> **Slug:** `BITQUERY_ARCHIVE_DATABASE_QUERY`
>
> Query the Bitquery V1 GraphQL API for historical blockchain data using blockchain-specific root types such as bitcoin and ethereum. Historical coverage varies by chain.
>
> #### Input Parameters
>
> **query** `string` *required*
>
> GraphQL query string to execute against the Bitquery Archive Database (V1 API). Use the V1 schema which includes blockchain-specific root types like 'bitcoin', 'ethereum', etc. For example: \{ bitcoin \{ blocks(limit: 5, orderBy: \{descending: height}) \{ height } } }
>
> **variables** `object`
>
> Optional mapping of GraphQL variables for parameterized queries
>
> **operationName** `string`
>
> Optional operation name if the query document contains multiple operations
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Combined Database Query
>
> **Slug:** `BITQUERY_COMBINED_DATABASE_QUERY`
>
> Query Bitquery's Combined Database (v2 API) for blockchain data across 40+ networks. Use this tool to fetch real-time and historical blockchain data including: - Blocks, transactions, and events - Token transfers and balances - DEX trades and liquidity data - Smart contract interactions - NFT data and metadata Supported networks include: Ethereum (eth), BSC (bsc), Polygon (matic), Solana, Tron, and more. The v2 API uses a different schema than v1 - use EVM(network: eth) instead of ethereum root field.
>
> #### Input Parameters
>
> **query** `string` *required*
>
> The GraphQL query string to execute against Bitquery's Combined Database. Uses v2 API schema with network-specific root fields like EVM(network: eth), Solana, Tron, etc. Supports real-time and historical blockchain data. Always include explicit `limit: {count: N}` and time range filters (UTC timestamps) — omitting them causes timeouts and oversized payloads. Field names, dataset names, and filter structures must be exact; schema errors return empty results silently, not descriptive error messages. For large datasets, use cursor-based pagination instead of single bulk pulls.
>
> **variables** `object`
>
> Optional map of GraphQL variables for parameterized queries. Use to pass dynamic values like addresses, block numbers, or limits.
>
> **operationName** `string`
>
> Optional operation name when the query document contains multiple named operations. Specifies which operation to execute.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Conditional Metrics Snippet
>
> **Slug:** `BITQUERY_CONDITIONAL_METRICS`
>
> Generate a Bitquery GraphQL metric snippet with an if condition for count, sum, avg, min, or max, for embedding in a query. The snippet can include a distinct field for counts, a post-aggregation filter, and an alias.
>
> #### Input Parameters
>
> **if** `object` *required*
>
> Conditional filter to apply to the metric via the 'if:' attribute. Uses nested object structure matching Bitquery GraphQL filter syntax. Example: \{'Block': \{'GasUsed': \{'gt': '0'}}} or \{'Transaction': \{'Success': true}}.
>
> **alias** `string`
>
> GraphQL alias to prefix the metric output. Example: 'totalGas' produces 'totalGas: sum(...)'.
>
> **field** `string` *required*
>
> The field to aggregate using 'of:' in GraphQL. Required for 'sum', 'avg', 'min', 'max' operations. For 'count' operation, this field is ignored unless using distinct\_field. Example: 'Block\_GasUsed', 'Transaction\_Value'.
>
> **operation** `string ("count" | "sum" | "avg" | "min" | "max")` *required*
>
> Type of metric operation to apply. Options: 'count' (count rows), 'sum' (sum values), 'avg' (average), 'min' (minimum), 'max' (maximum).
>
> **select\_where** `object`
>
> HAVING-style filter applied after aggregation via 'selectWhere:'. Useful for filtering aggregated results. Example: \{'ge': '1000000'} to only include results >= 1000000.
>
> **distinct\_field** `string`
>
> Field name for counting distinct values (only valid for 'count' operation). When provided, generates 'distinct: \<field>' in the output. Example: 'Block\_Number' to count distinct blocks.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Database Selection
>
> **Slug:** `BITQUERY_DATABASE_SELECTION`
>
> Generate a GraphQL dataset selection fragment for the archive, realtime, or combined dataset.
>
> #### Input Parameters
>
> **dataset** `string ("realtime" | "archive" | "combined")` *required*
>
> Determines which Bitquery GraphQL dataset to use: realtime (latest blocks), archive (historical data), combined (merge both).
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Early Access Program Query
>
> **Slug:** `BITQUERY_EARLY_ACCESS_PROGRAM_QUERY`
>
> Submit a GraphQL query to Bitquery's Early Access Program endpoint for real-time blockchain data, including data from Solana and EVM networks. Optional variables can parameterize the query; the response contains the endpoint's result.
>
> #### Input Parameters
>
> **query** `string` *required*
>
> GraphQL query string for the Bitquery EAP Streaming API. Supports blockchain data queries for chains like Solana, EVM networks, etc. Example query: \{ EVM(network: eth) \{ Blocks(limit: \{count: 10}) \{ Block \{ Number Time } } } } Example subscription: subscription \{ Solana \{ DEXTrades \{ Block \{ Time } Trade \{ Price } } } }
>
> **variables** `object`
>
> Optional GraphQL variables for parameterized queries. Pass as a dictionary mapping variable names to values. Example: \{'network': 'eth', 'limit': 10}
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Network Selection
>
> **Slug:** `BITQUERY_NETWORK_SELECTION`
>
> Generate a GraphQL network selection fragment for a supported blockchain network.
>
> #### Input Parameters
>
> **network** `string ("eth" | "bsc" | "bsc_testnet" | "goerli" | "rinkeby" | "ropsten" | "sepolia" | "classic" | "mordor" | "kotti" | "astor" | "polygon" | "arbitrum" | "avalanche" | "optimism" | "fantom" | "cronos" | "klaytn" | "fusion" | "huobi" | "moonbeam" | "celo" | "canto" | "aurora")` *required*
>
> Blockchain network to query. If omitted, GraphQL defaults to eth. Supported networks: eth, bsc, bsc\_testnet, goerli, rinkeby, ropsten, sepolia, classic, mordor, kotti, astor, polygon, arbitrum, avalanche, optimism, fantom, cronos, klaytn, fusion, huobi, moonbeam, celo, canto, aurora.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Options Query
>
> **Slug:** `BITQUERY_OPTIONS_QUERY`
>
> Fetch root-level GraphQL query fields and their arguments through schema introspection for the selected Bitquery environment.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Price Asymmetry Metric
>
> **Slug:** `BITQUERY_PRICE_ASYMMETRY_METRIC`
>
> Tool to generate GraphQL PriceAsymmetry filter snippet. Use when you need to filter trades based on price asymmetry metric.
>
> #### Input Parameters
>
> **ge** `number`
>
> Price asymmetry greater than or equal to this value.
>
> **gt** `number`
>
> Price asymmetry greater than this value.
>
> **le** `number`
>
> Price asymmetry less than or equal to this value.
>
> **lt** `number`
>
> Price asymmetry less than this value.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Realtime Database Query
>
> **Slug:** `BITQUERY_REALTIME_DATABASE_QUERY`
>
> Query the Bitquery Streaming (V2) API for realtime blockchain data. This tool accesses the Bitquery Streaming API at streaming.bitquery.io/graphql which provides real-time blockchain data with minimal latency. Use this for recent data (within minutes). For historical data, use the Archive Database Query. Supported query formats: - V2 EVM queries: \{ EVM(network: eth) \{ Blocks(limit: \{count: 5}) \{ Block \{ Number Time } } } } - V2 Bitcoin queries: \{ bitcoin(network: bitcoin) \{ blocks(limit: \{count: 5}) \{ height timestamp \{ time } } } } Note: Requires an active Bitquery subscription for streaming API access.
>
> #### Input Parameters
>
> **query** `string` *required*
>
> GraphQL query string to execute against the Bitquery Streaming (V2) API. Use EVM() for Ethereum-compatible chains or bitcoin() for Bitcoin data.
>
> **variables** `object`
>
> Optional mapping of GraphQL variables for parameterized queries
>
> **operationName** `string`
>
> Optional operation name if the query document contains multiple operations
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Select By Metric
>
> **Slug:** `BITQUERY_SELECT_BY_METRIC`
>
> Tool to generate a GraphQL metric snippet filtering by its value using selectWhere. Use when you need to include only metrics meeting specific value conditions (e.g., only positive sums).
>
> #### Input Parameters
>
> **of** `string` *required*
>
> The metric field to aggregate, e.g., 'BalanceUpdate\_Amount'
>
> **alias** `string`
>
> Optional GraphQL alias for the metric snippet
>
> **operation** `string ("sum" | "avg" | "min" | "max")` *required*
>
> Aggregation operation supporting selectWhere (e.g., sum, avg, min, max)
>
> **selectWhere** `object` *required*
>
> Filter expression for the metric values using selectWhere
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not
