hCaptcha solving for AI agents
An agent that cannot get past a challenge cannot finish the task. Expose one tool: sitekey and page URL in, token out. The agent submits the token and continues.
Steps
- When the agent sees an hCaptcha widget, have it extract the sitekey and the current URL.
- The tool calls POST /v1/solves and returns only the token, not the rest of the solve object.
- The agent writes that token into the page and submits. Mint the token immediately before submit — it expires in about two minutes.
tool
import os, requests def solve_hcaptcha(sitekey: str, url: str) -> str: """Return an hCaptcha token for this sitekey and page URL.""" res = requests.post( "https://api.vanishcaptcha.com/v1/solves", params={"wait": 90}, headers={"Authorization": f"Bearer {os.environ['VANISHCAPTCHA_KEY']}"}, json={"type": "hcaptcha", "sitekey": sitekey, "url": url}, timeout=120, ) res.raise_for_status() return res.json()["token"]
Enterprise rqdata
If the widget carries rqdata, send type: "hcaptcha_enterprise" and that value. The token that comes back is what the enterprise sitekey expects. Fields are in the API reference.
Questions
Does this solve reCAPTCHA or Turnstile?
No. These guides are hCaptcha only. reCAPTCHA and Turnstile are not live on VanishCaptcha.
How long is the token good for?
About two minutes, and it can be submitted once. Request it immediately before the form goes out.