{
  "openapi": "3.0.1",
  "info": {
    "title": "Crypto Market Data API - Kaiko OHLCV, Trades, Order Books",
    "description": "Crypto market data API: OHLCV and VWAP candles, tick trades, order book depth, slippage and spread, liquidations, fair market value prices, reference rates, funding rates, open interest and greeks from Kaiko across 100+ CEX and DEX exchanges. Bring your own API key.",
    "version": "0.1",
    "x-build-id": "u7UcjCZsuGHzqAbvA"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/nabeelbaghoor~crypto-ohlcv-trades-order-book-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-nabeelbaghoor-crypto-ohlcv-trades-order-book-api",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/nabeelbaghoor~crypto-ohlcv-trades-order-book-api/runs": {
      "post": {
        "operationId": "runs-sync-nabeelbaghoor-crypto-ohlcv-trades-order-book-api",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/nabeelbaghoor~crypto-ohlcv-trades-order-book-api/run-sync": {
      "post": {
        "operationId": "run-sync-nabeelbaghoor-crypto-ohlcv-trades-order-book-api",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "mode": {
            "title": "What to read",
            "enum": [
              "ohlcv",
              "countOhlcvVwap",
              "trades",
              "marketDepth",
              "priceSlippage",
              "orderBookAggregation",
              "liquidations",
              "liquidationVolumes",
              "directPrice",
              "syntheticPrice",
              "referenceRate",
              "derivativesPrice",
              "derivativesRisk",
              "derivativesContracts",
              "assets",
              "exchanges",
              "instruments"
            ],
            "type": "string",
            "description": "Candle, trade, order book, liquidation and derivatives modes read the instruments list. Direct and synthetic prices read pairs, liquidation volumes read assets and reference rates read index codes. Contract details, assets, exchanges and instruments need none of these.",
            "default": "ohlcv"
          },
          "instruments": {
            "title": "Instruments",
            "type": "array",
            "description": "Kaiko exchange and instrument codes as exchange:instrument, one per line: cbse:btc-usd (Coinbase), krkn:eth-usd (Kraken), binc:btc-usdt (Binance). Add a class to override the instrument class for one line: binc:perpetual-future:btc-usdt, okex:future:btcusdt250117. The instruments mode lists every valid code.",
            "default": [
              "cbse:btc-usd"
            ],
            "items": {
              "type": "string"
            }
          },
          "instrumentClass": {
            "title": "Instrument class",
            "enum": [
              "spot",
              "future",
              "perpetual-future",
              "option"
            ],
            "type": "string",
            "description": "Market type for the instruments list, and the class filter for the instruments and contract details modes. Order book modes read spot only; liquidations read futures and perpetual futures; derivatives modes switch spot to perpetual future.",
            "default": "spot"
          },
          "pairs": {
            "title": "Pairs",
            "type": "array",
            "description": "Direct and synthetic prices. Base and quote asset codes, one per line: btc-usd, eth-eur, sol-usdt.",
            "items": {
              "type": "string"
            }
          },
          "assets": {
            "title": "Assets",
            "type": "array",
            "description": "Liquidation volumes. Kaiko asset codes, one per line: btc, eth, sol.",
            "items": {
              "type": "string"
            }
          },
          "indexCodes": {
            "title": "Index codes",
            "type": "array",
            "description": "Reference rates. Kaiko rate tickers, one per line, such as KK_BRR_BTCUSD. Your Kaiko indices subscription decides which tickers you can read.",
            "items": {
              "type": "string"
            }
          },
          "startTime": {
            "title": "Start time",
            "type": "string",
            "description": "Inclusive start of the window, as YYYY-MM-DD or a UTC time such as 2026-01-31T12:00:00Z. Left empty, the provider serves its most recent data."
          },
          "endTime": {
            "title": "End time",
            "type": "string",
            "description": "Exclusive end of the window, as YYYY-MM-DD (read as the end of that day) or a UTC time. Reference rates use the last 24 hours when no window is given."
          },
          "interval": {
            "title": "Interval",
            "type": "string",
            "description": "Candles, order book aggregation and fair market value prices: any interval from 1s to 1d, such as 1m, 15m, 1h or 1d. Liquidation volumes: 1h to 1d. Derivatives price and risk: 1m, 1h, 4h or 1d.",
            "default": "1d"
          },
          "sortOrder": {
            "title": "Sort order",
            "enum": [
              "desc",
              "asc"
            ],
            "type": "string",
            "description": "Newest first keeps the most recent rows when the maximum results cap is reached.",
            "default": "desc"
          },
          "slippage": {
            "title": "Slippage order size",
            "minimum": 0,
            "type": "number",
            "description": "Price slippage and order book aggregation. Order size in the quote asset (for example 100000 for a 100,000 USD market order) to compute the slippage for."
          },
          "slippageRef": {
            "title": "Slippage reference",
            "enum": [
              "mid_price",
              "best"
            ],
            "type": "string",
            "description": "Price slippage and order book aggregation. Measure slippage from the mid price or from the best bid and ask.",
            "default": "mid_price"
          },
          "includeExchanges": {
            "title": "Exchanges to include",
            "type": "array",
            "description": "Direct and synthetic prices. Only use trades from these exchange codes, such as cbse, krkn, bfnx. Empty means all exchanges.",
            "items": {
              "type": "string"
            }
          },
          "excludeExchanges": {
            "title": "Exchanges to exclude",
            "type": "array",
            "description": "Direct and synthetic prices. Leave these exchange codes out of the calculation.",
            "items": {
              "type": "string"
            }
          },
          "extrapolateMissingValues": {
            "title": "Fill missing prices",
            "type": "boolean",
            "description": "Direct and synthetic prices. Fill intervals without trades with the last available price.",
            "default": false
          },
          "priceMetrics": {
            "title": "Include price metrics",
            "type": "boolean",
            "description": "Direct and synthetic prices. Add the 99 percent confidence interval and the stress market indicator.",
            "default": false
          },
          "syntheticSources": {
            "title": "Include synthetic price sources",
            "type": "boolean",
            "description": "Synthetic price. Add the intermediary pair prices the synthetic price was built from.",
            "default": false
          },
          "rateParameters": {
            "title": "Include rate parameters",
            "type": "boolean",
            "description": "Reference rates. Add the rate composition: exchanges and calculation window.",
            "default": false
          },
          "rateDetail": {
            "title": "Include rate partitions",
            "type": "boolean",
            "description": "Reference rates. Add the partition data behind each publication: price, volume, trade count and the selected trade.",
            "default": false
          },
          "exchange": {
            "title": "Exchange",
            "type": "string",
            "description": "Contract details (required) and instruments (optional filter). A Kaiko exchange code such as drbt (Deribit), binc (Binance), okex (OKX), bbit (Bybit) or cbse (Coinbase)."
          },
          "baseAsset": {
            "title": "Base asset",
            "type": "string",
            "description": "Contract details and instruments. Filter by base asset code, such as btc."
          },
          "quoteAsset": {
            "title": "Quote asset",
            "type": "string",
            "description": "Contract details and instruments. Filter by quote asset code, such as usd or usdt."
          },
          "optionType": {
            "title": "Option type",
            "enum": [
              "any",
              "C",
              "P"
            ],
            "type": "string",
            "description": "Contract details for options. Calls, puts or both.",
            "default": "any"
          },
          "minStrike": {
            "title": "Strike from",
            "minimum": 0,
            "type": "number",
            "description": "Contract details for options. Lowest strike price."
          },
          "maxStrike": {
            "title": "Strike up to",
            "minimum": 0,
            "type": "number",
            "description": "Contract details for options. Highest strike price."
          },
          "activeOnly": {
            "title": "Active instruments only",
            "type": "boolean",
            "description": "Instruments. Only instruments that are still trading.",
            "default": false
          },
          "region": {
            "title": "Region",
            "enum": [
              "us",
              "eu"
            ],
            "type": "string",
            "description": "Which Kaiko market data host to call. Both serve the same data; pick the one nearer your other systems. Reference rates always use the US host, as documented.",
            "default": "us"
          },
          "maxResults": {
            "title": "Maximum results",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "The most rows this run returns and charges for, across all instruments, pairs, assets or codes. Also the page size where the provider documents one, and the limit for the instruments mode.",
            "default": 500
          },
          "requestsPerMinute": {
            "title": "Requests per minute",
            "minimum": 1,
            "maximum": 6000,
            "type": "integer",
            "description": "Pacing. Kaiko allows 6000 requests a minute per key; the actor also waits and retries when the provider answers 429.",
            "default": 600
          },
          "apiKey": {
            "title": "API key",
            "type": "string",
            "description": "Your own Kaiko API key, issued with a Kaiko data subscription. Stored as a secret and sent in the documented X-Api-Key header, never in a URL and never logged. You can instead set the DATA_API_KEY environment secret."
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}