Dexploit is in public beta. Share feedback →

Skip to content
← Back to Blog
solanaohlcvapitutorial

How to Get Solana DEX Candles on a Free API Key (What 14 Days of History Gets You)

Dexploit Team··10 min read
How to Get Solana DEX Candles on a Free API Key (What 14 Days of History Gets You)

Yes. A Free Dexploit key returns OHLCV candles for the Solana pools Dexploit indexes, on all eight timeframes from 1 second to 1 day, over both REST and GraphQL. It covers the last 14 days, at 10 requests per second and 10,000 requests a month. Older history needs a paid key. I ran every example below on a Free key on 18 November 2026.

This post shows what that gets you in practice: how to find a pool, how to pull a window of candles, what the Free limits look like when you hit them, and a short script that summarises a day of trading.

What a Free key includes

Free key
Timeframes1s, 30s, 1m, 5m, 15m, 1h, 4h, 1d
Historythe last 14 days
Rate limit10 requests per second
Monthly quota10,000 requests
RoutesREST candles and GraphQL candles, same data

Get a key from the dashboard. Keys start with ohlcv_live_sk_; replace ohlcv_live_sk_<your_key> in the examples with your whole key. Limits and error codes are in the authentication and quotas and errors docs.

When I asked each timeframe for candles from 13 days and 23 hours back on this pool, all eight returned them, 1s included. On a Free key the 14-day window is the limit, not the timeframe.

Step 1: find the pool

Candles belong to a pool, not a token, because one token trades on several pools with different prices and volumes (pairs vs tokens). The pairs route lists the pools for a token, busiest first:

curl -H 'X-API-Key: ohlcv_live_sk_<your_key>' \
  'https://api.dexploit.dev/api/v1/pairs?token_address=DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263&limit=3'

That is BONK. The first row on the day I ran it was an Orca pool (protocol: "orca", status: "active") with this pair_address:

5zpyutJu9ee6jFymDGoK7F6S5Kczqtc9FomP3ueKuyA9

Pools change, so run it yourself and use the first pair_address it gives you.

Step 2: pull a window of candles over REST

The route is GET /api/v1/candles. It needs pair_address and timeframe. Pass both start and end (RFC 3339 timestamps) so you know exactly which window you get. Use times inside the last 14 days:

curl -G https://api.dexploit.dev/api/v1/candles \
  -H 'X-API-Key: ohlcv_live_sk_<your_key>' \
  -d pair_address=5zpyutJu9ee6jFymDGoK7F6S5Kczqtc9FomP3ueKuyA9 \
  -d timeframe=5m \
  -d start=2026-11-18T14:20:00Z \
  -d end=2026-11-18T14:35:00Z \
  -d limit=3

Those are the times I used on 18 November 2026. A Free key refuses them from 2 December 2026, so replace them with times from the last 14 days.

The first candle that came back:

{
  "timestamp": "2026-11-18T14:20:00+00:00",
  "pair_address": "5zpyutJu9ee6jFymDGoK7F6S5Kczqtc9FomP3ueKuyA9",
  "token_address": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
  "base_mint": "So11111111111111111111111111111111111111112",
  "timeframe": "5m",
  "open": 3.170250260881335e-08,
  "high": 3.170252514219429e-08,
  "low": 3.1653907872625294e-08,
  "close": 3.1653907872625294e-08,
  "volume_sol": 2130091086,
  "volume_token": 6727878603208,
  "trade_count": 4,
  "buy_count": 1,
  "sell_count": 3,
  "unique_traders": 2
}

Two things to know about the units (candle units):

  • open, high, low and close are in SOL per whole token, already adjusted for decimals.
  • volume_sol is in lamports, despite the name. Divide by 1e9. Here 2130091086 is 2.13 SOL.

Candles come back oldest first. buy_count and sell_count split each candle's trades by direction, so a candle already shows which way the trading leaned.

Step 3: the same call in GraphQL

The GraphQL endpoint is https://api.dexploit.dev/graphql. Send a POST with the same key in X-API-Key. It returns the same candles, with camelCase names (volumeSol is REST's volume_sol) and only the fields you ask for:

query Window($pair: String!, $start: String!, $end: String!) {
  candles(pairAddress: $pair, timeframe: "5m", start: $start, end: $end, limit: 3) {
    timestamp open high low close volumeSol tradeCount buyCount sellCount uniqueTraders
  }
}

As a curl call:

curl -X POST https://api.dexploit.dev/graphql \
  -H 'X-API-Key: ohlcv_live_sk_<your_key>' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "query Window($pair: String!, $start: String!, $end: String!) { candles(pairAddress: $pair, timeframe: \"5m\", start: $start, end: $end, limit: 3) { timestamp open high low close volumeSol tradeCount buyCount sellCount uniqueTraders } }",
    "variables": {
      "pair": "5zpyutJu9ee6jFymDGoK7F6S5Kczqtc9FomP3ueKuyA9",
      "start": "2026-11-18T14:20:00Z",
      "end": "2026-11-18T14:35:00Z"
    }
  }'

The first candle that came back:

{
  "timestamp": "2026-11-18T14:20:00+00:00",
  "open": 3.170250260881335e-08,
  "high": 3.170252514219429e-08,
  "low": 3.1653907872625294e-08,
  "close": 3.1653907872625294e-08,
  "volumeSol": 2130091086.0,
  "tradeCount": 4,
  "buyCount": 1,
  "sellCount": 3,
  "uniqueTraders": 2
}

I compared the three candles from the REST call and from this query field by field, and every value matched. For a longer tour of the GraphQL side, see Query Solana DEX Candles with GraphQL.

Read the result correctly

  • Do not assume one row per slot. A five-minute slot with no trades has no candle: Dexploit does not carry the previous close forward (no phantom bars). A busy pool like this one filled all 288 slots in a day. A quiet pool will not. Use the row count and each row's timestamp. (One exception in the docs: when none of a candle's trades could be valued in SOL, the candle has trade_count 0 and volume_sol 0 and carries the previous close. Skip those if you only want traded bars.)
  • Always pass start. Without it, REST returned the newest candles and GraphQL does not, so the two routes give you different windows (GraphQL reference).
  • On REST, use an end in the past, or a limit at least as large as the window. When I asked REST for three five-minute candles from three hours ago, with no end, I got the second and third candle of the window plus the current, still-forming candle, not the first three. The same call with an end in the past, or the same arguments over GraphQL, returned the first three. That is how REST behaved when I wrote this (18 November 2026). The script below uses a limit larger than the number of candles in the window, so it is not affected.
  • Errors: a REST error carries an HTTP status and an error object. A GraphQL query error is still HTTP 200, with the problem in an errors array in the body, so check the body.

What happens at the edge of the Free window

Ask a Free key for a start older than 14 days and the request is refused. On REST it is an HTTP 403 with the code HISTORY_WINDOW_EXCEEDED:

{
  "success": false,
  "error": {
    "code": "HISTORY_WINDOW_EXCEEDED",
    "message": "The free tier serves the last 14 days of history. The oldest time you can request is 2026-11-04T19:11:28.194Z.",
    "oldest_allowed": "2026-11-04T19:11:28.194Z",
    "window_days": 14
  }
}

oldest_allowed is the earliest time your key can ask for, so a script can clamp its start to it. On GraphQL the same three values, code, oldest_allowed and window_days, come back inside errors[].extensions, with HTTP 200 (quotas and errors).

Two more limits you can hit:

  • limit defaults to 1000 and is at most 10,000. Over that is refused with HTTP 400 and limit must be <= 10000.
  • Rate limit. When I sent 30 requests in parallel, 10 succeeded and 20 came back as HTTP 429 with a retry-after of 1 second. Treat any 429 as "slow down": wait that second and retry.

A bad key is a plain 401 with the code UNAUTHORIZED.

A short script: summarise the last day

Save this as day.mjs (Node 18 or newer, no dependencies). It pulls the last 24 hours of five-minute candles for a pool and prints a summary:

// Usage: node day.mjs <pair_address>
// Pulls the last 24 hours of 5-minute candles for a pool over REST and summarises them.
const KEY = process.env.DEXPLOIT_API_KEY;
const pair = process.argv[2];
if (!KEY || !pair) { console.error("usage: DEXPLOIT_API_KEY=... node day.mjs <pair_address>"); process.exit(1); }

// End one second before the last 5-minute boundary, so only closed candles are in the window.
const FIVE_MIN = 5 * 60 * 1000;
const endMs = Math.floor(Date.now() / FIVE_MIN) * FIVE_MIN;
const iso = (ms) => new Date(ms).toISOString().slice(0, 19) + "Z";
const url = new URL("https://api.dexploit.dev/api/v1/candles");
url.search = new URLSearchParams({
  pair_address: pair,
  timeframe: "5m",
  start: iso(endMs - 24 * 3600 * 1000),
  end: iso(endMs - 1000),
  limit: "1000", // more than the 288 candles in a day, so the whole window comes back
});

const res = await fetch(url, { headers: { "X-API-Key": KEY } });
const text = await res.text();
let body;
try { body = JSON.parse(text); } catch { console.error(res.status, text.slice(0, 200)); process.exit(1); }
if (!res.ok || !body.success) {
  // e.g. 403 HISTORY_WINDOW_EXCEEDED on a Free key, 429 over the rate limit
  console.error(res.status, JSON.stringify(body.error ?? body));
  process.exit(1);
}

const candles = body.data;
if (candles.length === 0) { console.error("no candles in this window: has the pool traded in the last day?"); process.exit(1); }
const sol = (lamports) => lamports / 1e9; // volume_sol is lamports, despite the name
const high = Math.max(...candles.map((c) => c.high));
const low = Math.min(...candles.map((c) => c.low));
const volume = candles.reduce((n, c) => n + sol(c.volume_sol), 0);
const buys = candles.reduce((n, c) => n + c.buy_count, 0);
const sells = candles.reduce((n, c) => n + c.sell_count, 0);

console.log(`${candles.length} five-minute candles (a full day is 288; a 5-minute slot with no trades has no candle)`);
console.log(`first ${candles[0].timestamp}`);
console.log(`last  ${candles.at(-1).timestamp}`);
console.log(`open  ${candles[0].open.toExponential(3)} SOL   close ${candles.at(-1).close.toExponential(3)} SOL`);
console.log(`high  ${high.toExponential(3)} SOL   low   ${low.toExponential(3)} SOL`);
console.log(`volume ${volume.toFixed(2)} SOL, ${buys} buys, ${sells} sells`);
export DEXPLOIT_API_KEY='ohlcv_live_sk_<your_key>'
node day.mjs 5zpyutJu9ee6jFymDGoK7F6S5Kczqtc9FomP3ueKuyA9

A real run (the numbers will differ for you). The window ends one second before the last five-minute boundary, so every candle in it has closed:

288 five-minute candles (a full day is 288; a 5-minute slot with no trades has no candle)
first 2026-11-17T19:10:00+00:00
last  2026-11-18T19:05:00+00:00
open  3.214e-8 SOL   close 3.178e-8 SOL
high  3.248e-8 SOL   low   3.146e-8 SOL
volume 1601.41 SOL, 3850 buys, 4543 sells

When 14 days is not enough

A Free key is refused any request for a time older than 14 days. For longer history you need a paid key, which is not limited to the 14-day window; see pricing. How far back each timeframe goes is in the data coverage docs. If you are not sure whether you need it yet, build against the last 14 days first: the routes, fields and units are the same either way.

Questions

Is there a free Solana DEX candles API? Yes. Dexploit's Free key returns OHLCV candles over REST and GraphQL, on eight timeframes, for the last 14 days.

How far back does the Free tier go? 14 days. A start older than that returns HISTORY_WINDOW_EXCEEDED, with the earliest time you may ask for in oldest_allowed.

Which timeframes can I use? All eight: 1s, 30s, 1m, 5m, 15m, 1h, 4h and 1d.

Are candles the same as individual trades? No. A candle summarises the trades in one interval. Individual swaps come from the REST swaps routes, which are covered in the docs.

Next