When​ ​you​ ​have integrated​ ​server​ ​SDK​ ​and​ ​run​ ​the​ ​demo, a ​simplified​ ​ version of captcha has already been integrated.​ ​We​ ​also​ ​provide​ ​other​​ configuration parameters​ ​and​ ​APIs except the demo presented.​ This session will explain the configuration and APIs of client.​

Development environment

Item Description
Compatibility IE 6+, Chrome, Firefox, Safari, Opera, mainstream mobile browsers and Webview of iOS and Android


Item Link
Data communication flow chart Data communication flow chart
API documentation API example


Preparation: please ensure that you have finish the integration of server (Server integration docs)

Add captcha initialization function

Import captcha initialization function initGeetest through the following example.

<script src="gt.js"></script>

The captcha initialization should be finished after the web page has been loaded. Otherwise, the captcha cannot collect the behavior data in this web page, which will lead to activation failure of some policies.

Notice: the gt.js is used to load the corresponding JS libraries. Each server SDK zip file contains a gt.js. Please could copy and paste this file to the project if you want to use it.

Call the captcha initialization function to initial the captcha verification

url: "API1接口(详见服务端部署)",
type: "get",
dataType: "json",
success: function (data) {
//请检测data的数据结构, 保证data.gt, data.challenge, data.success有值
// 以下配置参数来自服务端 SDK
gt: data.gt,
challenge: data.challenge,
offline: !data.success,
new_captcha: true
}, function (captchaObj) {
// 这里可以调用验证实例 captchaObj 的实例方法

The initialization need to work together with server SDK, because initialization requires parameters that passed by server.


The parameter configuration refers to the config object (key-value structure) which is passed during the captcha verification. It is the first parameter passed when called the initGeetest.

The following parameters are required to be configured.

Variables Type Description
gt String CAPTCHA ID. You can get it from the dashboard.
challenge String ID of CAPTCHA request, generated when server SDK sends a request to GeeTest server.
offline Boolean Status of GeeTest API server, which indicates whether GeeTest server is uptime or downtime (i.e. in Failback mode)
new_captcha Boolean Refers to the CAPTCHA version (V3.0 or V2.0) and could be used in Failback mode. The return value true refers to V3.0.

You only need to pass these parameters which are returned by server SDK as shown in the Demo.

Please check the API referer for the optional configuration parameters.