{"version":"1.7.42","title":"Flair Indexing API","tabs":[{"name":"Simple SQL Query","endpoint":"https://api.flair.build","query":"# Run arbitrary SQL query with JOIN or aggregations on your entities\nquery {\n sql(\n query: \"\"\"\n SELECT\n COUNT(*) as totalCount,\n entityType\n FROM\n entities\n WHERE\n namespace = 'fuji-finance'\n GROUP BY entityType\n ORDER BY totalCount DESC\n LIMIT 100\n \"\"\"\n ) {\n stats {\n elapsedMs\n }\n rows\n }\n}","headers":{"X-API-Key":"DEMO"}},{"name":"Complex SQL Query","endpoint":"https://api.flair.build","query":"# Run arbitrary SQL query with JOIN or aggregations on your entities\nquery {\n sql(\n query: \"\"\"\n SELECT\n chainId,\n contractAddress,\n owner,\n MAX(horizon) as highestHorizon,\n SUM(IF(entityType = 'Deposit', 1, 0)) as totalDeposits,\n SUM(IF(entityType = 'Withdraw', 1, 0)) as totalWithdraws,\n TRY_CAST(\n (\n SUM(IF(entityType = 'Deposit', TRY_CAST(shares as u256), TRY_CAST(0 as u256))) -\n SUM(IF(entityType = 'Withdraw', TRY_CAST(shares as u256), TRY_CAST(0 as u256)))\n ) as string\n ) as totalShares\n FROM\n entities\n WHERE\n namespace = 'fuji-finance' AND\n (entityType = 'Deposit' OR entityType = 'Withdraw')\n GROUP BY\n chainId, contractAddress, owner\n ORDER BY totalShares DESC\n LIMIT 100\n \"\"\"\n ) {\n stats {\n elapsedMs\n }\n rows\n }\n}","headers":{"X-API-Key":"DEMO"}},{"name":"Backfill Events","endpoint":"https://api.flair.build","query":"# Backfill events of a contract from deployment time to current block\n# Proactively ingest and process events for one or more contract\nmutation {\n backfillEvents(\n idempotencyKey: \"backfill-test-attempt-1\"\n tagKey: \"manual\"\n chainId: 1\n contractAddresses: [\"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d\"]\n startBlockNumber: \"17072200\" # Optional, defaults to contract deployment block\n endBlockNumber: \"17072295\" # Optional, defaults to current block\n ) {\n id\n \n createdAt\n startedAt\n updatedAt\n \n orchestrationState\n orchestrationError\n \n actualStartBlock\n actualEndBlock\n \n blocksAttempts\n blocksReattempts\n blocksScans\n blocksRescans\n blocksIngests\n blocksFailures\n transactionsScans\n transactionsIngests\n transactionsFailures\n logsScans\n logsSkips\n logsIngests\n logsQueued\n logsFailures\n \n processorTransactionsVisits\n processorLogsTopicSkips\n processorLogsAddressSkips\n processorLogsIngestions\n processorHandlerSuccesses\n processorHandlerSkips\n processorHandlerRetries\n processorHandlerFailures\n\n type\n request\n }\n}","headers":{"X-API-Key":"DEMO"}},{"name":"Backfill Transactions","endpoint":"https://api.flair.build","query":"# Backfill transactions of a contract from deployment time to current block\n# Proactively ingest and process transactions for one or more contract\n# To include \"internal\" transactions your indexer config in manifest.yml must have \"emitTraces: true\"\nmutation {\n backfillTransactions(\n idempotencyKey: \"backfill-test-attempt-1\"\n tagKey: \"manual\"\n chainId: 1\n contractAddresses: [\"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d\"]\n startBlockNumber: \"17072200\" # Optional, defaults to contract deployment block\n endBlockNumber: \"17072295\" # Optional, defaults to current block\n ) {\n id\n \n createdAt\n startedAt\n updatedAt\n \n orchestrationState\n orchestrationError\n \n actualStartBlock\n actualEndBlock\n \n blocksAttempts\n blocksReattempts\n blocksScans\n blocksRescans\n blocksIngests\n blocksFailures\n transactionsScans\n transactionsIngests\n transactionsFailures\n logsScans\n logsSkips\n logsIngests\n logsQueued\n logsFailures\n \n processorTransactionsVisits\n processorLogsTopicSkips\n processorLogsAddressSkips\n processorLogsIngestions\n processorHandlerSuccesses\n processorHandlerSkips\n processorHandlerRetries\n processorHandlerFailures\n\n type\n request\n }\n}","headers":{"X-API-Key":"DEMO"}},{"name":"Track Contract","endpoint":"https://api.flair.build","query":"# Add one or more contracts to filter group and track new events in real-time\nmutation {\n upsertContractsToFilterGroup(\n cluster: \"dev\",\n chainId: 5,\n contractAddresses: [\"0xbdcf4b6693e344115b951c4796e8622a66cdb728\"],\n groupId: \"default\"\n ) {\n groupId\n type\n mode\n details {\n chainId\n address\n topic\n \n anyChain\n anyAddress\n anyTopic\n }\n }\n}","headers":{"X-API-Key":"DEMO"}},{"name":"Un-track Contract","endpoint":"https://api.flair.build","query":"# Remove one or more contracts from filter group and stop tracking events\nmutation {\n removeContractsFromFilterGroup(\n cluster: \"dev\",\n chainId: 5,\n contractAddresses: [\"0xbdcf4b6693e344115b951c4796e8622a66cdb728\"],\n groupId: \"default\"\n ) {\n groupId\n type\n mode\n details {\n chainId\n address\n topic\n \n anyChain\n anyAddress\n anyTopic\n }\n }\n}","headers":{"X-API-Key":"DEMO"}},{"name":"Delete Entities by SQL","endpoint":"https://api.flair.build","query":"# Remove all entities matching a SQL query\n# - It takes a while to delete all entities after this request is completed.\n# - The query must return at least \"entityId\" and \"entityType\" columns.\n# - You can send the same request multiple times, it will be idempotent for the same \"idempotencyKey\".\nmutation {\n deleteEntities(\n namespace: \"fuji-finance\"\n cluster: \"dev\"\n tagKey: \"manual\"\n idempotencyKey: \"delete-some-entities-attempt-1\"\n sql:\n \"\"\"\n SELECT entityId, entityType FROM entities\n WHERE \n namespace = 'fuji-finance'\n AND entityType = 'TestModel'\n \"\"\"\n ) {\n id\n\n createdAt\n startedAt\n updatedAt\n\n orchestrationState\n orchestrationError\n\n deletePages\n deleteRows\n deleteSuccesses\n deleteDuplicates\n deleteInvalids\n deletePagesErrors\n\n type\n request\n }\n}\n ","headers":{"X-API-Key":"DEMO"}}],"settings":{"prettier.useTabs":true},"canSaveConfig":false}