Skip to content

Stats endpoints

Aggregate swap volume reporting. The Venum swap dApp records every landed swap to a Postgres-backed swap_landed table; the public /v1/stats/volume endpoint serves the rolling totals (USD volume, swap count) for any time window directly from that table.

These endpoints power the Venum DefiLlama dimension-adapter listing and any third-party analytics that wants to show our aggregator volume.


POST /v1/stats/swap-landed

Record a successful on-chain swap. Called by frontends after polling /v1/tx/:signature and observing a confirmed or finalized status.

The server resolves the input/output mints, computes a USD value snapshot from the current pool prices (same source as /v1/prices), dedupes by signature, and inserts a row into the swap_landed Postgres table (ON CONFLICT (signature) DO NOTHING).

Request

http
POST /v1/stats/swap-landed
Content-Type: application/json
X-API-Key: YOUR_API_KEY

Body

FieldTypeRequiredDescription
inputMintstringYesBase58 mint or token symbol
outputMintstringYesBase58 mint or token symbol
inputAmountstringYesRaw amount sent in (smallest units)
outputAmountstringYesRaw amount received (smallest units)
signaturestringYesBase58 transaction signature (80–90 char)
dexstringNoDEX identifier (e.g. orca-whirlpool)
poolAddressstringNoBase58 pool address

Example

bash
curl -X POST https://api.venum.dev/v1/stats/swap-landed \
  -H 'content-type: application/json' \
  -H 'x-api-key: YOUR_API_KEY' \
  -d '{
    "inputMint": "SOL",
    "outputMint": "USDC",
    "inputAmount": "1000000000",
    "outputAmount": "168200000",
    "signature": "5j7Sc...Wxyz",
    "dex": "orca-whirlpool",
    "poolAddress": "HJPjoWUrhoZzkNfRpHuieeFk9AnbVjTk9Gc5SJRqsQTK"
  }'

Response

json
{ "status": "recorded", "signature": "5j7Sc...Wxyz" }

If the signature has already been recorded:

json
{ "status": "already-recorded", "signature": "5j7Sc...Wxyz" }

status values:

  • recorded — the row was inserted
  • already-recorded — the signature already existed (idempotent)
  • accepted-no-db — the API is running without a Postgres connection (dev/standalone). The call is accepted so frontends don't error, but nothing is persisted.

Errors

StatusDescription
400Invalid request body or unknown symbol
401Missing or invalid API key
429Rate limit exceeded
500Failed to persist swap record (Postgres error)

Auth

Requires API key.


GET /v1/stats/volume

Return total USD swap volume and swap count for a time window.

Request

http
GET /v1/stats/volume?from=<unix>&to=<unix>

Query parameters

FieldTypeRequiredDefaultDescription
fromnumberNo0Window start, UNIX seconds (inclusive)
tonumberNonowWindow end, UNIX seconds (exclusive)

Example

bash
# Last 24h
NOW=$(date -u +%s)
DAY_AGO=$((NOW - 86400))
curl "https://api.venum.dev/v1/stats/volume?from=$DAY_AGO&to=$NOW"

Response

json
{
  "from": 1733500800,
  "to": 1733587200,
  "volumeUsd": 124530.42,
  "swapCount": 87
}

volumeUsd is the sum of the larger of input/output USD value for each swap in the window — defensive against any one side being temporarily unpriced. swapCount counts the number of recorded landed swaps in the window.

Errors

StatusDescription
400Invalid from / to (non-numeric or from > to)
429Rate limit exceeded
500Failed to query the swap_landed table

Auth

Optional auth. The endpoint is intended to be queryable by external indexers (e.g. DefiLlama) without an API key.

Rate Limit

Tier limits (per minute):

TierLimit
anonymous30
free60
starter300
pro1000
internal

Cached for 60 s server-side.