---
title: "PATCH /v2/{+name}"
method: PATCH
path: "/v2/{+name}"
tags: ["projects"]
---

# PATCH /v2/{+name}

`PATCH /v2/{+name}`

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`.

## Path parameters

- `name` string, required

## Query parameters

- `updateMask` string

## Request body

- V2Key — The representation of a key managed by the API Keys API.
  - `restrictions` V2Restrictions — Describes the restrictions on the key.
    - `browserKeyRestrictions` V2BrowserKeyRestrictions — The HTTP referrers (websites) that are allowed to use the key.
      - `allowedReferrers` string[] — A list of regular expressions for the referrer URLs that are allowed to make API calls with this key.
    - `androidKeyRestrictions` V2AndroidKeyRestrictions — The Android apps that are allowed to use the key.
      - `allowedApplications` V2AndroidApplication[] — A list of Android applications that are allowed to make API calls with this key.
        - `packageName` string — The package name of the application.
        - `sha1Fingerprint` string — The SHA1 fingerprint of the application. For example, both sha1 formats are acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. Output format is the latter.
    - `iosKeyRestrictions` V2IosKeyRestrictions — The iOS apps that are allowed to use the key.
      - `allowedBundleIds` string[] — A list of bundle IDs that are allowed when making API calls with this key.
    - `apiTargets` V2ApiTarget[] — A restriction for a specific service and optionally one or more specific methods. Requests are allowed if they match any of these restrictions. If no restrictions are specified, all targets are allowed.
      - `service` string — The service for this restriction. It should be the canonical service name, for example: `translate.googleapis.com`. You can use [`gcloud services list`](https://cloud.google.com/sdk/gcloud/reference/services/list) to get a list of services that are enabled in the project.
      - `methods` string[] — Optional. List of one or more methods that can be called. If empty, all methods for the service are allowed. A wildcard (*) can be used as the last symbol. Valid examples: `google.cloud.translate.v2.TranslateService.GetSupportedLanguage` `TranslateText` `Get*` `translate.googleapis.com.Get*`
    - `serverKeyRestrictions` V2ServerKeyRestrictions — The IP addresses of callers that are allowed to use the key.
      - `allowedIps` string[] — A list of the caller IP addresses that are allowed to make API calls with this key.
  - `uid` string — Output only. Unique id in UUID4 format.
  - `keyString` string — Output only. An encrypted and signed value held by this key. This field can be accessed only through the `GetKeyString` method.
  - `deleteTime` string, google-datetime — Output only. A timestamp when this key was deleted. If the resource is not deleted, this must be empty.
  - `serviceAccountEmail` string — Optional. The email address of [the service account](https://cloud.google.com/iam/docs/service-accounts) the key is bound to.
  - `etag` string — A checksum computed by the server based on the current value of the Key resource. This may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. See https://google.aip.dev/154.
  - `name` string — Identifier. The resource name of the key. The `name` has the form: `projects//locations/global/keys/`. 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`.
  - `annotations` object — Annotations is an unstructured key-value map stored with a policy that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects.
  - `displayName` string — Human-readable display name of this key that you can modify. The maximum length is 63 characters.
  - `createTime` string, google-datetime — Output only. A timestamp identifying the time this key was originally created.
  - `updateTime` string, google-datetime — Output only. A timestamp identifying the time this key was last updated.

## Response `200`

Successful response

---

[API](https://skmtc.dev/google/apis/apikeys.md) · [All operations](https://skmtc.dev/google/apis/apikeys/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/google/apikeys/revisions/be9946e8f6a0/schema)
