Skip to content

Gmail — Remove label

Type: gmail-remove-label  ·  Package: Gmail v1.0.4  ·  Output: —

Removes one or more labels from an email. It is the inverse of Apply label: use it, for example, to remove Pending once the case is solved.

It works on the session created with Gmail — Connect. Pass it in the session parameter, or place this activity inside the body of Gmail — Connect to inherit it automatically.

  • Give the labels by name (case-insensitive) or by ID; look them up with Get labels.
  • Each label must exist in the mailbox; if one doesn’t, it fails without removing any.
  • Removing a label the email doesn’t have changes nothing and does not fail.
  • System labels can be removed too: INBOX is the same as archiving and UNREAD the same as marking as read.
ParameterTypeDefaultDescription
idstring—Message ID.
labelsstring | List—Label name(s) or ID(s) to remove: text separated by commas or semicolons, or a list.
ParameterTypeDefaultDescription
sessionZoanGmailSession—Gmail — Connect session (inherited inside body).

This activity does not return a value.

MessageCause and fix
Label not found. Use an existing label name or ID.A label does not exist in the mailbox. Check the name with Get labels.
'labels' is required.labels is empty.
'id' is required.id is empty or the expression returned null.
Requested entity was not found.No email with that ID exists in the mailbox.
Gmail — Connect credential = credential("gmail-support")
└─ body:
Gmail — Get emails query = "label:Pending subject:solved" → output: solved
For each email in solved
└─ Gmail — Remove label id = email["id"] labels = "Pending"
Gmail — Apply label id = email["id"] labels = "Solved"