> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Remove label

> Remove an existing Gmail label from one or many messages.

`removeLabel` removes one label from Gmail messages without deleting the label itself. Use it to clear a workflow stage or classification while leaving the label available elsewhere in the mailbox.

## Example

Remove the `Triage` label from each newly received message:

```ts theme={null}
import { automation } from "automate.ax"
import { onNewEmail, removeLabel } from "automate.ax/gmail"

export default automation("Clear Gmail triage labels", () => {
  const email = onNewEmail()

  removeLabel({
    label: "Triage",
    messageIds: email.messageId,
  })
})
```

The label must exist in the selected Gmail account.

## Inputs

| Name         | Type                                 | Required | Description                                                                      |
| ------------ | ------------------------------------ | -------- | -------------------------------------------------------------------------------- |
| `label`      | `string`                             | Yes      | Label display name or immutable Gmail label ID.                                  |
| `messageIds` | `string \| string[]`                 | Yes      | One or up to 1,000 immutable Gmail message IDs.                                  |
| `account`    | `string \| Google account reference` | No       | Google account binding to use. Defaults to the project's default Google account. |

Every input field also accepts a compatible `Signal`; the example passes `email.messageId` directly.

Label IDs must match exactly. Display names are matched after trimming surrounding whitespace and ignoring capitalization. If the label does not exist in the selected account, the action fails without modifying the messages.

## Output

The action returns a `Signal<string[]>` containing the modified message IDs in input order.

Removing a Gmail system label changes the corresponding state: for example, removing `INBOX` archives a message and removing `UNREAD` marks it as read. The action affects only the supplied messages, not the label resource or every message in their threads.
