# Get a task result (CapSolver style)

> CapSolver-style getTaskResult for a task that was still processing.

`POST https://api.solvecha.com/getTaskResult`


Returns the state of a task from [createTask](https://solvecha.com/docs/api/capsolver-create-task.md). While it runs, `status` is `processing`. Fetching a finished task again is free.

## Authorization

Send your API key as `Authorization: Bearer YOUR_API_KEY`. Other ways are the `key` field of the body and the `key` query parameter. See [Authentication](https://solvecha.com/docs/authentication.md).

## Request body

JSON, or url-encoded form data. The body is limited to 4.5 MB.

| Name | Type | Required | Description |
|---|---|---|---|
| `clientKey` | string | Yes | Your Solvecha API key. |
| `taskId` | string | Yes | The `taskId` from createTask. |

## Example request


**cURL**

```bash
curl -X POST "https://api.solvecha.com/getTaskResult" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "clientKey": "YOUR_API_KEY",
  "taskId": "1234567"
}'
```

**Python**

```python
import requests

response = requests.post(
    "https://api.solvecha.com/getTaskResult",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "clientKey": "YOUR_API_KEY",
        "taskId": "1234567"
    },
)
print(response.status_code, response.json())
```

**Node.js**

```js
const response = await fetch("https://api.solvecha.com/getTaskResult", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "clientKey": "YOUR_API_KEY",
    "taskId": "1234567"
  }),
});
console.log(response.status, await response.json());
```

**Go**

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	body := strings.NewReader(`{
  "clientKey": "YOUR_API_KEY",
  "taskId": "1234567"
}`)
	req, err := http.NewRequest("POST", "https://api.solvecha.com/getTaskResult", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	out, _ := io.ReadAll(resp.Body)
	fmt.Println(resp.StatusCode, string(out))
}
```


## Response

### 200 OK

The state of the task.

```json
{
  "errorId": 0,
  "errorCode": "",
  "errorDescription": "",
  "status": "ready",
  "taskId": "1234567",
  "solution": {"type": "multi", "objects": [0, 2, 5], "size": 3}
}
```
