dydt.aiTerminalTerminalDevelopers
DocsAPI referenceChangelog
Open terminalGet API key

GET STARTED

OverviewQuickstartCore concepts

REFERENCE

HTTP endpointsWebSocket streams

ACCOUNT

API keysPricing and billing

GUIDES

AI agentsBuild your own agentChart embedChangelog

SPECS

OpenAPI JSON ↗AsyncAPI JSON ↗
Developers/Get started

Quickstart

From an API key to live data in four steps.

Get an API key

Sign in and create a key on the API keys page; the Free plan needs no payment. Store the key in an environment variable on your server. Paste the key into the HTTP explorer to try any route from the browser.

Make your first request

The SOL reference price takes no parameters. Every response has the same shape: code is 0 on success and data holds the result.

Terminal
export DYDT_API_KEY="dydt_live_…"
curl "https://data.dydt.ai/v1/market/sol-price" \
  --header "Authorization: Bearer $DYDT_API_KEY"
Response
{
  "code": 0,
  "error": null,
  "message": "OK",
  "data": { "price_usd": 113.16 }
}

Find a live token and load its candles

Rankings return pools with their token. Use pool_address for pool data such as candles, and token.token_address for token data. Runs in Node 18 or later.

JavaScript
const API = "https://data.dydt.ai/v1";
const headers = { Authorization: `Bearer ${process.env.DYDT_API_KEY}` };

async function get(path) {
  const response = await fetch(API + path, { headers });
  const body = await response.json();
  if (body.code !== 0) throw new Error(`${body.error}: ${body.message}`);
  return body.data;
}

const [top] = await get("/tokens/rankings/popular?window=1h&limit=1");
console.log(top.token.symbol, top.token.token_address, top.pool_address);

const candles = await get(`/pools/${top.pool_address}/candles?interval=1m&limit=60&currency=usd`);
console.log(candles.at(-1));

Symbols are not unique on Solana. When you already know the token, look it up by mint address rather than by symbol. Every parameter is listed in the HTTP reference.

Stream live trades

One WebSocket carries every stream. Authenticate with the first frame, subscribe, ping every 15 seconds, and read events from message.data.

JavaScript
const socket = new WebSocket("wss://data.dydt.ai/ws");
const pool_address = "POOL_ADDRESS_FROM_STEP_3";

socket.onopen = () => {
  socket.send(JSON.stringify({ type: "auth", key: process.env.DYDT_API_KEY }));
  socket.send(JSON.stringify({ type: "subscribe", stream: "pool_trades", payload: { pool_address } }));
  setInterval(() => socket.send(JSON.stringify({ type: "ping" })), 15_000);
};

socket.onmessage = ({ data }) => {
  const message = JSON.parse(data);
  if (message.stream === "pool_trades") console.log(message.data);
};

Events missed while disconnected are not replayed. After a reconnect, subscribe again and reload the HTTP snapshot.

Next steps

  • Core concepts: errors, pagination, units, and reconnects.
  • Stream explorer: payloads and live events for every stream.
  • OpenAPI spec: generate a typed client.