SDKs

JavaScript and TypeScript

The official is-credible package for Node.js, edge runtimes and serverless functions.

npm install is-credible

Works in Node.js 18+, serverless and edge runtimes. No dependencies.

Usage#

import { IsCredibleClient, decide, findingCodes } from "is-credible";

const iscredible = new IsCredibleClient({
  apiKey: process.env.ISCREDIBLE_API_KEY!,
  timeoutMs: 3000, // default 10000
  maxRetries: 1    // retries 429 and 5xx, default 2
});

const result = await iscredible.verify({ email, ip, deviceId, accountCreation: true });

const { action, reasons } = decide(result); // "APPROVE" | "REVIEW" | "DENY", plus reasons
findingCodes(result);                        // e.g. ["DISPOSABLE_EMAIL_DETECTED"]

Options#

verify(userData, options) accepts:

OptionDescription
scenarioIdRun one scenario
scenarioIdsRun these scenarios
systemScenariosAlways use the built-in scenarios
signalAn AbortSignal to cancel the request

Errors#

Failures throw IsCredibleError with status (HTTP status, or 0 for network errors and timeouts) and retryable.

import { IsCredibleError } from "is-credible";

try {
  await iscredible.verify({ email });
} catch (err) {
  if (err instanceof IsCredibleError && err.status === 401) {
    // fix the API key
  }
  // otherwise fail open
}

Other languages#

The API is plain JSON over HTTPS, so any HTTP client works. See the cURL and Python examples in the Verify API reference.