Command

nylas email delete

Delete an email by message ID.

Written by Qasim Muhammad Staff SRE

What does nylas email delete do?

The nylas email delete command permanently removes a message from the provider. On Gmail this moves to Trash; on IMAP it sets the \Deleted flag. Use --force to skip the confirmation prompt.

Usage

nylas email delete <message-id> [grant-id] [--force]

Flags

FlagDescription
--jsonOutput as JSON
--no-colorDisable color output
--verbose(-v)Enable verbose output
--configCustom config file path
--help(-h)Show help for the command
--limitLimit results (most list commands)
--yes(-y)Skip confirmations
--force(-f)Skip confirmation prompt

Examples

The nylas email delete command permanently removes a message from the provider.

Delete a specific email

nylas email delete msg_abc123

Batch delete old emails with jq pipe

nylas email list --json --limit 50 | jq -r '.[].id' | xargs -I{} nylas email delete {} --force

Example output

✓ Message moved to trash
  Message ID: msg_abc123

Troubleshooting

Delete succeeds but email still visible

Gmail moves deleted messages to Trash instead of permanently removing them. Trash is purged after 30 days.

Permission denied when deleting

Your OAuth scope may not include delete permissions. Run nylas auth login again and ensure mail.modify or equivalent scope is granted.

Recommended guides

Run nylas email delete --help for full help output.