TrustComponent
Rust
TrustCaptcha · Bot protection

Rust CAPTCHA Integration

Add a Rust CAPTCHA to your backend to stop bot sign-ups, form spam and API abuse. Our step-by-step Rust integration validates the verification token in minutes. Your users solve no puzzles, data is processed in the EU, and the setup is GDPR-compliant.

Quickstart

How the integration works

1. Create a CAPTCHA

Create a user account or log in with an existing one. Then create a new CAPTCHA or pick an existing one. If you want to try TrustCaptcha first, every plan comes with a 14-day free trial.

The CAPTCHA overview page shows your site key and license key, and you create your API key there. Add your website’s domains to the authorized domains in the CAPTCHA security rules so they can use your CAPTCHA.

Start of the CAPTCHA creation form.
CAPTCHA security rules of a demo CAPTCHA.

2. Integrate the CAPTCHA widget into your frontend

Integrate the CAPTCHA widget into your website or app. The CAPTCHA widget guide in our documentation has step-by-step instructions.

Read the documentation

The CAPTCHA widget will then be displayed on your website or app:

CAPTCHA start

Pre-built frontend integrations
Our pre-built frontend integrations add the CAPTCHA widget to your website or application. If there is none for your frontend technology yet, your developers can integrate the widget themselves using our documentation or ask our support team for a pre-built integration.

Angular
Contact Form 7
Craft CMS
JavaScript
Joomla
JTL-Shop
Keycloak
Magento 2
React
Shopware 6
Svelte
TYPO3
Vue
Webflow
WordPress

3. Validate the CAPTCHA result in your backend

The following steps show how a Rust backend fetches the CAPTCHA verification result from our server and decides what to do with it. For the full instructions, read the CAPTCHA integration guide for Rust in our documentation.

Read the documentation

First, install our TrustCaptcha Rust dependency:

Install
bash
cargo add trustcaptcha

Fetch the verification result from our server with the verification token and your API key:

Fetch Result
Rust
// Retrieving the verification result
let trust_captcha = TrustCaptcha::builder("<your_api_key>").build()?;
let verification_result = match trust_captcha.get_verification_result("<verification_token_from_your_client>").await {
  Ok(result) => result,
  Err(e) => {
    // Fetch verification result failed - handle error
    return;
  }
};

Based on the verification result and your own requirements, decide how to proceed:

Handle Result
Rust
// Act on the verification result
if !verification_result.verification_passed || verification_result.score > 0.5 {
  // Verification failed or bot score > 0.5 - possible automated request
}

Need detailed information about the Rust CAPTCHA integration?
Our Rust CAPTCHA integration guide has the detailed instructions, and our CAPTCHA samples repository on GitHub has a complete integration example.

Other backend technology instead of Rust?
If you run something other than Rust on your server, or have several backends, pick a different integration here. If we have no pre-built integration for your backend technology yet, your developers can integrate the CAPTCHA verification themselves using our documentation or ask our support team for a pre-built integration.

.NET
Go
Groovy
Java
Kotlin
Node.js
PHP
Python
Ruby
Rust
Scala

4. Test your integration

TrustCaptcha is now active. Send a test request and check that it goes through.

CAPTCHA done

FAQs

What do I need to validate a Rust CAPTCHA on my backend?
You receive a verification token from the frontend, then your Rust backend calls the TrustComponent verification API using your API key. The response is a verification result you can use to allow, review, or block the request.
Do I still need a frontend integration if I use Rust on the backend?
Yes. The CAPTCHA is solved in the frontend (website or app). Only after a user solves it, a verification token is created. Your Rust backend can only validate what it receives from the frontend.
How does the verification token reach my Rust backend?
That’s up to your application. The token can be sent in a form submit, a JSON body, a request header, or another transport. The important part is: your backend must receive the verification token reliably and then validate it server-side.
What do 'verification passed' and 'bot score' mean?
Always check verification passed first: it confirms the CAPTCHA flow was successful (including the proof-of-work and any security rules such as IP or geo rules). Then check the bot score: it's a risk score from 0 (likely human) to 1 (likely bot). You decide what score is acceptable for your use case.
How should I choose a decision threshold for the bot score?
A simple starting point is a single threshold, for example 0.5: below it you accept, above it you block. If you want stricter protection, lower the threshold (e.g., 0.3–0.4). If you want fewer blocks, raise it (e.g., 0.6–0.7). You can also use multiple levels, such as: accept (low), add extra checks like email/2FA (medium), block (high).
How long is a verification token valid, and what happens if the API is not reachable?
By default, the verification token is single-use and valid for 15 minutes. On the Enterprise plan you can extend the validity and allow a limited number of retrievals. If your server cannot reach our API at all (ServerUnreachableError), decide upfront how to react; our documentation suggests allowing the request and logging the incident. If the widget reports an outage that your server cannot confirm (ClientReportedServerUnreachableError), reject the request or ask for another check.
Losing leads to CAPTCHAs?

TrustCaptcha blocks spam and bots, not customers. No puzzles, GDPR-compliant, EU-hosted.

CAPTCHA start
CAPTCHA done
No puzzles for visitors
The check runs in the background while visitors type, so more people finish your forms instead of giving up.
GDPR-compliant
Hosted in the EU, no cookies, encrypted transmission and automatic data deletion. Every customer gets a Data Processing Agreement.
Multi-layer security
Adaptive proof-of-work and risk scoring stop abuse early, even when attack traffic spikes.
Full control
Set the sensitivity, keep allow and block lists and use geoblocking. You decide how strict the check is.

Protect your Rust application with TrustCaptcha in just a few steps!

  • EU-hosted & GDPR-compliant
  • No puzzles
  • Try free for 14 days