# IRPCBackgroundOperationsAdmin.GetAsyncTasksRange

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Administration API](https://developer.m-files.com/APIs/gRPC-API/admin/index.md) > [Background operations](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/GetAsyncTasksRange/

Badges: `Administration API / specialized` `admin` `session` `idempotent`

Gets a page of asynchronous tasks, oldest or newest first, optionally only tasks in given
states.

- **Service:** [Background operations](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/index.md) `MFiles.IRPCBackgroundOperationsAdmin`
- **gRPC method:** `/MFiles.IRPCBackgroundOperationsAdmin/GetAsyncTasksRange`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/get-async-tasks-range`
- **Request:** [`GetAsyncTasksRangeRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.GetAsyncTasksRangeRequest/index.md)
- **Response:** [`GetAsyncTasksRangeResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.GetAsyncTasksRangeResponse/index.md)
- **Book and level:** Administration API, specialized
- **Kind:** admin
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** yes
- **Returns metadata structure version:** no
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

- Requires a vault session and the vault right `change_metadata_structure`.
- **Set `max_count` and `async_task_start`.** `max_count` 0 returns nothing. With `latest`, set
  `async_task_start` to -1 to start from the newest task; the default 0 returns nothing.
- With `latest`, a start ID and `filters`, the result also includes newer tasks into which
  matching older tasks were merged.
- `filters` with only unknown bits fails with "The parameter is incorrect. (Unknown filter)".

<a id="request"></a>

## Request: GetAsyncTasksRangeRequest

A structure that specifies the request type for the WaitForAsyncTaskCompletion method.

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `async_task_start` | `int64` | The first task ID to return, or -1 to start from the newest (`latest` true) or the oldest (`latest` false) task. |
| `max_count` | `uint32` | The maximum number of tasks to return. 0 returns nothing. |
| `latest` | `bool` | True to go from `async_task_start` towards older tasks (descending IDs), false to go towards newer tasks (ascending IDs). |
| `filters` | `uint32` | The task states to include, as a sum of bit values: 1 queued, 2 running, 4 completed successfully, 8 cancelled, 16 failed. 0 includes all tasks. |

<a id="response"></a>

## Response: GetAsyncTasksRangeResponse

A structure that specifies the response type for the WaitForAsyncTaskCompletion method.

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `async_tasks[]` | repeated [`AsyncTask`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.AsyncTask/index.md) | The tasks, in the order given by `latest`. |
| `async_tasks[].id` | `int64` | Task ID. |
| `async_tasks[].type` | `string` | Task type name. |
| `async_tasks[].definition` | `string` | The display string of the task definition. |
| `async_tasks[].is_running` | `bool` | True if the task is currently running. |
| `async_tasks[].last_run_started_utc` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) | The last time the task ran started. Zero to indicate that the task has never run (or is still running for the first time). |
| `async_tasks[].last_run_ended_utc` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) | The last time the task ran ended. Zero to indicate that the task has never run (or is still running for the first time). |
| `async_tasks[].last_run_succeeded` | `bool` | True if the last run was successful, false otherwise. |
| `async_tasks[].last_run_errors` | `string` | Error string from the last run (if any). |
| `async_tasks[].canceled` | `bool` | True if the task is canceled. |
| `async_tasks[].progress_info` | `string` | The progress info string of the task. |
| `async_tasks[].output_info` | `string` | The output info string of the task. |

<a id="related"></a>

## Related methods

- [GetAsyncTasks](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/GetAsyncTasks/index.md): Gets the vault's asynchronous tasks, newest first.
