{"id":27976,"date":"2026-11-15T04:47:53","date_gmt":"2026-11-15T04:47:53","guid":{"rendered":"https:\/\/capskip.com\/?p=27976"},"modified":"2026-11-15T04:47:53","modified_gmt":"2026-11-15T04:47:53","slug":"cf-turnstile-response-required","status":"publish","type":"post","link":"https:\/\/capskip.com\/zh\/cf-turnstile-response-required\/","title":{"rendered":"\u4fee\u590d\uff1acf-turnstile-response \u5b57\u6bb5\u4e3a\u5fc5\u586b\u7684\u9519\u8bef"},"content":{"rendered":"<p>The message &quot;The cf-turnstile-response field is required&quot; comes from the site&#8217;s own form validation, and it means the form post arrived with no field of that name, or an empty one. The fix depends on who sent the form. In a browser, the Turnstile widget didn&#8217;t produce a token. In your own script, nobody asked for one. This guide shows both causes, then fixes the script case in Python with a token from CapSkip.<\/p>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">What the message means<\/h2>\n<p>It is not a Cloudflare error. Validation layers such as the one in Laravel build this sentence from the field name, in the pattern &quot;The :attribute field is required&quot;, so the name inside the message is the name the server looked for and didn&#8217;t find. The check runs before the server calls Cloudflare at all. When a server does call the Cloudflare <a href=\"https:\/\/developers.cloudflare.com\/turnstile\/get-started\/server-side-validation\/\" rel=\"noopener nofollow\" target=\"_blank\">siteverify endpoint<\/a> with no response value, Cloudflare answers with its own code, missing-input-response, which is a different message.<\/p>\n<p>The Cloudflare <a href=\"https:\/\/developers.cloudflare.com\/turnstile\/get-started\/client-side-rendering\/\" rel=\"noopener nofollow\" target=\"_blank\">widget documentation<\/a> says an invisible input named cf-turnstile-response is created for a widget placed inside a form, and that it travels with the other fields. So the field only exists after the widget has run and produced a token.<\/p>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">Why the field is missing<\/h2>\n<table>\n<thead>\n<tr>\n<th>Cause<\/th>\n<th>How to tell<\/th>\n<th>Fix<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>The widget never rendered<\/td>\n<td>No Turnstile box on the page, and a blocked request for the widget script in the browser&#8217;s network tab<\/td>\n<td>Allow the script, and load it from the exact URL Cloudflare gives, because Cloudflare says a proxied or cached copy breaks on updates<\/td>\n<\/tr>\n<tr>\n<td>The widget sits outside the form<\/td>\n<td>The box shows, but the hidden input is not inside the form element<\/td>\n<td>Move the widget into the form, or copy the token into a field yourself<\/td>\n<\/tr>\n<tr>\n<td>The form was sent before the widget finished<\/td>\n<td>The error shows up only when the visitor submits at once, and a second try works<\/td>\n<td>Disable the submit button until the widget has produced its token<\/td>\n<\/tr>\n<tr>\n<td>The field has another name<\/td>\n<td>The message names a different field, or the page sets a custom response field name<\/td>\n<td>Send the name the message shows. Cloudflare documents a response-field-name option whose default is cf-turnstile-response<\/td>\n<\/tr>\n<tr>\n<td>The widget&#8217;s response field is turned off<\/td>\n<td>The box shows, but the form has no input named cf-turnstile-response, and the page sets data-response-field to false<\/td>\n<td>Remove that setting, or read the token from the widget callback and put it in a field yourself<\/td>\n<\/tr>\n<tr>\n<td>A script submits the form<\/td>\n<td>No browser is involved, and the submission carries only your own fields<\/td>\n<td>Get a token and send it, which is the rest of this guide<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The last row is the one you can fix in code, and the message helps with the field name: it prints the name the server wants, so copy it exactly. The &quot;how to tell&quot; column is my reading of how the widget behaves. Cloudflare documents the hidden input, the response-field and response-field-name options, and the rule about the script URL.<\/p>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">What you need<\/h2>\n<ul>\n<li>A Windows PC with CapSkip running. The <a href=\"https:\/\/capskip.com\/cloudflare-turnstile-solver\/\">Cloudflare Turnstile solver<\/a> page lists the widget request: a sitekey and the page address.<\/li>\n<li>Python 3.10 or newer, which is the floor declared by capskip 1.7.0, plus requests. The first line of the first block shows the pip command that installs both. I ran the blocks on Python 3.11.7, 3.13.7 and 3.14.0 with capskip 1.7.0 and requests 2.34.2.<\/li>\n<li>A form you are allowed to submit to. The sample uses the placeholder address https:\/\/example.com\/contact, a form with a hidden CSRF field named _token, an email field and a message field.<\/li>\n<li>For a script on another machine, switch CapSkip to Server mode and pass that PC&#8217;s address as host. The setup guide describes the switch under <a href=\"https:\/\/capskip.com\/setup-guide\/#connection-settings\">connection settings<\/a>. Starting Server mode makes CapSkip accept connections from any address. To keep the port for the machines you trust, add a Windows Firewall block rule for the rest.<\/li>\n<\/ul>\n<p>I ran everything against two mocks I wrote: one plays CapSkip, one plays a form site. The mock site refuses a form submission without the field and prints the message from this post. Every rule on it is mine, and I sent no task to the real CapSkip app, so nothing here shows that a real site accepts a token.<\/p>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">Step 1: set up the session<\/h2>\n<p>Save the first block as turnstile_form.py. The two blocks after it go at the end of the same file. The helper named read_input reads a hidden input, and send_form posts your fields. It sets the Referer header to the form page, as a browser would, because requests sends none by itself.<\/p>\n<div data-no-translation>\n<pre data-enlighter-language=\"python\" class=\"EnlighterJSRAW\"># python -m pip install capskip requests\nimport re\n\nimport requests\nfrom capskip import CapSkip\n\nFORM_URL = &quot;https:\/\/example.com\/contact&quot;  # the page that shows the form\n\n# Local mode. In Server mode, use your server's address as the host.\nsolver = CapSkip(host=&quot;127.0.0.1&quot;, port=8080)\n\n\ndef read_input(html, name):\n    tag = re.search(r'&lt;input[^&gt;]*name=&quot;' + re.escape(name) + r'&quot;[^&gt;]*&gt;', html)\n    value = re.search(r'value=&quot;([^&quot;]*)&quot;', tag.group(0)) if tag else None\n    return value.group(1) if value else None\n\n\ndef open_form():\n    session = requests.Session()  # keeps the session cookie\n    return session, session.get(FORM_URL, timeout=30).text\n\n\ndef send_form(session, html, extra):\n    fields = {&quot;_token&quot;: read_input(html, &quot;_token&quot;), &quot;email&quot;: &quot;you@example.com&quot;, &quot;message&quot;: &quot;Hello&quot;}\n    fields.update(extra)\n    return session.post(FORM_URL, data=fields, headers={&quot;Referer&quot;: FORM_URL}, timeout=30)<\/pre>\n<\/div>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">Step 2: reproduce the error<\/h2>\n<p>Post the form the way a script usually first does, with your own fields and nothing else. Add this block next. Against my mock the reply was status 200 with the page shown again and the message in its error list. Your site may redirect or answer 422, so look for the sentence in the body.<\/p>\n<div data-no-translation>\n<pre data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">session, html = open_form()\nreply = send_form(session, html, {})  # no cf-turnstile-response at all\nprint(reply.status_code, re.findall(r&quot;&lt;li&gt;(.*?)&lt;\/li&gt;&quot;, reply.text))\n# 200 ['The cf-turnstile-response field is required.']<\/pre>\n<\/div>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">Step 3: fix it with a token from CapSkip<\/h2>\n<p>Read the sitekey from the widget&#8217;s data-sitekey attribute, ask CapSkip for a token with the turnstile method of the solver, and send the code value of the result under the exact field name. The CapSkip API docs say the solver uses a specific browser User-Agent for Turnstile and that you must send the same one with the token, and that the answer includes it. The block copies it onto the session when it is there. My mock returned one, and I haven&#8217;t seen what the real app returns for a widget.<\/p>\n<p>A token works once. Cloudflare says each token is valid for 300 seconds and meant for a single use, so request it just before the form post, not at the top of a long script. If the sitekey is not in a data-sitekey attribute because the page calls the render function instead, copy it from that call once.<\/p>\n<div data-no-translation>\n<pre data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">session, html = open_form()\nsitekey = re.search(r'data-sitekey=&quot;([^&quot;]+)&quot;', html).group(1)\n\nresult = solver.turnstile(sitekey, FORM_URL)\nif result.get(&quot;userAgent&quot;):  # the docs say the answer names the browser to present\n    session.headers[&quot;User-Agent&quot;] = result[&quot;userAgent&quot;]\n\nreply = send_form(session, html, {&quot;cf-turnstile-response&quot;: result[&quot;code&quot;]})\nprint(reply.status_code, re.findall(r&quot;&lt;p&gt;(.*?)&lt;\/p&gt;&quot;, reply.text))\n# 200 ['Message sent. Thank you.']  (your site's success text will differ)<\/pre>\n<\/div>\n<p>Against the mock, all three Python versions gave these results:<\/p>\n<table>\n<thead>\n<tr>\n<th>Mock setting<\/th>\n<th>What happened<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Step 2, no field sent<\/td>\n<td>The message appeared and the CapSkip mock received no task<\/td>\n<\/tr>\n<tr>\n<td>Step 3, token sent under the right name<\/td>\n<td>One task, the form post was accepted<\/td>\n<\/tr>\n<tr>\n<td>The site expects another field name<\/td>\n<td>The message named that other field, and sending the token under it was accepted<\/td>\n<\/tr>\n<tr>\n<td>Token sent a second time<\/td>\n<td>A different message, &quot;The captcha could not be verified&quot;, so the field was present but the token was spent<\/td>\n<\/tr>\n<tr>\n<td>Field sent with an empty value<\/td>\n<td>The same required message, so an empty field counts as missing<\/td>\n<\/tr>\n<tr>\n<td>Mock set to check the User-Agent<\/td>\n<td>Token sent without copying the returned User-Agent was refused, and with the copy it was accepted<\/td>\n<\/tr>\n<tr>\n<td>Same token, no Referer header<\/td>\n<td>403 from the mock, whose own rule is to require a same-origin Referer<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Read the table as a test of my mock. The message wording, the single use and the Referer rule are mine, and a real site decides for itself.<\/p>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">If the message stays after you add the token<\/h2>\n<ul>\n<li>A different message, such as one about failed verification, means the field arrived. Look at the token: used twice, older than five minutes, or requested for another page address.<\/li>\n<\/ul>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">FAQ<\/h2>\n<details style=\"border:1px solid #e2e5ee;border-radius:10px;padding:14px 18px;margin:0 0 12px;\">\n<summary style=\"cursor:pointer;\">\n<h3 style=\"font-size:1.15rem;line-height:1.4;display:inline;margin:0;\">Is the cf-turnstile-response required error a Cloudflare error?<\/h3>\n<\/summary>\n<p style=\"margin:12px 0 0;\">No. It is the site&#8217;s validation reporting a missing form field. Cloudflare only gets involved when the site sends a token to its verification endpoint.<\/p>\n<\/details>\n<details style=\"border:1px solid #e2e5ee;border-radius:10px;padding:14px 18px;margin:0 0 12px;\">\n<summary style=\"cursor:pointer;\">\n<h3 style=\"font-size:1.15rem;line-height:1.4;display:inline;margin:0;\">Does this apply to a Cloudflare challenge page?<\/h3>\n<\/summary>\n<p style=\"margin:12px 0 0;\">No. A full page challenge is not a form field. CapSkip answers it with a cookie, and the <a href=\"https:\/\/capskip.com\/api-docs\/\">API docs<\/a> describe that method separately. The PHP and Node.js guides show the two extra values a Turnstile challenge page needs. See <a href=\"https:\/\/capskip.com\/turnstile-php\/\">solving Turnstile in PHP<\/a> for how they are sent. The Node.js version is in <a href=\"https:\/\/capskip.com\/turnstile-nodejs\/\">solving Turnstile in Node.js<\/a>.<\/p>\n<\/details>\n<details style=\"border:1px solid #e2e5ee;border-radius:10px;padding:14px 18px;margin:0 0 12px;\">\n<summary style=\"cursor:pointer;\">\n<h3 style=\"font-size:1.15rem;line-height:1.4;display:inline;margin:0;\">Can the script run on a different machine from CapSkip?<\/h3>\n<\/summary>\n<p style=\"margin:12px 0 0;\">Yes, through Server mode. Pass the CapSkip PC&#8217;s address as host. The setup guide says a static public IP gives the most stable remote access for a server setup, and Server mode needs CapSkip to run as administrator. Your solver still runs on your own Windows hardware, with no per-solve billing.<\/p>\n<\/details>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">The short version<\/h2>\n<p>The error means the server saw no cf-turnstile-response value. In a browser, get the widget to render. In a script, ask for a token just before the form post and send it under the name the message shows. Because CapSkip is a <a href=\"https:\/\/capskip.com\/\">local captcha solver<\/a> that runs on your own PC, every retry costs no extra fee on a licensed copy. The <a href=\"https:\/\/capskip.com\/python-captcha-solver\/\">Python CAPTCHA solver page<\/a> lists the other SDK calls, and the <a href=\"https:\/\/capskip.com\/api-docs\/\">API docs<\/a> give the raw request.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u8868\u5355\u63d0\u4ea4\u5230\u8fbe\u65f6\u6ca1\u6709 Turnstile token\uff0c\u670d\u52a1\u5668\u5c31\u4f1a\u8bf4 cf-turnstile-response \u5b57\u6bb5\u4e3a\u5fc5\u586b\u3002\u8fd9\u91cc\u8bb2\u4e3a\u4ec0\u4e48\u4f1a\u8fd9\u6837\uff0c\u4ee5\u53ca Python \u7684\u4fee\u590d\u65b9\u6cd5\u3002<\/p>","protected":false},"author":1,"featured_media":27975,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"cf-turnstile-response Field Is Required: Fix | CapSkip","rank_math_description":"Seeing the cf-turnstile-response field is required error? Find out why your form post has no token, then fix it in Python with CapSkip and requests.","rank_math_focus_keyword":"cf-turnstile-response field is required","footnotes":""},"categories":[70],"tags":[],"class_list":["post-27976","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-captcha"],"_links":{"self":[{"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/posts\/27976","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/comments?post=27976"}],"version-history":[{"count":1,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/posts\/27976\/revisions"}],"predecessor-version":[{"id":28204,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/posts\/27976\/revisions\/28204"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/media\/27975"}],"wp:attachment":[{"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/media?parent=27976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/categories?post=27976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/tags?post=27976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}