Documentation

CyberFence screens every sign-up with one API call from your backend. Clear abuse is refused; suspicious sign-ups are held back by the trust rules and Agent, and can appeal. API base URL: https://api.cyberfence.dev.

Quickstart

  • Create a workspace, then an API key under API keys (test keys work immediately; live keys need a verified email).
  • Store it on your server as CYBERFENCE_KEY. Never ship it to the browser.
  • Call protect() before creating the user. On review, create the account but give no trial until it is approved.
terminal
npm i @cyberfence/node
signup handler
import { CyberFence, requestContext } from '@cyberfence/node';

const fence = new CyberFence({ apiKey: process.env.CYBERFENCE_KEY! });

app.post('/signup', async (req, res) => {
  const verdict = await fence.protect({
    email: req.body.email,
    name: req.body.name,
    timeZone: req.body.timeZone,             // from the browser, optional
    timeToSubmitMs: req.body.timeToSubmitMs, // optional
    ...requestContext(req.headers, req.socket.remoteAddress), // ip, userAgent, country, language
  });

  if (verdict.decision === 'deny') return res.status(403).json({ error: verdict.message });

  const user = await db.users.create({
    email: verdict.normalizedEmail,
    status: verdict.decision === 'review' ? 'held_back' : 'active',
    evaluationId: verdict.id,
  });
  if (verdict.id) await fence.report(verdict.id, { outcome: 'created', externalUserId: user.id });

  // Put verdict.emailOpenPixelUrl in your verification email (rule 10).
  await sendVerificationEmail(user, { pixelUrl: verdict.emailOpenPixelUrl });

  res.json({ ok: true, heldBack: verdict.decision === 'review', message: verdict.message });
});

Integrate with an AI coding agent

AI coding agents — Claude Code, Cursor, Copilot and others — can do the whole integration for you: install the SDK, wire protect() into your sign-up handler, hold back on review, add the rule 10 pixel and verify-click call, the appeal form and the webhook receiver. Paste this prompt into your agent:

prompt
Integrate CyberFence sign-up protection into this app. Follow the instructions at https://cyberfence.dev/llms-full.txt exactly (also shipped as node_modules/@cyberfence/node/AGENTS.md after install).
  • /llms-full.txt is the full agent playbook and SDK reference; /llms.txt is the short index (llmstxt.org format).
  • The same playbook ships inside the npm package as node_modules/@cyberfence/node/AGENTS.md, so agents find it offline after install.
  • Using Claude Code? The repo includes a skill, cyberfence-integrate (skills/cyberfence-integrate/SKILL.md), that runs the integration step by step.

Node SDK

@cyberfence/node has zero dependencies and works on Node 18+, Bun, Deno and edge runtimes with fetch.

MethodPurpose
new CyberFence({ apiKey, baseUrl?, timeoutMs?, failOpen? })Client. baseUrl defaults to CYBERFENCE_URL or the hosted API.
protect(input)Evaluate a sign-up. With failOpen (default true) network errors, 5xx and 429 return allow with failedOpen: true; bad keys and bad input still throw CyberFenceError.
report(id, { outcome, externalUserId?, note? })created links your user id; customer marks a paying customer (the domain becomes known-good, exempt from rules 1 and 11); fraud rejects it.
verifyClick(id, { pageReferrer, origin, referer, appHost })Rule 10 from your verify-email handler. verifyClickContext(headers, pageReferrer) builds the input. Fails open.
appeal(id, { website, useCase })A held-back user asks for a review. Returns { status: "approved" | "pending_review", evaluation }.
review(id, { action, note? })Approve / reject a held-back sign-up from your own tooling.
getEvaluation(id)Fetch an evaluation.
verifyWebhook(rawBody, header, secret)Verify and parse a webhook. Throws WebhookVerificationError.
requestContext(headers, remote?)ip (CF-Connecting-IP → X-Real-IP → X-Forwarded-For → socket), userAgent, country and language.

API reference

Authenticate with Authorization: Bearer cf_live_… (or cf_test_…). Errors are JSON: { "error": { "message", "status" } }.

POST /v1/protect

Always answers 200 with a decision, except 429 quota_exceeded when a Free workspace is over its monthly quota (the SDK fails open).

FieldTypeDescription
emailstring, requiredEmail exactly as typed. Normalization (plus-alias, Gmail dots) happens server-side.
namestringFull name. Used by rules 3, 6, 8, 12 and by Agent.
ipstringEnd-user IP. Use getClientIp() / requestContext() from the SDK. Never sent to the agent.
userAgentstringEnd-user User-Agent header.
providerstring"credentials" (default), "google", "github", …
isPasswordSignupbooleanOverride; defaults to provider === "credentials". Rules 3, 6, 9 and the captcha requirement only apply to password sign-ups.
countrystringISO-2 country of the network, e.g. from cf-ipcountry. Used by rule 7 and by Agent.
timeZonestringBrowser time zone (Intl.DateTimeFormat().resolvedOptions().timeZone). Agent compares it with the country.
languagestringBrowser language (navigator.language or Accept-Language). Agent compares it with the country.
captchaTokenstringTurnstile / hCaptcha / reCAPTCHA token; verified server-side if configured.
timeToSubmitMsnumberMilliseconds between form render and submit. Under 1.5s sets bot.tooFast.
honeypotstring | booleanValue of a hidden field. Anything non-empty is a bot.
externalUserIdstringYour user id. Echoed back in webhooks.
metadataobject (≤4KB)Arbitrary JSON echoed back in webhooks.
debugbooleanInclude the full signal vector and decision trace in the response.

Response:

FieldDescription
idEvaluation id (evl_…). Store it with the user — you need it for verify-click, appeals and reports.
decisionallow | review | deny — what your app should do. review = held back. Always allow in dry-run mode.
modelDecisionWhat the model decided (differs from decision only in dry-run).
reasonReason code, e.g. disposable_email, rule3_one_word_name, rule13_agent_sure, ok.
scoreWeak-signal risk score (0+).
messageEnd-user-safe message. Empty for allow.
normalizedEmailCanonical email — use it as the unique key for the account.
statusallowed | pending_review | denied (later approved / rejected).
aiAgent’s opinion when it answered: { verdict: "real" | "suspicious", confidence, signal }.
emailOpenPixelUrlSigned 1×1 GIF URL for your verification email (rule 10).
dryRun / livemodeWorkspace mode and key mode.
latencyMsServer-side processing time.
curl
curl -X POST https://api.cyberfence.dev/v1/protect \
  -H "Authorization: Bearer $CYBERFENCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]","name":"Jane Doe","ip":"203.0.113.7","country":"US",
       "timeZone":"America/New_York","language":"en-US","userAgent":"Mozilla/5.0 ..."}'

GET /v1/evaluations/:id

Returns id, email, decision, modelDecision, reason, score, status, livemode, externalUserId, metadata, reviewedAt, reviewNote, aiReview, appeal, postSignup, isCustomer, createdAt.

POST /v1/evaluations/:id/report

Body { "outcome": "created" | "customer" | "fraud", "externalUserId"?, "note"? }.

POST /v1/evaluations/:id/verify-click

Body { "pageReferrer"?, "origin"?, "referer"?, "appHost"? } → { tempMailHost, heldBack, evaluation }. See rule 10.

POST /v1/evaluations/:id/appeal

Body { "website", "useCase" } → { status: "approved" | "pending_review", evaluation }. 400 if the answers are too short, 409 if the sign-up is not held back, was already appealed, or appeals are off.

POST /v1/evaluations/:id/review

Body { "action": "approve" | "reject", "note"? }. 409 if not pending_review. Fires signup.approved / signup.rejected.

Test & live keys

  • cf_test_… keys run the full pipeline (decision model, Agent, webhooks with livemode: false) with velocity counters isolated from live traffic, and never count toward your quota.
  • cf_live_… keys require a verified email to create.
  • Keys are shown once. Only an HMAC is stored; revoke and recreate if one leaks.
  • Dry-run is a workspace mode: live keys always get allow, the real decision is recorded as modelDecision.

Trust rules

The default policy is the sign-up trust rule set from Scalelist’s production system, measured on 26k real sign-ups (rules 1–6, 11 and 12 held back zero paying customers). There are two outcomes for a bad sign-up:

  • deny — clear abuse (disposable, no MX, bots, Tor, honeypot, failed captcha, network floods). Refuse the sign-up.
  • review — held back, not lost. The trust rules below only hold back: create the account but give no free trial or credits until a person — or Agent on appeal — approves it.
RuleReasonHolds back when
1rule1_throwaway_domain5+ accounts on one unpaid company domain in 30 days (or mail.com).
2rule2_subdomain_emailEmail on a sub-domain of a company domain, and the name is not in the email.
3rule3_one_word_namePassword sign-up with a one-word name that is not in the company email (general inboxes, initials and the company name itself are fine).
4rule4_digits_in_company_emailCompany email with 3+ digits in a row.
5rule5_student_emailStudent email, or a university email that does not fit the name.
6rule6_repeated_nameSame full name on 5+ password sign-ups in 30 days.
7rule7_countryCountry in the workspace hold-back list (Settings → Trust rules). Off by default.
8rule8_junk_nameJunk one-word name on a webmail address.
9rule9_temp_gmailPassword sign-up with a Gmail address in the temp-Gmail dot pattern.
10rule10_temp_mail_*After sign-up: the verification email was opened, or its link clicked, on a temp-mail site.
11rule11_same_network3+ accounts from one network in 24 hours (known-good company domains exempt).
12rule12_mashed_nameName typed by mashing keys, on a webmail address.
13rule13_agent_sureAgent says suspicious at ≥ sureConfidence (default 0.85).

Evaluation order (first match wins):

ReasonOutcome
allowlisted_domainallow — trusted domain bypasses everything
blocklisted_domaindeny — blocked by an admin
honeypot / invalid_email / disposable_email / no_mx_recordsdeny
bot / tor / captcha_failed / captcha_requireddeny
ip_blocked (10+/hour) / rate_limited (3+/10 min)deny
domain_blocked (company domain, 5+ denials in 30 days)deny
rules 1–13 (above)review — held back
elevated_risk (score ≥ 50)review — held back
okallow

Mark a paying customer with report(id, { outcome: "customer" }) or the dashboard toggle: its domain becomes domain.knownGood and is exempt from rules 1 and 11.

Agent

Agent is TypeSafe’s structured-decision model typesafe/jev-1.13, called through OpenRouter’s Decisions API (not chat completions). For every sign-up it receives a small JSON state and answers two typed questions — about $0.00002 per check:

  • verdict: real or suspicious, with a confidence.
  • signal: the main warning sign, one of the values below.
signalMeaning
noneNo warning sign.
random_nameThe name looks random, typed by mashing keys, or is not a person name.
generated_emailThe email looks machine-made (random letters, long number runs).
name_email_mismatchThe name and the email clearly belong to different people.
country_mismatchThe network country, time zone and language clearly disagree.
many_accounts_same_networkSeveral accounts came from the same network recently.
many_accounts_same_domainSeveral accounts came from the same company domain recently.
repeated_nameThe same name was used for other recent sign-ups.
throwaway_domainThe email domain looks like a throwaway or made-up domain.

Facts sent to the agent (no raw IP, ever):

  • name, email, emailDomain, emailIsWebmail
  • ipCountry (the country, never the IP), browserTimeZone, browserLanguage
  • accountsFromSameNetworkLast24h, accountsFromSameCompanyDomainLast24h, accountsWithSameNameLast7Days
  • context: your “Business context for Agent” setting
  • Rule 13: Agent only decides on its own when it is sure — suspicious at ≥ sureConfidence (default 0.85) holds the sign-up back. Below that, its opinion is stored for reviewers.
  • Privacy: requests are routed only to zero-data-retention providers that don’t collect data (Settings → Agent, on by default).
  • Fails open: no OpenRouter key, a timeout or an error means Agent is skipped and the rules decide alone. A real person is never punished for an outage.
  • Bring your own OpenRouter key and business context in Settings → Agent. The response’s ai field carries { verdict, confidence, signal }.

After sign-up (rule 10)

Throwaway inboxes often pass every check at sign-up. Rule 10 catches them when the verification email is used, and holds an allowed sign-up back after the fact (webhook signup.held_back). Turn it on or off with Settings → Trust rules.

1. Email-open pixel

Put the signed emailOpenPixelUrl from the protect response in your verification email as a 1×1 image. Opened on a temp-mail site → held back.

verification email (HTML)
<img src="{{ emailOpenPixelUrl }}" width="1" height="1" alt="" style="display:block;border:0" />

2. Verify-link click

Have your verify page send document.referrer to your backend, then forward it with the request’s Origin / Referer:

verify-email handler
import { verifyClickContext } from '@cyberfence/node';

app.post('/verify-email', async (req, res) => {
  const user = await db.users.verify(req.body.token);
  const r = await fence.verifyClick(user.evaluationId, verifyClickContext(req.headers, req.body.pageReferrer));
  // POST /v1/evaluations/:id/verify-click { pageReferrer, origin, referer, appHost }
  if (r.heldBack) await db.users.holdBack(user.id); // clicked from a temp-mail site
  res.json({ ok: true });
});

Appeals

Held back, not lost. When appeals are on (default), show held-back users a short form: their company website or LinkedIn, and what they want to do.

appeal
const r = await fence.appeal(user.evaluationId, {
  website: 'https://acme.com',            // or a LinkedIn URL
  useCase: 'Find leads for our agency',  // at least a few words
});
// POST /v1/evaluations/:id/appeal { website, useCase }
if (r.status === 'approved') await db.users.activate(user.id);
// 'pending_review' → a reviewer decides; you get signup.approved / signup.rejected
  • Agent runs a second check. With auto-approve on, an approve at ≥ minConfidence (default 0.8) approves the sign-up and fires signup.approved.
  • Anything else stays held back for a reviewer, with the appeal attached, and fires signup.appealed.
  • An appeal can be sent once. Errors: 400 (answers too short), 409 (not held back, already appealed, or appeals off).

Decision model

Every workspace runs a GoRules JDM graph on the ZEN engine. Download it from the dashboard, edit it at editor.gorules.io, test it in the simulator, then publish (Pro and Business). Published models are compiled and smoke-tested first; if one fails at runtime, that request falls back to the built-in model.

The built-in model: Request → Risk score → Agent → Signup policy (first hit) → Response. Templates: Sign-up trust rules + Agent (default) and Rules only (no LLM call).

Agent node
{
  "id": "agent",
  "type": "customNode",
  "name": "Agent (typesafe/jev-1.13)",
  "content": {
    "kind": "agent",
    "config": { "minScore": 0, "timeoutMs": 6000, "model": null }
  }
}

minScore > 0 asks Agent only about riskier sign-ups; model: null uses the workspace model (default typesafe/jev-1.13). Contract: the last node outputs decision and reason; score, message and ai are optional.

Signals

Every field below is addressable from a decision table column.

GroupFields
emailnormalized, domain, valid, disposable, freemail, webmail, hasMx (true / false / null = unknown), tempPattern, plusAlias, digitRatio, localRandom, subdomain, generalInbox, digitRun3, university, student, gmailDotPattern
domainallowListed, blockListed, blockReason, knownGood (a paying customer’s domain), company (not webmail), throwaway
ippresent, version, private, tor
namepresent, random, oneWord, inEmail, initialMatchesEmail, isCompanyOfDomain, fitsUniversityEmail, junk, mashed
velocityipAttempts10m, ipAttempts1h, ipDenials24h, sameNetwork24h, domainAccounts24h, domainAccounts30d, domainDenials30d, sameName7d, sameNamePasswordSignups30d, emailPriorSignups — per workspace and key mode
botuaMissing, uaHeadless, uaAutomation, uaCrawler, tooFast, honeypotFilled, timeToSubmitMs
captchaconfigured, provided, valid
requestprovider, passwordSignup, country, countryBlocked, timeZone, language
scoreComputed by the "Risk score" expression node
aiverdict ("real" | "suspicious" | null), confidence, signal, sureConfidence — after the Agent node

Raw IPs are never stored — they are HMAC-hashed per workspace, IPv6 grouped by /64.

Review queue

  • Held-back sign-ups appear in the queue with Agent’s opinion, the appeal (if any) and what happened after sign-up.
  • Reviewers (role reviewer and above) approve or reject, optionally allow / block the whole domain.
  • Resolution is atomic — one webhook per evaluation, even with concurrent reviewers and Agent on appeal.
  • Held-back sign-ups wait until someone decides; optionally auto-resolve after N hours (Settings → Review queue, default off).

Webhooks

EventWhen
signup.allowedSign-up passed.
signup.deniedClear abuse was refused.
signup.review_requiredHeld back at sign-up (rules 1–13, elevated risk).
signup.held_backAn allowed sign-up was held back later (rule 10).
signup.appealedThe user appealed and Agent could not approve; a person decides.
signup.approvedApproved by a reviewer or by Agent on appeal.
signup.rejectedRejected by a reviewer.
request
POST https://yourapp.com/webhooks/cyberfence
CyberFence-Event: signup.approved
CyberFence-Delivery: whd_…
CyberFence-Signature: t=1733140000,v1=<hex HMAC-SHA256(secret, "<t>.<rawBody>")>

{ "id": "evt_…", "type": "signup.approved", "created": "…", "workspaceId": "ws_…",
  "data": { "evaluation": { "id": "evl_…", "email": "…", "status": "approved", "reason": "rule3_one_word_name",
            "externalUserId": "usr_42", "aiReview": {…}, "appeal": {…}, "postSignup": {…}, "isCustomer": false } } }
verify (Express)
import { verifyWebhook } from '@cyberfence/node';

app.post('/webhooks/cyberfence', express.raw({ type: 'application/json' }), async (req, res) => {
  const event = verifyWebhook(req.body, req.headers['cyberfence-signature'], process.env.CYBERFENCE_WEBHOOK_SECRET!);
  const ev = event.data.evaluation!;
  if (event.type === 'signup.approved') await db.users.activate(ev.externalUserId!);
  if (event.type === 'signup.held_back') await db.users.holdBack(ev.externalUserId!);
  if (event.type === 'signup.rejected') await db.users.disable(ev.externalUserId!);
  res.sendStatus(200);
});
  • Verify against the raw body. Signatures older than 5 minutes are rejected (replay protection).
  • Respond 2xx quickly. Failures are retried 8 times with backoff (10s → 24h, ~45h total); see the delivery log to replay.
  • In production, endpoints must be https and must not resolve to private addresses.