# Returning Task Statuses

**`GET /tasks/{taskId}`**

Returns the current status and result of an asynchronous task by its ID.

**Authentication:** Bearer token required (`Authorization: Bearer <token>`)

***

## Request

### Path Parameters

| Parameter | Type          | Required | Description                       |
| --------- | ------------- | -------- | --------------------------------- |
| `taskId`  | string (UUID) | Yes      | The unique identifier of the task |

***

## Response

### Success Response

**Status:** `200 OK`

```json
{
  "taskId": "63e3e5e8a01b3c001234abcd",
  "action": "Create policy",
  "done": true,
  "error": null,
  "result": {},
  "steps": [
    {
      "time": "2024-06-01T12:34:56.789Z",
      "message": "Policy created"
    }
  ]
}
```

| Field    | Type           | Description                      |
| -------- | -------------- | -------------------------------- |
| `taskId` | string         | The task identifier              |
| `action` | string         | Description of the task action   |
| `done`   | boolean        | Whether the task has completed   |
| `error`  | object \| null | Error details if the task failed |
| `result` | object \| null | Task result payload when done    |
| `steps`  | array          | Progress steps completed so far  |

### Error Responses

| Status                      | Description               |
| --------------------------- | ------------------------- |
| `401 Unauthorized`          | Missing or invalid token  |
| `500 Internal Server Error` | Unexpected server failure |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guardian.hedera.com/docs/develop/tasks-and-external/task-apis/returning-task-statuses.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
