JavaScript SDK

Integrate FingerprintIQ into any JavaScript application.

Installation

npm install @fingerprintiq/js

Basic Usage

javascript
import FingerprintIQ from '@fingerprintiq/js'; const fiq = new FingerprintIQ({ apiKey: 'fiq_live_your_key', endpoint: 'https://api.fingerprintiq.com', // default timeout: 10000, // 10 seconds (default) detectWallets: true, // detect Web3 wallets (default: true) }); // Identify the current device const result = await fiq.identify();

Instantiate FingerprintIQ once at module load time, not inside an event handler or on each page load. The instance is lightweight and reusable across multiple identify() calls.

Configuration Options

apiKey string required

Your API key from the dashboard. Use fiq_live_ for production and fiq_test_ for development. Test keys don't count toward your monthly quota.

endpoint string

API endpoint URL. Defaults to https://api.fingerprintiq.com. Override this if you're using a proxy or a self-hosted instance.

timeout number

Request timeout in milliseconds. Defaults to 10000 (10 seconds). Increase this on slow networks or decrease it if you need faster failure.

Enable Web3 wallet detection. Defaults to true. Set to false to skip wallet enumeration and save ~50 ms if you don't need Web3 signals.

Response Type

typescript
interface IdentifyResponse { visitorId: string; // Stable device identifier visitCount: number; // Total visits by this device firstSeenAt: number; // Unix timestamp (ms) of first visit confidence: number; // 0.0 - 1.0 signal confidence score botProbability: number; // 0.0 - 1.0 bot likelihood score signals: { client: Record<string, unknown>; // All 29 client signals server: { asn: { asn: number; org: string; category: string }; geo: { country: string; city: string; rttCoherence: number }; tls: { cipher: string; version: string; protocol: string }; consistency: string[]; }; }; riskFactors: string[]; // Active risk indicators timestamp: number; // Unix timestamp (ms) of this visit }

Error Handling

javascript
try { const result = await fiq.identify(); // handle result } catch (error) { if (error.message.includes('429')) { // Rate limited — retry after a delay, or show a fallback console.warn('FingerprintIQ rate limit hit'); } else if (error.message.includes('401')) { // Invalid or missing API key — check your configuration console.error('Invalid FingerprintIQ API key'); } else { // Network timeout or connectivity issue console.error('FingerprintIQ request failed:', error.message); } }

If identify() fails, your application should degrade gracefully — don't block the user experience. Log the error and continue without the fingerprint when possible.

Use Cases

javascript
const result = await fiq.identify(); if (result.visitCount > 1) { // This device has been seen before — check trial status const hasUsedTrial = await checkTrialStatus(result.visitorId); if (hasUsedTrial) { showPaywall(); } }

Always verify visitorId server-side before making trial decisions. A client-side check is easy to bypass.

Ask a question... ⌘I