---
title: "POST /v2/labels"
method: POST
path: "/v2/labels"
tags: ["labels"]
---

# POST /v2/labels

`POST /v2/labels`

Creates a label. For more information, see [Create and publish a label](https://developers.google.com/workspace/drive/labels/guides/create-label).

## Query parameters

- `languageCode` string
- `useAdminAccess` boolean

## Request body

- GoogleAppsDriveLabelsV2Label — A label defines a taxonomy that can be applied to Drive items in order to organize and search across items. Labels can be simple strings, or can contain fields that describe additional metadata that can be further used to organize and search Drive items.
  - `revisionId` string — Output only. Revision ID of the label. Revision ID might be part of the label `name` depending on the request issued. A new revision is created whenever revisioned properties of a label are changed. Matches the regex: `([a-zA-Z0-9])+`.
  - `schemaCapabilities` GoogleAppsDriveLabelsV2LabelSchemaCapabilities — The capabilities related to this label when editing the label.
    - `canDelete` boolean — Whether the user can delete this label. The user must have permission and the label must be disabled.
    - `canEnable` boolean — Whether the user can enable this label. The user must have permission and this label must be disabled.
    - `canUpdate` boolean — Whether the user can change this label.
    - `canDisable` boolean — Whether the user can disable this label. The user must have permission and this label must not already be disabled.
  - `disabler` GoogleAppsDriveLabelsV2UserInfo — Information about a user.
    - `person` string — The identifier for this user that can be used with the [People API](https://developers.google.com/people) to get more information. For example, `people/12345678`.
  - `lockStatus` GoogleAppsDriveLabelsV2LockStatus — Contains information about whether a label component should be considered locked.
    - `locked` boolean — Output only. Indicates whether this label component is the (direct) target of a label lock. A label component can be implicitly locked even if it's not the direct target of a label lock, in which case this field is set to false.
  - `revisionCreateTime` string, google-datetime — Output only. The time this label revision was created.
  - `customer` string — Output only. The customer this label belongs to. For example: `customers/123abc789`.
  - `revisionCreator` GoogleAppsDriveLabelsV2UserInfo — Information about a user.
    - `person` string — The identifier for this user that can be used with the [People API](https://developers.google.com/people) to get more information. For example, `people/12345678`.
  - `properties` GoogleAppsDriveLabelsV2LabelProperties — Basic properties of the label.
    - `title` string — Required. Title of the label.
    - `description` string — The description of the label.
  - `appliedCapabilities` GoogleAppsDriveLabelsV2LabelAppliedCapabilities — The capabilities a user has on this label's applied metadata.
    - `canRead` boolean — Whether the user can read applied metadata related to this label.
    - `canApply` boolean — Whether the user can apply this label to items.
    - `canRemove` boolean — Whether the user can remove this label from items.
  - `appliedLabelPolicy` GoogleAppsDriveLabelsV2LabelAppliedLabelPolicy — Behavior of this label when it's applied to Drive items.
    - `copyMode` 'COPY_MODE_UNSPECIFIED' | 'DO_NOT_COPY' | 'ALWAYS_COPY' | 'COPY_APPLIABLE' — Indicates how the applied label and field values should be copied when a Drive item is copied.
  - `createTime` string, google-datetime — Output only. The time this label was created.
  - `learnMoreUri` string — Custom URL to present to users to allow them to learn more about this label and how it should be used.
  - `enabledAppSettings` GoogleAppsDriveLabelsV2LabelEnabledAppSettings — Describes the Google Workspace apps in which the label can be used.
    - `enabledApps` GoogleAppsDriveLabelsV2LabelEnabledAppSettingsEnabledApp[] — Optional. The list of apps where the label can be used.
      - `app` 'APP_UNSPECIFIED' | 'DRIVE' | 'GMAIL' — Optional. The name of the app.
  - `fields` GoogleAppsDriveLabelsV2Field[] — List of fields in descending priority order.
    - `publisher` GoogleAppsDriveLabelsV2UserInfo — Information about a user.
      - `person` string — The identifier for this user that can be used with the [People API](https://developers.google.com/people) to get more information. For example, `people/12345678`.
    - `queryKey` string — Output only. The key to use when constructing Drive search queries to find files based on values defined for this field on files. For example, "`{query_key}` > 2001-01-01".
    - `lifecycle` GoogleAppsDriveLabelsV2Lifecycle — The lifecycle state of an object, such as label, field, or choice. For more information, see [Label lifecycle](https://developers.google.com/workspace/drive/labels/guides/label-lifecycle). The lifecycle enforces the following transitions: * `UNPUBLISHED_DRAFT` (starting state) * `UNPUBLISHED_DRAFT` -> `PUBLISHED` * `UNPUBLISHED_DRAFT` -> (Deleted) * `PUBLISHED` -> `DISABLED` * `DISABLED` -> `PUBLISHED` * `DISABLED` -> (Deleted) The published and disabled states have some distinct characteristics: * `Published`: Some kinds of changes might be made to an object in this state, in which case `has_unpublished_changes` will be true. Also, some kinds of changes aren't permitted. Generally, any change that would invalidate or cause new restrictions on existing metadata related to the label are rejected. * `Disabled`: When disabled, the configured `DisabledPolicy` takes effect.
      - `disabledPolicy` GoogleAppsDriveLabelsV2LifecycleDisabledPolicy — The policy that governs how to treat a disabled label, field, or selection choice in different contexts.
        - `showInApply` boolean — Whether to show this disabled object in the apply menu on Drive items. * When `true`, the object is generally shown in the UI as disabled and is unselectable. * When `false`, the object is generally hidden in the UI.
        - `hideInSearch` boolean — Whether to hide this disabled object in the search menu for Drive items. * When `false`, the object is generally shown in the UI as disabled but it appears in the search results when searching for Drive items. * When `true`, the object is generally hidden in the UI when searching for Drive items.
      - `state` 'STATE_UNSPECIFIED' | 'UNPUBLISHED_DRAFT' | 'PUBLISHED' | 'DISABLED' | 'DELETED' — Output only. The state of the object associated with this lifecycle.
      - `hasUnpublishedChanges` boolean — Output only. Whether the object associated with this lifecycle has unpublished changes.
    - `dateOptions` GoogleAppsDriveLabelsV2FieldDateOptions — Options for the date field type.
      - `dateFormat` string — Output only. ICU date format.
      - `dateFormatType` 'DATE_FORMAT_UNSPECIFIED' | 'LONG_DATE' | 'SHORT_DATE' — Localized date formatting option. Field values are rendered in this format according to their locale.
      - `minValue` GoogleTypeDate — Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
        - `month` integer — Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
        - `day` integer — Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
        - `year` integer — Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
      - `maxValue` GoogleTypeDate — Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
        - `month` integer — Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
        - `day` integer — Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
        - `year` integer — Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
    - `creator` GoogleAppsDriveLabelsV2UserInfo — Information about a user.
      - `person` string — The identifier for this user that can be used with the [People API](https://developers.google.com/people) to get more information. For example, `people/12345678`.
    - `integerOptions` GoogleAppsDriveLabelsV2FieldIntegerOptions — Options for the Integer field type.
      - `maxValue` string, int64 — Output only. The maximum valid value for the integer field.
      - `minValue` string, int64 — Output only. The minimum valid value for the integer field.
    - `id` string — Output only. The key of a field, unique within a label or library. This value is autogenerated. Matches the regex: `([a-zA-Z0-9])+`.
    - `displayHints` GoogleAppsDriveLabelsV2FieldDisplayHints — UI display hints for rendering a field.
      - `shownInApply` boolean — This field should be shown in the apply menu when applying values to a Drive item.
      - `disabled` boolean — Whether the field should be shown in the UI as disabled.
      - `required` boolean — Whether the field should be shown as required in the UI.
      - `hiddenInSearch` boolean — This field should be hidden in the search menu when searching for Drive items.
    - `selectionOptions` GoogleAppsDriveLabelsV2FieldSelectionOptions — Options for the selection field type.
      - `choices` GoogleAppsDriveLabelsV2FieldSelectionOptionsChoice[] — The options available for this selection field. The list order is consistent, and modified with `insert_before_choice`.
        - `publisher` GoogleAppsDriveLabelsV2UserInfo — Information about a user.
          - `person` string — The identifier for this user that can be used with the [People API](https://developers.google.com/people) to get more information. For example, `people/12345678`.
        - `creator` GoogleAppsDriveLabelsV2UserInfo — Information about a user.
          - `person` string — The identifier for this user that can be used with the [People API](https://developers.google.com/people) to get more information. For example, `people/12345678`.
        - `lifecycle` GoogleAppsDriveLabelsV2Lifecycle — The lifecycle state of an object, such as label, field, or choice. For more information, see [Label lifecycle](https://developers.google.com/workspace/drive/labels/guides/label-lifecycle). The lifecycle enforces the following transitions: * `UNPUBLISHED_DRAFT` (starting state) * `UNPUBLISHED_DRAFT` -> `PUBLISHED` * `UNPUBLISHED_DRAFT` -> (Deleted) * `PUBLISHED` -> `DISABLED` * `DISABLED` -> `PUBLISHED` * `DISABLED` -> (Deleted) The published and disabled states have some distinct characteristics: * `Published`: Some kinds of changes might be made to an object in this state, in which case `has_unpublished_changes` will be true. Also, some kinds of changes aren't permitted. Generally, any change that would invalidate or cause new restrictions on existing metadata related to the label are rejected. * `Disabled`: When disabled, the configured `DisabledPolicy` takes effect.
          - `disabledPolicy` GoogleAppsDriveLabelsV2LifecycleDisabledPolicy — The policy that governs how to treat a disabled label, field, or selection choice in different contexts.
            - `showInApply` boolean — Whether to show this disabled object in the apply menu on Drive items. * When `true`, the object is generally shown in the UI as disabled and is unselectable. * When `false`, the object is generally hidden in the UI.
            - `hideInSearch` boolean — Whether to hide this disabled object in the search menu for Drive items. * When `false`, the object is generally shown in the UI as disabled but it appears in the search results when searching for Drive items. * When `true`, the object is generally hidden in the UI when searching for Drive items.
          - `state` 'STATE_UNSPECIFIED' | 'UNPUBLISHED_DRAFT' | 'PUBLISHED' | 'DISABLED' | 'DELETED' — Output only. The state of the object associated with this lifecycle.
          - `hasUnpublishedChanges` boolean — Output only. Whether the object associated with this lifecycle has unpublished changes.
        - `id` string — The unique value of the choice. This ID is autogenerated. Matches the regex: `([a-zA-Z0-9_])+`.
        - `displayHints` GoogleAppsDriveLabelsV2FieldSelectionOptionsChoiceDisplayHints — UI display hints for rendering an option.
          - `badgePriority` string, int64 — The priority of this badge. Used to compare and sort between multiple badges. A lower number means the badge should be shown first. When a badging configuration is not present, this will be 0. Otherwise, this will be set to `BadgeConfig.priority_override` or the default heuristic which prefers creation date of the label, and field and option priority.
          - `hiddenInSearch` boolean — This option should be hidden in the search menu when searching for Drive items.
          - `darkBadgeColors` GoogleAppsDriveLabelsV2BadgeColors — The color derived from BadgeConfig and changed to the closest recommended supported color.
            - `soloColor` GoogleTypeColor — Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to and from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't have information about the absolute color space that should be used to interpret the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most `1e-5`. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ...
              - …
            - `backgroundColor` GoogleTypeColor — Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to and from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't have information about the absolute color space that should be used to interpret the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most `1e-5`. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ...
              - …
            - `foregroundColor` GoogleTypeColor — Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to and from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't have information about the absolute color space that should be used to interpret the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most `1e-5`. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ...
              - …
          - `shownInApply` boolean — This option should be shown in the apply menu when applying values to a Drive item.
          - `badgeColors` GoogleAppsDriveLabelsV2BadgeColors — The color derived from BadgeConfig and changed to the closest recommended supported color.
            - `soloColor` GoogleTypeColor — Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to and from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't have information about the absolute color space that should be used to interpret the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most `1e-5`. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ...
              - …
            - `backgroundColor` GoogleTypeColor — Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to and from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't have information about the absolute color space that should be used to interpret the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most `1e-5`. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ...
              - …
            - `foregroundColor` GoogleTypeColor — Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to and from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't have information about the absolute color space that should be used to interpret the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most `1e-5`. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ...
              - …
          - `disabled` boolean — Whether the option should be shown in the UI as disabled.
        - `publishTime` string, google-datetime — Output only. The time this choice was published. This value has no meaning when the choice is not published.
        - `disableTime` string, google-datetime — Output only. The time this choice was disabled. This value has no meaning when the choice is not disabled.
        - `updater` GoogleAppsDriveLabelsV2UserInfo — Information about a user.
          - `person` string — The identifier for this user that can be used with the [People API](https://developers.google.com/people) to get more information. For example, `people/12345678`.
        - `schemaCapabilities` GoogleAppsDriveLabelsV2FieldSelectionOptionsChoiceSchemaCapabilities — The capabilities related to this choice when editing the choice.
          - `canUpdate` boolean — Whether the user can update this choice.
          - `canDelete` boolean — Whether the user can delete this choice.
          - `canEnable` boolean — Whether the user can enable this choice.
          - `canDisable` boolean — Whether the user can disable this choice.
        - `updateTime` string, google-datetime — Output only. The time this choice was updated last.
        - `disabler` GoogleAppsDriveLabelsV2UserInfo — Information about a user.
          - `person` string — The identifier for this user that can be used with the [People API](https://developers.google.com/people) to get more information. For example, `people/12345678`.
        - `lockStatus` GoogleAppsDriveLabelsV2LockStatus — Contains information about whether a label component should be considered locked.
          - `locked` boolean — Output only. Indicates whether this label component is the (direct) target of a label lock. A label component can be implicitly locked even if it's not the direct target of a label lock, in which case this field is set to false.
        - `createTime` string, google-datetime — Output only. The time this choice was created.
        - `properties` GoogleAppsDriveLabelsV2FieldSelectionOptionsChoiceProperties — Basic properties of the choice.
          - `badgeConfig` GoogleAppsDriveLabelsV2BadgeConfig — Badge status of the label.
            - `color` GoogleTypeColor — Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to and from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't have information about the absolute color space that should be used to interpret the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most `1e-5`. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ...
              - …
            - `priorityOverride` string, int64 — Override the default global priority of this badge. When set to 0, the default priority heuristic is used.
          - `displayName` string — Required. The display text to show in the UI identifying this field.
          - `insertBeforeChoice` string — Input only. Insert or move this choice before the indicated choice. If empty, the choice is placed at the end of the list.
          - `description` string — The description of this label.
        - `appliedCapabilities` GoogleAppsDriveLabelsV2FieldSelectionOptionsChoiceAppliedCapabilities — The capabilities related to this choice on applied metadata.
          - `canSearch` boolean — Whether the user can use this choice in search queries.
          - `canSelect` boolean — Whether the user can select this choice on an item.
          - `canRead` boolean — Whether the user can read related applied metadata on items.
      - `listOptions` GoogleAppsDriveLabelsV2FieldListOptions — Options for a multi-valued variant of an associated field type.
        - `maxEntries` integer — Maximum number of entries permitted.
    - `disableTime` string, google-datetime — Output only. The time this field was disabled. This value has no meaning when the field is not disabled.
    - `updater` GoogleAppsDriveLabelsV2UserInfo — Information about a user.
      - `person` string — The identifier for this user that can be used with the [People API](https://developers.google.com/people) to get more information. For example, `people/12345678`.
    - `schemaCapabilities` GoogleAppsDriveLabelsV2FieldSchemaCapabilities — The capabilities related to this field when editing the field.
      - `canDisable` boolean — Whether the user can disable this field. The user must have permission and this field must not already be disabled.
      - `canDelete` boolean — Whether the user can delete this field. The user must have permission and the field must be deprecated.
      - `canEnable` boolean — Whether the user can enable this field. The user must have permission and this field must be disabled.
      - `canUpdate` boolean — Whether the user can change this field.
    - `updateTime` string, google-datetime — Output only. The time this field was updated.
    - `disabler` GoogleAppsDriveLabelsV2UserInfo — Information about a user.
      - `person` string — The identifier for this user that can be used with the [People API](https://developers.google.com/people) to get more information. For example, `people/12345678`.
    - `lockStatus` GoogleAppsDriveLabelsV2LockStatus — Contains information about whether a label component should be considered locked.
      - `locked` boolean — Output only. Indicates whether this label component is the (direct) target of a label lock. A label component can be implicitly locked even if it's not the direct target of a label lock, in which case this field is set to false.
    - `userOptions` GoogleAppsDriveLabelsV2FieldUserOptions — Options for the user field type.
      - `listOptions` GoogleAppsDriveLabelsV2FieldListOptions — Options for a multi-valued variant of an associated field type.
        - `maxEntries` integer — Maximum number of entries permitted.
    - `createTime` string, google-datetime — Output only. The time this field was created.
    - `textOptions` GoogleAppsDriveLabelsV2FieldTextOptions — Options for the Text field type.
      - `minLength` integer — Output only. The minimum valid length of values for the text field.
      - `maxLength` integer — Output only. The maximum valid length of values for the text field.
    - `properties` GoogleAppsDriveLabelsV2FieldProperties — The basic properties of the field.
      - `displayName` string — Required. The display text to show in the UI identifying this field.
      - `insertBeforeField` string — Input only. Insert or move this field before the indicated field. If empty, the field is placed at the end of the list.
      - `required` boolean — Whether the field should be marked as required.
    - `appliedCapabilities` GoogleAppsDriveLabelsV2FieldAppliedCapabilities — The capabilities related to this field on applied metadata.
      - `canRead` boolean — Whether the user can read related applied metadata on items.
      - `canWrite` boolean — Whether the user can set this field on Drive items.
      - `canSearch` boolean — Whether the user can search for Drive items referencing this field.
  - `name` string — Output only. Resource name of the label. Will be in the form of either: `labels/{id}` or `labels/{id}@{revision_id}` depending on the request. See `id` and `revision_id` below.
  - `creator` GoogleAppsDriveLabelsV2UserInfo — Information about a user.
    - `person` string — The identifier for this user that can be used with the [People API](https://developers.google.com/people) to get more information. For example, `people/12345678`.
  - `lifecycle` GoogleAppsDriveLabelsV2Lifecycle — The lifecycle state of an object, such as label, field, or choice. For more information, see [Label lifecycle](https://developers.google.com/workspace/drive/labels/guides/label-lifecycle). The lifecycle enforces the following transitions: * `UNPUBLISHED_DRAFT` (starting state) * `UNPUBLISHED_DRAFT` -> `PUBLISHED` * `UNPUBLISHED_DRAFT` -> (Deleted) * `PUBLISHED` -> `DISABLED` * `DISABLED` -> `PUBLISHED` * `DISABLED` -> (Deleted) The published and disabled states have some distinct characteristics: * `Published`: Some kinds of changes might be made to an object in this state, in which case `has_unpublished_changes` will be true. Also, some kinds of changes aren't permitted. Generally, any change that would invalidate or cause new restrictions on existing metadata related to the label are rejected. * `Disabled`: When disabled, the configured `DisabledPolicy` takes effect.
    - `disabledPolicy` GoogleAppsDriveLabelsV2LifecycleDisabledPolicy — The policy that governs how to treat a disabled label, field, or selection choice in different contexts.
      - `showInApply` boolean — Whether to show this disabled object in the apply menu on Drive items. * When `true`, the object is generally shown in the UI as disabled and is unselectable. * When `false`, the object is generally hidden in the UI.
      - `hideInSearch` boolean — Whether to hide this disabled object in the search menu for Drive items. * When `false`, the object is generally shown in the UI as disabled but it appears in the search results when searching for Drive items. * When `true`, the object is generally hidden in the UI when searching for Drive items.
    - `state` 'STATE_UNSPECIFIED' | 'UNPUBLISHED_DRAFT' | 'PUBLISHED' | 'DISABLED' | 'DELETED' — Output only. The state of the object associated with this lifecycle.
    - `hasUnpublishedChanges` boolean — Output only. Whether the object associated with this lifecycle has unpublished changes.
  - `labelType` 'LABEL_TYPE_UNSPECIFIED' | 'SHARED' | 'ADMIN' | 'GOOGLE_APP' — Required. The type of label.
  - `publisher` GoogleAppsDriveLabelsV2UserInfo — Information about a user.
    - `person` string — The identifier for this user that can be used with the [People API](https://developers.google.com/people) to get more information. For example, `people/12345678`.
  - `publishTime` string, google-datetime — Output only. The time this label was published. This value has no meaning when the label isn't published.
  - `disableTime` string, google-datetime — Output only. The time this label was disabled. This value has no meaning when the label isn't disabled.
  - `id` string — Output only. Globally unique identifier of this label. ID makes up part of the label `name`, but unlike `name`, ID is consistent between revisions. Matches the regex: `([a-zA-Z0-9])+`.
  - `displayHints` GoogleAppsDriveLabelsV2LabelDisplayHints — The UI display hints for rendering the label.
    - `disabled` boolean — Whether the label should be shown in the UI as disabled.
    - `priority` string, int64 — The order to display labels in a list.
    - `shownInApply` boolean — This label should be shown in the apply menu when applying values to a Drive item.
    - `hiddenInSearch` boolean — This label should be hidden in the search menu when searching for Drive items.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/drivelabels.md) · [All operations](https://skmtc.net/google/apis/drivelabels/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/drivelabels/versions/0865f97e9c4a/schema)
