reCAPTCHA
Why reCAPTCHA tokens expire and how to time them
A reCAPTCHA token is a short lived, single use pass. Most "invalid token" errors in automation are timing errors, and they disappear once solves are scheduled around the moment of use.
The two rules
Google's documentation for reCAPTCHA is clear on two points. A token is valid for two minutes after it is issued. And each token can be verified only once; a second verification attempt fails with a duplicate error. Both rules apply to v2 checkbox, v2 invisible, v3 and the Enterprise variants alike.
The design is deliberate. A short lifetime limits the value of a stolen or harvested token: it cannot be stockpiled and used later in bulk. Single use stops one pass from covering many requests. For a site owner these are cheap, strong protections. For automation they mean that a CAPTCHA token behaves like a ticket with a printed time, not like a key you can keep in a drawer.
How expiry shows up
You will rarely see the word "expired". Sites translate Google's verification failures into their own messages, and they usually do not say which rule was broken. Typical symptoms:
- A form re-renders with "Please complete the CAPTCHA" although your request carried a token.
- An API answers 400 or 403 with a generic "verification failed" body.
- The first request in a batch succeeds and later ones fail, because they reused the first token.
- Failures cluster in runs where the script did something slow between solve and submit, such as waiting for a page or a database.
Inside the verification response the site receives error codes such as timeout-or-duplicate, which covers both rules at once. You do not see that response, so log your own timestamps instead. If the gap between the moment the token arrived and the moment it was sent is close to or above two minutes, you have your answer.
Where the time goes
It helps to think of the two minute window as a budget that starts the instant the token is issued, which is just before the API reports the task as ready. From then on, everything your code does eats into it:
- The polling delay: up to three seconds if the task became ready right after your last poll.
- Your own processing: parsing, logging, writing to a queue.
- Browser work: navigating, filling fields, waiting for scripts.
- Network time to the target site and its own processing before it verifies.
Usually this adds up to a few seconds and nothing goes wrong. Trouble starts when the solve is placed at the wrong point in the flow: before a slow login step, before a page that loads for twenty seconds, or in a separate stage of a pipeline that hands tokens to workers through a queue.
Solve right before submit
The dependable rule is simple: request the token as the last step before the request that uses it. Fill every field first, run every navigation first, then solve, then submit. In code, that means the solve call sits immediately above the submit call, with nothing slow in between.
This sounds obvious, but scripts drift. Someone adds a screenshot step, a retry around a flaky field, or a log upload, and the gap grows. Write the order down as a comment next to the solve call and keep it there.
Do not prefetch into a pool
A common idea for speeding up high volume jobs is to solve tokens in advance and keep a pool ready. With reCAPTCHA this mostly backfires. A token taken from the pool may already be a minute old, and a slow step later pushes it over the line. The pool also wastes money: every token that expires unused was still a solved task, and solved tasks are charged.
If waiting for a solve is the bottleneck, overlap instead of prefetching. Start the solve for a given form as soon as you know its parameters, run the rest of that form's preparation in parallel, and submit when both are done. Many tasks can run at once, since there is no limit on concurrent tasks, so a batch job can have dozens of solves in flight with each token tied to exactly one submit. A reCAPTCHA v2 token typically arrives under 9 seconds, which is usually shorter than the page work it overlaps with.
A timing guard in code
Add a tiny check that refuses to use a token that is too old, and solves again instead. It turns a silent site side failure into a clear, cheap retry on your side.
import time
TOKEN_BUDGET_S = 100 # stay well inside the two minute window
class FreshToken:
def __init__(self, value: str):
self.value = value
self.born = time.monotonic()
def usable(self) -> bool:
return time.monotonic() - self.born < TOKEN_BUDGET_S
def submit_with_fresh_token(get_token, send):
tok = FreshToken(get_token())
if not tok.usable():
tok = FreshToken(get_token())
return send(tok.value)
The budget of 100 seconds leaves room for network time to the site and its own verification. The clock starts when your code receives the token, which is slightly after Google issued it, so do not cut the margin much finer.
Single use in practice
The second rule catches people in subtler ways than expiry:
- Retries. A failed submit retried with the same token will fail again even if the first failure had nothing to do with the CAPTCHA. Solve again for each attempt.
- Two step forms. A form that validates on the server and then submits sends two requests. If both carry the token, the second fails. Check which request actually verifies.
- Parallel workers. Sharing a token object between threads leads to double use. Keep each token local to the request it was made for.
- Front end double clicks. In a browser flow, clicking submit twice can send the token twice. Wait for navigation or a response before acting again.
v3 has its own timing twist
Some v3 pages call grecaptcha.execute on load and store the result in a hidden field, then refresh it on a timer, often every 90 seconds or so, to keep a fresh token ready for the form. If you fill that field yourself, do it right before submit and stop the page's refresh from overwriting it, or simply submit within a few seconds of filling. The guide on solving reCAPTCHA v3 in Python shows how to send the token with the page's own request instead, which avoids the race.
Cost and failure handling
Timing mistakes are expensive in a quiet way, because the API did its job: the task was solved and charged, and the site refused it later. Tasks that fail or time out on our side are free, but a token wasted by a slow script is not. That is another reason to keep solves next to submits and to avoid pools. Track the share of submits rejected by the site separately from API errors; if it rises, look at timing first.
Checklist
- Solve after all slow steps and immediately before the request that verifies.
- Use each token once, for one request, then discard it.
- Guard with a budget well under two minutes, and solve again when exceeded.
- Overlap solving with page work instead of keeping a token pool.
- Log solve time and submit time for each token so drift is visible.
More on token lifetimes for other widgets is in the help article on how long a token stays valid, and the reCAPTCHA v2 page has the task reference.
Common questions
How long is a reCAPTCHA token valid?
About two minutes from when it is issued, according to Google's documentation. After that the site's verification fails.
Can I reuse a token for a retry?
No. Each token can be verified once. Solve a new task for every attempt that needs a token.
Is it worth keeping a pool of pre-solved tokens?
Usually not. Tokens expire in the pool and you still pay for them. Overlap solving with page work instead.
Am I charged for a token that expired before I used it?
It is, as long as the task was solved; only failed, unsolvable and timed out tasks are free, so keep solves close to use.
Does the same expiry apply to v3 and Enterprise?
Yes. All reCAPTCHA variants use short lived, single use tokens.
Keep reading
- CAPTCHA tokenThe signed string a widget returns after a pass, how long it lives, and how site servers check it.
- How long does a CAPTCHA token stay valid?Token lifetimes are short and set by the vendor: about two minutes for reCAPTCHA, a few minutes for Turnstile.
- Can one CAPTCHA token be used twice?Token answers are single use by design; the vendor marks them spent at the first server check, so reuse fails.
- reCAPTCHA v2 solver$0.56 per 1,000 tasks, answers under 9 seconds.