Skip to content
Account and onboarding

Get the Google connect link

A Product Metrics link the person opens in a browser to grant Google access; an assistant cannot grant it.

GET /google/connect-link

Scope setup · Access Read only · Operation id google.get_connect_link

Try it

productmetrics runs after productmetrics login; curl needs PM_TOKEN (see Authentication).

productmetrics google get-connect-link --scope ads --json

Response

API response (200):

{
  "data": {
    "url": "https://example-store.com",
    "scope": "ads",
    "check_with": "setup.get_status"
  },
  "request_id": "req_01JAXMCT3R1DN0FV0YD0V9YA4W"
}

CLI output: productmetrics google get-connect-link --json prints { "ok": true, "data": …, "request_id": "…" } with the same data, plus "next_action": { "type": "browser", "url": "…" } when a person must open a link (exit code 4).

Before you call

ads connects Google Ads and Merchant Center in one Google consent (use it when setup.get_status shows user.google_grant none, missing_scope or revoked). merchant asks again for the same grant on the Google account already connected, when Merchant Center access is missing. Give url to the person; they sign in to Product Metrics if needed and approve in Google. Nothing changes until they do. Afterwards call setup.get_status and read user.google_grant.

Browser step: the result can hold a URL the person must open in a browser. An agent cannot finish that step itself: give the person the URL (the CLI prints it and exits 4).

Query parameters

NameTypeRequiredDescription
scopeenumYesads connects Google Ads and Merchant Center in one consent; merchant asks again for Merchant Center access. One of ads, merchant.

Errors

A failure answers with its HTTP status and { error: { code, message, details? }, request_id }. Branch on code (stable, lower_snake); show message to the person. The CLI prints the same error with "ok": false.

{
  "error": {
    "code": "insufficient_scope",
    "message": "This operation needs the setup scope; connect again and allow it.",
    "details": {
      "required_scope": "setup"
    }
  },
  "request_id": "req_01J9YJC50JQV9BYFT45DFT8A4J"
}
StatusCodeWhen
400invalid_requestA path, query or body value does not match this page. details.issues lists each location, path and message.
401invalid_tokenThe token is missing, expired or revoked: sign in again (productmetrics login). The WWW-Authenticate header says why.
403insufficient_scopeThe token lacks the setup scope (details.required_scope): sign in again and allow it.
429rate_limitedMore than 600 requests a minute for this person: wait the Retry-After seconds (60) and retry.

All Account and onboarding operations