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

# Get Task Result

> Poll for the status and result of a task.

## `GET /getTaskResult/{taskId}`

Retrieves the current status and result of a previously created task.

## Path Parameters

| Parameter | Type          | Description                          |
| --------- | ------------- | ------------------------------------ |
| `taskId`  | string (UUID) | The task ID returned by `createTask` |

## Response

### Processing (202)

The task is still processing. Continue polling.

```json theme={null}
{
  "errorId": 0,
  "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "processing"
}
```

### Completed Successfully (200)

The task finished successfully. The `solution.token` contains the result token.

```json theme={null}
{
  "errorId": 0,
  "solution": {
    "token": "282d9a2536f.d"
  },
  "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "ready"
}
```

### Completed with Error (200)

The task completed without a usable result token.

```json theme={null}
{
  "errorId": 1,
  "errorCode": "ERROR_CAPTCHA_UNSOLVABLE",
  "errorDescription": "The interaction could not be completed.",
  "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "ready"
}
```

### Task Not Found (404)

The task ID doesn't exist or has expired.

```json theme={null}
{
  "errorId": 1,
  "errorCode": "ERROR_TASK_NOT_FOUND",
  "errorDescription": "Task not found or has expired.",
  "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
```

### Task Failed (403)

The task encountered a fatal error.

```json theme={null}
{
  "errorId": 1,
  "errorCode": "ERROR_TASK_EXCEPTION",
  "errorDescription": "An internal error occurred.",
  "taskId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "failure"
}
```

## Response Fields

| Field              | Type    | Description                                 |
| ------------------ | ------- | ------------------------------------------- |
| `errorId`          | integer | `0` = success, `1` = error                  |
| `errorCode`        | string  | Error code (only when `errorId: 1`)         |
| `errorDescription` | string  | Human-readable error message                |
| `taskId`           | string  | The task UUID                               |
| `status`           | string  | `processing`, `ready`, or `failure`         |
| `solution`         | object  | Contains the result token (only on success) |
| `solution.token`   | string  | The result token for the completed task     |

## Polling Strategy

<Tip>
  Poll every **0.5 seconds**. Results expire **120 seconds** after completion.
</Tip>

```python theme={null}
import time
import requests

def get_result(task_id, interval=0.5, max_attempts=600):
    for _ in range(max_attempts):
        resp = requests.get(f"https://api.funbypass.com/getTaskResult/{task_id}")
        data = resp.json()

        if data["status"] == "ready":
            if data["errorId"] == 0:
                return data["solution"]["token"]
            raise Exception(f"{data['errorCode']}: {data['errorDescription']}")

        if data["status"] == "failure":
            raise Exception(f"{data['errorCode']}: {data['errorDescription']}")

        time.sleep(interval)

    raise TimeoutError("Polling timeout")
```

## Common Errors

| Error Code                 | HTTP | Description                            |
| -------------------------- | ---- | -------------------------------------- |
| `ERROR_TASK_NOT_FOUND`     | 404  | Task expired or doesn't exist          |
| `ERROR_TASK_EXCEPTION`     | 403  | Internal task failure                  |
| `ERROR_CAPTCHA_UNSOLVABLE` | 403  | The interaction could not be completed |
| `ERROR_PROXY_CONNECTION`   | 503  | Proxy connection failed                |
| `ERROR_SOLVE_TIMEOUT`      | 504  | Processing exceeded 120 seconds        |
| `ERROR_TASK_TIMEOUT`       | 504  | Task exceeded 300 seconds              |
