SDK reference
LENS
dc.lens — events, feedback, customers, sources, decisions, rules and shared lists.
| Call | Route |
|---|---|
events.create(event) · events.batch(events) | POST /lens/events, /lens/events/batch |
events.list(query?) · events.get(id) | GET /lens/events |
feedback.create(body) · feedback.list() | /lens/feedback |
alerts.list(query?) | GET /lens/alerts |
subjects.list() · subjects.get(ref) · subjects.update(ref, body) · subjects.link(ref, identityId) | /lens/subjects |
score({ subjectId, amountUsd?, counterpartyReference? }) | POST /lens/score |
sources.list() · sources.create(body) · sources.update(id, body) | /lens/sources |
decide(input, { timeoutMs?, fallback?, allowBelowUsd? }) | POST /lens/decisions |
decisions.get(id) · decisions.list(query?) | GET /lens/decisions |
rules.list() · rules.create(body) · rules.update(id, body) · rules.delete(id) | /lens/rules |
settings.get() · settings.update(body) | /lens/settings |
network.agreement() · network.accept() · network.withdraw() | /lens/network/agreement |
network.report(body) · network.check(identifiers) | /lens/network/reports, /check |
usage(query?) | GET /lens/usage |
decide under failure
decide reads settings once and caches them for 60 seconds. When the API does not answer within
timeoutMs, it returns a local decision with fallback: true: allow below fail_allow_below_usd,
otherwise the project's fail_mode. Pass fallback or allowBelowUsd to override.
const decision = await dc.lens.decide(payout, { timeoutMs: 800 });
if (decision.effective_verdict !== 'allow') return holdPayout(payout, decision);
