# AsyncTask

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Reference](https://developer.m-files.com/APIs/gRPC-API/Reference/index.md) > [Messages](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/index.md)

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

Struct for an asynchronous task.

- **Full name:** `MFiles.AsyncTask`
- **Proto file:** [`mfiles/structs.proto`](https://developer.m-files.com/APIs/gRPC-API/downloads/proto/mfiles/structs.proto)

<a id="fields"></a>

## Fields

| Field | Type | Number | Description |
|---|---|---|---|
| <a id="f-id"></a>`id` | `int64` | 1 | Task ID. |
| <a id="f-type"></a>`type` | `string` | 2 | Task type name. |
| <a id="f-definition"></a>`definition` | `string` | 3 | The display string of the task definition. |
| <a id="f-is_running"></a>`is_running` | `bool` | 4 | True if the task is currently running. |
| <a id="f-last_run_started_utc"></a>`last_run_started_utc` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) | 5 | The last time the task ran started. Zero to indicate that the task has never run (or is still running for the first time). |
| <a id="f-last_run_ended_utc"></a>`last_run_ended_utc` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) | 6 | The last time the task ran ended. Zero to indicate that the task has never run (or is still running for the first time). |
| <a id="f-last_run_succeeded"></a>`last_run_succeeded` | `bool` | 7 | True if the last run was successful, false otherwise. |
| <a id="f-last_run_errors"></a>`last_run_errors` | `string` | 8 | Error string from the last run (if any). |
| <a id="f-canceled"></a>`canceled` | `bool` | 9 | True if the task is canceled. |
| <a id="f-progress_info"></a>`progress_info` | `string` | 10 | The progress info string of the task. |
| <a id="f-output_info"></a>`output_info` | `string` | 11 | The output info string of the task. |

<a id="used-by-methods"></a>

## Used by methods

- [IRPCBackgroundOperationsAdmin.GetAsyncTask](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/GetAsyncTask/index.md): Gets one asynchronous task by ID.
- [IRPCBackgroundOperationsAdmin.GetAsyncTasks](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/GetAsyncTasks/index.md): Gets the vault's asynchronous tasks, newest first.
- [IRPCBackgroundOperationsAdmin.GetAsyncTasksRange](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/GetAsyncTasksRange/index.md): Gets a page of asynchronous tasks, oldest or newest first, optionally only tasks in given states.
- [IRPCBackgroundOperationsAdmin.QueueAndGetLatestAsyncTask](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/QueueAndGetLatestAsyncTask/index.md): Gets the newest asynchronous task of the vault and asks the server to queue pending tasks for running now.

<a id="used-in-fields"></a>

## Used in fields

- [`GetAsyncTasksResponse.async_tasks`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/GetAsyncTasks/index.md#response): The tasks, newest first.
- [`GetAsyncTaskResponse.async_task`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/GetAsyncTask/index.md#response): The task.
- [`QueueAndGetLatestAsyncTaskResponse.async_task`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCBackgroundOperationsAdmin/QueueAndGetLatestAsyncTask/index.md#response): The newest task (highest ID). Valid only if `is_available` is true.
- [`GetAsyncTasksRangeResponse.async_tasks`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.GetAsyncTasksRangeResponse/index.md#f-async_tasks): The tasks, in the order given by `latest`.
