{"uid":"cap_owIgc1PkflITuHCbex6Db","slug":"x402stock-forex-pair-aggregate-bars-8dba9fea","name":"x402stock Forex Pair Aggregate Bars","description":"Pay-per-call market and economic data API for AI agents: US stocks, ETFs and options, forex, crypto and on-chain perps, energy commodities, US and global macro (Fed, CPI, jobs, GDP, Treasury, World Bank), SEC filings, congressional trades, and market sentiment. No API keys, no accounts. Pay per request in USDC via x402 on Base.","url":"https://x402stock.xyz/api/v1/forex/%7Bpair%7D/aggregates","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","$schema":"https://json-schema.org/draft/2020-12/schema","required":["multiplier","timespan","from","to","adjusted","sort","limit"],"properties":{"to":{"type":"string","default":"2026-09-15","minLength":1},"from":{"type":"string","default":"2025-09-15","minLength":1},"sort":{"enum":["asc","desc"],"type":"string","default":"asc"},"limit":{"type":"integer","default":5000,"maximum":50000,"exclusiveMinimum":0},"adjusted":{"type":"boolean","default":true},"timespan":{"enum":["minute","hour","day","week","month","quarter","year"],"type":"string","default":"day"},"multiplier":{"type":"integer","default":1,"maximum":50000,"exclusiveMinimum":0}},"additionalProperties":false}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["ticker","data","source","as_of"],"properties":{"data":{"type":"object","required":["bars","count"],"properties":{"bars":{"type":"array","items":{"type":"object","required":["open","high","low","close","volume","vwap","trade_count","timestamp"],"properties":{"low":{"type":"number"},"high":{"type":"number"},"open":{"type":"number"},"vwap":{"anyOf":[{"type":"number"},{"type":"null"}]},"close":{"type":"number"},"volume":{"type":"number"},"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}]},"trade_count":{"anyOf":[{"type":"number"},{"type":"null"}]}},"additionalProperties":false}},"count":{"type":"number"},"adjusted":{"type":"boolean"}},"additionalProperties":false},"as_of":{"type":"string"},"source":{"type":"string","const":"x402stock"},"ticker":{"type":"string"},"feedback":{"type":"object","required":["endpoint","method","free","note"],"properties":{"free":{"type":"boolean"},"note":{"type":"string"},"method":{"type":"string","const":"POST"},"endpoint":{"type":"string"}},"additionalProperties":false}},"additionalProperties":false}}}}},"responseSchema":{"type":"json","example":{"data":{"bars":[{"low":192.5,"high":196,"open":193,"vwap":194.8,"close":195.12,"volume":50000000,"timestamp":"2026-05-28T04:00:00.000Z","trade_count":450000}],"count":1,"adjusted":true},"as_of":"2026-05-29T20:00:00.000Z","source":"x402stock","ticker":"AAPL"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","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.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_jyjwjZFLtI8oVIIYALald","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns OHLCV aggregate bar data (open, high, low, close, volume, VWAP) for a forex currency pair over a specified time range and resolution, paid per-request in USDC via x402.","exampleAgentPrompt":"Pull daily OHLCV aggregate bars for EUR/USD from January 1 2025 to June 1 2025, 1-day timespan, adjusted, sorted ascending, limit 500.","exampleUseCases":[{"title":"Backtest forex trading strategy","prompt":"Fetch hourly OHLCV bars for GBP/USD from March 1 2024 to March 31 2024, 1-hour timespan, adjusted, sorted ascending, limit 720 — I need the full month of intraday data to backtest a moving average crossover strategy."},{"title":"Monitor recent EUR/JPY price action","prompt":"Pull the last 30 days of daily candlestick data for EUR/JPY up to today, 1-day timespan, sorted ascending — I want to review the recent trend and check where VWAP has been sitting relative to close each day."},{"title":"Weekly forex bars for USD/CAD analysis","prompt":"Get weekly aggregate OHLCV bars for USD/CAD from January 1 2023 to December 31 2023, 1-week timespan, adjusted, sorted ascending — I'm building a year-long chart to analyze how the pair moved across different macro events last year."}],"resultDescription":"A JSON object containing an array of OHLCV bar objects for the requested forex pair, each with open, high, low, close, volume, VWAP, trade count, and timestamp fields, plus a total bar count, adjusted flag, data source identifier, ticker symbol, and as-of timestamp.","failureModes":["Invalid or unsupported currency pair returns 404 or empty bars array","Payment not received / x402 payment required returns HTTP 402","Date range too large or limit exceeded returns validation error","Invalid timespan or multiplier value returns 400 bad request","Network timeout for large date ranges with minute-level granularity"],"whenToPreferThis":"Use this endpoint when you need historical OHLCV candlestick/bar data for a forex currency pair with flexible time resolution (from minute to year), no API key setup, and pay-per-call pricing in USDC. Prefer over subscription-based forex APIs when you need occasional or agent-driven on-demand lookups without account management.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T13:00:45.610Z","isFirstParty":false}