Command Structure
Allgws commands follow a consistent structure:
Components
- service: The Google Workspace API to use (e.g.,
drive,gmail,calendar) - resource: The API resource type (e.g.,
files,messages,events) - method: The operation to perform (e.g.,
list,create,update,delete) - flags: Optional parameters to customize the request
Examples
Common Flags
These flags work across all commands:--params
Pass query parameters and path parameters as JSON:
--json
Provide the request body as JSON:
--dry-run
Validate the request without sending it to the API:
--page-all
Automatically fetch all pages of results (output as NDJSON):
--page-limit
Limit the number of pages to fetch (default: 10):
--page-delay
Set delay between page requests in milliseconds (default: 100):
--format
Specify output format (json, table, yaml, csv):
--upload
Upload a file with multipart request:
--sanitize
Sanitize API responses through Model Armor:
Using —help
Every command, resource, and method has built-in help:Dynamic Discovery
gws doesn’t ship with a static list of commands. It reads Google’s Discovery Service at runtime, so when Google adds new API endpoints or methods, gws picks them up automatically.
To introspect any method’s schema:
Helper Commands
Some services include helper commands (prefixed with+) for common workflows:
- Drive:
+upload - Gmail:
+send,+watch,+triage - Calendar:
+insert - Sheets:
+append,+read - Docs:
+write - Chat:
+send
Service Pages
Detailed command examples for each service:Drive
Manage files, folders, and shared drives
Gmail
Send, read, and manage email
Calendar
Manage calendars and events
Sheets
Read and write spreadsheets
Docs
Read and write Google Docs
Chat
Manage Chat spaces and messages
Admin
Manage users, groups, and devices
All Services
Complete service reference table
Environment Variables
Control behavior with environment variables:| Variable | Description |
|---|---|
GOOGLE_WORKSPACE_CLI_TOKEN | Pre-obtained OAuth2 access token |
GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE | Path to credentials JSON |
GOOGLE_WORKSPACE_CLI_IMPERSONATED_USER | For service account domain-wide delegation |
GOOGLE_WORKSPACE_CLI_SANITIZE_TEMPLATE | Default Model Armor template |
GOOGLE_WORKSPACE_CLI_SANITIZE_MODE | warn (default) or block |
.env file in your working directory.