# IRPCApplicationTaskQueue.AddTask

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Server integration API](https://developer.m-files.com/APIs/gRPC-API/integration/index.md) > [Application task queue](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCApplicationTaskQueue/index.md)

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

Badges: `Server integration API / specialized` `write` `session`

Adds a task to a task queue, ready to be reserved at once.

- **Service:** [Application task queue](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCApplicationTaskQueue/index.md) `MFiles.IRPCApplicationTaskQueue`
- **gRPC method:** `/MFiles.IRPCApplicationTaskQueue/AddTask`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/add-task`
- **Request:** [`AddTaskRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCApplicationTaskQueue/AddTask/index.md#request)
- **Response:** [`AddTaskResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCApplicationTaskQueue/AddTask/index.md#response)
- **Book and level:** Server integration API, specialized
- **Kind:** write
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** no
- **Returns metadata structure version:** no
- **Streaming:** none (unary)

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

## Remarks

- The queue must have been opened with
  [OpenTaskQueue](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCApplicationTaskQueue/OpenTaskQueue/index.md); otherwise the call fails
  with "The task queue is not open.".
- Requires a vault session and the vault right `change_full_control_role`.

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

## Request: AddTaskRequest

> 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 |
|---|---|---|
| `queue_id` | `string` | The ID of the queue. |
| `restore_to_waiting_timeout_in_minutes` | `int32` | How long the task may stay in progress without an [UpdateTask](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCApplicationTaskQueue/UpdateTask/index.md) call before it goes back to waiting. 0 or less means 5 minutes. |
| `task_type` | `string` | A free-form type name that tells the processor how to read `task_data`. |
| `task_data` | `bytes` | The payload of the task. |

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

## Response: AddTaskResponse

> 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 |
|---|---|---|
| `task_id` | `string` | The ID of the new task, a decimal number as a string. |

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

## Related methods

- [OpenTaskQueue](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCApplicationTaskQueue/OpenTaskQueue/index.md): Creates a task queue if it does not exist, or confirms an existing one.
