{"openapi":"3.1.0","info":{"title":"AgentRail","version":"0.6.0","description":"Pay-per-call (x402, USDC on Base) or prepaid credits (Bearer agent key)."},"servers":[{"url":"https://agentrail-backend-eta.vercel.app"}],"components":{"securitySchemes":{"agentKey":{"type":"http","scheme":"bearer","description":"Agent key from A2A {\"action\":\"enrol\"}"}}},"paths":{"/api/x402/venue-health":{"get":{"summary":"Live up/down status and latency for Binance, Kraken and Bybit, checked from Sydney. Use before routing an order.","operationId":"venue_health","x-price-usd":0.001,"security":[{},{"agentKey":[]}],"parameters":[{"name":"venue","in":"query","required":false,"schema":{"type":"string","enum":["binance","kraken","bybit"],"description":"Omit for all venues"}}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"venues":[{"venue":"kraken","status":"online","latency_ms":94,"detail":null,"checked_at":"2026-11-26T07:10:12Z"}]}}}},"400":{"description":"Bad input (not charged)"},"402":{"description":"Payment required (x402); or send a Bearer agent key"}}}},"/api/x402/estimate-fees":{"get":{"summary":"Exchange fee estimate for a trade on Binance, Kraken or Bybit at public base-tier rates.","operationId":"estimate_fees","x-price-usd":0.001,"security":[{},{"agentKey":[]}],"parameters":[{"name":"venue","in":"query","required":true,"schema":{"type":"string","enum":["binance","kraken","bybit"]}},{"name":"liquidity","in":"query","required":true,"schema":{"type":"string","enum":["maker","taker"]}},{"name":"notional_usd","in":"query","required":true,"schema":{"type":"number","exclusiveMinimum":0,"maximum":1000000000}}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"venue":"kraken","liquidity":"taker","notional_usd":1000,"fee_rate_pct":0.4,"fee_usd":4}}}},"400":{"description":"Bad input (not charged)"},"402":{"description":"Payment required (x402); or send a Bearer agent key"}}}},"/api/x402/venue-uptime":{"get":{"summary":"Uptime history for Binance, Kraken and Bybit: % online, degraded and offline, average and p95 latency, last outage, over the last 1 to 90 days. Free status pages only show the current moment.","operationId":"venue_uptime","x-price-usd":0.002,"security":[{},{"agentKey":[]}],"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":90}}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"days":7,"venues":[{"venue":"kraken","checks":412,"online_pct":99.5,"avg_latency_ms":96,"p95_latency_ms":180,"last_offline":null}]}}}},"400":{"description":"Bad input (not charged)"},"402":{"description":"Payment required (x402); or send a Bearer agent key"}}}},"/api/x402/pretrade-check":{"get":{"summary":"Everything before routing one order, in one call: venue health now, the fee for this trade, 7-day uptime, and a go / caution / avoid verdict. Cheaper than buying the three separately.","operationId":"pretrade_check","x-price-usd":0.003,"security":[{},{"agentKey":[]}],"parameters":[{"name":"venue","in":"query","required":true,"schema":{"type":"string","enum":["binance","kraken","bybit"]}},{"name":"liquidity","in":"query","required":true,"schema":{"type":"string","enum":["maker","taker"]}},{"name":"notional_usd","in":"query","required":true,"schema":{"type":"number","exclusiveMinimum":0,"maximum":1000000000}}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"venue":"kraken","verdict":"go","reason":"Venue is up now and has been reliable this week.","fee":{"fee_usd":4},"uptime_7d":{"online_pct":99.8}}}}},"400":{"description":"Bad input (not charged)"},"402":{"description":"Payment required (x402); or send a Bearer agent key"}}}},"/api/x402/token-price":{"get":{"summary":"Cross-exchange token price: bid, ask and last on Binance, Kraken and Bybit, best bid and ask, spreads, and the gap between venues gross and net of taker fees. Says plainly when a gap is not arbitrage. Three venues in one call; single-venue price calls elsewhere typically cost 0.01-0.02 USD.","operationId":"token_price","x-price-usd":0.002,"security":[{},{"agentKey":[]}],"parameters":[{"name":"symbol","in":"query","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9]{2,10}$","description":"Token symbol, quoted in USDT"}}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"symbol":"BTC","best_bid":{"venue":"binance","price":59227.5},"best_ask":{"venue":"bybit","price":59224.2},"cross_venue_gap":{"net_after_taker_fees_pct":-0.49,"is_arbitrage_signal":false}}}}},"400":{"description":"Bad input (not charged)"},"402":{"description":"Payment required (x402); or send a Bearer agent key"}}}},"/api/x402/market-search":{"get":{"summary":"Search tens of thousands of x402 pay-per-call services from the Coinbase and PayAI Bazaar catalogues by keyword. Deduplicated per provider, USDC prices normalised to USD, ranked by relevance then price. The catalogues themselves have no search.","operationId":"market_search","x-price-usd":0.002,"security":[{},{"agentKey":[]}],"parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2,"maxLength":200}},{"name":"max_price_usd","in":"query","required":false,"schema":{"type":"number","exclusiveMinimum":0}},{"name":"finance","in":"query","required":false,"schema":{"type":"integer","enum":[0,1]}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":25}}],"responses":{"200":{"description":"Result","content":{"application/json":{"example":{"results":[{"service_name":"Token price feed","resource":"https://example.com/price","price_usd":0.001,"network":"eip155:8453"}]}}}},"400":{"description":"Bad input (not charged)"},"402":{"description":"Payment required (x402); or send a Bearer agent key"}}}}}}