3 easy steps

How to add CAPTCHA to your website

1. Setup an account

A Private Captcha account is needed to issue CAPTCHA challenges and to verify their solutions. Inside you can register a new domain and create an API key. Check out everything for free during 14 days without a credit card.

Getting started guide

2. Frontend integration

To enable protection, you need to add our widget to your website page or form and disable form submit until CAPTCHA is solved. Works with native HTML as well as React and Vue. Widget is easy to install and customize.

Check docs

3. Backend integration

You need to verify CAPTCHA solution before form submission is processed in the backend. Install our library for Python (batteries included) and check out the copy-and-paste snippets for your backend code.

Check docs
Backend verification Python
from private_captcha import Client, SolutionError

client = Client(api_key="YOUR_API_KEY")

def submit_form(form_data):
    result = client.verify(
        solution=form_data.get("private-captcha-solution"),
        sitekey="YOUR_SITEKEY",
    )
    if not result.ok():
        raise SolutionError(f"Captcha verification failed: {result.code}")

    # Verification passed. Process your form submission here.

Backend

Verify before you process

  1. Install the library

    Add the official library to your project:

    pip install private-captcha

  2. Create a client

    Initialize a client with your API key and Sitekey. Keep the API key as your server secret.

  3. Check every submission

    Verify the private-captcha-solution form field before running any business logic. Continue only when verification passes.

Frontend

Enable submit when solved

  1. Load the script

    Load the deferred script directly from our CDN. The widget adds the solution to your form automatically, ready for backend verification.

  2. Add the widget

    Place the widget inside your form and replace YOUR_SITE_KEY with your property's sitekey from the Portal.

  3. Wait for the solution

    Keep the submit button disabled. Set data-finished-callback to a function that enables it once the captcha is solved.

Client-side documentation
<script defer
 src="https://cdn.privatecaptcha.com/widget/js/privatecaptcha.js">
</script>

<form action="/submit" method="POST">
  <!-- Your form fields go here. -->
  <div class="private-captcha"
       data-sitekey="YOUR_SITE_KEY"
       data-finished-callback="onCaptchaSolved"></div>
  <button id="formSubmit" type="submit" disabled>Submit</button>
</form>

<script>
  function onCaptchaSolved() {
    document.querySelector("#formSubmit").disabled = false;
  }
</script>

Next steps

After implementing the basics, here's what else you can do.

Custom rules

Customize CAPTCHA puzzle difficulty for your unique use-case

Widget customization

Different visual themes, more than 10 localizations, popup/hidden modes and more

Question zone

Frequently Asked Questions

More questions

More questions

Protect Your Forms
And APIs From Abuse

Independent, privacy-first, user-friendly CAPTCHA service made in EU

Contact us