Registry / http-networking / abuseipdb-client

abuseipdb-client

JSON →
library2.0.90jsnpmunverified

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.

http-networkingauth-security
npm install abuseipdb-client
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AbuseIPDBClient
import { AbuseIPDBClient } from 'abuseipdb-client';
const AbuseIPDBClient = require('abuseipdb-client');
The primary class for interacting with the AbuseIPDB API. It is a named export. While CJS is supported, ESM is recommended for modern Node.js applications.
AbuseIPDBClient
const { AbuseIPDBClient } = require('abuseipdb-client');
import AbuseIPDBClient from 'abuseipdb-client';
Correct CommonJS import for the named export. Direct default import will fail as there is no default export.
AbuseIPDBResponse
import type { AbuseIPDBResponse } from 'abuseipdb-client';
Type import for the structured response object returned by client methods.

This quickstart demonstrates initializing the `AbuseIPDBClient` with an API key from environment variables and performing an IP check, including structured error handling.

import { AbuseIPDBClient } from 'abuseipdb-client'; import 'dotenv/config'; // Ensure environment variables are loaded if using .env const API_KEY = process.env.ABUSEIPDB_API_KEY ?? ''; if (!API_KEY) { console.error('ABUSEIPDB_API_KEY environment variable is not set.'); process.exit(1); } const client = new AbuseIPDBClient(API_KEY); async function checkIp() { try { const response = await client.check('127.0.0.1', { maxAgeInDays: 15 }); const { headers, result, error } = response; console.log('API Headers:', headers); if (error) { console.error('API Error:', error); } else if (result) { console.log('API Result:', result.data); } } catch (err) { console.error('Client execution error:', err); } } checkIp();
Debug
Known issues
breakingThe library explicitly requires Node.js version 24 or higher due to its `engines` field configuration. Using it with older Node.js versions will result in errors.
fix
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.
affects: >=2.0.0
gotchaAPI keys should never be hardcoded directly into your source code. They must be managed securely, typically via environment variables.
fix
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`.
affects: >=2.0.0
gotchaThe client wraps all API responses into a consistent object structure, distinguishing between `result` and `error` properties. It does not throw exceptions for API-level errors (e.g., invalid input, unauthorized access); instead, it populates the `error` object.
fix
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.
affects: >=2.0.0
gotchaAbuseIPDB enforces rate limits. The client exposes rate limit information in the `headers` object of the response (e.g., `x-ratelimit-limit`, `x-ratelimit-remaining`, `retry-after`). Exceeding limits will lead to errors.
fix
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.
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: AbuseIPDBClient is not a constructor
Attempting to instantiate the `AbuseIPDBClient` class incorrectly in a CommonJS environment or with an incorrect ESM import.
fix
For CommonJS, use `const { AbuseIPDBClient } = require('abuseipdb-client');`. For ESM, ensure `import { AbuseIPDBClient } from 'abuseipdb-client';` is used (named import).
Error: Response code 401 (Unauthorized) - Missing API Key or invalid API Key.
The AbuseIPDB API key was either not provided to the client constructor or is incorrect/expired.
fix
Ensure you pass a valid AbuseIPDB API key string when initializing `new AbuseIPDBClient(yourApiKey)` and that the key is active and has necessary permissions.
{ errors: [ { detail: 'ipAddress must be a valid IPv4 or IPv6 address', status: 422, source: { parameter: 'ipAddress' } } ] }
An invalid IP address string was provided to an API method (e.g., `client.check()`). The API's runtime validation (via Zod) caught the malformed input.
fix
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.
Upgrade
Version history
2.0.90latest on PyPI
Audit
Dependencies

No dependency data recorded yet.

Agent activity
70 hits · last 30 days
node
12
petalbot
3
ahrefsbot
3
Amazon
2
amazonbot
1
bytedance
1
claudebot
1
Resources