Website widget

Check signups in the browser

Add one script tag and every signup form on your site is checked before it is sent, against the rules you already have, using the visitor's real IP, region and device. Your server then confirms the result, so nobody can skip it by turning the script off.

How it works

  1. On submit, the script sends the email to Sortance with your website key (pk_live_…). Sortance runs your default policy and answers allow, review, challenge or deny, with a one-time token.
  2. On deny the form does not send and the visitor sees your message. Otherwise the token is added to the form as sortance_token.
  3. Your server sends the token to POST /v1/client/redeem with your secret API key, and only then creates the account.

IP, country, region and network (request.*) are taken from the connection by Cloudflare, never from the page, so a visitor cannot change them. This is why IP and region rules are more reliable from the browser than from a server that has to forward them.

1. Add the script

Create a website key under Website in the dashboard and list the sites it may be used on. The dashboard shows the snippet with the key and an integrity hash filled in.

<script
  src="https://api.sortance.com/v1/client/sdk-1.0.0.js"
  integrity="sha384-…"
  crossorigin="anonymous"
  data-key="pk_live_…"
  async
></script>

<form action="/signup" method="post">
  <input type="email" name="email" data-sortance required>
  <button>Sign up</button>
</form>

Add data-sortance-mode="observe" to the input to check and log without ever blocking the form. For forms sent with JavaScript, call Sortance.check(email) yourself; it resolves { action, message, token, expires_in }.

2. Confirm on your server

POST https://api.sortance.com/v1/client/redeem
Authorization: Bearer sk_live_…
{ "token": "<sortance_token>", "email": "<the submitted email>" }

→ { "valid": true, "action": "allow", "email_match": true,
    "request": { "ip": "…", "country": "DE", "region": "Berlin", "asn": 3320 },
    "device": { "type": "desktop", "webdriver": false, … }, "trace_id": "vr_…" }
→ { "valid": false, "reason": "used" }   // expired, bad_signature, wrong_account, not_found

With the JavaScript SDK: await sortance.redeemToken(token, email). Refuse the signup when valid is false, email_match is false or action is deny. A token works once and expires after 5 minutes.

Device rules

Rules can use these fields alongside request.* and velocity.*. Fields from the page are unknown on server calls, and a rule over an unknown field follows its on_unknown.

FieldValuesFrom
device.typedesktop, mobile, tablet, bot, unknownConnection (User-Agent, client hints)
device.oswindows, macos, ios, android, linux, chromeos, otherConnection
device.browserchrome, safari, firefox, edge, opera, samsung, otherConnection
device.is_bot_uatrue / falseConnection
device.tls_versione.g. TLSv1.3Connection
device.webdrivertrue / falsePage (widget only)
device.timezone_mismatchtrue / falsePage timezone vs the network's
device.language_mismatchtrue / falsePage languages vs the browser's
device.screensmall, medium, largePage (widget only)
device.id_seen_daynumberChecks from this device today

Limits and safety

  • A website key only works from the sites you list (test keys also work on localhost).
  • Each visitor IP gets 5 to 120 checks a minute (you choose; 20 by default), then 429.
  • Your organisation's rate limit and monthly quota apply: each check is one verification.
  • The page is told only the action and your message: never a score, a rule or an IP. The full result is in Logs (source: Website) and in the redeem answer.
  • If Sortance cannot be reached, the script lets the form send without a token; your server decides.