TrustComponent
Kotlin
TrustCaptcha · Bot protection

Kotlin CAPTCHA Integration

Add a Kotlin CAPTCHA to your app with TrustCaptcha: verify CAPTCHA results on your server in minutes and keep spam out of your APIs and contact forms. You get a verification status and a bot score to allow, block or review each request. EU-hosted, GDPR-compliant and without puzzles for your visitors.

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 Kotlin 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 Kotlin in our documentation.

Read the documentation

First, add our TrustCaptcha Kotlin dependency:

Maven Central
XML
<dependency>
  <groupId>com.trustcomponent</groupId>
  <artifactId>trustcaptcha</artifactId>
  <version>3.0.0</version>
</dependency>

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

Fetch Result
Kotlin
// Retrieving the verification result
val verificationResult = try {
  TrustCaptcha.getVerificationResult("<your_api_key>", "<verification_token_from_your_client>")
} catch (e: CaptchaFailureException) {
  // Fetch verification result failed - handle error
}

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

Handle Result
Kotlin
// Act on the verification result
if (!verificationResult.verificationPassed || verificationResult.score > 0.5) {
  // Verification failed or bot score > 0.5 - possible automated request
}

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

Other backend technology instead of Kotlin?
If you run something other than Kotlin 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

How does a Kotlin CAPTCHA check work?
A Kotlin CAPTCHA is a check your backend runs before it processes a request. On the client, the TrustCaptcha widget starts on its own, solves a proof-of-work task whose difficulty grows with the risk and adds a verification token to the form. Your Kotlin backend fetches the result for that token with TrustCaptcha.getVerificationResult and your API key, then acts on whether the human verification passed and on the bot score. That keeps spam, credential stuffing and carding bots away from your forms and APIs without a puzzle.
Can I call it from coroutines?
Yes. The library makes a blocking HTTP call with default timeouts of 3 seconds to connect and 5 seconds to read, so in a coroutine wrap it in withContext(Dispatchers.IO). If you need other timeouts, a proxy or a different API host, build one instance with TrustCaptcha.builder(apiKey) at startup; it is immutable and thread-safe, so all requests can share it.
Does it work with Spring Boot, Ktor and Micronaut?
Yes. It is a plain JVM library from Maven Central (com.trustcomponent:trustcaptcha), so it fits Spring Boot controllers, Ktor routes, Micronaut and any other Kotlin stack, with Gradle or Maven. Read the verification token from the request in your route or controller and check it before you process the form. For Spring Boot and Micronaut we have dedicated guides.
How do I test my Kotlin endpoints without solving the CAPTCHA?
From the Team plan you can create bypass keys for automated tests. They always pass the CAPTCHA with a bot score of 0, so your integration tests and CI pipeline can call protected endpoints. In unit tests, put the TrustCaptcha call behind a small interface of your own and mock it. Keep bypass keys out of your production configuration.
Is TrustCaptcha GDPR compliant?
TrustCaptcha processes all data in the EU on ISO 27001-certified infrastructure and never sets cookies. You can sign the Data Processing Agreement online. Whether your setup is compliant also depends on how you use it and on your privacy policy; this is not legal advice, so check the details with your data protection officer.
Can I fully customize TrustCaptcha's appearance?
Largely, yes. The widget has 37+ languages ready to use, you can add any other language and override every text, and you can choose light, dark or the visitor's system setting. From the Team plan you can adjust colors, borders and corner radius. A widget without our branding and a fully invisible widget are available with the paid Captcha Branding add-on.
Will TrustCaptcha slow down my Kotlin application?
Your backend makes one API call per submitted form to fetch the verification result, so the extra work for your Kotlin service is small. The proof-of-work runs in the visitor's browser while they fill in the form, and it only gets harder when a request looks risky. There are no image puzzles to load or click through.
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 Kotlin application with TrustCaptcha in just a few steps!

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