Docs / Quickstart

Quickstart

Put FraudLens on a signup form: browser collects a session, your server scores it. About 10 minutes if the form already exists.

1. Create API keys

  1. Open Get API key and sign up with a work email for Live Network trial, or Free for email/IP only.
  2. Copy publishable fk_pk_… (browser) and secret fk_sk_… (server).
  3. Store the secret in env — never ship it to the client or commit it to git.
Free vs Growth Free scores email + basic IP. Live DNS/WebRTC/path needs Growth (or trial). Without live plan, session create returns 402 plan_upgrade_required.

2. Allow your website origin

Browser collect checks Origin. Register your front-end origin once:

curl -s https://fraudlens.io/v1/account/origins \
  -X PUT \
  -H "X-Api-Key: fk_sk_YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "origins": ["https://yourshop.com", "http://localhost:3000"] }'

3. Embed the browser SDK

Prefer same-origin /c.js (proxy our script) so adblockers are less likely to kill collect. Fallback: load from fraudlens.io.

<!-- On your signup / login page -->
<script src="/c.js" async></script>
<script>
  window.addEventListener("load", function () {
    FX.auto({
      publishableKey: "fk_pk_YOUR_PUBLISHABLE",
      baseUrl: "",              // same origin → /v1/x proxied to FraudLens
      form: "#signup",          // form selector
      mode: "full",             // all live pillars
      progressive: true,        // idle before heavy WebRTC
      onReady: function (r) {
        // r.session_id is written to hidden input name=frod_session_id
        console.debug("FraudLens session", r.session_id);
      }
    });
  });
</script>

What happens under the hood: create session → fire DNS canary → wait idle → WebRTC / path → POST …/collect. On submit, if the session is still empty, the SDK finishes collect urgently.

Full options: Browser embed.

4. Score on your server

When the form posts, read frod_session_id and call assess with your secret key:

curl -s https://fraudlens.io/v1/assess \
  -H "X-Api-Key: fk_sk_YOUR_SECRET" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "session_id": "ses_…",
    "user_id": "usr_123",
    "watch_mode": "new_only",
    "context": { "flow": "signup" }
  }'

Node example:

const res = await fetch("https://fraudlens.io/v1/assess", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Api-Key": process.env.FROD_SECRET_KEY,
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    email: req.body.email,
    session_id: req.body.frod_session_id,
    user_id: String(user.id),
    watch_mode: "new_only",
    context: { flow: "signup" },
  }),
});
const data = await res.json();
// data.score, data.action, data.reasons, data.support

5. Act on the response

action
allow

Create account / continue

action
challenge

OTP, 3DS, manual review

action
block

Reject quietly or with message

Use action for enforcement. If Shadow mode is on, action is forced to allow while raw_action shows what you would have done — perfect for a tuning week.

6. Verify the integration

  1. DevTools → Network: session create, canary/pixel, collect all 2xx.
  2. Assess returns ok: true and a network block when live plan is on.
  3. Dashboard → recent assesses / stats look sane.
  4. Optional: set webhook and trigger a low-score test.
Credits reminder Session create + collect = 0. First deep assess (or serious Always-on change) = 1. Trusted First-sync revisit = 0. Details: API → Credits.