Skip to content

Web SDK

Web SDK supports all modern browsers with multiple integration methods.

See it work in 30 seconds

demo-v1.captcha.la — pure HTML + PHP, MIT-licensed, view-source on every page.

Quick start

html
<!-- 1. Load via CDN (or npm install captchala) -->
<script src="https://cdn.captcha-cdn.net/captchala-loader.js"></script>

<button id="login-btn">Sign in</button>

<script>
loadCaptchala(function () {
  Captchala.init({
    appKey: 'YOUR_APP_KEY',
    product: 'bind',
    action: 'login',
    lang: 'auto',
  })
  .onSuccess(res => sendToBackend(res.token))
  .onError(err => console.error(err.message))
  .bindTo('#login-btn');
});
</script>

Installation

CDN

html
<!-- Recommended: auto-fallback loader, ~6 KB gzip -->
<script src="https://cdn.captcha-cdn.net/captchala-loader.js"></script>

NPM

bash
npm install captchala
# or framework wrappers
npm install @captcha-la/vue
npm install @captcha-la/react
js
import Captchala from 'captchala';
import 'captchala/dist/captchala.css';

Modes

js
Captchala.init({ appKey: 'YOUR_APP_KEY', product: 'popup', action: 'login' })
  .bindTo('#login-btn')
  .onSuccess(res => sendToBackend(res.token));

Float Mode

js
Captchala.init({ appKey: 'YOUR_APP_KEY', product: 'float', action: 'browse' })
  .appendTo('#captcha-container')
  .onSuccess(res => sendToBackend(res.token));

Bind Mode

js
Captchala.init({ appKey: 'YOUR_APP_KEY', product: 'bind', action: 'login' })
  .bindTo('#submit-button')
  .onSuccess(res => submitForm(res.token));   // fires only after challenge passes

Embed Mode

js
Captchala.init({ appKey: 'YOUR_APP_KEY', product: 'embed', action: 'register' })
  .appendTo('#captcha-container')
  .onSuccess(res => sendToBackend(res.token));

Common options

ParameterTypeDefaultDescription
appKeystringApplication Key (required)
productstringpopupDisplay mode: popup
actionstringdefaultBusiness scene (e.g. login, register, pay). The server applies different security policies per scene.
langstringautoBCP-47 tag (e.g. en, ja, pt-BR) or auto to follow navigator.language. See Supported languages — 54 locales.
serverTokenstringSingle-use token (sct_xxx) issued by your server. Strongly recommended in production — prevents unbounded challenge refresh abuse.
onServerTokenExpired() => Promise<string>Called when serverToken expires; return a new one so SDK can continue without interrupting the flow.
enableVoicebooleantrueShow the audio-captcha entry point (accessibility support for visually impaired users).

Server-side validation

After onSuccess, send res.token (prefix pt_) to your own backend, then validate it server-side:

bash
POST https://apiv1.captcha.la/v1/validate
X-App-Key: YOUR_APP_KEY
X-App-Secret: YOUR_APP_SECRET
Content-Type: application/json

{ "pass_token": "<token>", "client_ip": "<end-user IP>" }

See the API Reference for the full validation endpoint.

MIT-licensed examples · CaptchaLa is operated independently