The AbuseZero API is in public beta. Breaking changes are announced two weeks in advance.
AbuseZero

Quickstart

Install the SDK and run your first risk check.

This guide takes you from zero to a working risk check in your trial sign-up flow.

Install the SDK

npm install @abusezero/node

Add your API key

Create a key in the dashboard and add it to your environment. Use a test key (az_test_...) while you build; it talks to the sandbox and never affects production data.

.env
ABUSEZERO_API_KEY="az_test_4f9c2d7e8b1a"

Check the sign-up

Call checks.create before you start the trial.

app/api/trial/route.ts
import { AbuseZero } from '@abusezero/node';

const abusezero = new AbuseZero(process.env.ABUSEZERO_API_KEY);

export async function POST(request: Request) {
  const { email, deviceId } = await request.json();

  const check = await abusezero.checks.create({
    event: 'trial_start',
    identity: {
      email,
      deviceId,
      ip: request.headers.get('x-forwarded-for') ?? undefined,
    },
    benefit: { type: 'free_trial', plan: 'pro' },
  });

  if (check.decision === 'deny') {
    return Response.json({ error: 'Trial not available' }, { status: 403 });
  }

  return Response.json({ trial: 'started' }); 
}

Record the benefit

Once the trial starts, tell AbuseZero. Future checks use this benefit history to spot repeat claims.

await abusezero.benefits.record({
  identity: { email, deviceId },
  type: 'free_trial',
  checkId: check.id,
});

You're done

Try starting a second trial with the same email in the sandbox. The second check comes back with a higher score and a repeat_claim signal.

Next steps

How is this guide?

Edit on GitHub

Last updated on

On this page