> ## 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 Disconnect Proxy endpoint

# POST /api/domain/disconnect-proxy/{org_id}

Returns the DNS configuration needed to disconnect the proxy and restore original DNS settings.

## Purpose

This endpoint provides Entri-compatible DNS records to restore the domain back to its original configuration (before the proxy was set up).

## Architecture

```mermaid theme={null}
flowchart TD
    A[Frontend Request] --> B[Disconnect Proxy Endpoint]
    B --> C[Get AI Site Data]
    C --> D{Domain Type?}
    D -->|Apex| E[Build A/CNAME Records]
    D -->|Subdomain| F[Build CNAME Record]
    E --> G[Include TXT Cleanup]
    F --> G
    G --> H[Return DNS Records]
```

## Response Fields

| Field                      | Type    | Description                             |
| -------------------------- | ------- | --------------------------------------- |
| `success`                  | boolean | Whether config was retrieved            |
| `custom_domain`            | string  | The custom domain                       |
| `domain_type`              | string  | "apex" or "subdomain"                   |
| `subdomain_label`          | string  | Subdomain label (e.g., "www" or "@")    |
| `original_www_cname`       | string  | Original CNAME target                   |
| `original_apex_a_records`  | array   | Original A record IPs (for apex)        |
| `dns_records`              | array   | Entri-compatible DNS records to restore |
| `ssl_txt_record_to_delete` | object  | Optional TXT record to remove           |

## DNS Record Types

### For Subdomain Domains

Returns a single CNAME record pointing back to the original target.

### For Apex Domains

Returns either:

* Original CNAME record (if was CNAME-flattened)
* Original A records (if was A record)

## Preservation Note

This endpoint only returns the DNS config. It does NOT delete:

* CloudFront distribution
* ACM certificate

These are preserved for fast reconnection later.

## Code Location

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