IPAbuse Developers
Beginner10 min

Using the Node.js SDK

The official @ipabuse/sdk package provides a type-safe client for Node.js and TypeScript. It handles authentication, retries, and error normalisation so you can focus on your application logic.

1

Install the package

Add the SDK to your project using npm, yarn, or pnpm.

cURL
npm install @ipabuse/sdk
2

Initialise the client

Create a single client instance and reuse it across your app.

client.ts
import { IPAbuseClient } from "@ipabuse/sdk";

const client = new IPAbuseClient({
  apiKey: process.env.IPABUSE_API_KEY!,
});
3

Look up an IP

All methods return fully-typed responses.

lookup.ts
const result = await client.reputation("1.2.3.4");

console.log(result.reputationScore);  // number
console.log(result.riskLevel);        // "LOW" | "MEDIUM" | "HIGH" | "CRITICAL"
console.log(result.categories);       // string[]
4

Submit a report

Reports require a user token. Authenticate first, then call report().

report.ts
await client.authenticate({
  email: "you@example.com",
  password: process.env.IPABUSE_PASSWORD!,
});

const report = await client.report({
  ipAddress: "1.2.3.4",
  category: "SPAM",
  description: "Sending spam from this IP",
  severity: 3,
});

console.log("Credits earned:", report.creditsEarned);