{"uid":"cap_JjnnpNA3hwKoH-lXj6B7X","slug":"agent402-coin-ohlc-price-bars-98ca7da7","name":"Agent402 Coin OHLC Price Bars","description":"OHLC candles for a coin: days 1 (30-min candles), 7 or 14 (4-hour), 30 / 90 / 180 / 365 (daily), in any vs currency. Returns aligned {time, open, high, low, close} bars plus the window's high/low/first/last and % change. The candle sibling of crypto-history, which returns close-only points: use OHLC for technical indicators, range/volatility work and charting. Cached in-process for 60 seconds.","url":"https://agent402.tools/api/coin-ohlc","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":["coin"],"properties":{"coin":{"type":"string","description":"Coin id (bitcoin, ethereum, ...)."},"days":{"type":"number","description":"1, 7, 14, 30, 90, 180 or 365 (default 7)."},"currency":{"type":"string","description":"vs currency (default usd)."}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","required":["source","fetchedAt","cached","coin","currency","days","count","granularity","summary","bars"],"properties":{"bars":{"type":"array"},"coin":{"type":"string"},"days":{"type":"integer"},"count":{"type":"integer"},"cached":{"type":"boolean"},"source":{"type":"string"},"summary":{"type":"object"},"currency":{"type":"string"},"fetchedAt":{"type":"string"},"granularity":{"type":"string"}}}}}}},"responseSchema":{"type":"json","example":{"bars":[{"low":65900,"high":66500.1,"open":66120.4,"time":"2026-08-15T16:00:00.000Z","close":66210.3}],"coin":"bitcoin","days":7,"count":42,"cached":false,"source":"coingecko","summary":{"low":64995.9,"high":69850,"last":68210,"first":66120.4,"changePct":3.16},"currency":"usd","fetchedAt":"2026-08-22T13:20:00.000Z","granularity":"4h"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.008","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.008/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.008","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.008","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_C7Q9ul2kqOUCs9d5wsecS","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.008","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns historical OHLC (open/high/low/close) candlestick price bars for a cryptocurrency over a specified time period and granularity.","exampleAgentPrompt":"Can you get me the OHLC candlestick price bars for bitcoin over the last 30 days in USD — I need the open, high, low, close values and the overall price change percentage?","exampleUseCases":[{"title":"Crypto portfolio performance tracker","prompt":"Pull the last 30 days of OHLC price bars for ethereum in USD so I can see how its price has moved and what the percentage change has been."},{"title":"Trading chart data feed","prompt":"I need candlestick data for bitcoin over the past 7 days in USD — get me the open, high, low, and close values at whatever granularity is available."},{"title":"Multi-coin price comparison","prompt":"Fetch the 90-day OHLC price history for solana in EUR, including the high, low, first and last prices and the overall change percentage."}],"resultDescription":"Returns an array of OHLC bars each with open, high, low, close prices and a UTC timestamp, plus a summary object with overall high, low, first, last prices and percentage change. Also includes metadata: coin id, number of days, count of bars, currency, granularity (e.g. 4h), data source (CoinGecko), fetchedAt timestamp, and a cached flag.","failureModes":["Unknown coin id returns error or empty response","Unsupported days value outside allowed set (1,7,14,30,90,180,365) may return error","Unsupported currency code returns error","Rate limiting or upstream CoinGecko unavailability causes failure","Payment of 0.008 USDC required per call; unpaid requests are rejected with 402"],"whenToPreferThis":"Choose this endpoint when you need structured OHLC candlestick price history for a specific cryptocurrency over a defined lookback window, especially when you want a built-in price summary (first, last, high, low, changePct) alongside the raw bars. Ideal for charting, backtesting signals, or reporting on price movement without building your own aggregation. Prefer over raw tick data sources when 4h or daily granularity suffices and pay-per-call USDC pricing with no API key is acceptable.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T12:58:53.657Z","isFirstParty":false}