Skip to main content

Configuration

This document describes the basic configuration options available for AI Captcha integration.

Container Parameter Configuration

Query parameters

Parameters that can be passed when introducing api.js:

ParameterValueDefaultDescription
onloadFunction name-Optional. Name of the callback function to execute after loading all dependencies
renderexplicit | onloadonloadOptional. Default is onload, which automatically renders the captcha in the first ai-recaptcha tag found. If set to explicit, it will not render automatically and requires manual method calls to display the captcha
hlLanguage code-Optional. Forces the captcha to render in a specific language. If no language is specified, the user's language will be automatically detected. If both HTML and render method specify language, the HTML and render parameters take precedence

Data Attributes

You can also configure parameters through the aiCaptcha container <div>. The available parameters are as follows:

ParameterValueDefaultDescription
data-sitekeySite key from console-Required. Your public API site key
data-themelight | darklightOptional. Theme setting
data-sizenormal | compactnormalOptional. Container size
data-hlLanguage identifier-Optional. If no language is specified, the user's language will be automatically detected. See language codes
data-callbackFunction name-Optional. Callback after successful verification, returns aicaptcha-response
data-error-callbackFunction name-Optional. Callback for verification failure, returns error information
data-chalexpired-callbackFunction name-Optional. Called when the user display of a challenge times out with no answer.
data-expired-callbackFunction name-Optional. Callback when verification response expires

When using HTML integration, you can specify configuration through data attributes:

<div class="aicaptcha" 
data-sitekey="your-site-key"
data-theme="light"
data-size="normal"
data-callback="onCaptchaSuccess">
</div>

JavaScript API

aiCaptcha.render(container,parameters)

  • Type: Function
  • Description: Renders the container as a Captcha widget. Returns a unique widgetID for the widget.
  • Parameters:

container: The string ID of the container or the container DOM element.

parameters: An object containing parameters as key=value pairs.

aiCaptcha.render('captcha-container', {
sitekey: 'your-site-key',
theme: 'light',
size: 'normal',
callback: function(response) {
// Handle successful verification
console.log('Verification successful:', response);
},
'error-callback': function(error) {
console.error('Captcha error:', error);
}
});

aiCaptcha.reset(widgetID)

  • Type: Function
  • Description: Resets the Captcha widget.
  • Parameters: widgetID: Optional widget ID. Defaults to first widget created.

aiCaptcha.getResponse(widgetID)

  • Type: Function
  • Description: Gets the response for the Captcha widget.
  • Parameters: wID: Optional widget ID. Defaults to first widget created.

aiCaptcha.execute(widgetID)

  • Type: Function
  • Description: Triggers the Captcha workflow programmatically. Generally used in invisible mode where the target container is a div rather than a button.
  • Parameters: widgetID: Optional widget ID. Defaults to first widget created.

aiCaptcha.remove(widgetID)

  • Type: Function
  • Description: Remove the Captcha widget.
  • Parameters: widgetID: Optional widget ID. Defaults to first widget created.

Security Configuration

Domain Restrictions

  • Configure allowed domains in the AI Captcha console
  • Restricts where your site key can be used
  • Prevents unauthorized usage of your captcha

IP Policies

  • Available in certain subscription tiers
  • Allows or blocks specific IP ranges
  • Helps prevent abuse and automated attacks