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

Updates a queue.

This method creates the queue if it does not exist and updates the queue if it does exist.

Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not.

WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.

### HTTP request

`PATCH https://cloudtasks.googleapis.com/v2/{queue.name=projects/*/locations/*/queues/*}`

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

### Path parameters

| Parameters ||
|---|---|
| `queue.name` | `string` Caller-specified and required in `https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues/create#google.cloud.tasks.v2.CloudTasks.CreateQueue`, after which it becomes output only. The queue name. The queue name must have the following format: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - `PROJECT_ID` can contain letters (\[A-Za-z\]), numbers (\[0-9\]), hyphens (-), colons (:), or periods (.). For more information, see [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) - `LOCATION_ID` is the canonical ID for the queue's location. The list of available locations can be obtained by calling `locations.list`. For more information, see <https://cloud.google.com/about/locations/>. - `QUEUE_ID` can contain letters (\[A-Za-z\]), numbers (\[0-9\]), or hyphens (-). The maximum length is 100 characters. |

### Query parameters

| Parameters ||
|---|---|
| `updateMask` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#field-mask` format)`` A mask used to specify which fields of the queue are being updated. If empty, then all fields will be updated. This is a comma-separated list of fully qualified names of fields. Example: `"user.displayName,photo"`. |

### Request body

The request body contains an instance of `https://docs.cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues#Queue`.

### Response body

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

### 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).