> **recipe-label-and-archive-emails** — skill 79 of 95 in [googleworkspace/cli](https://skillsdocs.com/googleworkspace/cli).
>
> Book (all skills, one file): https://skillsdocs.com/googleworkspace/cli.md
> Machine manifest: https://skillsdocs.com/googleworkspace/cli/.well-known/agent-skills/index.json
> Install the book: `npx skills add googleworkspace/cli`
> Upstream: https://github.com/googleworkspace/cli/blob/main/skills/recipe-label-and-archive-emails/SKILL.md @ `main`
> Raw bytes, no header: https://raw.githubusercontent.com/googleworkspace/cli/main/skills/recipe-label-and-archive-emails/SKILL.md
> Base for relative paths: https://raw.githubusercontent.com/googleworkspace/cli/main/skills/recipe-label-and-archive-emails/
> Licence: Apache-2.0 — https://spdx.org/licenses/Apache-2.0.html
>
> Content © its authors, served unmodified. Takedown: https://github.com/DreambaseAI/skillsdocs/issues/new?labels=takedown&title=Takedown+request

<!-- Verbatim upstream SKILL.md follows, YAML frontmatter included. -->

---
name: recipe-label-and-archive-emails
description: "Apply Gmail labels to matching messages and archive them to keep your inbox clean."
metadata:
  version: 0.22.5
  openclaw:
    category: "recipe"
    domain: "productivity"
    requires:
      bins:
        - gws
      skills:
        - gws-gmail
---

# Label and Archive Gmail Threads

> **PREREQUISITE:** Load the following skills to execute this recipe: `gws-gmail`

Apply Gmail labels to matching messages and archive them to keep your inbox clean.

## Steps

1. Search for matching emails: `gws gmail users messages list --params '{"userId": "me", "q": "from:notifications@service.com"}' --format table`
2. Apply a label: `gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"addLabelIds": ["LABEL_ID"]}'`
3. Archive (remove from inbox): `gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"removeLabelIds": ["INBOX"]}'`
