---
title: "Create DNS Monitor"
description: "Creates a new DNS monitor for a customer."
---

`POST /api/dns-monitors`

## Request Body

```json
{
  "customerId": "6bfec6f6-245a-47ce-843b-157d97d56f88",
  "name": "Example DNS",
  "hostname": "deinkunde.com",
  "status": "active",
  "checkInterval": 30,
  "timeoutSeconds": 30,
  "dnsConfig": {
    "rrtypes": ["A", "AAAA"],
    "matchMode": "exact",
    "expectedValues": {
      "A": ["93.184.216.34"],
      "AAAA": ["2606:2800:220:1:248:1893:25c8:1946"]
    },
    "triggerOn": {
      "resolveError": true,
      "mismatch": true
    }
  }
}
```

Notes:

- `customerId`, `name`, `hostname`, `dnsConfig.rrtypes`, `dnsConfig.matchMode`, and `dnsConfig.expectedValues` are required.
- `customerId` accepts either the internal numeric ID or the customer `publicId` UUID.
- Global supporters and readonly users cannot create DNS monitors.
- `hostname` must be a hostname (no protocol, no path).
- `dnsConfig.expectedValues` must contain at least one expected value for every RR type listed in `dnsConfig.rrtypes`.

## Example (cURL)

```bash
BASE_URL="https://uptimeify.io"
TOKEN="<your-api-token>"

curl -X POST \
  "$BASE_URL/api/dns-monitors" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"customerId":"6bfec6f6-245a-47ce-843b-157d97d56f88","name":"Example DNS","hostname":"deinkunde.com","dnsConfig":{"rrtypes":["A"],"matchMode":"exact","expectedValues":{"A":["93.184.216.34"]},"triggerOn":{"resolveError":true,"mismatch":true}}}'
```

## Common errors

- `400 Invalid Customer identifier`
- `400 hostname must be a valid hostname (no protocol, no path)`
- `400 Expected values are required for RR type <TYPE>`
- `401 Unauthorized`
- `403 Forbidden` (readonly/global supporter or no access)
- `404 Customer not found`

## Response

Returns the created DNS monitor object. See [Error Codes](/api/error-codes-and-known-pitfalls) for error responses.
