Scala CAPTCHA Integration
Stop fake sign-ups, login brute force and form spam in your Scala apps in minutes with TrustCaptcha's Scala CAPTCHA integration. You get a pass or fail plus a risk score to route or block suspicious traffic. Privacy-first, EU-hosted and built for accessibility: no cookies, no image puzzles.
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.


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:

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.
3. Validate the CAPTCHA result in your backend
The following steps show how a Scala 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 Scala in our documentation.
Read the documentation
First, add our TrustCaptcha Scala dependency:
<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:
// Retrieving the verification result
var verificationResult: VerificationResult = null
try {
verificationResult = TrustCaptcha.getVerificationResult("<your_api_key>", "<verification_token_from_your_client>")
} catch {
case e: CaptchaFailureException =>
// Fetch verification result failed - handle error
}Based on the verification result and your own requirements, decide how to proceed:
// Act on the verification result
if (!verificationResult.isVerificationPassed || verificationResult.getScore > 0.5) {
// Verification failed or bot score > 0.5 - possible automated request
}Need detailed information about the Scala CAPTCHA integration?
Our Scala CAPTCHA integration guide has the detailed instructions, and our CAPTCHA samples repository on GitHub has a complete integration example.
Other backend technology instead of Scala?
If you run something other than Scala 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.
4. Test your integration
TrustCaptcha is now active. Send a test request and check that it goes through.

FAQs
How does a Scala CAPTCHA check work?
Can I use it with Play Framework or Akka HTTP?
The call is blocking. How do I use it with Futures?
How do I test my Scala app without solving the CAPTCHA?
Is TrustCaptcha GDPR-compliant for EU projects?
Can I customize the look of TrustCaptcha in my Scala app?
How does TrustCaptcha improve accessibility over image-based CAPTCHAs?
TrustCaptcha blocks spam and bots, not customers. No puzzles, GDPR-compliant, EU-hosted.


Protect your Scala application with TrustCaptcha in just a few steps!
- EU-hosted & GDPR-compliant
- No puzzles
- Try free for 14 days