Turnstile

Solves Cloudflare Turnstile in managed, non-interactive and invisible modes. Costs $0.80 per 1,000 tokens.

Task object

Send this as task in createTask.

TurnstileTask fields
FieldTypeDescription
type RequiredstringAlways TurnstileTask.
websiteURL RequiredstringThe full URL of the page where the widget appears.
websiteKey RequiredstringThe Turnstile site key. It starts with 0x.
action OptionalstringThe action value the site sets on the widget, if any.
cdata OptionalstringThe cData value the site sets on the widget, if any.
proxy OptionalstringOptional. Turnstile tasks work without a proxy.
JSON
{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "TurnstileTask",
    "websiteURL": "https://example.com/login",
    "websiteKey": "0x4AAAAAAABkMYinukE8nzY",
    "action": "login",
    "cdata": "session-7f3a"
  }
}

Finding the site key

Look in the page source for either of these:

  • A data-sitekey attribute on the cf-turnstile element.
  • A sitekey option passed to turnstile.render().

The same element or call holds data-action and data-cdata (or action and cData) when the site uses them. Send them exactly as they appear, or the site will reject the token.

Solution

Turnstile solution fields
FieldTypeDescription
token RequiredstringThe Turnstile response token.
JSON
{
  "errorId": 0,
  "status": "ready",
  "solution": {
    "token": "0.xK3fQ9...Lm2"
  }
}

Submitting the token

Most sites read the token from a form field named cf-turnstile-response. Put the token there and submit the form as usual.

<input type="hidden" name="cf-turnstile-response" value="TOKEN" />