Node SDK
The official Node.js client for the Synthient API: IP and domain lookups, account details, real-time feed streams, and Parquet exports.
The package is on npm. There is no hosted API reference, but every class and method carries TSDoc that your editor shows. These pages cover the same surface with examples. The source and runnable programs are at github.com/synthient/synthient-node, with the programs in examples/.
Getting started
1. Install
npm install @synthient/synthient
Requires Node.js 22.12 or later. The package is ESM only, and CommonJS code can require() it. It ships its own TypeScript declarations, tested with TypeScript 5.8 and later. The gRPC schema fetcher is a separate entry point, @synthient/synthient/grpcschema, that needs optional peer dependencies.
2. Make your first lookup
This program creates a client and looks up one address. Each lookup costs one credit. The examples on these pages use top-level await, which works in ES modules.
import { Synthient } from "@synthient/synthient";
const client = new Synthient();
const info = await client.lookupIP("8.8.8.8");
console.log(info.network?.isp, info.network?.type);
console.log(info.intelligence?.risk_score, info.intelligence?.categories);
new Synthient() reads the API key from the SYNTHIENT_API_KEY environment variable. IPInfo.network, IPInfo.location, and IPInfo.intelligence are absent when the API has no data for that section, so check them before reading their fields.
3. Check your credits
account returns the account that owns the API key, including its scopes and remaining lookup credits. It costs no credits.
const account = await client.account();
const { credits, resets_in } = account.lookup_quota;
console.log(account.email, account.organization.name, account.scopes);
console.log(credits, "credits, resetting in", resets_in, "seconds");
4. Handle errors
Failed requests reject with a SynthientError or one of its subclasses. Check them with instanceof:
import { APIError } from "@synthient/synthient";
try {
await client.lookupIP("8.8.8.8");
} catch (error) {
if (!(error instanceof APIError)) {
throw error;
}
switch (error.status) {
case 402:
console.log("out of lookup credits");
break;
case 429:
if (error.retryAfter === undefined) {
console.log("monthly request budget spent");
} else {
console.log(`rate limited, retry after ${error.retryAfter} ms`);
}
break;
default:
console.log("request", error.requestID, "failed:", error.detail || error.title);
}
}
5. Keep going
- Client: create and configure the client, and read the metadata of every API response.
- Lookups: look up IP addresses and domains, and check your account and the API's health.
- Feeds: stream each feed's real-time events and download its hourly and daily Parquet exports.
- Errors and retries: how failed requests are reported, and which requests are retried.
- Types: the fields of every response and event type, and the enumerations they use.
- gRPC schema: fetch the protobuf schema of the Synthient gRPC API.