Docs / Guides
Quickstart
Send your first captcha task from PowerShell, Playwright, Puppeteer, Selenium or a browser extension — five steps from an API key to a solved captcha.
SurSolver is an HTTP API. You send the page URL and the parameters your code already reads from the page, and you get back the token, cookies or fields the page expects. There is nothing to install — no SDK, no browser extension, no plugin.
Five steps take you from an empty account to a solved captcha. Steps 1, 2, 4 and 5 are the same for everyone; step 3 is the code you paste. Pick the tool you will send with — the link jumps to that tool’s section in step 3:
Step 1: Create an account and an API key
- Sign up at sursolver.com. One account holds up to five prepaid keys.
- Open Dashboard → API keys and click Create key. Copy the key
when it appears: it is shown once and cannot be retrieved later. It looks like
sur_…; Change on the same page replaces it with a new one. - Top up the balance from the same dashboard. A task is charged when the API accepts it; Billing & packages explains what that means for failures.
The key travels in the request body as clientKey. The solver endpoints have no auth
header, so never put the key in a URL.
Step 2: Know what you are sending
POST /createTask takes one JSON object:
{
"clientKey": "sur_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"task": {
"type": "TurnstileTokenProxyLess",
"websiteURL": "https://example.com/login",
"websiteKey": "0x4AAAAAAA...",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36"
}
}
typepicks the solver; the example above solves Cloudflare Turnstile without a proxy.websiteURLis the page the captcha sits on.websiteKeyis the site key you can read from that page’s HTML.userAgentis required for every browser captcha: the User-Agent of the browser or HTTP client that will use the result. The solve runs with it, so send every later request with the same one. The result never returns a user agent.- Types that must run from your own IP take proxy fields as well — see Proxies.
The public catalog, GET /v1/task-types (no key needed), lists every type, the exact
field names it accepts and what its answer carries. The API stores your task object as sent.
Step 3: Send it with your tool
The call is the same everywhere; only the tool that makes it differs. Pick yours from the list at the top of this page — the sections below are in the same order.
REST API
Any language with an HTTP client works. This is the whole call from PowerShell.
-
Paste your key into the constant at the top so it stays out of your code:
$clientKey = 'sur_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' -
Create the task:
$task = @{ clientKey = $clientKey task = @{ type = 'TurnstileTokenProxyLess' websiteURL = 'https://example.com/login' websiteKey = '0x4AAAAAAA...' userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36' } } Invoke-RestMethod -Method Post -Uri 'https://api.sursolver.com/createTask' -ContentType 'application/json' -Body ($task | ConvertTo-Json -Depth 10) -
Read
taskIdfrom the reply and continue with step 4. The fields your type takes are inGET /v1/task-types.
Playwright
-
npm install playwright, then submit the task with Playwright’s own request context — no second HTTP library needed:const { request } = require('playwright'); const API_KEY = 'sur_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // `page` is the page that will submit the token: the solve runs with its user agent. async function createTask(page) { const api = await request.newContext(); const res = await api.post('https://api.sursolver.com/createTask', { data: { clientKey: API_KEY, task: { type: 'TurnstileTokenProxyLess', websiteURL: 'https://example.com/login', websiteKey: '0x4AAAAAAA...', userAgent: await page.evaluate(() => navigator.userAgent), }, }, }); if (!res.ok()) throw new Error(`HTTP ${res.status()}`); // transport failure return res.json(); // { errorId, taskId, status } } -
Once step 4 hands you the token, put it into the page and submit the form:
await page.evaluate((token) => { document.querySelector('input[name="cf-turnstile-response"]').value = token; }, solution.token); -
Got
taskId? Go to step 4. The fields your type takes are inGET /v1/task-types.
Puppeteer
-
Install Puppeteer and send the task with
fetch— Puppeteer drives the browser but has no HTTP client of its own:const API_KEY = 'sur_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // `page` is the page that will submit the token: the solve runs with its user agent. async function createTask(page) { const res = await fetch('https://api.sursolver.com/createTask', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ clientKey: API_KEY, task: { type: 'TurnstileTokenProxyLess', websiteURL: 'https://example.com/login', websiteKey: '0x4AAAAAAA...', userAgent: await page.evaluate(() => navigator.userAgent), }, }), }); if (!res.ok) throw new Error(`HTTP ${res.status}`); // transport failure return res.json(); // { errorId, taskId, status } } -
After step 4, hand the token to the open page:
await page.evaluate((token) => { document.querySelector('input[name="cf-turnstile-response"]').value = token; }, solution.token); -
Head to step 4 with the
taskId; the fields your type takes are inGET /v1/task-types.
Selenium
-
Send the task from the same Python process that drives the browser — Selenium has no HTTP client of its own, so use
requests:import requests API_KEY = "sur_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # The browser that will submit the token: the solve runs with its user agent. USER_AGENT = driver.execute_script("return navigator.userAgent") created = requests.post( "https://api.sursolver.com/createTask", json={ "clientKey": API_KEY, "task": { "type": "TurnstileTokenProxyLess", "websiteURL": "https://example.com/login", "websiteKey": "0x4AAAAAAA...", "userAgent": USER_AGENT, }, timeout=30, ) created.raise_for_status() # a non-200 reply is a transport failure task_id = created.json()["taskId"] -
Once step 4 returns the token, write it into the page:
driver.execute_script( "document.querySelector('input[name=\"cf-turnstile-response\"]').value = arguments[0];", solution["token"], ) -
Continue with step 4; the fields your type takes are in
GET /v1/task-types.
Browser extension
SurSolver ships no extension — the extension here is yours, and it calls the same API from its background service worker (Manifest V3).
-
Ask the service worker for a task when the toolbar button is clicked:
chrome.action.onClicked.addListener(async (tab) => { const { apiKey } = await chrome.storage.local.get('apiKey'); const res = await fetch('https://api.sursolver.com/createTask', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ clientKey: apiKey, task: { type: 'TurnstileTokenProxyLess', websiteURL: tab.url, websiteKey: '0x4AAAAAAA...', userAgent: navigator.userAgent, }, }); if (!res.ok) throw new Error(`HTTP ${res.status}`); // transport failure const { taskId } = await res.json(); // Poll getTaskResult (step 4) for that taskId, then inject the token below. });Reading
tab.urlneeds the"tabs"permission; the injection below needs"scripting"and the key is kept with"storage"— all three go inmanifest.json. -
After step 4, inject the token into the tab:
await chrome.scripting.executeScript({ target: { tabId: tab.id }, func: (token) => { document.querySelector('input[name="cf-turnstile-response"]').value = token; }, args: [solution.token], }); -
Continue with step 4. Keep the key in
chrome.storage.local, never in a content script, and remember that a key shipped inside a published extension is readable by everyone who installs it. The fields your type takes are inGET /v1/task-types.
Step 4: Poll for the answer
createTask returns a taskId immediately; the solver works in the background. Ask
POST /getTaskResult for that id — with the taskId from step 3:
$body = @{ clientKey = $clientKey; taskId = 'tsk_9c1f4e2a7b0d5e3f81a62c47' } | ConvertTo-Json -Depth 10
Invoke-RestMethod -Method Post -Uri 'https://api.sursolver.com/getTaskResult' -ContentType 'application/json' -Body $body
While the solver is working, the answer is:
{"errorId":0,"status":"processing"}
Poll every 3 seconds until status is ready; the solution object then carries what
the page expects:
{"errorId":0,"status":"ready","solution":{"token":"0.eUN4b21wbGVfLi4u"}}
Polling is not metered by the rate limits. Replies the API reports itself are HTTP 200:
check errorId, and on errorId: 1 stop polling and read errorCode and
errorDescription. A non-200 status or a body without errorId is a transport failure —
see Errors. Results stay readable for 30 minutes from creation; after that the
task answers ERROR_TASK_EXPIRED (see
Task lifecycle).
Step 5: Use the solution
solution carries the values the page needs: usually the token for the widget’s hidden
response field; for the cookie types the protection’s cookie under its own name (such as
cf_clearance, datadome or _abck) and cookies, an object of every returned cookie
name and value. Use it with
the same userAgent you sent in the task. Keep the solve’s exit IP for IP-bound types
such as Cloudflare Challenge, Vercel and Akamai SBSD; Akamai _abck, Kasada and Shape
can be replayed from your own IP.
POST /getBalance reports the cash balance of the key’s owner in USD:
{"errorId":0,"balance":9.987}
Complete runnable scripts in PowerShell, Python, Node.js and Playwright are at the bottom of this page, generated from the same source as every task page.
Where to go next
- Authentication — how the key authenticates and how it is rotated
- Task lifecycle — what happens between the two calls
- Errors — every error code and how to react
- API reference — the OpenAPI view of these three endpoints
A complete example
Every tab is generated from the same source as the examples in theAPI reference. The PowerShell, Python and Node.js tabs run against https://api.sursolver.com once your key and the fields for your site are in place (GET /v1/task-types lists them); the Playwright tab, where there is one, declares every setting as a constant at the top of the script.
$api = 'https://api.sursolver.com'
$key = 'sur_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
# 1/2 Create the task. API errors are HTTP 200 with errorId 1; a thrown request is a transport failure.
$task = @{
type = 'ReCaptchaV3TokenProxyLess'
websiteURL = 'https://example.com/login'
websiteKey = '6Le...'
userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36'
}
$request = @{ clientKey = $key; task = $task } | ConvertTo-Json -Depth 10
$created = Invoke-RestMethod -Method Post -Uri "$api/createTask" -ContentType 'application/json' -Body $request
if ($created.errorId -ne 0) { Write-Error $created.errorDescription; exit 1 }
# 2/2 Poll getTaskResult until the task is ready (60 tries, 3 s apart).
for ($attempt = 0; $attempt -lt 60; $attempt += 1) {
$poll = @{ clientKey = $key; taskId = $created.taskId } | ConvertTo-Json -Depth 10
$result = Invoke-RestMethod -Method Post -Uri "$api/getTaskResult" -ContentType 'application/json' -Body $poll
if ($result.errorId -ne 0) { Write-Error $result.errorDescription; exit 1 }
if ($result.status -eq 'ready') { $result.solution; exit 0 }
Start-Sleep -Seconds 3
}
Write-Error "task $($created.taskId) was not ready after 60 polls"
exit 1import time
import requests
CLIENT_KEY = "sur_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
API = "https://api.sursolver.com"
POLL_ATTEMPTS = 60
def call(path, body):
# API errors are HTTP 200 with errorId 1; anything else is a transport failure.
response = requests.post(f"{API}{path}", json=body, timeout=30)
response.raise_for_status()
data = response.json()
if data["errorId"] != 0:
raise RuntimeError(f'{data["errorCode"]}: {data["errorDescription"]}')
return data
def solve(task):
created = call("/createTask", {"clientKey": CLIENT_KEY, "task": task})
for _ in range(POLL_ATTEMPTS):
result = call("/getTaskResult", {"clientKey": CLIENT_KEY, "taskId": created["taskId"]})
if result["status"] == "ready":
return result["solution"]
time.sleep(3)
raise TimeoutError(f'task {created["taskId"]} was not ready in {POLL_ATTEMPTS} polls')
solution = solve({
"type": "ReCaptchaV3TokenProxyLess",
"websiteURL": "https://example.com/login",
"websiteKey": "6Le...",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36",
})
print(solution)const { setTimeout: sleep } = require('node:timers/promises');
const CLIENT_KEY = 'sur_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
const API = 'https://api.sursolver.com';
const POLL_ATTEMPTS = 60;
// API errors are HTTP 200 with errorId 1; anything else is a transport failure.
async function call(path, body) {
const res = await fetch(`${API}${path}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
if (data.errorId !== 0) throw new Error(`${data.errorCode}: ${data.errorDescription}`);
return data;
}
async function solve(task) {
const created = await call('/createTask', { clientKey: CLIENT_KEY, task });
for (let attempt = 0; attempt < POLL_ATTEMPTS; attempt += 1) {
const result = await call('/getTaskResult', {
clientKey: CLIENT_KEY,
taskId: created.taskId,
});
if (result.status === 'ready') return result.solution;
await sleep(3000);
}
throw new Error(`task ${created.taskId} was not ready in ${POLL_ATTEMPTS} polls`);
}
solve({
type: 'ReCaptchaV3TokenProxyLess',
websiteURL: 'https://example.com/login',
websiteKey: '6Le...',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36',
}).then(
(solution) => console.log(solution),
(error) => {
console.error(error);
process.exitCode = 1;
},
);// recaptcha-v3-playwright.js - solve reCAPTCHA v3 on the live page and submit the form with the
// token.
// Install: npm install playwright && npx playwright install chromium
// Run: node recaptcha-v3-playwright.js
const { chromium } = require('playwright');
const { setTimeout: sleep } = require('node:timers/promises');
// Your SurSolver API key.
const CLIENT_KEY = 'sur_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
// The page that renders the widget, with its path and query string.
const TARGET_URL = 'https://example.com/page';
// Optional, read from the page when empty: the render= value of the api.js or enterprise.js
// script URL.
const SITE_KEY = '';
// The action in the page's grecaptcha.execute(key, { action }) call.
const PAGE_ACTION = 'YOUR_PAGE_ACTION';
// Enterprise only: 0.3 or below answers fastest, higher runs a second execute.
const MIN_SCORE = undefined;
// The User-Agent the solve runs with; send the result with this same user agent.
const USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36';
// The control that submits the form.
const SUBMIT_SELECTOR = '.PASTE_SUBMIT_SELECTOR';
// A selector that matches only after the site accepted the result.
const SUCCESS_SELECTOR = '.PASTE_ACCEPTED_SELECTOR';
const API = 'https://api.sursolver.com';
const POLL_ATTEMPTS = 60;
// API errors are HTTP 200 with errorId 1; anything else is a transport failure.
async function call(path, body) {
const res = await fetch(`${API}${path}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
if (data.errorId !== 0) throw new Error(`${data.errorCode}: ${data.errorDescription}`);
return data;
}
async function solve(task) {
const created = await call('/createTask', { clientKey: CLIENT_KEY, task });
for (let attempt = 0; attempt < POLL_ATTEMPTS; attempt += 1) {
const result = await call('/getTaskResult', {
clientKey: CLIENT_KEY,
taskId: created.taskId,
});
if (result.status === 'ready') return result.solution;
await sleep(3000);
}
throw new Error(`task ${created.taskId} was not ready in ${POLL_ATTEMPTS} polls`);
}
// Optional task fields are sent only when they have a value.
function withoutEmpty(fields) {
return Object.fromEntries(
Object.entries(fields).filter(([, value]) => value !== undefined && value !== ''),
);
}
// A value the page did not show must be pasted into its constant at the top.
function need(name, value) {
if (value === undefined || value === null || value === '') {
throw new Error(`Could not read ${name} from the page; fill in the ${name} constant.`);
}
return value;
}
// Opens the page once and reads what the solve needs from it.
async function readPage(browser) {
const page = await browser.newPage({ userAgent: USER_AGENT });
try {
await page.goto(TARGET_URL, {
waitUntil: 'domcontentloaded',
timeout: 45000,
});
// The widget is often added after the page loads; give it a moment to appear.
await page
.waitForFunction(
() =>
!!(() => {
const src = [...document.scripts]
.map((script) => script.src)
.find((url) => /recaptcha\/(api|enterprise)\.js\?.*render=/.test(url));
const key = src ? new URL(src).searchParams.get('render') : null;
const fallback = document.querySelector('[data-sitekey]')?.dataset.sitekey;
return key && key !== 'explicit' ? key : fallback;
})(),
undefined,
{ timeout: 10000 },
)
.catch(() => undefined);
const dom = await page.evaluate(() => ({
websiteKey: (() => {
const src = [...document.scripts]
.map((script) => script.src)
.find((url) => /recaptcha\/(api|enterprise)\.js\?.*render=/.test(url));
const key = src ? new URL(src).searchParams.get('render') : null;
const fallback = document.querySelector('[data-sitekey]')?.dataset.sitekey;
return key && key !== 'explicit' ? key : fallback;
})(),
}));
return {
pageUrl: page.url(),
...dom,
};
} finally {
await page.close();
}
}
async function main() {
const browser = await chromium.launch();
try {
const found = await readPage(browser);
const solution = await solve({
type: 'ReCaptchaV3TokenProxyLess',
websiteURL: found.pageUrl,
websiteKey: need('websiteKey', SITE_KEY || found.websiteKey),
pageAction: PAGE_ACTION,
userAgent: USER_AGENT,
...withoutEmpty({
minScore: MIN_SCORE,
}),
});
// Submit from a fresh session with the user agent the solve ran with.
const context = await browser.newContext({ userAgent: USER_AGENT });
const page = await context.newPage();
await page.goto(found.pageUrl);
// reCAPTCHA defines execute() a moment after the page loads.
await page.waitForFunction(
() => typeof window.grecaptcha?.execute === 'function',
undefined,
{ timeout: 15000 },
);
const applied = await page.evaluate(
({ token }) => {
const api = window.grecaptcha;
if (!api || typeof api.execute !== 'function') return false;
// The page now receives the solved token wherever it calls execute().
api.execute = () => Promise.resolve(token);
for (const field of document.querySelectorAll('[name="g-recaptcha-response"]')) {
field.value = token;
}
return true;
},
{ token: solution.gRecaptchaResponse },
);
if (!applied) {
throw new Error('The page has no reCAPTCHA API; check how it requests the token.');
}
await page.click(SUBMIT_SELECTOR);
await page.locator(SUCCESS_SELECTOR).first().waitFor({ timeout: 15000 });
console.log('The site accepted the token.');
} finally {
await browser.close();
}
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});