> ## 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 Verify DNS endpoint

# POST /api/domain/verify-dns/{org_id}

Performs live DNS lookups to verify that DNS records are properly configured.

## Purpose

This endpoint provides optional verification by checking:

1. SSL validation CNAME (Part 1)
2. www CNAME pointing to CloudFront (Part 2)

## Architecture

```mermaid theme={null}
flowchart TD
    A[Frontend Request] --> B[Verify DNS Endpoint]
    B --> C{Already DEPLOYED?}
    C -->|Yes| D[Return All Found]
    C -->|No| E[Check SSL CNAME]
    E --> F[Check www CNAME]
    F --> G{Current Status?}
    G -->|PENDING_VALIDATION| H{SSL Found?}
    H -->|Yes| I[Update: SSL_VALIDATING]
    H -->|No| J[Return Not Found Yet]
    G -->|SSL_VALIDATED| K{www Found?}
    K -->|Yes| L[Update: DEPLOYED]
    K -->|No| M[Return Complete Part 2]
    I --> N[Return Status]
    L --> N
```

## Internal Services

### lookup\_cname

Performs DNS CNAME lookup for a given hostname.

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

## Response Fields

| Field             | Type    | Description                                |
| ----------------- | ------- | ------------------------------------------ |
| `ssl_cname_found` | boolean | Whether SSL validation CNAME is configured |
| `www_cname_found` | boolean | Whether www CNAME points to CloudFront     |
| `proxy_status`    | string  | Current/updated proxy status               |
| `message`         | string  | Human-readable status message              |

## Status Transitions

| Current Status      | Condition       | New Status      |
| ------------------- | --------------- | --------------- |
| PENDING\_VALIDATION | SSL CNAME found | SSL\_VALIDATING |
| SSL\_VALIDATED      | www CNAME found | DEPLOYED        |

## Code Location

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