Siftil Documentation PT Sign in Create free account

Quickstart

Five minutes from signup to the first decision in your backend. You need a site (localhost is fine) and a backend that receives the form you want to protect.

1. Create the account

Create a free account on the home page with your e-mail. You get, right away:

You can also create it through the API:

bash
curl -X POST https://siftil.com/v1/signup \
  -H 'content-type: application/json' \
  -d '{"email": "dev@yourcompany.com", "site": "https://www.yourcompany.com"}'

2. Add the tag

On the form page (signup, login, checkout):

html
<script src="https://siftil.com/v1/agent.js"></script>
<script>
  Siftil.observe() // optional: mouse and keyboard behaviour from here on
  const siftil = Siftil.identify({ endpoint: 'https://siftil.com/v1', apiKey: 'pk_YOUR_KEY' })
</script>

identify takes 150 to 500 ms and runs while the user fills in the form. Start early and only wait on submit.

3. Send the token with the form

js
form.addEventListener('submit', async (ev) => {
  ev.preventDefault()
  const { server } = await siftil
  const data = Object.fromEntries(new FormData(form))
  await fetch('/api/signup', {
    method: 'POST',
    headers: { 'content-type': 'application/json' },
    body: JSON.stringify({ ...data, siftilToken: server.token, siftilRequestId: server.requestId }),
  })
})

4. Check it in the backend

The simplest way is to ask the API with your secret key:

js
// Node 18+, Bun, Deno, Workers
const r = await fetch('https://siftil.com/v1/verify', {
  method: 'POST',
  headers: { authorization: 'Bearer ' + process.env.SIFTIL_SK, 'content-type': 'application/json' },
  body: JSON.stringify({ token: body.siftilToken }),
})
const t = await r.json() // { valid, rid, vid, ss, risk, bot, new, iat }

if (!t.valid) return res.status(400).send('please reload the page')
if (t.risk === 'high') return requireVerification() // SMS, captcha, manual review
await createAccount({ ...body, visitorId: t.vid, requestId: t.rid })

The token is valid for 10 minutes. To stop anyone from reusing the same token for two signups, store the rid and reject a repeated rid. The token carries a summary of the decision; when you need every signal, fetch the event:

bash
curl https://siftil.com/v1/events/REQUEST_ID -H 'authorization: Bearer sk_…'

When the user signs in, call again with their ID in your system. That is what separates multi-accounting (fraud) from a shared computer (a clinic front desk, a lab):

js
Siftil.identify({ endpoint: 'https://siftil.com/v1', apiKey: 'pk_YOUR_KEY', linkedId: user.id })

Done. What next?

Siftil · API v1 documentation