getTaskResult
Poll for task status and retrieve the solution.
Poll a task until it is ready or failed. Returns the current status and, when complete, the solution.
/getTaskResultAuthentication
Pass your AnySolver API key as clientKey in the JSON body. Send Content-Type: application/json.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
clientKey* | string | Yes | Your API key. Create one in the AnySolver dashboard. |
taskId* | string | Yes | Unique identifier returned when the task was created. |
Example
{ "clientKey": "YOUR_API_KEY", "taskId": "01KFNDF328KAN2AJ3BNHCQYE88"}curl -X POST https://api.anysolver.com/getTaskResult \ -H 'Content-Type: application/json' \ -d '{"clientKey":"YOUR_API_KEY","taskId":"01KFNDF328KAN2AJ3BNHCQYE88"}'const res = await fetch('https://api.anysolver.com/getTaskResult', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ "clientKey": "YOUR_API_KEY", "taskId": "01KFNDF328KAN2AJ3BNHCQYE88"}),});const data = await res.json();import requestsres = requests.post( 'https://api.anysolver.com/getTaskResult', json={ "clientKey": "YOUR_API_KEY", "taskId": "01KFNDF328KAN2AJ3BNHCQYE88"},).json()Response body
See Error IDs for what each errorId value means.
| Field | Type | Required | Description |
|---|---|---|---|
status* | Yes | Task status: "processing", "ready", or "failed". Example: | |
errorId* | Yes | 0 = success, 1 = external error, 2 = internal error. Example: | |
taskId | string | No | Unique identifier returned when the task was created. Example: |
errorCode | No | Machine-readable error code. Example: | |
errorDescription | string | No | Human-readable error message with resolution hints. Example: |
cost | number | No | Actual cost charged for this task in USD. Example: |
taskType | No | The type of CAPTCHA task to solve. Example: | |
provider | No | Specific provider to use. If omitted, automatic routing selects the best provider. Example: |
Status values
| Status | Description |
|---|---|
| Processing | Task is queued or being solved by a provider. |
| Ready | Task completed successfully. Solution is available. |
| Failed | Task failed. Check errorCode for details. |
Examples
{ "status": "processing", "taskId": "01KFNDF328KAN2AJ3BNHCQYE88", "errorId": 0, "taskType": "ReCaptchaV2TokenProxyLess", "provider": "Multibot", "solution": null}{ "status": "ready", "taskId": "01KFNDF328KAN2AJ3BNHCQYE88", "errorId": 0, "cost": 0.00013, "taskType": "ReCaptchaV2TokenProxyLess", "provider": "Multibot", "solution": { "token": "03AGdBq24PBCbwiDRaS_MJ7Z..." }}{ "status": "failed", "taskId": "01KFNDF328KAN2AJ3BNHCQYE88", "errorId": 1, "errorCode": "CAPTCHA_UNSOLVABLE", "errorDescription": "The captcha could not be solved.", "taskType": "ReCaptchaV2TokenProxyLess", "provider": "Multibot", "solution": null}Used proxy
When a completed task used a proxy, the response includes it as usedProxy, exactly as you submitted it. With proxy rotation, this is the final attempt's proxy.
| Field | Type | Description |
|---|---|---|
index | number | Index of this proxy in the task.proxy array (0 for a single proxy). |
type | string | http, https, socks4, or socks5. |
host | string | Proxy host. |
port | number | Proxy port. |
username | string | Proxy username, if any. |
password | string | Proxy password, if any. |
Retry and fallback statistics
When auto retry or auto fallback is active, the response can include a retry object describing every attempt. It is disabled by default to keep responses small. Opt in per request with settings.statistics: true on createTask, or enable Response statistics on the API key in the dashboard.
Statistics work while the task is still processing
With statistics enabled, retry already lists the finished attempts while status is processing. If a task takes
longer than usual, poll it to see which attempts failed and which provider is currently solving.
| Field | Type | Description |
|---|---|---|
totalAttempts | number | Finished attempts. While processing, the in-flight attempt is not counted yet. |
retries | number | Same-provider retries performed. |
fallbacks | number | Provider fallbacks performed. |
provider | string | Provider of the final attempt. While processing, the provider currently solving. |
attempts | array | One entry per finished attempt (see below). |
Each entry in attempts:
| Field | Type | Description |
|---|---|---|
attempt | number | Zero-based attempt index. |
provider | string | Provider used for this attempt. |
kind | string | How it was reached: initial, retry, or fallback. |
proxyIndex | number | Index of the proxy used, if any. |
errorCode | string | Error that ended this attempt. Absent on success. |
errorDescription | string | Human-readable error message. |
durationMs | number | Attempt duration in milliseconds. |
{
"status": "processing",
"taskId": "01KFNDF328KAN2AJ3BNHCQYE88",
"errorId": 0,
"taskType": "ReCaptchaV2Token",
"provider": "CapSolver",
"retry": {
"totalAttempts": 1,
"retries": 0,
"fallbacks": 0,
"provider": "CapSolver",
"attempts": [
{
"attempt": 0,
"provider": "Multibot",
"kind": "initial",
"proxyIndex": 0,
"errorCode": "CAPTCHA_UNSOLVABLE",
"errorDescription": "The captcha could not be solved.",
"durationMs": 18234
}
]
}
}{
"status": "ready",
"taskId": "01KFNDF328KAN2AJ3BNHCQYE88",
"errorId": 0,
"cost": 0.00013,
"taskType": "ReCaptchaV2Token",
"provider": "CapSolver",
"solution": { "token": "03AGdBq24PBCbwiDRaS_MJ7Z..." },
"usedProxy": {
"index": 1,
"type": "http",
"host": "5.6.7.8",
"port": 8080,
"username": "user",
"password": "pass"
},
"retry": {
"totalAttempts": 2,
"retries": 0,
"fallbacks": 1,
"provider": "CapSolver",
"attempts": [
{
"attempt": 0,
"provider": "Multibot",
"kind": "initial",
"proxyIndex": 0,
"errorCode": "CAPTCHA_UNSOLVABLE",
"errorDescription": "The captcha could not be solved.",
"durationMs": 18234
},
{ "attempt": 1, "provider": "CapSolver", "kind": "fallback", "proxyIndex": 1, "durationMs": 9120 }
]
}
}Polling
Wait three to five seconds after createTask before the first poll. Then poll every two to three seconds until status is ready or failed. Cap total wait around 120 seconds.
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.anysolver.com';
const TASK = {
type: 'ReCaptchaV2TokenProxyLess',
websiteURL: 'https://www.google.com/recaptcha/api2/demo',
websiteKey: '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI',
pageTitle: 'reCAPTCHA demo',
};
const post = async (path, body) =>
await fetch(`${BASE_URL}${path}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
}).then(async (r) => await r.json());
async function solveCaptcha() {
console.log('Creating task...');
const create = await post('/createTask', { clientKey: API_KEY, task: TASK });
if (create.errorId !== 0) throw new Error(`${create.errorCode}: ${create.errorDescription ?? 'Unknown error'}`);
console.log(`Task created: ${create.taskId}`);
console.log('Polling for result...');
let result;
do {
await new Promise((r) => setTimeout(r, 3000));
result = await post('/getTaskResult', { clientKey: API_KEY, taskId: create.taskId });
console.log(`Status: ${result.status}`);
if (result.status === 'ready') {
console.log('Task completed!');
return result.solution.token;
}
if (result.status === 'failed') {
throw new Error(`${result.errorCode}: ${result.errorDescription ?? 'Unknown error'}`);
}
if (result.status !== 'processing') {
throw new Error(`Unexpected status: ${result.status}`);
}
} while (result.status === 'processing');
}
void solveCaptcha().then((token) => console.log('Solved:', token));
Task lifetime
A task is available only for a short time:
- While solving, the task stays live until the provider finishes. Poll it during this phase to watch progress.
- After it finishes, the result stays fetchable for a few minutes, then it is deleted.
Save the solution as soon as you receive it
Once a task is deleted, getTaskResult returns TASK_NOT_FOUND and the solution cannot be recovered, so you would
have to create a new task. Store the solution the moment a task is ready.
Individual tasks are not kept long-term. Your dashboard statistics are stored separately and stay accurate over time.
Errors
| Error code | Cause | Fix |
|---|---|---|
TASK_NOT_FOUND | Task ID is unknown or has expired. | Re-create the task with createTask. |
CAPTCHA_UNSOLVABLE | The provider could not solve the CAPTCHA. | Refunded automatically. Verify sitekey, domain, and proxy. |
TASK_TIMEOUT | Task did not complete in time. | Refunded automatically. Retry; consider a different provider. |
PROXY_CONNECTION_FAILED | Provider could not connect through your proxy. | Refunded automatically. Check the proxy is reachable from the public internet. |
Full list: Error handling.
Notes
- Responses always return HTTP 200. Branch on
errorId, not the HTTP status. - The
solutionobject shape is task-specific. See the relevant page in Tasks for the exact fields. - Results are short-lived. See Task lifetime for how long a task stays fetchable.