Developer

SignupCops SDK

Call identifyUser when a signup completes. Optionally verify the email server-side to block disposable and high-risk signups before you accept them. For what SignupCops is and why, see the product page.

Track the signup

Call identifyUser the moment a signup completes, with the user's email. This works for every signup path: email and password forms, and Sign in with Google or any OAuth. Pick your stack:

// Identify the user as soon as their email is known.
// Works on any page: login, signup, checkout, profile, and more.

window.dcutils.identifyUser("[email protected]");

// Optionally pass a user ID from your own system
window.dcutils.identifyUser("[email protected]", "usr_123abc");

This needs the DataCops script on your site. If it is not there yet, add this one line in your <head>, using your public key from Settings, API Keys.

HTML
<script id="datacops_script"
  src="https://cdn.joindatacops.com/script?cop_key=YOUR_COP_KEY" async></script>

Verify

Trigger a login or signup on your site. The user's email appears in your dashboard within seconds. identifyUser is safe to call more than once. The same email is only stored once.

Get user data (server SDK)

Use @datacops/services-sdk to query risk scores, disposable email detection, and linked accounts from your backend, so you can block bad signups before you accept them.

1. Install the SDK

Shell
# npm
npm install @datacops/services-sdk

# yarn
yarn add @datacops/services-sdk

# pnpm
pnpm add @datacops/services-sdk

2. Get your private API key

Create a key of type Private or Secret in Settings, API Keys, then store it as DATACOPS_PRIVATE_KEY in your environment.

Never expose your private key in client-side code.

3. Initialise the SDK

TypeScript
import { DCServiceSdk } from "@datacops/services-sdk";

// Initialise once and reuse across your app.
// Your private key is available in Settings, API Keys.
const sdk = new DCServiceSdk({
  apiKey: process.env.DATACOPS_PRIVATE_KEY, // keep this server-side only
});

4. Check an email

TypeScript
const result = await sdk.checkEmail("[email protected]");

// result.emailInfo  live risk analysis
console.log(result.emailInfo?.risk_label);    // "low" | "medium" | "high" | "critical"
console.log(result.emailInfo?.risk_score);    // 0 to 100
console.log(result.emailInfo?.disposable);    // true if throw-away email
console.log(result.emailInfo?.free_provider); // true if Gmail, Yahoo, etc.

// result.userInfo  identity record (null if not yet identified)
console.log(result.userInfo?.related_emails);      // other emails on same device
console.log(result.userInfo?.related_email_count); // total emails for that device
console.log(result.userInfo?.deviceFingerprint);   // device fingerprint object

5. Block risky signups

TypeScript
async function handleSignup(email) {
  const result = await sdk.checkEmail(email);

  if (result.emailInfo?.disposable) {
    throw new Error("Disposable email addresses are not allowed.");
  }

  if ((result.emailInfo?.risk_score ?? 0) >= 75) {
    await flagForReview(email, result.emailInfo);
  }

  // Proceed with signup...
}

6. Full Express example

TypeScript
import express from "express";
import { DCServiceSdk } from "@datacops/services-sdk";

const sdk = new DCServiceSdk({ apiKey: process.env.DATACOPS_PRIVATE_KEY });
const app = express();

app.post("/api/signup", async (req, res) => {
  const { email } = req.body;
  const { emailInfo } = await sdk.checkEmail(email);

  if (emailInfo?.disposable) {
    return res.status(400).json({ error: "Disposable emails are not accepted." });
  }

  // ... create user account ...
  res.json({ success: true });
});

Response reference

FieldTypeDescription
emailInfo.risk_labelstring"low" | "medium" | "high" | "critical"
emailInfo.risk_scorenumber0 to 100 risk score
emailInfo.disposablebooleanTrue if this is a throwaway address
emailInfo.free_providerbooleanTrue if Gmail, Yahoo, etc.
emailInfo.domainstringThe email domain
userInfo.related_emailsstring[]Other emails on the same device
userInfo.related_email_countnumberTotal unique emails for that device
userInfo.deviceFingerprintobject | nullDevice fingerprint data
  • Requires Node.js 18 or later (uses native fetch).
  • All requests are server-to-server. Your private key is never exposed to the browser.
  • checkEmail throws typed errors: DCServiceError, DCServiceTimeoutError.
  • userInfo is null if identifyUser was never called for this email.
Was this page helpful?