REST API
Async CAPTCHA Solver
RequestValidateHard
Description
Automate a 2captcha/anti-captcha style solver: submit a task, then poll until a token is ready, respecting Retry-After.
Test Scenario
// Submit a solve task, then poll until ready (the 2captcha / anti-captcha pattern).
const submit = await request.post('/api/v1/captcha', {
data: { type: 'recaptcha', sitekey: 'demo', pageurl: 'https://example.com' },
});
expect(submit.status()).toBe(202);
const { taskId } = await submit.json();
let token;
for (let i = 0; i < 10; i++) {
const poll = await request.get('/api/v1/captcha?id=' + taskId);
const body = await poll.json();
if (body.status === 'ready') { token = body.token; break; }
await new Promise((r) => setTimeout(r, 2000)); // honor Retry-After
}
expect(token).toBeTruthy(); // inject this where the real captcha response would goEndpoint
/api/v1/captchaTesting Tips
- โขPOST returns 202 + taskId โ the work is not done yet, you must poll
- โขGET ?id=<taskId> returns status "processing" with a Retry-After header until it flips to "ready"
- โขRespect Retry-After between polls and cap your attempts โ the exact loop a headless suite uses to get past a captcha it cannot solve itself
// Playwright API Testing - RESTimport { test, expect } from '@playwright/test';test('REST API request', async ({ request }) => {const response = await request.get('/api/v1/resource');expect(response.ok()).toBeTruthy();expect(response.status()).toBe(200);const data = await response.json();expect(data).toBeDefined();});
Challenge ID: rest-captcha-solver
2 frameworks available
API Playground
Send requests and inspect responses
Endpoint: /api/v1/captcha
Press Enter to send