Canonry integrates with Google Search Console (GSC) via OAuth 2.0 to pull search performance data, inspect URL indexing status, and submit pages for indexing. This is separate from the GA4 integration (which uses a service account).
You can complete the entire setup via the web dashboard or the CLI — both are documented below.
Two APIs are needed:
In Google Cloud Console:
Or go directly:
https://console.developers.google.com/apis/api/searchconsole.googleapis.com/overview?project=YOUR_PROJECT_ID
https://console.developers.google.com/apis/api/indexing.googleapis.com/overview?project=YOUR_PROJECT_ID
Note: The Indexing API is only required if you plan to use the request-indexing feature. All other GSC features work with just the Search Console API.
canonry)If you haven’t configured the OAuth consent screen yet, Google will prompt you. For personal use, set it to External with Testing status and add your Google account as a test user.
Canonry has two callback paths depending on your setup:
Option A — Shared callback (recommended). Local canonry serve installs automatically use the local shared callback from apiUrl / the serve port. If you configure a publicUrl in your canonry server config or pass --public-url when connecting, canonry uses that same shared-callback shape for all projects:
http://localhost:4100/api/v1/google/callback
Register this one URI and you’re done. For a custom host, replace localhost:4100 with your server address.
Option B — Per-project callbacks (auto-detect fallback). If canonry cannot resolve a shared callback from publicUrl or a local loopback apiUrl, it generates a per-project redirect URI based on the request headers:
http://localhost:4100/api/v1/projects/<project-name>/google/callback
This means you’d need to register a separate redirect URI for each project you connect. To avoid this, use Option A by setting a public URL (see Step 3 below).
Tip: If Google rejects the connection with a
redirect_uri_mismatcherror, the error page shows the exact URI to add to your OAuth client’s authorized redirect URIs.
This is a one-time setup that tells canonry your Google OAuth app credentials. You need to do this before connecting any project to GSC.
The card shows “Ready” when credentials are saved.
During canonry init:
canonry init --google-client-id <CLIENT_ID> --google-client-secret <CLIENT_SECRET>
After initial setup:
canonry settings google --client-id <CLIENT_ID> --client-secret <CLIENT_SECRET>
Environment variables (CI/Docker):
export GOOGLE_CLIENT_ID=your-client-id
export GOOGLE_CLIENT_SECRET=your-client-secret
canonry bootstrap
canonry_gsc_connect with the project name and open the returned
authUrl in your browser to grant Google access.canonry_gsc_properties.
Pass the exact siteUrl you want to canonry_gsc_set_property.canonry_google_connections_list.Projects with the same connection domain share their selected property. Selecting a different property or disconnecting clears the previous property’s stored Search Console data for all of them. A new sync fills the data for the selected property. Wait for active syncs and sitemap inspections to finish before switching.
If the popup is blocked by your browser, canonry falls back to a full-page redirect. Allow popups for your canonry server URL for the smoothest experience.
canonry google connect <project>
This opens your browser to the Google OAuth consent screen. After granting access, canonry stores the tokens and you’re ready to go.
If running canonry on a remote server with a different public URL:
canonry google connect <project> --public-url https://your-server.com
After connecting, tell canonry which Search Console property to use.
# List available properties
canonry google properties <project>
# Set the one you want
canonry google set-property <project> https://example.com/
Properties in GSC are typically
https://example.com/(URL prefix) orsc-domain:example.com(domain property). Some accounts also surface a numeric property ID (e.g.364127269); canonry passes any of these formats straight through to the GSC API. Use whichever matches your verified property.
list-sitemaps reads the sitemap registrations already in Google Search Console.
set-sitemap only stores Canonry’s local default for later inspection or
--configured submission. submit-sitemap asks Google to submit or resubmit
one or more sitemap URLs for refetching.
On the Search Console tab, enter your sitemap URL in the sitemap input field.
# Auto-discover from GSC + robots.txt
canonry google discover-sitemaps <project> --wait
# Or save Canonry's local default (this does not submit it to Google)
canonry google set-sitemap <project> https://example.com/sitemap.xml
# List sitemap registrations currently in Google Search Console
canonry google list-sitemaps <project>
# Submit one or more sitemap URLs to Google for refetching
canonry google submit-sitemap <project> https://example.com/sitemap.xml https://example.com/news-sitemap.xml
# Resubmit Canonry's saved default, or prefer sitemap indexes (fallback: top-level files)
canonry google submit-sitemap <project> --configured
canonry google submit-sitemap <project> --all
# Submit every standalone top-level sitemap and every child listed by each sitemap index
# (parent index URLs are not redundantly submitted)
canonry google submit-sitemap <project> --all-files
Google accepting a sitemap requests a refetch; it does not guarantee that its
URLs will be indexed. Existing read-only OAuth connections must disconnect and
reconnect to grant the full webmasters scope required for sitemap submission.
Use --all for the normal large-property case; --all-files can submit many
more files and Canonry batches them in groups of 50.
The Search Console tab on each project page provides:
# Sync search analytics data (default: last 28 days)
canonry google sync <project>
canonry google sync <project> --days 90 --full --wait
# Search performance data (one page, ordered by clicks descending)
canonry google performance <project>
canonry google performance <project> --days 30 --keyword "best widgets"
canonry google performance <project> --start 2026-06-01 --end 2026-06-30 --order-by date
canonry google performance <project> --limit 2000 --offset 2000
# Top pages ranked by clicks (aggregated in SQL, one row per page)
canonry google top-pages <project>
canonry google top-pages <project> --start 2026-06-01 --end 2026-06-30 --limit 20
# Totals per search query for a window (one row per query, clicks desc).
# `position` is weighted by impressions and `days` counts the dates the query
# appeared. These are the queries Google names; Google leaves rare queries
# out, so the rows do not add up to the property total (use performance-daily).
# The JSON `window.earliestDataDate` is the first stored per-query day: a window
# that starts before it is only partly covered, not a low-traffic period.
canonry google query-totals <project> --start 2026-06-01 --end 2026-06-30
canonry google query-totals <project> --window 90d --limit 500 --offset 500
# Index coverage summary
canonry google coverage <project>
canonry google coverage-history <project>
# Inspect a specific URL
canonry google inspect <project> https://example.com/page
# Bulk inspect all sitemap URLs
canonry google inspect-sitemap <project> --wait
# View inspection history
canonry google inspections <project>
canonry google inspections <project> --url https://example.com/page
# Find deindexed pages
canonry google deindexed <project>
# Submit URLs for indexing
canonry google request-indexing <project> https://example.com/new-page
canonry google request-indexing <project> --all-unindexed
# Connection management
canonry google status <project>
canonry google disconnect <project>
Google connection is incomplete — please reconnectThe OAuth tokens are missing or expired beyond recovery.
UI: On the Search Console tab, click Disconnect, then Connect to Google Search Console again.
CLI:
canonry google disconnect <project>
canonry google connect <project>
redirect_uri_mismatch error during OAuthGoogle rejected the callback because the redirect URI isn’t registered. The error page shows the exact URI that was used.
Fix: Go to Google Cloud Console → Credentials, click your OAuth client, and add the URI shown in the error to Authorized redirect URIs.
Token exchange failed (400)The OAuth callback failed. Common causes:
Search Console API not enabled — connection succeeds, then every call returns 403Symptom: the OAuth flow completes and the connection is stored, but opening the
project immediately shows an “Action needed — Enable the Search Console API”
banner (and, in the CLI, a FORBIDDEN with the message below). The first live call
canonry makes — listing your Search Console properties — returns 403.
Cause: when you use your own Google OAuth client, granting OAuth consent is not enough — the Search Console API must also be enabled on that OAuth client’s Google Cloud project. OAuth authorizes the account; enabling the API authorizes the project to call it. They are separate steps, and the second is easy to miss.
Fix: enable both APIs on the GCP project that owns your OAuth client, wait ~2–5 minutes for the change to propagate, then retry:
https://console.developers.google.com/apis/api/searchconsole.googleapis.com/overview?project=YOUR_PROJECT_ID
https://console.developers.google.com/apis/api/indexing.googleapis.com/overview?project=YOUR_PROJECT_ID
The dashboard banner deep-links straight to the enable page with your project number already filled in. The 403 does not log you out — a Google permission error is not a canonry session error, so your dashboard session stays valid while you fix it.
Indexing API returned 403Either:
No properties foundYour Google account doesn’t have any verified properties in Search Console, or you authorized with the wrong account. Verify your site at Google Search Console.
GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET must both be setBoth values are required.
UI: Go to Settings and check the Google Search Console card — fill in both fields.
CLI:
canonry settings google --client-id <ID> --client-secret <SECRET>
Some browsers block the OAuth popup. Either: