Keys and scopes

minted on the organization page

Send the key as a bearer token. Each key carries the scopes it was minted with and, optionally, the addresses it may be used from. A request outside either is a 403 whose error names the rule: missing_scope or ip_not_allowed.

curl -H "Authorization: Bearer dfk_your_key" \
  "https://dfrds.com/api/v1/me"
ScopeUnlocks
read Read data: prices, datasets, research pages, status
research:write Write findings: append research blocks, create citations
exports Queue and download data exports

Endpoints

61 endpoints, from openapi.yaml
MethodPath and parametersScopeWhat it returns
GET
/api/v1/me
read The organization, plan, entitlements and limits behind this key
GET
/api/v1/status
read Warehouse reachability and ingest lag
GET
/api/v1/public/status
public The status page as JSON (public, no key)
GET
/api/v1/public/resolve
q as
public What a typed string names on chain (public, no key)
GET
/api/v1/public/review/{token}
{token}
public One unpublished page for the outside reviewer holding its link
GET
/api/v1/public/auth
public How the SPA signs in (public, no key)
POST
/api/v1/auth/exchange
X-DFRDS-Client
public Redeem an Accounts sign-in (the SPA's BFF)
POST
/api/v1/auth/refresh
X-DFRDS-Client
public Rotate the Accounts refresh token (the SPA's BFF)
POST
/api/v1/auth/logout
X-DFRDS-Client
public Sign out of Accounts here (the SPA's BFF)
GET
/api/v1/public/site
public The public site's facts (public, no key)
GET
/api/v1/public/home
public The landing page (public, no key)
GET
/api/v1/public/plans
public The pricing page's plans (public, no key)
GET
/api/v1/public/about
public What the about page lists as covered today (public, no key)
GET
/api/v1/public/api_reference
public The API reference page (public, no key)
GET
/api/v1/public/docs
q audience
public The documentation index (public, no key)
GET
/api/v1/public/docs/{slug}
{slug}
public One guide (public, no key)
GET
/api/v1/public/legal
public The legal documents (public, no key)
GET
/api/v1/public/legal/{slug}
{slug}
public One legal document (public, no key)
GET
/api/v1/public/blog
category
public The blog's published articles (public, no key)
GET
/api/v1/public/blog/{slug}
{slug}
public One published article (public, no key)
GET
/api/v1/public/published_pages/{slug}
{slug}
public A published research page (public, no key)
GET
/api/v1/public/citations/{hash}
{hash}
public One citation record as its page prints it (public, no key)
GET
/api/v1/public/explorer
chain
public The explorer's idle console (public, no key)
GET
/api/v1/public/explorer/address/{address}
{address} chain block_from block_to date_from date_to topic0 before after lens
public An address's activity, or the logs touching it (public, no key)
GET
/api/v1/public/explorer/events/{topic}
{topic} chain block_from block_to date_from date_to before after
public Logs carrying an event signature (public, no key)
GET
/api/v1/public/blocks/{number}
{number} chain expect_hash cursor limit
public One block and its transactions (public, no key)
GET
/api/v1/public/transactions/{hash}
{hash} chain
public One transaction, its receipt and decoded logs (public, no key)
GET
/api/v1/public/prices
base quote source chain
public The price finder (public, no key)
GET
/api/v1/public/prices/{address}
{address} period range from to invert compare chain
public One pool's price chart (public, no key)
GET
/api/v1/public/tracking
public The tracked protocols, live and planned (public, no key)
GET
/api/v1/public/tracking/{slug}
{slug} chain range from to
public One protocol's tracking page (public, no key)
GET
/api/v1/public/tracking/{slug}/liquidations
{slug} chain symbol from to range cursor limit
public A pool lender's liquidation dataset (public, no key)
GET
/api/v1/public/tracking/{slug}/accounts/{address}
{slug} {address} chain
public One account's position on a pool lender (public, no key)
GET
/api/v1/public/timeline
category chain from to verified limit cursor
public The event timeline as JSON (public, no key)
GET
/api/v1/public/timeline/{id}
{id}
public One timeline event with its provenance (public, no key)
GET
/api/v1/tokens
q limit cursor
read Token symbols that trade in a tracked market
GET
/api/v1/pairs
base quote q source limit
read Pools trading a pair, ranked by activity
GET
/api/v1/pools/{address}/prices
{address} period from to
read OHLC and volume bars for one pool
GET
/api/v1/liquidations
protocol collateral from to block_from block_to limit cursor
read Aave-style liquidations, newest first
GET
/api/v1/health_factors
protocol block account min_hf max_hf limit cursor
read Aave-style health factors at a snapshot block
GET
/api/v1/absorptions
market from to limit cursor
read Compound v3 absorptions, newest first
GET
/api/v1/charts/{source}
{source} protocol deployment block pool period from to category events
read The series behind a research chart, by source
GET
/api/v1/events
category chain from to limit cursor
read The sourced event registry (the timeline)
GET
/api/v1/datasets
read The data catalogue
POST
/api/v1/datasets/{key}/requests
{key}
exports Create and submit an export
GET
/api/v1/datasets/requests/{id}
{id}
exports Poll an export
GET
/api/v1/datasets/requests/{id}/download
{id} format
exports Fetch a completed export
POST
/api/v1/citations
research:write Cite a price series, a dataset query or a computed figure
GET
/api/v1/citations/{hash}
{hash}
public Resolve a citation hash (public, no key)
GET
/api/v1/research/pages
limit cursor
read Research pages this key can reach, newest first
POST
/api/v1/research/pages
research:write Create a research page in a project
GET
/api/v1/research/pages/{id}
{id}
read One research page, its blocks and its cited values
PATCH
/api/v1/research/pages/{id}
{id}
research:write Rename a page, move its status, or retag it
DELETE
/api/v1/research/pages/{id}
{id}
research:write Move a page to the trash
GET
/api/v1/research/pages/{id}/document
{id}
read The page body as one document
PUT
/api/v1/research/pages/{id}/document
{id}
research:write Put a whole document back
GET
/api/v1/research/pages/{id}/comments
{id} limit cursor
read The review comments on a page, oldest first
POST
/api/v1/research/pages/{id}/comments
{id}
research:write Open a thread on a block, or reply in one
POST
/api/v1/research/pages/{id}/export
{id} format
exports Download the page's bundle
GET
/api/v1/research/projects
limit cursor
read Research projects this key can reach, newest first
POST
/api/v1/research/pages/{id}/blocks
{id}
research:write Append a block to a research page

The web app's own endpoints (258 of them, under /api/v1/session) take the signed-in browser session, not a key, and are not part of the public API; openapi.yaml documents them for the app.

Errors are JSON, {"error": "rate_limited", "detail": "…"}, with conventional status codes: 401, 403, 404, 409, 422, 429, 503. A null figure means the value could not be derived. It never means zero.

Pages and cursors

Every list pages by cursor. A page carries next_cursor (null on the last page) and a Link: <…>; rel="next" header with the same request and the next cursor filled in. Pass it back as cursor. The cursor is opaque and stays valid while rows are appended above it, which an offset would not. Page size is limit, default 50, never more than 500 rows: a larger slice is an export.

GET /api/v1/liquidations?protocol=aave_v3&collateral=WETH&limit=200

{
  "protocol": "aave_v3",
  "matching": 1834,
  "count": 200,
  "next_cursor": "WzIxMzQ1Njc4LDEyXQ",
  "limit": 200,
  "max_rows": 500,
  "liquidations": [ … ]
}

Rate limits

The REST limit is per key, per clock hour, from your plan (api_requests_per_hour). Every response carries X-RateLimit-Limit and X-RateLimit-Remaining; the 429 says when the window resets. The counter is a row per key per window, so it survives a deploy, a restart and a cache flush. MCP has its own daily budget (mcp_calls_per_day) so an agent session cannot spend a script's hour.

Versioning and deprecation

The version is in the path (/api/v1). Fields are added without a version change; a field is never removed or renamed inside a version. When an endpoint is retired it answers for at least six months with two headers first: Deprecation (when it was deprecated) and Sunset (the date it stops), plus a Link: rel="successor-version" to what replaces it. Nothing is deprecated today. Watch for those headers in your client and you will never be surprised.

Examples

Pools for a pair, then two years of daily bars for the busiest.

API=https://dfrds.com/api/v1
H='Authorization: Bearer dfk_your_key'

curl -s -H "$H" "$API/pairs?base=WETH&quote=USDC" \
  | jq -r '.pools[0].address'
# 0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640

curl -s -H "$H" \
  "$API/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/prices?period=daily&from=2024-09-01"

Walk every Spark liquidation since a date with the cursor.

url="$API/liquidations?protocol=spark&from=2026-01-01&limit=500"
while [ -n "$url" ]; do
  page=$(curl -s -H "$H" "$url")
  echo "$page" | jq -c '.liquidations[]' >> spark.jsonl
  url=$(curl -sI -H "$H" "$url" \
    | sed -n 's/^[Ll]ink: <\(.*\)>; rel="next".*/\1/p')
done

Queue an export (needs the exports scope), poll it, fetch the file.

curl -s -H "$H" -H 'Content-Type: application/json' \
  -d '{"filters": {"protocols": ["aave_v3"], "date_from": "2026-01-01"}}' \
  "$API/datasets/aave_liquidations/requests"
# {"id": 418, "status": "queued", …}

curl -s -H "$H" "$API/datasets/requests/418" | jq .status
curl -L -H "$H" "$API/datasets/requests/418/download" -o liquidations.csv.gz

Cite a computed figure (needs research:write) and paste it into a page.

curl -s -H "$H" -H 'Content-Type: application/json' \
  -d '{"dataset": "aave_liquidations", "aggregate": "count",
       "date_from": "2026-01-01", "label": "liquidations this year"}' \
  "$API/citations"
# {"token": "{{derived:91}}", "value": "1834", "hash": "3f9c…", …}

curl -s -H "$H" -H 'Content-Type: application/json' \
  -d '{"kind": "callout", "body": "There were {{derived:91}} this year."}' \
  "$API/research/pages/12/blocks"

What a key reaches

An API key belongs to an organization; research belongs to a space. A key reaches the spaces its organization’s members belong to, and no wider. It grants no access the organization doesn’t already have. Exports and derived citations are made as the member who minted the key: the monthly export quota is theirs and the citation lands in their research space.

Each cited value on a page carries verification_state: verified, mismatch or unresolved. A consumer can tell a figure that still holds from one that has drifted since it was written. Treat mismatch as a finding, not a formatting detail.

Webhooks

Register an https endpoint on your organization page to be pushed events instead of polling. Every delivery is signed: X-DFRDS-Event names the event and X-DFRDS-Signature is the HMAC-SHA256 of the raw body, hex encoded, keyed with your endpoint secret. Sign the raw bytes you received, before any JSON parsing, and compare in constant time.

import hmac, hashlib

def verify(raw_body: bytes, signature: str, secret: str) -> bool:
    expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature)
  • Events: price_alert.triggered, liquidation_alert.triggered, chain_event_alert.triggered, data_export.ready, liquidation.recorded, chain_event.created.
  • Endpoints must reach a public address: a URL whose host is, or resolves to, a private, loopback or link-local address is refused, when it is saved and before every delivery. Redirects are not followed.
  • A null figure means we could not derive that value. It does not mean zero.
  • Reply 2xx within 10 seconds and do the work asynchronously. Deliveries retry with backoff; ten consecutive failures disable the endpoint until you re-enable it.
  • A retry can deliver twice. Treat the event as idempotent on its identifiers.

The same data from an AI assistant

Every tool runs the same service as its REST twin, under the same key, scopes, allow list and plan. There is no SQL passthrough: each tool is a bounded query.

{
  "mcpServers": {
    "dfrds": {
      "type": "http",
      "url": "https://dfrds.com/mcp",
      "headers": { "Authorization": "Bearer dfk_your_key" }
    }
  }
}
ToolREST twinScope
search_markets GET /api/v1/pairs read
get_price_bars GET /api/v1/pools/{address}/prices read
get_canonical_series POST /api/v1/citations research:write
get_entitlements GET /api/v1/me read
platform_status GET /api/v1/status read
get_health_factors GET /api/v1/health_factors read
get_liquidations GET /api/v1/liquidations read
get_events GET /api/v1/events read
list_research_pages GET /api/v1/research/pages read
get_research_page GET /api/v1/research/pages/{id} read
append_research_block POST /api/v1/research/pages/{id}/blocks research:write
cite_query POST /api/v1/citations research:write

Ground rules

  • Prices are estimated from on-chain events (V2 reserves, V3 swap prices); the methodology notes on each market page apply.
  • Series are token0-per-token1 and the response names the orientation. Invert client-side if you need the other direction.
  • Hashes and addresses are complete, always. Nothing is truncated for you to guess at.
  • Reads are research-sized and capped at 500 rows. Anything larger is an export through /datasets, or Data Downloads.