---
title: "Get Gsc Oauth Url"
method: GET
path: "/admin/gsc/auth-url"
tags: ["admin"]
---

# Get Gsc Oauth Url

`GET /admin/gsc/auth-url`

## Request

- Base URL: `https://api.xeorank.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.xeorank.com/admin/gsc/auth-url`
- Auth: none declared

Return the Google OAuth authorization URL for Search Console.

CLI flow: `cli_port` is carried in state so the callback redirects back to the CLI.
Web flow: `origin` (frontend host) + `site_id` + the logged-in `user_email` are
signed into state so the callback returns the user to the right site AND attaches
the GSC token to THEIR account — even for email/OTP users whose Google (used for the
GSC consent) isn't their login. `user_email` must be HMAC-signed with AGENT_API_KEY
(only the frontend, which holds that key, can vouch for a logged-in identity).

## Query parameters

- `cli_port` integer, nullable
- `origin` string
- `site_id` string
- `return_to` string
- `user_email` string
- `user_sig` string

## Response `200`

Successful Response

- OAuthURLResponse
  - `auth_url` string, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/xeorank/apis/seo-intelligence-engine.md) · [All operations](https://skmtc.dev/xeorank/apis/seo-intelligence-engine/llms.txt) · [OpenAPI document](https://skmtc.dev/xeorank/apis/seo-intelligence-engine/revisions/449a3fd73454?raw)
