Resource: Label
Labels are used to categorize messages and threads within the user's mailbox. The maximum number of labels supported for a user's mailbox is 10,000.
JSON representation |
---|
{ "id": string, "name": string, "messageListVisibility": enum ( |
Fields | |
---|---|
id |
The immutable ID of the label. |
name |
The display name of the label. |
messageListVisibility |
The visibility of messages with this label in the message list in the Gmail web interface. |
labelListVisibility |
The visibility of the label in the label list in the Gmail web interface. |
type |
The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread. System labels are internally created and cannot be added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads under some circumstances but this is not guaranteed. For example, users can apply and remove the |
messagesTotal |
The total number of messages with the label. |
messagesUnread |
The number of unread messages with the label. |
threadsTotal |
The total number of threads with the label. |
threadsUnread |
The number of unread threads with the label. |
color |
The color to assign to the label. Color is only available for labels that have their |
MessageListVisibility
Enums | |
---|---|
show |
Show the label in the message list. |
hide |
Do not show the label in the message list. |
LabelListVisibility
Enums | |
---|---|
labelShow |
Show the label in the label list. |
labelShowIfUnread |
Show the label if there are any unread messages with that label. |
labelHide |
Do not show the label in the label list. |
Type
Enums | |
---|---|
system |
Labels created by Gmail. |
user |
Custom labels created by the user or application. |
Color
JSON representation |
---|
{ "textColor": string, "backgroundColor": string } |
Fields | |
---|---|
textColor |
The text color of the label, represented as hex string. This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: |
backgroundColor |
The background color represented as hex string #RRGGBB (ex #000000). This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: |
Methods |
|
---|---|
|
Creates a new label. |
|
Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to. |
|
Gets the specified label. |
|
Lists all labels in the user's mailbox. |
|
Patch the specified label. |
|
Updates the specified label. |