# Recipe Label And Archive Emails

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

- Repository: https://github.com/googleworkspace/cli (32044 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add googleworkspace/cli --skill recipe-label-and-archive-emails -g -a claude-code -y`
Codex: `npx skills add googleworkspace/cli --skill recipe-label-and-archive-emails -g -a codex -y`
Cursor: `npx skills add googleworkspace/cli --skill recipe-label-and-archive-emails -g -a cursor -y`
Gemini CLI: `npx skills add googleworkspace/cli --skill recipe-label-and-archive-emails -g -a gemini-cli -y`

## Description

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

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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"]}'`


