Quickstart
1. Get an API key
Section titled “1. Get an API key”Create a key in the dashboard. Keys look like
dt_live_… (production) or dt_test_… (test) and are sent as a bearer token.
2. Make a decision
Section titled “2. Make a decision”curl -X POST https://api.detent.fr/v1/limit \ -H "Authorization: Bearer dt_live_…" \ -H "Content-Type: application/json" \ -d '{"namespace":"checkout","key":"user_42","algorithm":"sliding_window","limit":100,"window_ms":60000}'import { Detent } from "@detent/sdk";
const detent = new Detent({ apiKey: process.env.DETENT_KEY });const { allowed, remaining } = await detent.limit({ namespace: "checkout", key: "user_42", algorithm: "sliding_window", limit: 100, windowMs: 60_000,});from detent import Detent
detent = Detent(api_key=os.environ["DETENT_KEY"])verdict = detent.limit( namespace="checkout", key="user_42", algorithm="sliding_window", limit=100, window_ms=60_000,)The response is always HTTP 200:
{ "allowed": true, "remaining": 87, "reset_ms": 41230, "limit": 100 }3. Enforce the verdict
Section titled “3. Enforce the verdict”allowed is data — you decide what to do. Typically: return 429 when it’s false.
if (!allowed) return res.status(429).end();Next: how the algorithms behave and the full API reference.