> ## Documentation Index
> Fetch the complete documentation index at: https://6f524b4-productmetrics.manicule.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://6f524b4-productmetrics.manicule.dev/docs/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://6f524b4-productmetrics.manicule.dev/docs/api/mcp.
> Every agent surface: https://6f524b4-productmetrics.manicule.dev/docs/.well-known/llms-manifest.json

# Get the Google connect link (/docs/api/account/google-get-connect-link)

<!-- agent-signals: reading_time_min: 2 · est_tokens: 973 · updated: 2026-11-16 -->
Related: [Create a checkout link](/docs/api/account/billing-create-checkout-link.md), [Create workspace](/docs/api/account/companies-create.md), [Send feedback](/docs/api/account/feedback-send.md), [Invite teammates](/docs/api/account/invitations-send.md), [Complete onboarding](/docs/api/account/onboarding-complete.md), [Get onboarding state](/docs/api/account/onboarding-get-state.md)

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

`GET https://prod-backend.productmetrics.io/api/public/v1/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](/docs/api/overview#authentication)).



**productmetrics CLI:**

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

**curl:**

```bash
curl "https://prod-backend.productmetrics.io/api/public/v1/google/connect-link?scope=ads" \
  -H "Authorization: Bearer $PM_TOKEN"
```

## Response

API response (200):

```json
{
  "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`](/docs/api/account/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`](/docs/api/account/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

| Name    | Type | Required | Description                                                                                                                               |
| ------- | ---- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `scope` | enum | Yes      | `ads` 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`.

```json
{
  "error": {
    "code": "insufficient_scope",
    "message": "This operation needs the setup scope; connect again and allow it.",
    "details": {
      "required_scope": "setup"
    }
  },
  "request_id": "req_01J9YJC50JQV9BYFT45DFT8A4J"
}
```

| Status | Code                 | When                                                                                                                      |
| ------ | -------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| 400    | `invalid_request`    | A path, query or body value does not match this page. `details.issues` lists each `location`, `path` and `message`.       |
| 401    | `invalid_token`      | The token is missing, expired or revoked: sign in again (`productmetrics login`). The `WWW-Authenticate` header says why. |
| 403    | `insufficient_scope` | The token lacks the `setup` scope (`details.required_scope`): sign in again and allow it.                                 |
| 429    | `rate_limited`       | More than 600 requests a minute for this person: wait the `Retry-After` seconds (60) and retry.                           |

[All Account and onboarding operations](/docs/api/account)
