SDK
Browser SDK
Publishable key in the browser. collect, evaluate, then toCheckBody on your server with a secret key.
Package: @abusegraph/sdk. CDN: https://abusegraph.com/sdk/abusegraph.min.js.
Production edge URL is https://api.abusegraph.com — no config needed.
import { init } from "@abusegraph/sdk";
const sdk = init({
publicKey: process.env.NEXT_PUBLIC_ABUSEGRAPH_PUBLISHABLE_KEY!, // pk_test_…
});
export async function collectForAuth(
email: string,
event: "signup" | "login" | "password_reset" | "email_change" = "signup",
) {
const collected = await sdk.collect();
const edge = await sdk.evaluate(collected, { email });
return sdk.toCheckBody(collected, {
email,
event,
verdictToken: edge.verdictToken.token,
});
}POST that body from your server with sk_… via @abusegraph/server createCheckClient, or raw POST /api/v1/check.
Rules
- Only
pk_in the browser. - Call
collectwhile the form is open so behavior has time to accumulate. - Decide at signup/login — not on every pointer move.
- Fail open if the network blips; do not brick registration.
Mobile
Native and React Native: Mobile SDKs.
Try evaluate
Browser evaluate is documented under Browser Evaluate (POST /v1/risk/evaluate).