> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowmaticai.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Link Google Account — GET /api/integrations/google/connect

> GET /api/integrations/google/connect — Initiate the Google OAuth flow to link your Google account with Flowmatic. Opens a 302 redirect to the consent page.

To enable Flowmatic workflows to read from and write to Google Drive, you first need to authorize the connection by linking a Google account. This endpoint initiates that process by returning an HTTP 302 redirect to Google's OAuth consent page, where you can grant the necessary permissions. Once you approve the request, Google redirects you back to Flowmatic, which stores your credentials and activates the integration for your account.

## Endpoint

```bash theme={null}
GET /api/integrations/google/connect
```

## Authentication

All requests must include a valid Bearer token in the `Authorization` header so Flowmatic knows which account to link the Google credentials to.

```bash theme={null}
Authorization: Bearer <accessToken>
```

## Request Body

This endpoint does not accept a request body or query parameters.

## Response

A successful request returns **HTTP 302 Found** with a `Location` header pointing to Google's OAuth consent page. Your browser or HTTP client will follow this redirect automatically (if configured to do so).

<Note>
  This endpoint **must be opened in a web browser**, not called directly with curl or a server-side HTTP client. Because the flow involves a 302 redirect to Google's interactive consent page, it requires a user-facing browser session to display the authorization UI and handle the redirect back to Flowmatic. If you call it with curl, you will only see the redirect response — the OAuth flow will not complete.
</Note>

## How the OAuth Flow Works

When you navigate to this endpoint in your browser, the following sequence occurs:

1. **Flowmatic redirects you** to Google's OAuth consent page (HTTP 302).
2. **You log in** to your Google account (if not already signed in) and review the requested permissions.
3. **You grant consent** by clicking "Allow" on Google's consent screen.
4. **Google redirects you back** to Flowmatic with a short-lived authorization code.
5. **Flowmatic exchanges** the code for access and refresh tokens, storing them securely against your account.
6. **The integration is now active.** You can verify this by calling [GET /api/integrations/google/status](/api-reference/integrations/google-status).

<Warning>
  If you are building a web application that manages Flowmatic connections on behalf of users, you will need to pass your Flowmatic access token to this endpoint before the redirect occurs — for example, as a query parameter or via a cookie-based session, depending on how your frontend is configured. Consult your specific authentication setup to determine the correct approach. The access token must be resolvable by Flowmatic before the redirect so the returned credentials can be attributed to the correct account.
</Warning>

## Opening the URL in a Browser

To initiate the connect flow, open the following URL directly in your browser, substituting your actual access token:

```bash theme={null}
https://api.flowmatic.io/api/integrations/google/connect
```

If your application needs to trigger this flow programmatically and redirect the user, construct the URL on the server and issue a redirect response to the client:

```bash theme={null}
# Example: using curl to inspect the redirect target (does NOT complete the OAuth flow)
curl -v https://api.flowmatic.io/api/integrations/google/connect \
  -H "Authorization: Bearer <accessToken>"
```

<Info>
  After completing the consent flow, verify that the connection was established successfully by calling [GET /api/integrations/google/status](/api-reference/integrations/google-status). A successful link will return `{ "connected": true, "email": "your-google-account@gmail.com" }`.
</Info>

## What Permissions Are Requested

Flowmatic requests the minimum Google Drive scopes necessary to support your workflow nodes — typically read access for data-source nodes and write access for output nodes that update spreadsheets or files. The exact scopes are displayed on Google's consent screen before you approve.

<Tip>
  You only need to complete this OAuth flow once per Flowmatic account. After the initial authorization, Flowmatic automatically refreshes your Google credentials in the background using the stored refresh token. You do not need to re-authorize unless you explicitly revoke access from your Google account settings or disconnect the integration from within Flowmatic.
</Tip>

## Related Endpoints

* [GET /api/integrations/google/status](/api-reference/integrations/google-status) — check whether your account is already connected to Google before initiating this flow.
