# get\_task\_history

`imerit_ango.sdk.SDK.`

## get\_task\_history(task\_history\_id, task\_id)

Get the stage history of a task.

### Parameters

* **task\_history\_id:** string, optional, *default None*
  * Optionally, the ID of the stage history item.
  * For example, if you run this function on a task without passing`task_history_id`, assuming the task has been through 6 stages, you will receive a list with 6 objects. Each of these objects has its own `_id` value. If you pass this `_id` value as the `task_history_id` parameter, you can filter out all tak stage history items and only return the one with this specific ID.
  * Example: `'0000000aa0a00a0000aaaa0a'`
* **task\_id:** string
  * ID of the task to get the history of. Task IDs can be obtained [from the UI](https://docs.imerit.net/sdk/sdk-documentation/..#task-and-asset-ids), and from [get\_tasks](https://docs.imerit.net/sdk/sdk-documentation/..#get_tasks-project_id-page-limit-status).
  * Example: `'0000000aa0a00a0000aaaa0a'`

Returns:

* **output:** dict
  * A dictionary containing the result of the operation.
  * Including a `status` field indicating whether the request was successful and a `data` field containing the response payload with updated resources produced by the operation.

### Example

Get the task history of a specific task.&#x20;

{% tabs %}
{% tab title="python" %}

```python
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')

ango_sdk = SDK(api_key)

task_id = "<YOUR TASK ID>"
sdk_response = ango_sdk.get_task_history(task_id=task_id)
```

{% endtab %}

{% tab title="curl" %}

```bash
curl -X GET "https://imeritapi.ango.ai/v2/task/$TASK_ID/history" \
  -H "Content-Type: application/json" \
  -H "apikey: $ANGO_API_KEY"
```

{% endtab %}
{% endtabs %}

<details>

<summary>Sample Output</summary>

```json
{
  "status": "success",
  "data": {
    "taskHistory": {
      "answer": {
        "tools": [
          {
            "bounding-box": {
              "x": 1094.0928805593353,
              "y": 929.222117890566,
              "height": 112.31541717796104,
              "width": 242.29578986936937
            },
            "objectId": "68174969c44e1ef63301642",
            "classifications": [],
            "schemaId": "a3f7ff90ae260c29132f063",
            "metadata": {
              "createdAt": "2023-05-04T08:14:14.642Z",
              "createdBy": "lorenzo@ango.ai",
              "createdIn": "Label"
            },
            "title": "Amount"
          }
        ],
        "classifications": [],
        "relations": []
      },
      "deleted": false,
      "rework": false,
      "batches": [],
      "isSkipped": false,
      "_id": "6464b15e4ea9720015801e07",
      "labelTaskId": "6453677fc47af30015be5a58",
      "createdAt": "2023-05-04T08:06:23.734Z",
      "project": "645240ed462db80015ce881f",
      "organization": "64461ed038dcad0015cc2049",
      "asset": "6453677fc47af30015be5a57",
      "stage": "77dc1c42-6fef-4745-b783-d6c4d99204e1",
      "duration": 1681,
      "updatedAt": "2023-05-17T10:50:06.211Z",
      "updatedBy": "lorenzo@ango.ai",
      "assignee": "lorenzo@ango.ai",
      "brushDataUrl": null,
      "__v": 0
    }
  }
}
```

</details>

{% hint style="info" %}
**See also**

[get\_task](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/get_task)
{% endhint %}
