getTaskResult
Poll for task status and retrieve the solution.
Endpoint
POST /getTaskResultDescription
Retrieves the current status and result of a task. Poll this endpoint until the task status is ready or failed.
Request
| Header | Value |
|---|---|
| Content-Type | application/json |
| Field | Type | Description |
|---|---|---|
clientKey* | string | Your API key from the AnySolver dashboard. |
taskId* | string | Unique identifier returned when the task was created. |
Example Request
{ "clientKey": "your-api-key-from-dashboard", "taskId": "01KFNDF328KAN2AJ3BNHCQYE88"}Response
Response Fields
| Field | Type | Description |
|---|---|---|
status* | Task status: "processing", "ready", or "failed". Example: | |
taskId | string | Unique identifier returned when the task was created. Example: |
errorId* | 0 = success, 1 = external error, 2 = internal error. Example: | |
errorCode | Machine-readable error code (e.g., "CAPTCHA_UNSOLVABLE"). Example: | |
errorDescription | string | Human-readable error message with resolution hints. Example: |
cost | number | Actual cost charged for this task in USD. Example: |
taskType | The type of CAPTCHA task to solve. Example: | |
provider | Specific provider to use. If omitted, automatic routing selects the best provider. Example: |
Task 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. |
Processing Response
Task is still being solved:
Processing Response
{ "status": "processing", "taskId": "01KFNDF328KAN2AJ3BNHCQYE88", "errorId": 0, "taskType": "ReCaptchaV2TokenProxyLess", "provider": "Multibot", "solution": null}Ready Response
Task completed successfully:
Ready Response
{ "status": "ready", "taskId": "01KFNDF328KAN2AJ3BNHCQYE88", "errorId": 0, "cost": 0.00013, "taskType": "ReCaptchaV2TokenProxyLess", "provider": "Multibot", "solution": { "token": "03AGdBq24PBCbwiDRaS_MJ7Z..." }}Failed Response
Task failed:
Failed Response
{ "status": "failed", "taskId": "01KFNDF328KAN2AJ3BNHCQYE88", "errorId": 1, "errorCode": "CAPTCHA_UNSOLVABLE", "errorDescription": "The captcha could not be solved.", "taskType": "ReCaptchaV2TokenProxyLess", "provider": "Multibot", "solution": null}Common Errors
| Error Code | Description |
|---|---|
TASK_NOT_FOUND | Task ID not found or expired |
CAPTCHA_UNSOLVABLE | The CAPTCHA could not be solved |
TASK_TIMEOUT | Task timed out |
PROXY_CONNECTION_FAILED | Failed to connect to provided proxy |
See Error Handling for the complete list.
Polling Best Practices
Recommended Polling Strategy
- Wait 3-5 seconds after createTask before first poll 2. Poll every 2-3 seconds until status is
readyorfailed3. Set a maximum timeout (e.g., 120 seconds) to avoid infinite loops
Example Polling Logic
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));Solution Formats
The solution object format depends on the task type. See individual Task Type pages for task-specific response schemas.
Data Retention
24-Hour Retention
Task solutions and error descriptions are automatically removed after approximately 24 hours. Make sure to retrieve and store the solution promptly after task completion. Task metadata (status, cost, timestamps) is retained for billing and analytics purposes.