Integration guide

View as Markdown

Two steps: embed the widget, then verify the token on your server. Replace YOUR_SITE_KEY / YOUR_SECRET_KEY with the keys from your site.

1. Add the widget to your page

Drop this into your HTML form. On success the widget injects a hidden nc-response field — a plain form submit just works, no custom JavaScript required.

<div data-nordcaptcha data-site-key="YOUR_SITE_KEY"></div>
<script src="https://cdn.nordcaptcha.com/v1/nc.js" async defer></script>
Copy ↗

2. Verify the token on your server

When the form is submitted, exchange the nc-response token for a verdict using your secret key. The token is single-use and carries no personal data.

curl -X POST https://api.nordcaptcha.com/v1/verify \
  -H "content-type: application/json" \
  -d '{"secret": "YOUR_SECRET_KEY", "token": "$NC_TOKEN"}'
Copy ↗

Response & errors

A success returns { "success": true, "ts": ..., "hostname": "..." }. Compare hostname against your expected host. On failure you get an HTTP 400 with { "detail": { "code": ..., "message": ... } }:

ErrorMeaningWhat to do
invalid_site_key Secret key wrong, or token not issued for this site. Check you're sending this site's secret key.
token_expired Token is older than its short lifetime. Reject; have the visitor solve again (widget.reset()).
token_already_used Token was already verified once (single-use). Reject; never verify the same token twice.