# What a CAPTCHA is and what it asks of your scraper | Spider

A CAPTCHA is a test a site sets to tell people from programs. How to spot one in a response, what a 200 status can hide, and why a polite client stops.

Canonical: https://spider.cloud/learn/captcha/

A CAPTCHA is a test a website sets to decide whether the thing on the other end is a person or a program. When a site shows one to your client, it is asking the visitor to complete a check before going on. A client has no honest way to complete it, so the rule for a client is to stop and look at what came back.

The W3C describes the idea in its note on CAPTCHA accessibility. It says "All interactive approaches require users to perform a task believed to be relatively easy for humans but difficult for robots." The test can be a distorted word, a grid of pictures, a checkbox, or a check that runs in the background with nothing on screen. What they share is that the site, and not the client, decides whether you pass.

## What a challenge asks of a client

Two things follow for anyone who writes a scraper.

First, a challenge page is not the page you asked for. It has a different purpose and different text, and nothing in it is the data you wanted. If your parser reads it as the product page, you will save the wrong thing.

Second, the check asks the visitor to show they are a person, and a program cannot do that honestly. When a response makes a check the condition of getting the page, a well-behaved client stops there. It does not try to work out the puzzle. It records the address, moves on, and asks the owner for access if the data matters. Checking each response for this before it reaches your parser is part of [web scraping](/web-scraping/), and [web scraping ethics](/learn/ethics/) covers the questions to settle before a job.

There is a cost on the other side too. The W3C note adds that "Unfortunately the very nature of the interactive task inherently excludes many people with disabilities, resulting in a denial of service to these users." The same note also looks at newer checks that need no puzzle at all.

## How a challenge reaches you

A challenge does not always look like an error. Some sites answer with a 403 or a 429. Others answer 200 and put the widget in the page. The status code tells you whether the request went through. It does not tell you what the body holds. For the codes themselves, see [HTTP status codes](/learn/http-status-codes/).

A widget on a page is plain markup. Google's reCAPTCHA documentation says to add it with `g-recaptcha` and a site key, and it lists a callback option described as "Optional. The name of your callback function, executed when the user submits a successful response." The markers a client can look for follow from that: an element with the class `g-recaptcha`, a `data-sitekey` attribute, and a script loaded from a `/recaptcha/` address.

## A request to a demo page

Google publishes a demo page for reCAPTCHA, so it is meant to be read. This request fetches that page once, as one client that names itself, and looks only at the status and the body.

```bash
curl -s https://api.spider.cloud/scrape \
  -H "Authorization: Bearer $SPIDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.google.com/recaptcha/api2/demo", "request": "http", "return_format": "raw", "user_agent": "examplebot/1.0 (+https://example.com/bot; bot@example.com)"}'
```

One call on 2026-11-21 at 19:43 UTC, 1.4 seconds long, is the whole run. The answer is a JSON array with one object. The page status was 200 and `error` was null. The `content` field held the page's HTML. These are exact pieces of it, with the JSON escapes removed and the text between them left out.

```text
url: https://www.google.com/recaptcha/api2/demo
status: 200
<title>ReCAPTCHA demo</title>
<script src='/recaptcha/api.js' async defer nonce="jhbRs70MmD9nXQFgVIJfww"></script>
<legend>Sample Form with ReCAPTCHA</legend>
<div id="recaptcha-demo" class="g-recaptcha" data-sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-" data-callback="onSuccess" data-action="action"></div>
```

The status says 200, so the request went through and the demo page loaded. The body shows what the page holds: a title with the word ReCAPTCHA in it, a script from `/recaptcha/api.js`, and a `g-recaptcha` element with a `data-sitekey` attribute. Here that is a sample form with a widget on it, which is what the page is for. The run stopped there, with one request and nothing sent back to the widget.

A marker means look at the response. It does not mean stop on its own, because a page can carry a widget on a form and still serve the content you asked for. Stop when the response shows a challenge in place of that content, or makes completing one the condition of getting it.

The run shows one page. It does not show how a site that serves a challenge to a script behaves, and it does not show what each site uses. The markers above belong to one product. Others use other words, so keep your list of markers and a note of where each came from.

## What to do when you see one

Check the body for challenge markers before you parse it. When one turns up, read what the page offers. If the response shows a challenge in place of the content you asked for, or makes completing one the condition of getting it, mark that address as not fetched, write down the status and the marker you saw, and leave it. Do not retry the same address on a loop, because each retry is another visit the site has already declined.

Then look for a way the site wants you to come in. Some publish a feed, a sitemap, a data export or an API. A short message to the owner that says who you are, what you read and how often is also worth sending. Your robots.txt reading and your identifying header are covered in [robots.txt](/learn/robots-txt/) and [identify your crawler](/learn/identify-your-crawler/). A 429 with the content and no challenge is a different case. It asks you to slow down, and [rate limits](/learn/rate-limits/) covers the wait. A 429 that serves a challenge in place of the content still means stop and ask for access.

## Do this, avoid this

### Do this

- Search each body for challenge markers such as a g-recaptcha element or a challenge script before you parse it.
- When the challenge takes the place of the content, log the address, the status and the marker, then skip that address.
- Keep a list of the pages that showed a challenge, so a later run does not ask again.
- Write to the site owner, or look for the feed, export or API they offer.
- Take a 200 status as the start of the check and the body as the end of it.

### Avoid this

- Saving a challenge page as if it were the content you asked for.
- Retrying an address in a loop after it showed a challenge.
- Sending the puzzle to a person or a service to solve on your client's behalf.
- Skipping the body check because the status was 200.

## Read the body, then decide

The demo run shows how little it takes to see one. A 200, a title and a `g-recaptcha` element all sat in one response. Markers alone mean read on. If your pages come back with a challenge where the content should be, the next step is a message to the owner, and [web scraping ethics](/learn/ethics/) lists what to put in it. This page is not legal advice.

## Sources

1. [W3C, Inaccessibility of CAPTCHA, Group Draft Note, December 2021](https://www.w3.org/TR/turingtest/) Read November 21, 2026
2. [Google for Developers, reCAPTCHA v2](https://developers.google.com/recaptcha/docs/display) Read November 21, 2026
