# Recipe Label And Archive Emails

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

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

- Page: https://ss33.ai/skills/googleworkspace/recipe-label-and-archive-emails-13676300306
- Publisher: googleworkspace
- Category: [Business](https://ss33.ai/skills/category/business-y1h0vy) › [Operations & productivity](https://ss33.ai/skills/category/business-y1h0vy/operations-and-productivity-ivsf8j)
- License: Apache-2.0
- Source: https://github.com/googleworkspace/cli/blob/a3768d0e82ad83cca2da97724e46bea4ff0e6dbd/skills/recipe-label-and-archive-emails/SKILL.md

## Skill

SKILL.md: https://ss33.ai/api/v1/ss33/download/googleworkspace/recipe-label-and-archive-emails-13676300306

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