{"uid":"cap_dtWHhmokxD379l9s3b6Vx","slug":"onesource-ethereum-event-logs-eth-getlogs-dad3a1cc","name":"OneSource Ethereum Event Logs (eth_getLogs)","description":"Query Ethereum contract event logs via eth_getLogs - filter by contract, topic, and block range","url":"https://api.onesource.io/api/chain/events","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","HEAD","DELETE"],"type":"string"},"queryParams":{"type":"object","properties":{"topic":{"type":"string","pattern":"^0x[a-fA-F0-9]{64}$"},"network":{"enum":["ethereum","sepolia","robinhood"],"type":"string","default":"ethereum"},"contract":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"to_block":{"oneOf":[{"type":"integer","minimum":0},{"enum":["latest","pending","earliest","safe","finalized"],"type":"string"},{"type":"string","pattern":"^0[xX][a-fA-F0-9]+$"}]},"from_block":{"oneOf":[{"type":"integer","minimum":0},{"enum":["latest","pending","earliest","safe","finalized"],"type":"string"},{"type":"string","pattern":"^0[xX][a-fA-F0-9]+$"}]}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","required":["data","meta"],"properties":{"data":{"type":"object","properties":{"logs":{"type":"array","items":{"type":"object","properties":{"data":{"type":"string"},"topics":{"type":"array","items":{"type":"string"}},"address":{"type":"string"},"logIndex":{"type":"string"},"blockNumber":{"type":"string"},"transactionHash":{"type":"string"}}}},"count":{"type":"integer"},"to_block":{"type":"string"},"from_block":{"type":"string"}},"description":"Endpoint-specific response payload"},"meta":{"type":"object","required":["endpoint","request_id"],"properties":{"endpoint":{"type":"string"},"cost_usdc":{"type":"string"},"request_id":{"type":"string"},"payment_chain":{"type":"string"},"payment_token":{"type":"string"}}},"error":{"type":["object","null"],"properties":{"code":{"type":"integer"},"message":{"type":"string"}}}}}}}}},"responseSchema":{"type":"json","example":{"data":{"logs":[{"data":"0x0000000000000000000000000000000000000000000000000000000000000001","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],"address":"0xdac17f958d2ee523a2206206994597c13d831ec7","logIndex":"0x0","blockNumber":"0x133da1e","transactionHash":"0xad7e04119ecd85857728205f5b12e95f0bab8e99f9c2f60be5dc79cfc6a8df1f"}],"count":1,"to_block":"latest","from_block":"latest"},"meta":{"endpoint":"/api/chain/events","cost_usdc":"0.001","request_id":"00000000abcdef01","payment_chain":"base","payment_token":"USDC"}}},"example":{"request":{"topic":"0x0000000000000000000000000000000000000000000000000000000000000000","network":"sepolia","contract":"0x1234567890123456789012345678901234567890","to_block":"latest","from_block":"latest"},"response":{"data":{"logs":[],"count":0},"meta":{"endpoint":"/api/chain/events","request_id":"e5c45893ce91d6f4"}}},"exampleRequest":{"topic":"0x0000000000000000000000000000000000000000000000000000000000000000","network":"sepolia","contract":"0x1234567890123456789012345678901234567890","to_block":"latest","from_block":"latest"},"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_oOHAeoKZ8umYScQs_THdL","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Fetches on-chain Ethereum event logs filtered by contract address, topic hash, and block range on mainnet or Sepolia testnet","exampleAgentPrompt":"Can you fetch all Transfer events from the USDT contract at 0xdac17f958d2ee523a2206206994597c13d831ec7 on Ethereum mainnet from block 20000000 to latest? The Transfer topic hash is 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.","exampleUseCases":[{"title":"Monitor NFT collection minting activity","prompt":"I need to track all mint events for the Bored Ape Yacht Club NFT contract at 0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d on mainnet. Can you pull all Transfer events from block 12000000 onwards using the standard ERC721 Transfer topic 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef? This will help me identify recent whale buys and trading patterns."},{"title":"Audit smart contract interactions on testnet","prompt":"We're deploying a custom token contract to Sepolia testnet at 0x1234567890123456789012345678901234567890 and need to verify all Approval events fired during testing. Can you fetch event logs filtered by that contract address and the Approval topic hash 0x8c5be1e5ebee5fab7e6b2fc5e3e8e5d8d8e5d8d8d8e5d8d from block 1000 to block 5000?"},{"title":"Track liquidation events across DeFi protocols","prompt":"I'm building a risk dashboard and need to monitor liquidation events on Ethereum mainnet. Can you retrieve all events with topic hash 0x06b541ddaa720db2b10a4d0cdac15460525e1d83620f6412203f7b28184b3c12 from the Aave protocol contract 0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9 for the last 1000 blocks? This helps me understand market stress in real time."}],"resultDescription":"Returns a JSON object with a 'logs' array and a 'count' integer. Each log entry includes: 'address' (contract address), 'topics' (array of topic hashes), 'data' (ABI-encoded log data), 'tx_hash' (transaction hash), and 'block_number' (hex-encoded block number).","failureModes":["Invalid contract address format (not 0x + 40 hex chars) — likely 400 error","Invalid topic hash format (not 0x + 64 hex chars) — likely 400 error","from_block greater than to_block — likely 400 or empty result","Block range too large causing timeout","Payment not received (x402 payment required, 402 response)","Network not supported (only ethereum/sepolia accepted)","Node unavailability causing 503 or timeout"],"whenToPreferThis":"Use this endpoint when you need to query on-chain Ethereum event logs by contract address and event topic, especially for ERC20 Transfer events, NFT mints/transfers, or any custom smart contract events. Prefer over generic JSON-RPC eth_getLogs calls when you want a REST-style interface with per-call micropayment via x402/USDC, no API key setup, and support for both mainnet and Sepolia testnet.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T12:59:48.476Z","isFirstParty":false}