Request
https://api.zapi.ink/v1/finance:okx/long-short-ratioSend your key in the x-api-key header. The response is JSON in the { project, data, timestamp } envelope, and an identical request is served from cache for 1 minute.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
| currency | string | query | No | Coin the series is measured in. Default BTC Example: BTC |
| period | enum: 5m | 1H | 1D | query | No | Sampling interval. Default 5m Example: 5m |
| start | string | query | No | Oldest point to include. Epoch ms/s or ISO date Example: 2026-08-19T00:00:00Z |
| end | string | query | No | Newest point to include. Epoch ms/s or ISO date Example: 2026-08-20T00:00:00Z |
Code examples
curl -X GET "https://api.zapi.ink/v1/finance:okx/long-short-ratio?currency=BTC&period=5m&start=2026-08-19T00%3A00%3A00Z&end=2026-08-20T00%3A00%3A00Z" \ -H "x-api-key: zpi_xxxxxxxxxxxxxxxxxxxxxxxx"
const res = await fetch("https://api.zapi.ink/v1/finance:okx/long-short-ratio?currency=BTC&period=5m&start=2026-08-19T00%3A00%3A00Z&end=2026-08-20T00%3A00%3A00Z", { method: "GET", headers: { "x-api-key": "zpi_xxxxxxxxxxxxxxxxxxxxxxxx" }, }); const data = await res.json(); console.log(data);
import requests res = requests.get( "https://api.zapi.ink/v1/finance:okx/long-short-ratio", params={"currency":"BTC","period":"5m","start":"2026-08-19T00:00:00Z","end":"2026-08-20T00:00:00Z"}, headers={"x-api-key":"zpi_xxxxxxxxxxxxxxxxxxxxxxxx"}, ) print(res.json())
Example response
{ "project": "finance:okx", "data": { "count": 289, "items": [ { "date": "2026-08-19T00:00:00.000Z", "time": 1787097600000, "longShortRatio": 1.38 }, { "date": "2026-08-19T00:05:00.000Z", "time": 1787097900000, "longShortRatio": 1.38 }, { "date": "2026-08-19T00:10:00.000Z", "time": 1787098200000, "longShortRatio": 1.38 }, { "date": "2026-08-19T00:15:00.000Z", "time": 1787098500000, "longShortRatio": 1.35 }, { "date": "2026-08-19T00:20:00.000Z", "time": 1787098800000, "longShortRatio": 1.36 }, { "date": "2026-08-19T00:25:00.000Z", "time": 1787099100000, "longShortRatio": 1.36 } ], "period": "5m", "dataset": "long-short-ratio", "currency": "BTC", "provider": "okx" }, "timestamp": "2026-08-20T14:57:49Z" }
Frequently asked questions
How do I call the OKX Long Short Ratio API?
Send a GET request to https://api.zapi.ink/v1/finance:okx/long-short-ratio with your Zapi key in the x-api-key header. Parameters — optional: currency, period, start, end. The response is JSON in the { project, data, timestamp } envelope.
What does the OKX Long Short Ratio API return?
Long/short account ratio across an OKX coin. The example response has the fields count, items, period, dataset, currency, provider. Each item in items has fields such as date, time, longShortRatio.
Is the OKX Long Short Ratio API free?
Yes. It is on the Zapi free tier: 600 Zap a month with one API key and no credit card. Each call costs 1 Zap. Paid plans raise the limits.
Can an AI assistant call the OKX Long Short Ratio API?
Yes. Add the Zapi MCP server (https://mcp.zapi.ink/mcp) to Claude, Cursor or another MCP client and ask in plain words; it calls run_scraper with scraper "okx" and endpoint "long-short-ratio".
What other OKX API endpoints are there?
It has 3 endpoints. Besides Long Short Ratio: Funding Rate, Open Interest.
