{"uid":"cap_tzXYTT3qDgKNwkERbNVOC","slug":"defillama-batch-historical-token-prices-70512f92","name":"DefiLlama Batch Historical Token Prices","description":"Batch historical token prices by DefiLlama — prices for many coins at many timestamps in one call (coins is a JSON map).","url":"https://defillama.use.x402atlas.com/batch-historical","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"],"type":"string"},"queryParams":{"type":"object","required":["coins"],"properties":{"coins":{"type":"string","maxLength":8000,"minLength":1,"description":"Required JSON object mapping each {chain}:{address} or coingecko:{id} coin to an array of unix timestamps"},"searchWidth":{"type":"string","maxLength":200,"description":"Optional time range to search for each price (e.g. 4h)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","required":["queried_at","data"],"properties":{"data":{"type":"object","properties":{"coins":{"type":"object","description":"Keyed by {chain}:{address} or coingecko:{id}","additionalProperties":{"type":"object","properties":{"prices":{"type":"array","items":{"type":"object","properties":{"price":{"type":"number","description":"USD price"},"timestamp":{"type":"integer","description":"Unix timestamp (seconds)"}}}},"symbol":{"type":"string"}}}}},"description":"Raw DefiLlama batchHistorical payload","additionalProperties":true},"queried_at":{"type":"string","format":"date-time","description":"When this bridge fetched the upstream data"}}}}}}},"responseSchema":{"type":"json","example":{"data":{"coins":{"ethereum:0xdAC17F958D2ee523a2206206994597C13D831ec7":{"prices":[{"price":1,"timestamp":1650000000}],"symbol":"USDT"}}},"queried_at":"2026-07-01T12:00:00Z"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","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_zSGuFF9zbY10vOV4Q6Wr2","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 historical USD prices for multiple tokens at multiple timestamps in a single batch call using DefiLlama data.","exampleAgentPrompt":"Can you pull the historical prices for ethereum:0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 and coingecko:bitcoin at Unix timestamps 1700000000, 1710000000, and 1720000000, using a 4h search window?","exampleUseCases":[{"title":"Portfolio valuation at past dates","prompt":"I need to know what my crypto portfolio was worth on January 1st and July 1st of last year. Can you pull the historical prices for coingecko:ethereum, coingecko:bitcoin, and coingecko:solana at those two dates in one batch call so I can calculate my total holdings value at each point?"},{"title":"Tax reporting for crypto trades","prompt":"I have a bunch of trades from last year and I need the USD prices for coingecko:bitcoin, coingecko:ethereum, and coingecko:chainlink at the exact timestamps each trade happened. Can you fetch all those historical prices in a single batch request so I can calculate my cost basis and gains for tax purposes?"},{"title":"Backtesting DeFi yield strategy","prompt":"I'm backtesting a liquidity pool strategy and need to know what WETH and USDC were trading at on a series of specific dates over the past six months. Can you grab the historical prices for ethereum:0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 and coingecko:usd-coin at those timestamps all in one call?"}],"resultDescription":"A JSON object mapping each coin identifier to an array of price entries corresponding to the requested timestamps, including USD price and timestamp metadata for each data point.","failureModes":["Invalid coins JSON format causes 400 error","Unrecognized chain:address or coingecko:id returns missing or null price entries","Timestamps too far in the past with no data available return empty results","searchWidth too narrow causes no matching price to be found for a timestamp","Payment failure (402) if x402 payment not provided or insufficient USDC balance","Rate limiting or upstream DefiLlama data unavailability causes 5xx errors"],"whenToPreferThis":"Use this endpoint when you need historical prices for multiple tokens at multiple specific timestamps in a single efficient call. It is ideal for portfolio valuation at past dates, tax/accounting calculations, backtesting DeFi strategies, or any scenario requiring cross-token price history without making many individual requests. Prefer this over single-token historical endpoints when dealing with more than one coin or more than one timestamp.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:48:20.523Z","isFirstParty":false}