---
title: "Dex paid on charts · DexData API Docs"
description: "Draw a DexData Paid line on a token's price chart, with code for TradingView and Lightweight Charts."
image: "https://dexdata.org/og/data-api.png?v=5"
url: "https://docs.dexdata.org/api/charts"
agent:
  instructions: "Use this site's search API instead of crawling individual pages: send a token's name, symbol or contract address (on Solana, Elysium, Robinhood Chain, Ethereum, BNB Chain, Base, Arbitrum, Monad, Ink or HyperEVM), or a question about dexdata. Results are returned in Markdown. Every page is also available as Markdown: request it with Accept: text/markdown, or add .md to its path (/token/{mint}.md on Solana, /token/{chain}/{address}.md on another chain, the home page /index.md)."
  endpoint: "https://dexdata.org/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Dex paid on charts

> Draw a DexData Paid line on a token's price chart, with code for TradingView and Lightweight Charts.

Web page: https://docs.dexdata.org/api/charts

## Where the line goes

`paidAt` is the Unix ms time the token became dex paid: the payment time of its oldest approved order. It's null while the token isn't dex paid. It's where a chart draws its dex-paid line, and it only moves if that order is taken down in review, when it becomes the next approved order's time, or null.

- Draw it at `paidAt`, the time the token became dex paid, and only while `paid` is true. Both come from `/v1/tokens/{mint}/paid`, `/v1/paid?mints=` or any profile.
- Label it `DexData Paid`. On a time-axis mark or another marker too small for that, use the DexData logo (`/brand/dex-circle.svg` or `/brand/dex-square.svg`) or `DD`, with `DexData Paid` in its tooltip.
- Use the badge blue, `#1c4ae8`, or your chart's own accent colour, so long as the label stays legible.
- Check again when you reload the chart, or follow the change feed: a takedown in review means the line has to go.

## 1. Look it up on your server

The chart runs in the browser, so it gets the status from your server, which calls dexdata with your key. Cache it for a minute or so.

```js
// Your server: look up dex-paid status with your key (never send the key to a browser).
app.get("/api/dex-paid/:mint", async (req, res) => {
  const r = await fetch(`https://api.dexdata.org/v1/tokens/${req.params.mint}/paid`, {
    headers: { "x-api-key": process.env.DEXDATA_API_KEY },
  });
  if (!r.ok) return res.status(r.status === 400 ? 400 : 502).end();
  const { paid, paidAt, url } = await r.json();
  res.set("cache-control", "public, max-age=60").json({ paid, paidAt, url });
});
```

## 2. Draw it

```js
// TradingView Advanced Charts: a dashed vertical line where the token became dex paid.
const { paid, paidAt } = await fetch(`/api/dex-paid/${mint}`).then((r) => r.json());

widget.onChartReady(() => {
  if (!paid) return;
  widget.activeChart().createShape(
    { time: Math.floor(paidAt / 1000) }, // Unix seconds
    {
      shape: "vertical_line",
      text: "DexData Paid",
      lock: true,
      disableSelection: true,
      disableSave: true,
      overrides: { linecolor: "#1c4ae8", linewidth: 1, linestyle: 2, showLabel: true, textcolor: "#1c4ae8" },
    },
  );
});
```

```js
// Or a mark on the time axis, from your datafeed. onReady must report supports_timescale_marks: true.
getTimescaleMarks(symbolInfo, from, to, onResult) {
  const t = paid ? Math.floor(paidAt / 1000) : null;
  onResult(t !== null && t >= from && t <= to
    ? [{ id: "dexdata-paid", time: t, color: "#1c4ae8", label: "DD", tooltip: ["DexData Paid"], imageUrl: "https://dexdata.org/brand/dex-circle.svg" }]
    : []);
},
```

```js
// Lightweight Charts (v5): a marker on the candle the payment fell in.
import { createSeriesMarkers } from "lightweight-charts";

const { paid, paidAt } = await fetch(`/api/dex-paid/${mint}`).then((r) => r.json());
if (paid) {
  const at = Math.floor(paidAt / 1000); // Unix seconds, like the candles' time
  const candle = candles.findLast((c) => c.time <= at) ?? candles[0];
  createSeriesMarkers(series, [
    { time: candle.time, position: "aboveBar", shape: "arrowDown", color: "#1c4ae8", text: "DexData Paid" },
  ]);
}
```

---

dexdata developer docs: https://docs.dexdata.org/api.md · All docs: https://docs.dexdata.org/index.md · Full API reference: https://dexdata.org/llms.txt
