---
title: Web SDK
---
# Web SDK
Web SDK tüm modern tarayıcıları destekler ve birden fazla entegrasyon yöntemi sunar.
::: tip 30 saniyede çalışırken görün
[demo-v1.captcha.la](https://demo-v1.captcha.la) — saf HTML + PHP, MIT lisanslı, her sayfada view-source açıktır.
- [popup.html](https://demo-v1.captcha.la/popup.html) — açılır pencere modu
- [float.html](https://demo-v1.captcha.la/float.html) — kayan widget
- [bind.html](https://demo-v1.captcha.la/bind.html) — butona bağla
- [inline.html](https://demo-v1.captcha.la/inline.html) — satır içi gömme
- [server-token.html](https://demo-v1.captcha.la/server-token.html) — sunucu tarafından düzenlenen token (yeniden oynatma engelleme)
:::
## Hızlı başlangıç
```html
```
## Kurulum
### CDN
```html
```
### 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';
```
## Modlar
### Açılır Pencere Modu
```js
Captchala.init({ appKey: 'YOUR_APP_KEY', product: 'popup', action: 'login' })
.bindTo('#login-btn')
.onSuccess(res => sendToBackend(res.token));
```
### Kayan Mod
```js
Captchala.init({ appKey: 'YOUR_APP_KEY', product: 'float', action: 'browse' })
.appendTo('#captcha-container')
.onSuccess(res => sendToBackend(res.token));
```
### Bağla Modu
```js
Captchala.init({ appKey: 'YOUR_APP_KEY', product: 'bind', action: 'login' })
.bindTo('#submit-button')
.onSuccess(res => submitForm(res.token)); // fires only after challenge passes
```
### Gömme Modu
```js
Captchala.init({ appKey: 'YOUR_APP_KEY', product: 'embed', action: 'register' })
.appendTo('#captcha-container')
.onSuccess(res => sendToBackend(res.token));
```
## Ortak seçenekler
| Parametre | Tür | Varsayılan | Açıklama |
| --- | --- | --- | --- |
| `appKey` | string | — | Uygulama Anahtarı (zorunlu) |
| `product` | string | `popup` | Görüntüleme modu: popup | float | embed | bind |
| `action` | string | `default` | İş senaryosu (örn. login, register, pay). Sunucu her senaryoya farklı güvenlik politikaları uygular. |
| `lang` | string | `auto` | BCP-47 etiketi (örn. `en`, `ja`, `pt-BR`) veya `navigator.language` değerini takip etmek için `auto`. Bkz. [Desteklenen diller](/supported-languages) — 54 yerel ayar. |
| `serverToken` | string | — | Sunucunuz tarafından düzenlenen tek kullanımlık token (sct_xxx). Üretimde şiddetle tavsiye edilir — sınırsız challenge yenileme kötüye kullanımını önler. |
| `onServerTokenExpired` | `() => Promise` | — | serverToken süresi dolduğunda çağrılır; SDK'nın akışı kesintiye uğratmadan devam edebilmesi için yenisini döndürün. |
| `enableVoice` | boolean | `true` | Sesli CAPTCHA giriş noktasını göster (görme engelli kullanıcılar için erişilebilirlik desteği). |
## Sunucu tarafı doğrulama
`onSuccess` sonrası, `res.token` değerini (`pt_` ön ekli) kendi backend'inize gönderin ve sunucu tarafında doğrulayın:
```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": "" }
```
Tam doğrulama uç noktası için [API Referansı](./api-reference)'na bakın.