DuckVizBeta
Reference

API Endpoints

Every DuckViz app endpoint with method, auth, SSE, rate limit, and credit cost.

Flat reference for every endpoint on app.duckviz.com. Use this when:

  • Building a server proxy with @duckviz/sdk
  • Auditing which calls your PAT can reach
  • Budgeting credit cost for a workflow

All endpoints expect application/json POST bodies (≤ 1 MB), except GET where noted. SSE routes return text/event-stream. See Server Proxy Setup for wiring.

Auth legend

ColumnMeaning
BearerAuthorization: Bearer dvz_live_… accepted
CookieSession cookie accepted
Cookie-onlyPAT is rejected — see bearer-first precedence

Widget flow

EndpointMethodSSEAuthRateCredits (Std)
/api/widget-flow/fast-recommendPOSTBearer / Cookie~60/min3 (0 on cache hit)
/api/widget-flow/classifyPOSTBearer / Cookie~60/min1
/api/widget-flow/suggest-vizPOSTBearer / Cookie~60/min2
/api/widget-flow/generatePOSTBearer / Cookie~30/min5
/api/widget-flow/fix-queryPOSTBearer / Cookie~60/min1
/api/widget-flow/suggest-promptsPOSTBearer / Cookie~60/min1
/api/widget-flow/clarifyPOSTBearer / Cookie~30/min0
/api/widget-flow/precomputePOSTBearer / CookieOwn bucket0

Reports & decks

EndpointMethodSSEAuthCredits (Std)
/api/generate-report-sectionsPOSTBearer / Cookie5
/api/modify-report-sectionPOSTBearer / Cookie2
/api/generate-deck-slidesPOSTBearer / Cookie3
/api/modify-deck-slidesPOSTBearer / Cookie2

Logs

EndpointMethodSSEAuthCredits (Std)
/api/detect-log-formatPOSTBearer / Cookie1

SQL / prompts

EndpointMethodSSEAuthCredits (Std)
/api/query-from-promptPOSTBearer / Cookie1

Credits & usage (no cost)

EndpointMethodSSEAuthCredits
/api/credits/balanceGETBearer / Cookie0
/api/usageGETBearer / Cookie0

Stolen PATs must not mint tokens or move money. These routes reject bearer:

EndpointMethodPurpose
/api/tokensGET, POSTList / mint PATs
/api/tokens/:idDELETERevoke PAT
/api/referralsGETList referrals
/api/referrals/invitePOSTSend invite (10 / 24h)
/api/checkoutPOSTPaddle transaction / hosted-checkout session
/api/paddle/webhookPOSTPaddle webhook (server-to-server, HMAC-verified)
/api/custom-log-formatsGET, POSTList / create custom format
/api/custom-log-formats/:idPUT, DELETEUpdate / delete custom format
/api/feedbackPOSTIn-app feedback submission
/api/auth/resend-confirmationPOSTRe-send confirmation email

SSE event catalog

Clients parse the SSE stream as data: {"event":"<name>","data":...}\n\n. Errors emit a final error event; the stream then closes.

fast-recommend

EventMeaning
thinkingLLM is generating — only fires when the fast path misses cache
domainDetected data domain (e.g. "Sales & Revenue")
fast-resultViz type + SQL for a single widget — main payload
viz_suggestionViz type picked — only when falling back to the 3-step path
widgetEnriched widget payload (query + chart config) ready to render
doneStream closed
errorRecoverable failure — the client should fall back

generate-report-sections

EventMeaning
section-startOne report section has begun streaming
section-completeThat section's content is finalized
section-errorOne section failed; others continue
doneAll sections processed
errorStream-level failure

generate-deck-slides

EventMeaning
slide-startOne deck slide has begun streaming
slide-completeThat slide is finalized
slide-errorOne slide failed; others continue
doneAll slides processed
errorStream-level failure

classify, suggest-viz, generate

Minimal set: a single payload event named after the stage, plus done / error. Used in the slow-path fallback when fast-recommend can't satisfy the request.

Credits & tiers

Every base cost above is Standard tier. Premium multiplies by PREMIUM_CREDIT_MULTIPLIER = 5 — so fast-recommend becomes 15, report sections 25, etc. See Billing & Plans for the mechanics, and Credits for the full base-rate table with rationale.

Source of truth: apps/app/lib/auth/credits.ts — this reference updates whenever that file changes. If you find a mismatch, file an issue.

Headers and limits

Header / limitValue
Max request body1 MB
Rate-limit bucketPer-user KV sliding window
SSE keepaliveComment every ~15 s (: keep-alive\n\n)
Security headersX-Frame-Options: DENY · X-Content-Type-Options: nosniff · Referrer-Policy: strict-origin-when-cross-origin · HSTS · COOP: same-origin-allow-popups

See also