# Start Google Sign-in

> Get the Google consent URL for connecting a Gmail account.

Requires an API key with the `write` scope.

Returns the Google consent URL. An API key cannot finish a consent flow on its own: open the URL in a browser, sign in to Google and approve. FoxReach connects the account to the workspace of the API key when Google redirects back. There is no API route for the callback, so the connection is only complete once someone has approved it in the browser, and the new account appears in [List Email Accounts](/api-reference/email-accounts/list-accounts) afterwards.

The link carries a signed state token that is valid for 10 minutes. Request a new URL if it expires. There is no request body.

## Response

<ResponseField name="data" type="object">
  Result.

  <Expandable title="data">
    <ResponseField name="url" type="string">The Google consent URL to open in a browser.</ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
```bash cURL
curl -X POST "https://api.foxreach.io/api/v1/email-accounts/google-oauth/start" \
  -H "X-API-Key: otr_your_key"
```

```python Python SDK (beta)
from foxreach import FoxReach

client = FoxReach(api_key="otr_your_key")
result = client.email_accounts.google_oauth_start()
print(result["url"])
```

```typescript TypeScript SDK (beta)
import { FoxReach } from "foxreach";

const client = new FoxReach({ apiKey: "otr_your_key" });
const { url } = await client.emailAccounts.startGoogleOAuth();
```
</RequestExample>

<ResponseExample>
```json
{
  "data": {
    "url": "https://accounts.google.com/o/oauth2/v2/auth?..."
  }
}
```
</ResponseExample>

## Errors

| Status | Description |
|--------|-------------|
| `401` | Missing, invalid, revoked or expired API key |
| `403` | API key does not have the required scope: `write` |
| `503` | `Google OAuth is not configured` on environments without Google credentials |

## Rate Limit

- **100 requests per minute, per API key.** Fixed 60-second window.
- Every response includes `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset` (unix epoch seconds).
- A `429` response includes a `Retry-After` header (seconds until the bucket resets).

For client-side patterns (`Retry-After`, exponential backoff, monitoring `X-RateLimit-Remaining`), see [Rate Limiting](/rate-limiting).
