Using Cookies
🍪 Note: The
cookiesparameter is optional but can improve solving performance in certain situations.
It is most useful for reCAPTCHA v2 when solving speed is slower than usual, or for reCAPTCHA v3 when low scores are observed.
Overview
CaptchaAI allows you to optionally send browser cookies along with your captcha task request.
These cookies simulate a real browsing session, which can help:
- Increase solving speed for reCAPTCHA v2
- Improve score quality for reCAPTCHA v3
- Handle geo-restricted or session-based captchas
However, cookies are not required and in many cases, CaptchaAI achieves excellent performance without them.
⚠️ Overusing the same cookie set may reduce success rate and solving speed. Use fresh cookies whenever possible.
When to Use Cookies
| Situation | Recommendation |
|---|---|
| reCAPTCHA v2 solving slower than average | ✅ Recommended |
| reCAPTCHA v3 returning low scores | ⚠️ Try cookies if your scores are below 0.3 |
| Normal image captcha | 🚫 Not applicable |
| When captcha site requires login/session cookies | ✅ Required (if site is authenticated) |
Parameter Description
| Parameter | Type | Required | Description |
|---|---|---|---|
cookies | JSON Array | No | List of cookie objects to simulate browser session. Each object must contain at least name, value, and domain. |
Example Cookie Structure
[
{
"name": "my-cookie-name-1",
"value": "my-cookie-val-1",
"domain": "example.com",
"hostOnly": true,
"path": "/",
"secure": true,
"httpOnly": false,
"session": false,
"expirationDate": 1665434653,
"sameSite": "Strict"
},
{
"name": "my-cookie-name-2",
"value": "my-cookie-val-2",
"domain": ".google.com",
"hostOnly": false,
"path": "/",
"secure": true,
"httpOnly": false,
"session": false,
"expirationDate": 1668015805,
"sameSite": "None"
}
]
Example 1 — reCAPTCHA v2 with Cookies
curl -X POST "https://ocr.captchaai.com/in.php" -H "Content-Type: multipart/form-data" -F 'key=YOUR_API_KEY_HERE' -F 'method=userrecaptcha' -F 'googlekey=RECAPTCHA_SITE_KEY_HERE' -F 'pageurl=https://example.com/login' -F 'cookies=[{"name":"SID","value":"ABCD1234","domain":".google.com"}]'
✅ Response:
OK|0123456789
Then poll for the result:
curl -X POST "https://ocr.captchaai.com/res.php" -F 'key=YOUR_API_KEY_HERE' -F 'action=get' -F 'id=0123456789'
Response example:
OK|0cAFcWeA7janiclS8wg67ZGc9aya1M-xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Exporting Cookies Quickly
You can export cookies from your browser in JSON format using an extension such as:
🧩 Get cookies.txt LOCALLY — available on the Chrome Web Store.
Simply perform a Google search or visit your target page, then export the cookies as JSON and include them in the API request.
Tips & Best Practices
- 🔁 Use fresh cookies for each batch of solves to avoid IP/session correlation.
- 🕵️ CaptchaAI never returns cookies in the solution; only the solved token is returned.
- ⚖️ CaptchaAI typically achieves 0.7–0.9 reCAPTCHA v3 scores without cookies — use them only when necessary.
- 🧠 Avoid using too many cookies or reusing stale ones, as this can lower accuracy.
- 🧰 Use cookies only when your captcha type or website truly requires a logged-in or session context.
Example Request with Cookies (JSON payload)
POST https://ocr.captchaai.com/in.php
Content-Type: application/json
{
"key": "YOUR_API_KEY",
"method": "userrecaptcha",
"googlekey": "6Le-xxxxxx",
"pageurl": "https://example.com/login",
"cookies": [
{
"name": "SID",
"value": "ABCD1234",
"domain": ".google.com",
"secure": true,
"httpOnly": false
}
],
"json": 1
}
✅ Response:
{
"status": 1,
"request": "0123456789"
}
Then poll:
GET https://ocr.captchaai.com/res.php?action=get&id=0123456789&key=YOUR_API_KEY&json=1
Summary
cookiesare optional and should be used only if necessary.- Recommended for low reCAPTCHA v3 scores or slow v2 solving.
- Provide cookies in JSON array format.
- Avoid reusing identical cookies repeatedly.