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

# Overview

> Technical overview of the Complete Google Verification endpoint

# POST /api/domain/complete-google-verification/{org_id}

Completes Google domain verification and submits the sitemap to Google Search Console.

<Warning>
  **Deprecated for Frontend Use**

  This endpoint is no longer called directly by the frontend. Google verification is now handled automatically in the backend during Step 2 completion via `mark-step-complete`.

  The backend polls for Google verification every 10 seconds for 2 minutes, giving DNS time to propagate after the user adds the TXT record in Step 1.

  This endpoint remains available for manual testing and the cron's resubmit-sitemap flow.
</Warning>

## Purpose

This endpoint performs three sequential steps:

1. Verify domain ownership with Google Site Verification API
2. Add the site to Google Search Console
3. Submit the sitemap

## New Flow (Backend-Driven)

```mermaid theme={null}
flowchart TD
    A[Step 1: User adds TXT records] --> B[SSL TXT + Google TXT via Entri]
    B --> C[Step 2: User switches CNAME]
    C --> D[mark-step-complete called]
    D --> E[Background: Poll Google verification]
    E --> F{Verified?}
    F -->|Yes| G[Add to Search Console]
    G --> H[Submit Sitemap]
    F -->|No after 2 min| I[Skip GSC]
```

## Internal Services

### verify\_domain

Verifies domain ownership using the stored token.

**Location:** `src/app/shared/google_search_console.py`

### add\_to\_search\_console

Adds the verified site to Google Search Console.

**Location:** `src/app/shared/google_search_console.py`

### submit\_sitemap

Submits the sitemap.xml URL to Google Search Console.

**Location:** `src/app/shared/google_search_console.py`

## Response Fields

| Field                     | Type    | Description                   |
| ------------------------- | ------- | ----------------------------- |
| `status`                  | string  | "success" or "error"          |
| `verified`                | boolean | Whether domain was verified   |
| `added_to_search_console` | boolean | Whether site was added        |
| `sitemap_submitted`       | boolean | Whether sitemap was submitted |
| `message`                 | string  | Human-readable status         |

## Code Location

```
src/app/apis/domain/google_verification/routes.py
```
