The `abuseipdb-client` is an unofficial Node.js client library designed to interact with the AbuseIPDB API v2. It provides a robust, promise-based interface for checking IP addresses, reporting malicious activity, and managing API interactions. Currently stable at version 2.0.90, the library maintains a frequent release cadence, often issuing multiple patch updates monthly to keep dependencies current. Key differentiators include its TypeScript-first design, comprehensive runtime type checking powered by Zod, and full support for both ECMAScript Modules (ESM) and CommonJS (CJS) environments, though ESM is preferred. It standardizes API responses into a structured object containing headers, results, and explicit error handling properties, abstracting away raw HTTP responses.
npm install abuseipdb-clientVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates initializing the `AbuseIPDBClient` with an API key from environment variables and performing an IP check, including structured error handling.
Ensure your Node.js environment is upgraded to version 24 or higher. Alternatively, use an older version of the library that supports your Node.js version, if available.
Store your AbuseIPDB API key in an environment variable (e.g., `ABUSEIPDB_API_KEY` in a `.env` file) and access it using `process.env.ABUSEIPDB_API_KEY`.
Always check the `error` property of the response object after any API call. If `error` is defined, it contains details about the API-specific issue, and `result` will be undefined. Handle these errors explicitly.
Implement a robust rate-limiting strategy in your application. Monitor the `x-ratelimit-remaining` header and respect the `retry-after` header if present to avoid being temporarily blocked.
For CommonJS, use `const { AbuseIPDBClient } = require('abuseipdb-client');`. For ESM, ensure `import { AbuseIPDBClient } from 'abuseipdb-client';` is used (named import).Ensure you pass a valid AbuseIPDB API key string when initializing `new AbuseIPDBClient(yourApiKey)` and that the key is active and has necessary permissions.
Always validate IP address inputs in your application code before passing them to `abuseipdb-client` methods to ensure they conform to IPv4 or IPv6 standards.
No dependency data recorded yet.