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

# Monitor domains for DNS changes

> Entri Monitor allows you to monitor your customer's domains for any DNS changes.

## Overview

Entri Monitor allows you to monitor DNS record changes across multiple domains. This can be useful in a variety of scenarios, such as:

* Notifying your customer that they inadvertently broke the DNS record configuration required to use your application

* Detecting if a customer is at risk for churn or might be moving to a competing solution

If Entri Monitor detects a change (or deletion) of one of the records specified on a monitored domain, a notification is sent to the webhook URL that you provide on the App Settings page of the Entri Dashboard.

Entri Monitor runs an hourly check, 24x7.

Optionally, you can combine Entri Monitor with Entri Connect to help your user fix their DNS if Monitor detects a breaking change.

<img src="https://mintcdn.com/entri-42/y89yB6zwvoVA7ecV/images/monitor.png?fit=max&auto=format&n=y89yB6zwvoVA7ecV&q=85&s=39a55531545bf6c115686131dc8bc948" alt="" width="1021" height="828" data-path="images/monitor.png" />

## Adding monitoring using Entri Connect

When initializing a new domain using Entri Connect, you can pass a `monitor: true` property in either the domain object or each record object to specify that it should be tracked with Entri Monitor.

Monitor everything:

```json theme={null}
{
  "prefilledDomain": "mydomain123.com",
  "applicationId": "12345",
  "token": "12345",
  "monitor": true,
  "dnsRecords": [
    {
      "type": "CNAME",
      "host": "{SUBDOMAIN}.xyz.example.com", // blog.xyz.example.com
      "value": "custom-proxy.leadpages.net",
      "ttl": 300,
    },
    {
      "type": "TXT",
      "host": "@",
      "value": "{SLD}-{TLD}", // example-com
      "ttl": 300,
    }
  ]
}
```

Monitor only the CNAME record:

```json theme={null}
{
  "prefilledDomain": "mydomain123.com",
  "applicationId": "12345",
  "token": "12345",
  "dnsRecords": [
    {
      "type": "CNAME",
      "host": "{SUBDOMAIN}.xyz.example.com", // blog.xyz.example.com
      "value": "custom-proxy.leadpages.net",
      "ttl": 300,
      "monitor":true
    },
    {
      "type": "TXT",
      "host": "@",
      "value": "{SLD}-{TLD}", // example-com
      "ttl": 300,
    }
  ]
}
```

## General API Guidelines

### Base URL

```
https://api.goentri.com
```

### Authentication

All requests require the following headers:

* **`applicationId`**: Your unique application ID.

* **`Authorization`**: A bearer token generated using your client secret.

**Example Headers**:

```http theme={null}
applicationId: your-app-id
Authorization: Bearer your-auth-token
```

## Quickstart

### Step 1:  Add domains for monitoring

You'll first need to tell Entri Monitor which domain you'd like to monitor. Send a `POST` request to `/monitor/domains` with the name of the domain, as well as a list of the records you want to monitor, including their `type`, `host`, `value`, and `ttl` properties.

Example request body:

```json theme={null}
{
  "domain": "example.com",
  "dnsRecords": [
    {
      "type": "A",
      "host": "@",
      "value": "93.184.216.34",
      "ttl": 3600
    }
  ]
}
```

You'll recieve a response like this if you're successful:

```json theme={null}
{
  "message": "Domain added successfully"
}
```

### Step 2: Specify a webhook URL

Log into the Entri Dashboard and navigate to the App Settings page. Enter the URL of the webhook that you'll use to recieve notifications about the DNS changes you specified.

### Step 3: Set up your service to receive the webhook requests at the URL you specified

Your webhook URL will be sent requests if the DNS records you specified are modified or deleted. Example request:

```json theme={null}
{
 "id": "e98d267b-84b8-4229-a94a-1933ed7f91ea",
 "subdomain": "www",
 "domain": "example.com",
 "user_id": "user123",
 "type": "domain.record_missing" / "domain.record_restored",
 "data": {
  "records_propagated": [
   {
    "host": "www",
    "ttl": 300,
    "type": "CNAME",
    "value": "mydestinationdomain.com"
   }
  ],
  "records_non_propagated": [
   {
    "host": "@",
    "ttl": 300,
    "type": "TXT",
    "value": "domain_verification123"
   }
  ]
 },
 "connect_link": "https://customurl.goentri.dev/share/27bc7873e6ad452780686b8c0436eb75"
}
```

## Monitor API Reference

### **1. Manage DNS Records**

#### **Retrieve DNS Records**

**GET** `/monitor/domains/:domain_name/records`

**Description**: Fetch all monitored DNS records for a specific domain.

**Headers**:

* `applicationId`: Your application ID (required).

* `Authorization`: Bearer token (required).

**Path Parameters**:

* `domain_name` (string, required): The domain to retrieve records for.

**Response Example**:

```json theme={null}
{
  "domain": "example.com",
  "dnsRecords": [
    {
      "type": "A",
      "host": "@",
      "value": "93.184.216.34",
      "ttl": 3600
    }
  ]
}
```

***

#### **Create DNS Records**

**POST** `/monitor/domains/:domain_name/records`

**Description**: Add new DNS records to be monitored on an existing domain.

**Request Body**:

```json theme={null}
{
  "dnsRecords": [
    {
      "type": "A",
      "host": "@",
      "value": "93.184.216.34",
      "ttl": 3600
    }
  ]
}
```

**Key Descriptions**:

* **`dnsRecords`** (array, required): List of DNS records to add.

  * **`type`** (string, required): Record type (e.g., `A`, `CNAME`).

  * **`host`** (string, required): Hostname.

  * **`value`** (string, required): Record value.

  * **`ttl`** (integer, required): Time-to-live in seconds.

  * **`priority`** (string, only MX record): Record priority when multiple MX records are found.

**Response Example**:

```json theme={null}
{
  "message": "DNS records created successfully"
}
```

***

#### **Update DNS Records**

**PUT** `/monitor/domains/:domain_name/records`

**Description**: Update DNS records for a monitored domain.

**Request Body**:

```json theme={null}
{
  "dnsRecords": [
    {
      "type": "TXT",
      "host": "@",
      "value": "v=spf1 include:_spf.example.com ~all",
      "ttl": 3600
    }
  ]
}
```

**Response Example**:

```json theme={null}
{
  "message": "DNS records updated successfully"
}
```

***

#### **Delete DNS Records**

**DELETE** `/monitor/domains/:domain_name/records`

**Description**: Remove specific DNS records from the monitoring for a domain.

**Request Body**:

```json theme={null}
{
  "dnsRecords": [
    {
      "type": "CNAME",
      "host": "www",
      "value": "example.com",
      "ttl": 3600
    }
  ]
}
```

**Response Example**:

```json theme={null}
{
  "message": "DNS records deleted successfully",
  "deletedRecords": 1
}
```

***

### **2. Global Domain Management**

#### **List All Domains**

**GET** `/monitor/domains`

**Query Parameters**:

* `offset` (integer): Pagination offset.

* `limit` (integer): Number of domains per page.

* `from_date` (date): Filter start date.

* `to_date` (date): Filter end date.

**Response Example**:

```json theme={null}
{
  "domains": [
    {
      "domain": "example.com",
      "status": "active"
    }
  ]
}
```

#### **Retrieve Domain Details**

**GET** `/monitor/domains/:domain_name`

**Description**: Get all the settings for a specific monitored domain.

**Response Example**:

```json theme={null}
{
  "domain": "example.com",
  "status": "active",
  "dnsRecords": [
    {
      "type": "A",
      "host": "@",
      "value": "93.184.216.34",
      "ttl": 3600
    }
  ]
}
```

***

#### **Add a Domain**

**POST** `/monitor/domains`

**Description**: Add a domain for monitoring.

**Request Body**:

```json theme={null}
{
  "domain": "example.com",
  "dnsRecords": [
    {
      "type": "A",
      "host": "@",
      "value": "93.184.216.34",
      "ttl": 3600
    }
  ],
  "userId": "UUID"
}
```

**Response Example**:

```json theme={null}
{
  "message": "Domain added successfully"
}
```

***

#### **Update Domain**

**PUT** `/monitor/domains`

**Description**: Update details for an existing domain.

**Request Body**:

```json theme={null}
{
  "domain": "example.com",
  "dnsRecords": [
    {
      "type": "A",
      "host": "@",
      "value": "93.184.216.34",
      "ttl": 3600
    }
  ],
  "userId": "UUID"
}
```

**Response Example**:

```json theme={null}
{
  "message": "Domain updated successfully"
}
```

***

#### **Delete a Domain**

**DELETE** `/monitor/domains`

**Description**: Remove a domain from monitoring.

**Request Body**:

| Parameter           | Type    | Required | Default | Description                                                                                                                                               |
| ------------------- | ------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `domain`            | string  | Yes      | —       | The domain to remove from monitoring.                                                                                                                     |
| `deleteOnlyIfEmpty` | boolean | No       | `false` | When `true`, the domain is only deleted if it has no monitored DNS records. When `false` (default), the domain is deleted regardless of existing records. |

**Examples**:

Force delete (default behavior):

```json theme={null}
{
  "domain": "example.com"
}
```

Safe delete — only proceeds if the domain has no monitored DNS records:

```json theme={null}
{
  "domain": "example.com",
  "deleteOnlyIfEmpty": true
}
```

**Success Response (200)**:

```json theme={null}
{
  "message": "Domain deleted successfully",
  "domainId": "12345"
}
```

**Error Response — Domain has monitored records (409)**:

Returned when `deleteOnlyIfEmpty: true` and the domain still has monitored DNS records.

```json theme={null}
{
  "error": "DOMAIN_NOT_EMPTY",
  "message": "The domain cannot be deleted because it still has monitored DNS records.",
  "monitoredRecordsCount": 3
}
```

***

### **3. Batch Operations**

#### **Batch Create Domains**

**POST** `/monitor/domains/batch`

**Description**: Add multiple domains in a single request. A maximum of 100 domains can be sent per request.

**Request Body**:

```json theme={null}
{
  "domains": [
    {
      "domain": "example.com",
      "dnsRecords": [
        {
          "type": "A",
          "host": "@",
          "value": "93.184.216.34",
          "ttl": 3600
        }
      ]
    },
    {
      "domain": "example2.com",
      "dnsRecords": [
        {
          "type": "A",
          "host": "@",
          "value": "93.184.216.34",
          "ttl": 3600
        }
      ]
    }
  ]
}
```

**Response Example**:

```json theme={null}
{
  "message": "Batch created successfully"
}
```

***

#### **Batch Status**

**GET** `/monitor/domains/batch/status/:request_id`

**Description**: Check the status of a batch operation.

**Response Example**:

```json theme={null}
{
  "batchId": "batch-12345",
  "status": "completed",
  "successfulDomains": 10,
  "failedDomains": 0
}
```

***

## Webhooks

To recieve webhook notifications about the target domains, log into the Entri Dashboard and navigate to the App Settings page. Enter the URL of the webhook that you'll use to recieve notifications about the DNS changes you specified.

Your webhook URL will be sent requests if the DNS records you specified are modified or deleted.

### Top-Level fields

* **`id`**: A unique identifier for the webhook event (e.g. `"e98d267b-84b8-4229-a94a-1933ed7f91ea"`).
* **`user_id`**: The ID of the user who initiated the domain-related action (e.g. `"your-provided-user-id"`).
* **`domain`**: The domain involved in the event (e.g. `"example.com"`).
* **`subdomain`**: The subdomain associated with the event, if any (e.g. `"shop"`).
* **`type`**: Defines the type of event. Possible values:
  * `"domain.record_missing"`: Used whenever there is a record missing from the records that are being monitored.
  * `"domain.record_restored"`: Confirms that ALL records have been restored.
* **`data.records_propagated`**: Contains all the records that are being monitored and **were found correctly** configured on the domain.
* **`data.records_non_propagated`**: Contains all the records that are being monitored and **were found as missing** on the domain.
* **`connect_link`**: Entri Connect's sharing link with the configuration required to restablish the missing records on the domain.

Example request:

```json theme={null}
{
 "id": "e98d267b-84b8-4229-a94a-1933ed7f91ea",
 "subdomain": "www",
 "domain": "example.com",
 "user_id": "user123",
 "type": "domain.record_missing" / "domain.record_restored",
 "data": {
  "records_propagated": [
   {
    "host": "www",
    "ttl": 300,
    "type": "CNAME",
    "value": "mydestinationdomain.com"
   }
  ],
  "records_non_propagated": [
   {
    "host": "@",
    "ttl": 300,
    "type": "TXT",
    "value": "domain_verification123"
   }
  ]
 },
 "connect_link": "https://customurl.goentri.dev/share/27bc7873e6ad452780686b8c0436eb75"
}
```
