> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arjex.team/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Task

> Use GET /api/v1/captcha/tasks/{taskId} to check whether an hCaptcha task is pending, solved, or failed, and retrieve its solution token when ready.

Check the status of a task and retrieve its CAPTCHA token after it is solved. Use the `taskId` returned by [Create Task](https://docs.arjex.team/captcha/tasks/create.md), and repeat this request while the task is pending.

## Headers

**x-captcha-key** `string` *required*

Your Captcha API key.

## Path

**taskId** `string` *required*

The `data.taskId` returned by Create Task.

```bash cURL theme={null}
curl "https://arjex.team/api/v1/captcha/tasks/k3Jd9sLq2Xv7mTn8WbRz4YpC1HeA5GuF" \
  -H "x-captcha-key: YOUR_API_KEY"
```

## Response

**success** `boolean`

`true` when the task was found.

**code** `number`

HTTP status code of the response.

**message** `string`

Result message.

**data** `object`

**properties**

**taskId** `string`

The task ID.

**taskType** `string`

The CAPTCHA type of the task.

**status** `string`

The task status. See below.

**cost** `number`

The price of the task.

**solveTimeMs** `number | null`

Solve time in milliseconds. This is `null` while the task is `pending`.

**solution** `object | null`

`{ "token": "..." }` when the task is solved, otherwise `null`.

**refunded** `boolean`

`true` when the task failed and its cost was refunded.

## Task statuses

| Status | Meaning |
| - | - |
| `pending` | The task is still being solved. Keep checking. |
| `success` | The task is solved. The token is in `data.solution.token`. |
| `captured` | The solution is ready. The token is in `data.solution.token`. |
| `failed` | The task could not be solved. It is refunded automatically. |

```json Success theme={null}
{
  "success": true,
  "code": 200,
  "message": "Captcha task fetched successfully",
  "data": {
    "taskId": "k3Jd9sLq2Xv7mTn8WbRz4YpC1HeA5GuF",
    "taskType": "hcaptcha",
    "status": "success",
    "cost": 0.01,
    "solveTimeMs": 8420,
    "solution": {
      "token": "P1_eyJ0eXAiOiJKV1Qi..."
    },
    "refunded": false
  }
}
```

```json Pending theme={null}
{
  "success": true,
  "code": 200,
  "message": "Captcha task fetched successfully",
  "data": {
    "taskId": "k3Jd9sLq2Xv7mTn8WbRz4YpC1HeA5GuF",
    "taskType": "hcaptcha",
    "status": "pending",
    "cost": 0.01,
    "solveTimeMs": null,
    "solution": null,
    "refunded": false
  }
}
```

```json Failed theme={null}
{
  "success": true,
  "code": 200,
  "message": "Captcha task fetched successfully",
  "data": {
    "taskId": "k3Jd9sLq2Xv7mTn8WbRz4YpC1HeA5GuF",
    "taskType": "hcaptcha",
    "status": "failed",
    "cost": 0.01,
    "solveTimeMs": 31250,
    "solution": null,
    "refunded": true
  }
}
```

```json 404 theme={null}
{
  "success": false,
  "code": 404,
  "errorCode": "CAPTCHA_TASK_NOT_FOUND",
  "message": "Captcha task not found"
}
```

## Errors

Every error returns `success: false` with a `code`, an `errorCode`, and a `message`.

| Status | `errorCode` | What to do |
| - | - | - |
| 401 | `INVALID_CAPTCHA_KEY` | Send a valid key in the `x-captcha-key` header. |
| 403 | `CAPTCHA_FEATURE_REQUIRED` | Your account does not have the active Captcha feature. |
| 404 | `CAPTCHA_TASK_NOT_FOUND` | Check the `taskId`. It must belong to your account. |
| 500 | `CAPTCHA_TASK_FETCH_FAILED` | The task could not be fetched. Retry the request. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.