{
  "id": "surf.exchange.klines",
  "object": "tool",
  "name": "Exchange OHLCV Candlesticks",
  "summary": "Returns OHLCV candlestick data with period summary stats (high, low, total volume).",
  "description": "Returns OHLCV candlestick data with period summary stats (high, low, total volume). Intervals: 15 options from 1m to 1M. Pagination: use from to set the start time and limit to control candle count. For longer ranges, pass the last returned candle's timestamp as the next from value. Exchange-side limits vary (200–1000 per request). Set type=swap to query perpetual contract candles instead of spot.\n\nRaw surf#exchange/klines endpoint: input is { body, queryParams, pathParams } as the provider documents them (https://docs.asksurf.ai/data-api/exchange/klines).",
  "category": "lookup",
  "hosted_by": "Surf",
  "runtime": "partner",
  "side_effects": false,
  "status": "live",
  "credits": 0,
  "price": null,
  "providers": [
    {
      "id": "surf",
      "name": "Surf",
      "price": null,
      "own_key_only": true
    }
  ],
  "mcp_name": "surf_exchange_klines",
  "input_schema": {
    "type": "object",
    "properties": {
      "queryParams": {
        "type": "object",
        "properties": {
          "pair": {
            "type": "string",
            "minLength": 1,
            "description": "Trading pair (e.g. BTC/USDT). Example: BTC/USDT."
          },
          "type": {
            "default": "spot",
            "type": "string",
            "enum": [
              "spot",
              "swap",
              "perpetual",
              "perp"
            ],
            "description": "Market type: spot for spot trading, swap/perpetual/perp for perpetual contracts. Example: spot. Defaults to \"spot\"."
          },
          "interval": {
            "default": "1h",
            "type": "string",
            "enum": [
              "1m",
              "3m",
              "5m",
              "15m",
              "30m",
              "1h",
              "2h",
              "4h",
              "6h",
              "8h",
              "12h",
              "1d",
              "3d",
              "1w",
              "1M"
            ],
            "description": "Candle size — bucket duration for each returned OHLCV row. This endpoint uses interval only; it does NOT accept time_range. Use from + limit to control the window. Example: 1h. Defaults to \"1h\"."
          },
          "from": {
            "type": "string",
            "minLength": 1,
            "description": "Start of time range. Accepts Unix seconds or date string (YYYY-MM-DD, ISO8601). Example: 2026-03-01."
          },
          "limit": {
            "default": 100,
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "description": "Max number of candles to return. Exchange may cap lower (e.g. 200-1000). For longer ranges, paginate using the last returned timestamp as the next from value. Example: 100. Defaults to 100."
          },
          "exchange": {
            "default": "binance",
            "type": "string",
            "enum": [
              "binance",
              "okx",
              "bybit",
              "bitget",
              "coinbase",
              "kraken",
              "gate",
              "htx",
              "kucoin",
              "mexc",
              "upbit",
              "bitfinex",
              "bitstamp",
              "deribit",
              "bitmex",
              "bithumb",
              "hyperliquid"
            ],
            "description": "Exchange identifier. Note: hyperliquid uses USDC-settled perps (e.g. BTC/USDC:USDC); pass USDC-quoted pairs when querying hyperliquid. Example: binance. Defaults to \"binance\"."
          }
        },
        "required": [
          "pair"
        ],
        "additionalProperties": false
      }
    },
    "required": [
      "queryParams"
    ],
    "additionalProperties": false
  },
  "kind": "endpoint"
}