Solve a captcha
const url = 'https://api.clearance.rest/captchas/resolve';const options = { method: 'POST', headers: { 'X-Service-Timeout': '45000', 'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json' }, body: '{"provider":"capsolver","task":{"type":"ImageToTextTask","body":"<base64 image>"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.clearance.rest/captchas/resolve \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --header 'X-Service-Timeout: 45000' \ --data '{ "provider": "capsolver", "task": { "type": "ImageToTextTask", "body": "<base64 image>" } }'Sends the task to the chosen provider and holds the connection open until a solution arrives or the timeout elapses.
task is passed to the provider as-is, so its shape depends on provider:
capsolver: a Capsolver task, for example{ "type": "ImageToTextTask", "body": "<base64>" }.2captcha: a 2Captcha task object. -nonecap: NoneCap’s own request body, for example{ "type": "hcaptcha", "sitekey": "…", "url": "https://…" }.nonecap-browser:{ "url", "sitekey", "proxy"? }.sitekeyis required;typeandrqdataare not supported.
The response is not normalised: it is the provider’s own response with jobId and waitedMs added. A provider-side failure (for example 2Captcha’s code: "ERROR_…" or NoneCap’s status: "failed") is still HTTP 200; read the failure from the provider-specific fields.
If the project has no account for the requested provider, the request is rejected with 400.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Maximum time to wait, in milliseconds. Must be a positive integer. When the wait exceeds it, the response is HTTP 200 with error: "timeout". It can only lower the service’s own ceiling, never raise it.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Which solver to use.
Provider-specific task, passed through unchanged.
object
Examples
Capsolver, image to text
{ "provider": "capsolver", "task": { "type": "ImageToTextTask", "body": "<base64 image>" }}NoneCap, hCaptcha
{ "provider": "nonecap", "task": { "type": "hcaptcha", "sitekey": "9278ebd4-da60-402a-ac8a-e604bc4ac524", "url": "https://target.example" }}Responses
Section titled “Responses”The provider’s response plus jobId and waitedMs, or a timeout (error: "timeout").
The provider’s response, unmodified, with jobId and waitedMs added. The extra fields depend on the provider (see the examples).
object
Identifier of this solve, for correlation in support requests.
How long the request waited, in milliseconds.
object
Examples
{ "jobId": "6f1c1a4e-2f0e-4c39-9d1b-3f7a7f8c2b10", "waitedMs": 1234, "errorId": 0, "taskId": "8b1c…", "status": "ready", "solution": { "text": "abc123" }}{ "jobId": "6f1c1a4e-2f0e-4c39-9d1b-3f7a7f8c2b10", "waitedMs": 1234, "id": "12345", "code": "abc123"}{ "jobId": "6f1c1a4e-2f0e-4c39-9d1b-3f7a7f8c2b10", "waitedMs": 4021, "id": "solve_01HQF7K3JKWZX", "object": "solve", "status": "solved", "token": "P1_eyJhbGciOiJIUzI1NiIs…", "credits_charged": 1}{ "jobId": "6f1c1a4e-2f0e-4c39-9d1b-3f7a7f8c2b10", "waitedMs": 45000, "error": "timeout"}Invalid JSON body, unknown provider, missing task, invalid X-Service-Timeout, or the project has no account for the provider.
Error envelope returned with a non-2xx status.
object
Human-readable error message.
Examples
{ "success": false, "error": "invalid json body"}{ "success": false, "error": "unknown provider: foo"}{ "success": false, "error": "missing task"}The X-API-Key header is missing or invalid.
Error envelope returned with a non-2xx status.
object
Human-readable error message.
Example
{ "success": false, "error": "geçersiz API anahtarı"}The provider call threw (network error, auth error, or the provider’s own error field).
object
Examplegenerated
{ "jobId": "example", "error": "example"}