GSC CLI
Search Console from the command line.
Retrieve search analytics, manage sites, inspect URLs, and handle sitemaps. OAuth2 authentication with batch processing support.
View on NPMInstall
Install globally via npm:
npm install -g kanmi-gsc-cli
Or as part of the complete suite:
npm install -g kanmi-suite-cli
Features
Search Analytics
Clicks, impressions, CTR, and position data.
Site Management
List properties, verify sites, manage configs.
Advanced Filtering
Filter by device, search type, country, date.
Batch Processing
Process multiple sites and date ranges efficiently.
Usage
Authentication
gsc-cli auth
List Sites
gsc-cli sites --format table
Search Analytics Query
gsc-cli query \
--site "https://example.com" \
--dimensions "query,page" \
--date-range "last-7-days" \
--format json
Advanced Query with Filters
gsc-cli query \
--site "https://example.com" \
--dimensions "query,country,device" \
--filters "country:usa,device:mobile" \
--date-range "2024-01-01:2024-01-31" \
--limit 1000 \
--output search-data.csv
URL Inspection
gsc-cli inspect \
--site "https://example.com" \
--url "https://example.com/page"
Sitemap Management
gsc-cli sitemaps --site "https://example.com"
gsc-cli sitemaps --site "https://example.com" --submit "sitemap.xml"
Setup
Requires a Google Cloud Project with Search Console API enabled.
- Go to Google Cloud Console
- Enable Google Search Console API
- Create OAuth2 credentials (Desktop application)
- Download credentials JSON
# Environment variables
GSC_CREDENTIALS_PATH=/path/to/credentials.json
GSC_DEFAULT_SITE=https://example.com