mainwp-google-search-console category. All use the mainwp/ namespace on your MainWP Dashboard and are available to MainWP AI Assistant and authenticated API clients.
What You’ll Learn
- List connections and exact property scopes
- Read or replace a site’s property mapping
- Read cached aggregate search performance
- Inspect and change refresh settings
- Request background refreshes and check their outcomes
Prerequisites
- WordPress 6.9 or later on the MainWP Dashboard site
- MainWP Dashboard with Abilities API support; use version 6.2 or later for the
input_jsonand DELETE request examples below - Google Search Console 6.3 or later, active on MainWP Dashboard
- An authenticated WordPress user with
manage_optionsand access to the Google Search Console Add-on - A configured Google connection for property mappings and refreshes
edit_sites, access to the selected site, and a connected Child site. Team Control restrictions apply. Connection and property lists are administrator-level catalog views; their mapped-site counts respect site access. Refresh-status reads require Add-on access and either ownership of the job or administrator permission.
Available Abilities
Discover the abilities and their complete input and output schemas:
Inputs, Revisions, and Confirmation
Site calls usesite_id_or_domain, which accepts a site ID or domain. The examples use site ID 1. These abilities reject unknown input fields.
Connection references, property references, and revisions are opaque 64-character hexadecimal strings. Read them from the API rather than constructing them from a domain or Google account. The repeated a and b values below are fictional examples: replace them with the relevant returned reference or revision. Replace example UUIDs with a new UUID for each logical request.
For changes and refresh requests, if_match is an input field containing the current revision of the resource being changed:
Mapping replacements, policy replacements, and catalog refreshes require exactly one of
dry_run and confirm to be true. Start with dry_run: true, confirm: false, inspect the effects, then send the same request with dry_run: false, confirm: true to proceed. Keep the original if_match and request_ref for that preview-to-confirmation sequence. A site observation refresh has no preview or confirmation flags.
request_ref identifies one logical request. When retrying that exact request after a lost response, reuse its UUID and payload. If the target, revision, or requested settings change, use a new UUID. A stale revision requires reading the resource again and reviewing a new request; do not blindly retry with a newer revision.
List Connections
Ability:mainwp/list-google-search-console-connections-v1Method: GET
The response contains
connections, next_after_connection_ref, and truncated. Each connection includes connection_ref, label, method (oauth or service_account), status, property_count, mapped_site_count, last_catalog_refresh_at, and revision.
While truncated is true, pass next_after_connection_ref as after_connection_ref to read the next page. Connection health comes from stored state; this call does not contact Google or return credentials.
List Properties
Ability:mainwp/list-google-search-console-properties-v1Method: GET
The response contains
properties, next_after_property_ref, and truncated. Each property includes property_ref, connection_ref, property_type, property_scope, label, permission, usable, mapped_site_count, and revision.
property_type is domain or url_prefix. The exact property_scope matters: sc-domain:example.com and https://example.com/ are distinct properties. Select the returned property_ref for the intended scope. Permission values are owner, full, restricted, unverified, or unknown; usability also depends on the stored connection state.
While truncated is true, pass next_after_property_ref as after_property_ref. This reads the cached catalog. Use a catalog refresh to update it from Google.
Get Site Mapping
Ability:mainwp/get-site-google-search-console-mapping-v1Method: GET
status is unmapped, mapped, or stale. A stale mapping needs attention, for example after its property disappears from a refreshed catalog. cache_status is none, fresh, stale, or malformed. Use the returned mapping revision when replacing the mapping or requesting a site refresh.
Replace Site Mapping
Ability:mainwp/replace-site-google-search-console-mapping-v1Method: DELETE Preview assigning a property returned by List Properties:
site_id_or_domain, property_ref, if_match, and request_ref, plus the confirmation flags. Set property_ref to null to remove the mapping. A non-null reference must identify a usable property.
The response includes mode (preview or executed), request_id, site_id, would_change, changed, cache_would_invalidate, cache_invalidated, and mapping. The nested mapping contains its status, property and connection references, property type and label, and revision.
The preview’s nested mapping describes the proposed result. Keep the original revision from Get Site Mapping as if_match when confirming; do not substitute the proposed mapping’s revision. Changing the mapping invalidates the site’s cached Search Console data. This operation does not contact Google or fetch replacement statistics.
Get Cached Site Observation
Ability:mainwp/get-site-google-search-console-observation-v1Method: GET
site_id_or_domain is required. include_daily is optional and defaults to false.
The response includes site_id, availability, period (week, month, or null), period_start, period_end, generated_at, stale, totals, daily, and revision. Unavailable dates and metrics can be null.
totals contains clicks, impressions, click_through_rate, average_position, sitemap_submitted, sitemap_indexed, sitemap_errors, and indexing_rate. Click-through rate is a fraction from 0 to 1; indexing rate is a percentage from 0 to 100.
When requested, daily contains up to 31 entries with date, clicks, impressions, click_through_rate, and average_position. Otherwise it is an empty array. Observations older than 48 hours are marked stale. A stale mapping can return no metrics at all.
This ability does not contact Google. It returns validated aggregate data, excluding search queries, individual page URLs, sitemap URLs, credentials, and raw Google responses. Older cached data visible in the Add-on may not yet have this aggregate representation. Request a site refresh when
availability is no_cache and the mapping is valid.Get Refresh Policy
Ability:mainwp/get-google-search-console-refresh-policy-v1Method: GET
scheduler_mode is wordpress, external, or disabled. schedule_state is scheduled, unscheduled, or drifted; drift indicates a mismatch between the policy and the WordPress scheduled event. External scheduling can correctly report unscheduled with a null next_refresh_at.
last_refresh_at and next_refresh_at can be null. The last refresh time records a scheduled run with at least one successful refresh, not successful completion for every site. Use job status to check a particular ability-requested refresh.
Replace Refresh Policy
Ability:mainwp/replace-google-search-console-refresh-policy-v1Method: DELETE
Also provide
if_match from Get Refresh Policy, a request_ref, and the confirmation flags.
The response includes mode, request_id, would_change, changed, schedule_would_change, schedule_changed, caches_would_invalidate, caches_invalidated, and policy. Cache fields are counts. The preview returns the current policy alongside the predicted effects; after execution, policy contains the resulting settings and scheduler state.
Policy changes can invalidate cached data across sites. Confirming also reconciles the schedule, including when settings stay the same but the schedule has drifted. It does not immediately fetch data from Google.
Request a Site Refresh
Ability:mainwp/request-site-google-search-console-refresh-v1Method: POST
dry_run or confirm.
Example response:
requested does not mean new statistics are available. Save job_id and check refresh status. After success, read the site observation again.
Request a Catalog Refresh
Ability:mainwp/request-google-search-console-catalog-refresh-v1Method: POST
connection_ref, that connection’s current revision as if_match, a request_ref, and the confirmation flags.
The response includes mode and status (preview or requested), job_id, request_id, connection_ref, effects, and requested_at. Preview responses have null job_id and requested_at.
effects contains current_property_count, current_mapping_count, maximum_mapping_invalidations, and maximum_cache_invalidations. A preview does not contact Google, so these are current counts and conservative impact limits, not a prediction of which properties Google will return.
After confirmation, the job refreshes that connection’s property catalog. It can add, update, or remove local property entries, reconcile site mappings, and invalidate affected caches. A property that is no longer available can leave its mapping stale. This job does not delete properties from Google or replace a site observation refresh.
Get Refresh Status
Ability:mainwp/get-google-search-console-refresh-status-v1Method: GET
job_id as the required job_ref. This reads jobs requested through these abilities, not the history of ordinary scheduled or manual UI refreshes.
The response includes job_id, kind (site_observation or connection_catalog), target, status, phase, attempts, result, requested_at, updated_at, and completed_at. The target identifies a site_id or connection_ref; the unused field is null. completed_at is null until a terminal outcome is recorded.
phase is queued, authorizing, preparing, provider_request, validating, committing, or complete. Jobs use WordPress cron and can make up to three attempts for retryable failures. Authorization and resource revisions are checked again when work runs, so a queued job can fail if access or mappings change.
The result contains properties_added, properties_updated, properties_removed, mappings_invalidated, caches_invalidated, cache_updated, revision, and code. Use these fields to distinguish a catalog change from a site-cache update. Error codes can indicate problems such as credential_unavailable, provider_auth, provider_quota, stale_revision, mapping_invalid, or outcome_unknown.
Handling Errors
Ability errors use themainwp_google_search_console_ prefix. Authentication and access errors require an authorized user; confirmation errors require the correct preview or confirmation flags. For a stale revision, read the current resource and review the intended change again. For credential or provider authorization failures, repair the connection through the Add-on before requesting another refresh.
A successful request to queue work is not proof that Google data was refreshed. Poll the returned job, inspect its terminal result, then read the updated mapping, catalog, or observation. If a job remains queued, check that WordPress cron is running on the MainWP Dashboard site.
Related Resources
- Google Search Console Add-on - Connect accounts and use the Dashboard interface
- Abilities API Overview - Authentication, discovery, and HTTP methods
- Cache Control Abilities - Cache status and purge automation
