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
- On submit, the script sends the email to Sortance with your website key (
pk_live_…). Sortance runs yourdefaultpolicy and answersallow,review,challengeordeny, with a one-time token. - On
denythe form does not send and the visitor sees your message. Otherwise the token is added to the form assortance_token. - Your server sends the token to
POST /v1/client/redeemwith 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_foundWith 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.
| Field | Values | From |
|---|---|---|
device.type | desktop, mobile, tablet, bot, unknown | Connection (User-Agent, client hints) |
device.os | windows, macos, ios, android, linux, chromeos, other | Connection |
device.browser | chrome, safari, firefox, edge, opera, samsung, other | Connection |
device.is_bot_ua | true / false | Connection |
device.tls_version | e.g. TLSv1.3 | Connection |
device.webdriver | true / false | Page (widget only) |
device.timezone_mismatch | true / false | Page timezone vs the network's |
device.language_mismatch | true / false | Page languages vs the browser's |
device.screen | small, medium, large | Page (widget only) |
device.id_seen_day | number | Checks 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.