All Products
Search
Document Center

Captcha:Integration guide

Last Updated:Aug 24, 2026

CAPTCHA V2.0 can verify user requests only after you integrate it into your business client and your business server. This topic describes the full integration path, from activating the service and creating a verification scenario to integrating, testing, and publishing your client-side and server-side code.

Integration process

CAPTCHA V2.0 integration involves four steps:

  1. Activate CAPTCHA V2.0 with a subscription or pay-as-you-go plan and obtain the identity prefix.

  2. Create a verification scenario and obtain the scenario ID.

  3. Integrate CAPTCHA into your business client and business server, and then run verification tests.

  4. Publish the CAPTCHA integration.

The following diagram shows the four steps of the integration process.

image

For the interaction sequence between your business client, your business server, and the CAPTCHA server, see How V3 verification works.

Prerequisites

Integration code depends on values that you obtain in the console. Make sure that the following items are available before you start Step 3:

  • An activated CAPTCHA V2.0 plan — Step 1 describes how to activate CAPTCHA V2.0.

  • The identity prefix — Client-side integration requires the identity prefix of your CAPTCHA V2.0 instance. Step 1 describes where to obtain it.

  • The scenario ID — Step 2 describes how to create a verification scenario and obtain its scenario ID.

  • The CAPTCHA V2.0 SDK on your business server — Server-side integration calls the VerifyIntelligentCaptcha operation through the SDK. Step 3 links to the server-side integration instructions.

Step 1: Activate CAPTCHA V2.0

  1. Log on to the CAPTCHA V2.0 console and click Buy Now.

  2. Go to the Overview page and obtain the Identity Prefix from the instance basic information card. The identity prefix is required for client-side integration.

Step 2: Create a verification scenario

  1. In the left-side navigation pane, choose Scenarios > Create Scenario.

  2. Create a verification scenario based on your business requirements, configure parameters such as Scenario Name, Integration Method, and Verification Type, and obtain the Scenario ID.

Two of these parameters determine how the rest of the integration works:

  • Integration Method — This value must match the integration path that you follow in Step 3. Each integration path in Step 3 states the value to select.

  • Verification Type — This value determines how much interaction the CAPTCHA requires from your users. Slider, jigsaw, click-to-pass, and image restore verification require the user to complete a challenge on every verification. No-CAPTCHA verification checks whether the user is trusted first, and presents a challenge only when the first verification is considered suspicious. For the full interaction sequence of each verification type, see How V3 verification works.

Step 3: Integrate CAPTCHA V2.0 and run verification tests

Choose an integration path based on where verification runs:

  • Web pages or H5 pages — Integrate the CAPTCHA initialization code into the pages themselves. See Web and H5 integration.

  • Android or iOS apps — Load your integrated web or H5 pages in the web view component of the app. See App integration.

  • WeChat mini programs — Integrate the CAPTCHA initialization code into the mini program pages. See WeChat mini program integration.

The app path reuses the client-side and server-side integration described in Web and H5 integration. The WeChat mini program path has its own client-side integration instructions. Set Integration Method to the value that the first step of your path specifies.

Web and H5 integration

  1. When you create the verification scenario, set Integration Method to Web/H5. This value applies only to the web and H5 path.

  2. Client-side integration — On the web and H5 pages that require verification, integrate the CAPTCHA initialization code. For a code sample, see Web and H5 client-side integration for V3 architecture.

  3. Server-side integration — On your business server, integrate the SDK and call the VerifyIntelligentCaptcha operation to validate the CaptchaVerifyParam value that the client sends. For instructions, see Server-side integration.

App integration

An app loads the same web and H5 pages that you integrate in Web and H5 integration, so the client-side and server-side integration is identical. The Integration Method value and the app-side deployment are specific to the app path.

  1. When you create the verification scenario, set Integration Method to Webview+H5 (Supports apps and mini-programs).

  2. Complete the client-side and server-side integration described in steps 2 and 3 of Web and H5 integration. Step 1 of that section does not apply to the app path: keep Integration Method set to the value in the preceding step.

  3. Deploy the integrated business pages in your app:

WeChat mini program integration

  1. When you create the verification scenario, set Integration Method to Webview+H5 (Supports apps and mini-programs) or WeChat Mini Program Native Plugin.

  2. Integrate the CAPTCHA initialization code into the WeChat mini program pages that use the verification feature. For instructions, see Mini Program integration.

Verify the integration

Run the following four checks after you complete any of the three integration paths. Each check builds on the previous one, so run them in order.

Check 1: The business client initializes the CAPTCHA

After the integration configuration is complete, open the browser console on the page into which the CAPTCHA is integrated and view the Network information. Client-side integration is successful if all of the following items exist:

  • The initialization request.

  • CAPTCHA-related information in the Preview of the initialization request, with Success set to true.

  • The CAPTCHA resources.

The following example shows the response of an initialization request in which Success is true:

{
    "CaptchaType": "TRACELESS",
    "CertifyId": "3c6a84ac-xxx-xxx-xxx-xxx",
    "Code": "Success",
    "Message": "success",
    "StaticPath": "1.0.0/80c3280184eb1b98210a",
    "Success": true
}

Check 2: The business client verification succeeds

After a verification request is sent, open the browser console on the page into which the CAPTCHA is integrated and view the Network information. The verification is successful if VerifyResult is true.

The response of the client verification request also carries certifyId and securityToken, which distinguishes it from the server-side response in Check 3:

{
  "Code": "Success",
  "HttpStatusCode": 200,
  "Message": "success",
  "RequestId": "Exxxx...xxxx3",
  "Result": {
    "VerifyCode": "T001",
    "VerifyResult": true,
    "certifyId": "8JkVwuU1a2",
    "securityToken": "6o..."
  },
  "Success": true
}
Note

The initialization response in Check 1 returns CertifyId at the top level, whereas the client verification response returns certifyId inside Result. The two fields belong to different responses.

Check 3: The business server integration succeeds

After client-side integration succeeds, the client sends the verification parameter CaptchaVerifyParam to the business server over the business API. The business server then calls the VerifyIntelligentCaptcha operation of the CAPTCHA server, which returns the verification result.

View the verification result in the response of the VerifyIntelligentCaptcha operation. Server-side integration is successful if VerifyResult is true.

{
    "RequestId": "C******-B***-4***-A***-5*******1",
    "Message": "success",
    "HttpStatusCode": 200,
    "Code": "Success",
    "Success": true,
    "Result": {
        "VerifyCode": "T001",
        "VerifyResult": true
    }
}

Check 4: The CAPTCHA works as expected for users

After server-side integration succeeds, the business result and the CAPTCHA result are returned to the client, and the client processes the business logic based on the returned results. Complete the CAPTCHA on the client to test the verification effect:

  • Slider, jigsaw, click-to-pass, and image restore — The verification is successful if Verification Passed is displayed after you complete the verification as prompted.

  • No-CAPTCHA verification — The verification is successful if the business interaction succeeds. In a logon scenario, for example, the verification is successful if Logon Successful is displayed after you enter your username and password and log on.

Step 4: Publish the CAPTCHA integration

After the four verification checks pass, you can publish the CAPTCHA integration.

How V3 verification works

The following sequence diagrams show how the business client, the business server, and the CAPTCHA server interact during V3 verification. Read them to understand what each verification type requires from your code.

Slider, jigsaw, click-to-pass, and image restore

The following sequence diagram shows the verification flow for slider, jigsaw, click-to-pass, and image restore verification.

image

The diagram describes the following sequence:

  1. A user initializes the CAPTCHA on the business client. The business client requests the JS resources of the CAPTCHA, such as images or challenges, from the CAPTCHA server.

  2. The CAPTCHA server dynamically returns the relevant JS resources. The business client loads the resources and renders the CAPTCHA.

  3. The user completes the CAPTCHA interaction on the business client, such as a slider, jigsaw, or image restore challenge. The JS automatically sends an answer verification request. The CAPTCHA server verifies whether the answer is correct and whether the request comes from a bot.

  4. If the verification passes, the CAPTCHA server calls the success callback function and returns CaptchaVerifyParam. If the verification fails, the CAPTCHA is automatically refreshed and the user verifies again.

  5. The business client sends a request that carries the business parameters and CaptchaVerifyParam to the business server for parameter validation.

  6. The business server calls the VerifyIntelligentCaptcha operation of the CAPTCHA server to validate the CaptchaVerifyParam parameter.

  7. The CAPTCHA server verifies whether the parameter is correct and whether the request comes from a bot, and then returns the verification result.

  8. The business server processes the business logic based on the verification result, and then returns the verification result and the business result to the client web page.

No-CAPTCHA verification

The following sequence diagram shows the verification flow for no-CAPTCHA verification, including the secondary verification branch.

image

The diagram describes the following sequence:

  1. A user initializes the CAPTCHA on the business client. The business client requests the JS resources of the CAPTCHA, such as images or challenges, from the CAPTCHA server.

  2. The CAPTCHA server dynamically returns the relevant JS resources.

  3. The first time the user clicks the trigger button on the business client to initiate verification, the CAPTCHA server verifies whether the user is a trusted user.

  4. The CAPTCHA server returns the verification result to the business client:

    • If the user poses no risk, the first verification passes. The success callback function is called to return CaptchaVerifyParam for the subsequent business signature verification.

    • If the user poses a risk, the first verification is considered suspicious and a secondary verification is performed.

  5. For a secondary verification, the business client loads the JS resources and renders the CAPTCHA. After the user completes the CAPTCHA interaction on the business client, such as a slider, jigsaw, or image restore challenge, the JS automatically sends an answer verification request. The CAPTCHA server verifies whether the answer is correct and whether the request comes from a bot.

  6. If the secondary verification passes, the success callback function is called to return CaptchaVerifyParam for the subsequent business signature verification. If the secondary verification fails, the business client automatically refreshes the CAPTCHA and the user verifies again.

  7. The business client sends a request that carries the business parameters and CaptchaVerifyParam to the business server for parameter validation.

  8. The business server calls the VerifyIntelligentCaptcha operation of the CAPTCHA server to validate the CaptchaVerifyParam parameter.

  9. The CAPTCHA server verifies whether the parameter is correct and whether the request comes from a bot, and then returns the verification result.

  10. The business server processes the business logic based on the verification result, and then returns the verification result and the business result to the client web page.

Next steps

The following operations are optional after the integration configuration is complete:

  • View statistical data — View the verification data of your scenarios on the View statistical data page.

  • Check or extend your plan — In the right-side panel of the Overview page, view your current edition, such as Pay-as-you-go, and the number of remaining days. To make an additional purchase, click Subscribe or Purchase Resource Package and complete the purchase.