---
title: "PATCH /v1/projects/{projectsId}/locations/{locationsId}/attributes/{attributesId}"
method: PATCH
path: "/v1/projects/{projectsId}/locations/{locationsId}/attributes/{attributesId}"
tags: ["projects"]
---

# PATCH /v1/projects/{projectsId}/locations/{locationsId}/attributes/{attributesId}

`PATCH /v1/projects/{projectsId}/locations/{locationsId}/attributes/{attributesId}`

## Request

- Base URL: `https://apihub.googleapis.com`
- URL: `https://apihub.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}/attributes/{attributesId}`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/apihub.readwrite`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/apihub.readwrite`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`
- TypeScript: <https://skmtc.dev/google/apis/apihub/docs/v1/projects/:projectsId/locations/:locationsId/attributes/:attributesId/patch.ts> (a function with typed inputs; its response is checked against the schema)

Update the attribute. The following fields in the Attribute resource can be updated: * display_name The display name can be updated for user defined attributes only. * description The description can be updated for user defined attributes only. * allowed_values To update the list of allowed values, clients need to use the fetched list of allowed values and add or remove values to or from the same list. The mutable allowed values can be updated for both user defined and System defined attributes. The immutable allowed values cannot be updated or deleted. The updated list of allowed values cannot be empty. If an allowed value that is already used by some resource's attribute is deleted, then the association between the resource and the attribute value will also be deleted. * cardinality The cardinality can be updated for user defined attributes only. Cardinality can only be increased during an update. The update_mask should be used to specify the fields being updated.

## Path parameters

- `projectsId` string, required
- `locationsId` string, required
- `attributesId` string, required

## Query parameters

- `updateMask` string, google-fieldmask

## Request body

- GoogleCloudApihubV1Attribute: An attribute in the API Hub. An attribute is a name value pair which can be attached to different resources in the API hub based on the scope of the attribute. Attributes can either be pre-defined by the API Hub or created by users.
  - `allowedValues` GoogleCloudApihubV1AllowedValue[]: Optional. The list of allowed values when the attribute value is of type enum. This is required when the data_type of the attribute is ENUM. The maximum number of allowed values of an attribute will be 1000.
    - `description` string: Optional. The detailed description of the allowed value.
    - `displayName` string: Required. The display name of the allowed value.
    - `id` string: Required. The ID of the allowed value. * If provided, the same will be used. The service will throw an error if the specified id is already used by another allowed value in the same attribute resource. * If not provided, a system generated id derived from the display name will be used. In this case, the service will handle conflict resolution by adding a system generated suffix in case of duplicates. This value should be 3-500 characters, and valid characters are /a-z[0-9]-_/.
    - `immutable` boolean: Optional. When set to true, the allowed value cannot be updated or deleted by the user. It can only be true for System defined attributes.
  - `cardinality` integer: Optional. The maximum number of values that the attribute can have when associated with an API Hub resource. Cardinality 1 would represent a single-valued attribute. It must not be less than 1 or greater than 20. If not specified, the cardinality would be set to 1 by default and represent a single-valued attribute.
  - `createTime` string, google-datetime: Output only. The time at which the attribute was created.
  - `dataType` 'DATA_TYPE_UNSPECIFIED' | 'ENUM' | 'JSON' | 'STRING' | 'URI': Required. The type of the data of the attribute.
  - `definitionType` 'DEFINITION_TYPE_UNSPECIFIED' | 'SYSTEM_DEFINED' | 'USER_DEFINED': Output only. The definition type of the attribute.
  - `description` string: Optional. The description of the attribute.
  - `displayName` string: Required. The display name of the attribute.
  - `mandatory` boolean: Output only. When mandatory is true, the attribute is mandatory for the resource specified in the scope. Only System defined attributes can be mandatory.
  - `name` string: Identifier. The name of the attribute in the API Hub. Format: `projects/{project}/locations/{location}/attributes/{attribute}`
  - `scope` 'SCOPE_UNSPECIFIED' | 'API' | 'VERSION' | 'SPEC' | 'API_OPERATION' | 'DEPLOYMENT' | 'DEPENDENCY' | 'DEFINITION' | 'EXTERNAL_API' | 'PLUGIN': Required. The scope of the attribute. It represents the resource in the API Hub to which the attribute can be linked.
  - `updateTime` string, google-datetime: Output only. The time at which the attribute was last updated.

## Response `200`

Successful response

- GoogleCloudApihubV1Attribute: An attribute in the API Hub. An attribute is a name value pair which can be attached to different resources in the API hub based on the scope of the attribute. Attributes can either be pre-defined by the API Hub or created by users.
  - `allowedValues` GoogleCloudApihubV1AllowedValue[]: Optional. The list of allowed values when the attribute value is of type enum. This is required when the data_type of the attribute is ENUM. The maximum number of allowed values of an attribute will be 1000.
    - `description` string: Optional. The detailed description of the allowed value.
    - `displayName` string: Required. The display name of the allowed value.
    - `id` string: Required. The ID of the allowed value. * If provided, the same will be used. The service will throw an error if the specified id is already used by another allowed value in the same attribute resource. * If not provided, a system generated id derived from the display name will be used. In this case, the service will handle conflict resolution by adding a system generated suffix in case of duplicates. This value should be 3-500 characters, and valid characters are /a-z[0-9]-_/.
    - `immutable` boolean: Optional. When set to true, the allowed value cannot be updated or deleted by the user. It can only be true for System defined attributes.
  - `cardinality` integer: Optional. The maximum number of values that the attribute can have when associated with an API Hub resource. Cardinality 1 would represent a single-valued attribute. It must not be less than 1 or greater than 20. If not specified, the cardinality would be set to 1 by default and represent a single-valued attribute.
  - `createTime` string, google-datetime: Output only. The time at which the attribute was created.
  - `dataType` 'DATA_TYPE_UNSPECIFIED' | 'ENUM' | 'JSON' | 'STRING' | 'URI': Required. The type of the data of the attribute.
  - `definitionType` 'DEFINITION_TYPE_UNSPECIFIED' | 'SYSTEM_DEFINED' | 'USER_DEFINED': Output only. The definition type of the attribute.
  - `description` string: Optional. The description of the attribute.
  - `displayName` string: Required. The display name of the attribute.
  - `mandatory` boolean: Output only. When mandatory is true, the attribute is mandatory for the resource specified in the scope. Only System defined attributes can be mandatory.
  - `name` string: Identifier. The name of the attribute in the API Hub. Format: `projects/{project}/locations/{location}/attributes/{attribute}`
  - `scope` 'SCOPE_UNSPECIFIED' | 'API' | 'VERSION' | 'SPEC' | 'API_OPERATION' | 'DEPLOYMENT' | 'DEPENDENCY' | 'DEFINITION' | 'EXTERNAL_API' | 'PLUGIN': Required. The scope of the attribute. It represents the resource in the API Hub to which the attribute can be linked.
  - `updateTime` string, google-datetime: Output only. The time at which the attribute was last updated.

## Changes

- **2026-11-08** `09b6c7d2247b`: 4 info
  - the security scope `https://www.googleapis.com/auth/apihub.readwrite` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/apihub.readwrite` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/apihub/changes/v1/projects/:projectsId/locations/:locationsId/attributes/:attributesId/patch.md)

---

[API](https://skmtc.dev/google/apis/apihub.md) - [All operations](https://skmtc.dev/google/apis/apihub/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/apihub/revisions/09b6c7d2247b?raw)
