Documentation
Two lines in your page, one call from your server. This page is the whole integration.
1. Add the widget
Put these two lines where the form is. The div is where the widget renders; the script can go anywhere on the page.
<div class="servlys-gate" data-sitekey="YOUR_SITE_KEY"></div>
<script src="https://servlys.com/gate/v1.js" async defer></script>
On submission the widget adds a hidden field called servlys-gate-response to your form. That is the token your server needs to check.
2. Verify on your server
Never trust the widget alone. A bot can post your form directly without ever loading the page, so the token has to be checked server-side before you accept anything.
Your secret key goes in an Authorization header, not in the body. That keeps it
out of URLs, out of access logs, and lets the request be rejected before the body
is read at all.
curl -X POST https://servlys.com/gate/v1/verify \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-d response=$GATE_RESPONSE
A successful check returns:
{ "success": true, "hostname": "example.com", "ts": "2026-09-03T09:41:22Z" }
Process the form only on "success": true. Anything else, including a network failure, should be treated as a failed verification.
Check hostname against your own domain. Without that, someone who lifts your site key from your page source can use it on their own site and pass your checks.
3. Response codes
A rejected key returns HTTP 401. Everything else returns HTTP 200 with
"success": false, so check the status code as well as the body.
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 401 | missing-secret | No Authorization header | Fix your server configuration |
| 401 | invalid-secret | Key not recognised, or header malformed | Check you are not sending the site key by mistake |
| 200 | missing-response | No token in the request | The widget did not run, or the field was stripped |
| 200 | invalid-response | Token malformed or forged | Reject the submission |
| 200 | timeout-or-duplicate | Token expired or already used | Reject; tokens are valid once, for two minutes |
| 405 | method-not-allowed | Anything other than POST | Fix your server configuration |
4. Content Security Policy
Everything sits under one hostname, so a locked-down site needs one entry, not two:
script-src 'self' https://servlys.com;
connect-src 'self' https://servlys.com;
The same applies to corporate proxy allowlists. One entry for servlys.com covers the widget, the challenge and the verification.
5. Keys
You get two, and they are not interchangeable.
The site key goes in your HTML. It is public by design; anyone can read it in your page source. That is fine, which is why the hostname check in step 2 matters.
The secret key goes on your server and nowhere else, sent as Authorization: Bearer. Never put it in client-side JavaScript, a mobile app bundle, or a public repository. Never put it in a query string either, since that lands in access logs and browser history. If one leaks, rotate it. Old keys stop working immediately, so deploy the new one first.
6. Framework packages
Drop-in packages exist for WordPress, PHP, Node, Python and Ruby. Each wraps the two steps above and does the hostname check for you. The raw integration is two lines either way, so use a package if you want the response codes handled, and skip it if you would rather see what is happening.
7. Testing
Test keys are available that always pass or always fail, so you can exercise both branches of your form handler without waiting for a real bot. Ask for them when you get your key.
Before you go live, submit your form once with JavaScript disabled. You should see the fallback question rather than a broken form. If you do see a broken form, the widget markup is inside a block your template is not rendering.