Drag & Drop Method
The method can be used to bypass tasks where you need to drag one or more images onto specific positions on a background image.
DragAndDropTask specification
| Property | Type | Required | Description |
|---|---|---|---|
| type | String | Yes | Task type: DragAndDropTask |
| background | String | Yes | Background image encoded into Base64 format |
| images | Array of String | Yes | Array of images to drag, encoded into Base64 format. Order matters — the same order is used in the response |
| comment | String | No | A comment shown to workers to help them solve the captcha properly, e.g. "Drag the images to proper position" |
Request examples
Method: createTask
API endpoint: https://api.2captcha.com/createTask
DragAndDropTask request example
json
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "DragAndDropTask",
"background": "BASE64_BACKGROUND",
"images": [
"BASE64_IMAGE_1",
"BASE64_IMAGE_2"
],
"comment": "Drag the images to proper position"
}
}
Response example
Method: getTaskResult
API endpoint: https://api.2captcha.com/getTaskResult
json
{
"errorId": 0,
"status": "ready",
"solution": {
"coordinates": [
{"x": 120, "y": 340},
null,
{"x": 210, "y": 90}
]
},
"cost": "0.0012",
"ip": "1.2.3.4",
"createTime": 1692863536,
"endTime": 1692863556,
"solveCount": 1
}
IMPORTANT:
nullinsolution.coordinatesis a literal value for an image that wasn't moved — it does not mean an error and does not mean coordinates(0, 0). The position ofnullin the array still corresponds to the position of that image in theimagesarray you sent, sosolution.coordinatesalways has the same length and order as theimagesarray.