# Method: projects.locations.keys.patch

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

Patches the modifiable fields of an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is `global`.

### HTTP request

`PATCH https://apikeys.googleapis.com/v2/{key.name=projects/*/locations/*/keys/*}`

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

### Path parameters

| Parameters ||
|---|---|
| `key.name` | `string` Output only. The resource name of the key. The `name` has the form: `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`. For example: `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2` NOTE: Key is a global resource; hence the only supported value for location is `global`. |

### Query parameters

| Parameters ||
|---|---|
| `updateMask` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#field-mask` format)`` The field mask specifies which fields to be updated as part of this request. All other fields are ignored. Mutable fields are: `displayName`, `restrictions`, and `annotations`. If an update mask is not provided, the service treats it as an implied mask equivalent to all allowed fields that are set on the wire. If the field mask has a special value "\*", the service treats it equivalent to replace all allowed mutable fields. 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/api-keys/docs/reference/rest/v2/projects.locations.keys#Key`.

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/api-keys/docs/reference/rest/v2/operations#Operation`.

### Authorization scopes

Requires the following OAuth scope:

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

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

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `name` resource:

- `apikeys.keys.update`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).