Handling Cloudflare Turnstile in AI Browser Agents
Описание и применение
Автоматические браузерные агенты, работающие в headless‑режиме, сталкиваются с Cloudflare Turnstile, который требует токен, недоступный в обычных условиях. Решение: получить токен через API Peak, вставить его в скрытое поле и вызвать callback, после чего агент продолжает работу.
Задача
AI browser agents stall when encountering Cloudflare Turnstile because the widget requires a valid token that headless browsers on cloud IPs cannot obtain.
Результат
Agents can bypass Turnstile without complex fingerprinting by programmatically obtaining and injecting a valid token, reducing maintenance and token costs.
Рабочий процесс
- 1. Extract the Turnstile sitekey from the page’s data-sitekey attribute.
- 2. POST to https://api.peak.fo/solve with task_type "turnstiletaskproxyless", the page URL, and the sitekey to receive a token.
- 3. Inject the returned token into all cf-turnstile-response fields and invoke the widget’s callback (from data-callback or window.turnstile).
Доказательства
Turnstile writes a value into a hidden input named cf-turnstile-response and fires a JavaScript callback once it's satisfied.
One POST to https://api.peak.fo/solve with your API key in the header.
Writing the token into the hidden input isn’t always enough on its own. Plenty of integrations wait for Turnstile’s callback before they enable the submit button or kick off the request.
- Дата записи: 2026-10-13T08:41:21.160Z