- [HTTP request](https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks/run#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks/run#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks/run#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks/run#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks/run#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks/run#body.aspect)
- [Try it!](https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks/run#try-it)

Forces a task to run now.

When this method is called, Cloud Tasks will dispatch the task, even if the task is already running, the queue has reached its `https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues#RateLimits` or is `https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues#State.ENUM_VALUES.PAUSED`.

This command is meant to be used for manual debugging. For example, `https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks/run#google.cloud.tasks.v2.CloudTasks.RunTask` can be used to retry a failed task after a fix has been made or to manually force a task to be dispatched now.

If Cloud Tasks receives a successful response from the task's target, then the task will be deleted; otherwise the task's `https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks#Task.FIELDS.schedule_time` will be reset to the time that `https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks/run#google.cloud.tasks.v2.CloudTasks.RunTask` was called plus the retry delay specified in the queue's `https://docs.cloud.google.com/tasks/docs/reference/rest/v2/RetryConfig`.

`https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks/run#google.cloud.tasks.v2.CloudTasks.RunTask` returns `google.rpc.Code.NOT_FOUND` when it is called on a task that has already succeeded or permanently failed.

### HTTP request

`POST https://cloudtasks.googleapis.com/v2/{name=projects/*/locations/*/queues/*/tasks/*}:run`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Required. The task name. For example: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `name`: - `cloudtasks.tasks.run` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "responseView": enum (`https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks#View`) } ``` |

| Fields ||
|---|---|
| `responseView` | ``enum (`https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks#View`)`` The responseView specifies which subset of the `https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks#Task` will be returned. By default responseView is `https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks#View.ENUM_VALUES.BASIC`; not all information is retrieved by default because some data, such as payloads, might be desirable to return only when needed because of its large size or because of the sensitivity of data that it contains. Authorization for `https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks#View.ENUM_VALUES.FULL` requires `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) permission on the `https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks#Task` resource. |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks#Task`.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `https://www.googleapis.com/auth/cloud-tasks`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).