Integrations

Power Automate + CaptchaAI: Microsoft Flow CAPTCHA Solving

Microsoft Power Automate (formerly Flow) automates business processes across the Microsoft ecosystem and hundreds of third-party services. When those workflows encounter CAPTCHA-protected web forms or APIs, CaptchaAI can solve them through Power Automate's HTTP connector.

This guide shows how to build a Power Automate flow that submits CAPTCHAs to CaptchaAI, polls for results, and uses the solved token to complete form submissions.

Real-World Scenario

Your finance team needs to automate data retrieval from a vendor portal that shows reCAPTCHA v2. Instead of manual intervention, a Power Automate flow:

  1. Receives the CAPTCHA parameters (sitekey, page URL)
  2. Sends them to CaptchaAI
  3. Waits for the solution
  4. Uses the token to authenticate and retrieve the data

Step 1: Create the Flow

In Power Automate, create an Instant cloud flow with a Manual trigger (or any trigger of your choice).

Add Input Parameters to the Trigger

Add two text inputs to the manual trigger:

  • sitekey — The reCAPTCHA v2 sitekey
  • pageurl — The URL of the page with the CAPTCHA

Step 2: Submit CAPTCHA Task

Add an HTTP action (Premium connector):

Setting Value
Method GET
URI https://ocr.captchaai.com/in.php

Queries:

Key Value
key Your CaptchaAI API key
method userrecaptcha
googlekey @{triggerBody()['text']} (sitekey input)
pageurl @{triggerBody()['text_1']} (pageurl input)
json 1

Parse the response: Add a Parse JSON action after the HTTP action:

Schema:

{
  "type": "object",
  "properties": {
    "status": { "type": "integer" },
    "request": { "type": "string" }
  }
}

Content: @{body('HTTP')}

Step 3: Validate Submit Response

Add a Condition action:

  • Condition: @{body('Parse_JSON')?['status']} is equal to 1

If No (submit failed):

  • Add a Terminate action with status "Failed" and message: Submit error: @{body('Parse_JSON')?['request']}

If Yes:

  • Continue to polling loop

Step 4: Build the Polling Loop

Inside the "If Yes" branch, add a Do until loop:

Loop condition: @{variables('solveStatus')} is not equal to pending

Before the loop, initialize two variables:

  • solveStatus (String) = pending
  • solvedToken (String) = empty

Inside the Do until loop, add these actions in sequence:

4a. Delay

Add a Delay action: 5 seconds.

4b. HTTP — Poll for Result

Setting Value
Method GET
URI https://ocr.captchaai.com/res.php

Queries:

Key Value
key Your CaptchaAI API key
action get
id @{body('Parse_JSON')?['request']}
json 1

4c. Parse JSON — Poll Response

Use the same schema as Step 2.

4d. Condition — Check Status

Condition: @{body('Parse_JSON_2')?['status']} is equal to 1

If Yes (solved):

  • Set variable solvedToken = @{body('Parse_JSON_2')?['request']}
  • Set variable solveStatus = solved

If No:

  • Add another condition: @{body('Parse_JSON_2')?['request']} is not equal to CAPCHA_NOT_READY
  • If true (error), set solveStatus = error
  • If false (still pending), do nothing (loop continues)

Set the Do until loop limit:

  • Count: 20 (maximum iterations)
  • Timeout: PT3M (3 minutes)

Step 5: Use the Solved Token

After the loop, add a Condition to check @{variables('solveStatus')}:

If equals "solved":

  • Use @{variables('solvedToken')} in an HTTP POST to submit the form
  • Or send it via email, Teams message, or any other connector

Example HTTP POST to submit a form:

Setting Value
Method POST
URI Target form URL
Body {"g-recaptcha-response": "@{variables('solvedToken')}", "other_field": "value"}

If not "solved":

  • Send an error notification via Teams or email

Complete Flow Structure

[Manual Trigger (sitekey, pageurl)]
    ↓
[Initialize Variables: solveStatus, solvedToken]
    ↓
[HTTP: Submit to CaptchaAI /in.php]
    ↓
[Parse JSON]
    ↓
[Condition: status = 1?]
    ↓ Yes
[Do Until: solveStatus ≠ pending]
    ├── [Delay: 5 seconds]
    ├── [HTTP: Poll CaptchaAI /res.php]
    ├── [Parse JSON]
    └── [Condition: Solved or Error?]
    ↓
[Condition: solveStatus = solved?]
    ↓ Yes
[HTTP: Submit form with token]
    ↓
[Compose: Success response]

Troubleshooting

Problem Cause Fix
HTTP connector not available Free plan doesn't include Premium connectors Upgrade to Power Automate Premium or use a custom connector
Parse JSON fails Response body is text, not JSON Ensure json=1 is in the query parameters
Loop runs indefinitely solveStatus variable not updated Check variable names match exactly in Set Variable actions
403 error from CaptchaAI IP restriction or wrong API key Verify API key; check if IP whitelisting is enabled on your account
Flow timeout Default 30-day timeout is fine, but individual actions timeout at 2 min The Do Until timeout (PT3M) handles this; increase if needed

FAQ

Does this require a Premium Power Automate license?

Yes, the HTTP connector is a Premium feature. If you're on a free plan, consider using a custom connector or routing through Azure Functions.

Can I solve other CAPTCHA types?

Yes. Change the method parameter to turnstile for Cloudflare Turnstile, or post for Image CAPTCHAs. Adjust the required parameters accordingly.

How do I store the API key securely?

Use Power Automate's Environment Variables or Azure Key Vault connector to avoid hardcoding the API key in the flow definition.

Can I trigger this flow from Power Apps?

Yes. Use the Power Automate connector in Power Apps to call this flow, passing sitekey and pageurl as parameters, and receiving the token back.

Next Steps

Add CAPTCHA solving to your Power Automate workflows — get your CaptchaAI API key and build the flow.

Related guides:

Full Working Code

Complete runnable examples for this article in Python, Node.js, PHP, Go, Java, C#, Ruby, Rust, Kotlin & Bash.

View on GitHub →

Discussions (0)

No comments yet.