> ## 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.

# Verify DNS

Verify DNS records and update proxy status. Performs live DNS lookups for both the SSL validation CNAME and the www CNAME.

## Path Parameters

| Parameter | Type   | Required | Description                                         |
| --------- | ------ | -------- | --------------------------------------------------- |
| `org_id`  | string | Yes      | Clerk organization slug (e.g., company-name-123456) |

## When to Call

Call this endpoint after the user completes an Entri flow:

* **After Part 1**: Checks if SSL validation CNAME was added → updates to `SSL_VALIDATING`
* **After Part 2**: Checks if www CNAME points to CloudFront → updates to `DEPLOYED`

## Example Request

```bash theme={null}
curl -X POST https://searchcompany-main.up.railway.app/api/domain/verify-dns/my-company-123456 \
  -H "Authorization: Bearer $TOKEN"
```

## Example Responses

### Part 1 Complete (SSL CNAME Found)

```json theme={null}
{
  "ssl_cname_found": true,
  "www_cname_found": false,
  "proxy_status": "SSL_VALIDATING",
  "message": "SSL validation record found. AWS is validating your certificate (2-5 minutes)."
}
```

### Part 1 Pending (DNS Propagating)

```json theme={null}
{
  "ssl_cname_found": false,
  "www_cname_found": false,
  "proxy_status": "PENDING_VALIDATION",
  "message": "SSL validation record not found yet. DNS may still be propagating."
}
```

### Part 2 Complete (Fully Deployed)

```json theme={null}
{
  "ssl_cname_found": true,
  "www_cname_found": true,
  "proxy_status": "DEPLOYED",
  "message": "Domain is fully connected and operational!"
}
```

### SSL Validated, Waiting for Part 2

```json theme={null}
{
  "ssl_cname_found": true,
  "www_cname_found": false,
  "proxy_status": "SSL_VALIDATED",
  "message": "SSL is ready. Complete Part 2 to connect your domain."
}
```

## Response Fields

| Field             | Type    | Description                                |
| ----------------- | ------- | ------------------------------------------ |
| `ssl_cname_found` | boolean | True if SSL validation CNAME exists in DNS |
| `www_cname_found` | boolean | True if www CNAME points to CloudFront     |
| `proxy_status`    | string  | Current/updated status                     |
| `message`         | string  | Human-readable status message              |

## Status Transitions

This endpoint updates `proxy_status` based on DNS state:

| Current Status       | DNS State       | New Status       |
| -------------------- | --------------- | ---------------- |
| `PENDING_VALIDATION` | SSL CNAME found | `SSL_VALIDATING` |
| `SSL_VALIDATED`      | www CNAME found | `DEPLOYED`       |

Note: The transition to `SSL_VALIDATED` is handled by the `/complete-certificate` endpoint which validates, issues, and attaches the certificate.

## Proxy Status Flow

```
PENDING_VALIDATION → SSL_VALIDATED → DEPLOYED
       ↓                   ↓              ↓
  complete-certificate  verify-dns    Complete!
  (cert issued)         (www found)
```

Note: The `/complete-certificate` endpoint handles the entire certificate flow (validation, issuance, ACM import, CloudFront attachment) in one call.

## Frontend Integration

```typescript theme={null}
// After Entri closes successfully
const result = await verifyDNS(orgSlug, token);
console.log(result.message);
// Refresh proxy info to update UI
await fetchProxyInfo();
```
