# DMARC builder API

Build a DMARC record step by step, with a rollout plan from monitoring to reject and the records report services need.

`POST /v1/build/dmarc`

- Price: Free; any API key works and nothing is charged.
- Cache: Never cached; every call runs again.
- MCP tool: `build_dns_record`

A DMARC record built from your choices, with a rollout plan and the authorization records external report addresses need. Free; any API key works and nothing is charged. Never cached; every call runs again.

## Request body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `domain` | string or null | no | Your domain; names the record and checks report addresses. |
| `policy` | "none" | "quarantine" | "reject" | yes | What receivers do with mail that fails DMARC. |
| `subdomain_policy` | "none" | "quarantine" | "reject" or null | no | A different policy for subdomains; leave empty to use the main policy. |
| `pct` | integer | no | Percentage of failing mail the policy applies to. |
| `rua` | array of string or null | no | Addresses for daily aggregate reports, one per line. |
| `ruf` | array of string or null | no | Addresses for failure reports, one per line. |
| `adkim` | "r" | "s" | no | DKIM alignment, relaxed or strict. |
| `aspf` | "r" | "s" | no | SPF alignment, relaxed or strict. |
| `fo` | "0" | "1" | "d" | "s" or null | no | When failure reports are sent. |

## Response

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `tool` | string | yes |  |
| `target` | string | yes |  |
| `status` | "ok" | "partial" | "error" | yes |  |
| `fetched_at` | string | no |  |
| `cached` | boolean | no |  |
| `credits_used` | integer | no | Credits this call took from your balance. 0 for free tools, for a replay of an earlier call, and for a free check run on the website without signing in |
| `summary` | string | yes |  |
| `score` | integer or null | no |  |
| `findings` | array of object | no |  |
| `credits_remaining` | integer | yes | Your balance after this call. It can be below zero after a refund; free tools still work then |
| `data` | object | yes | This tool's result |
| `data.kind` | "spf" | "dmarc" | "caa" | yes |  |
| `data.name` | string | yes |  |
| `data.type` | "TXT" | "CAA" | yes |  |
| `data.value` | string | yes |  |
| `data.strings` | array of string | yes |  |
| `data.length` | integer | yes |  |
| `data.zone_line` | string | yes |  |
| `data.mode` | "build" | "validate" | yes |  |
| `data.spf` | object or null | no |  |
| `data.dmarc` | object or null | no |  |
| `data.caa` | object or null | no |  |

## Errors

- `400` Invalid domain, URL or parameter, a TLD this tool can't check, or an X-Request-Id already used for another call (`invalid_domain`, `invalid_url`, `invalid_request`, `unsupported_tld`)
- `401` Missing, unknown or revoked API key, or one whose creator is no longer a member of the account (`unauthorized`)
- `403` Account suspended, the key's creator is over the plan's seats, or an anonymous check without a valid proof-of-work or for a tool that needs an account, or bulk checks before a first purchase (`account_suspended`, `plan_limit`, `challenge_required`, `sign_in_required`, `bulk_locked`)
- `429` Too many requests, today's free checks are used up, or too many website scans at once; wait for the number of seconds in the Retry-After header (`rate_limited`, `free_limit_reached`, `too_many_jobs`). Not charged
- `500` Unexpected error (`internal_error`)

## Example

```sh
curl -X POST "https://api.dnssuper.com/v1/build/dmarc" \
  -H "Authorization: Bearer $DNSSUPER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"domain":"example.com"}'
```

```python
import os

import httpx

client = httpx.Client(
    base_url="https://api.dnssuper.com",
    headers={"Authorization": f"Bearer {os.environ['DNSSUPER_API_KEY']}"},
    timeout=60,
)
response = client.post("/v1/build/dmarc", json={
    "domain": "example.com",
})
response.raise_for_status()
result = response.json()
print(result["summary"], result["credits_used"])
```

```ts
const response = await fetch("https://api.dnssuper.com/v1/build/dmarc", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.DNSSUPER_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"domain":"example.com"}),
});
if (!response.ok) throw new Error((await response.json()).error.message);
const result = await response.json();
console.log(result.summary, result.credits_used);
```

Example response:

```json
{
  "tool": "dmarc-generator",
  "target": "",
  "status": "ok",
  "fetched_at": "2026-11-14T10:00:00Z",
  "cached": false,
  "credits_used": 0,
  "summary": "Your DMARC record is ready: publish it as a TXT record at _dmarc.example.com. The report domains it names must publish the authorization records listed.",
  "findings": [
    {
      "id": "dmarc_builder.external_reports",
      "severity": "info",
      "title": "Reports go to another domain",
      "detail": "reports.example.net",
      "fix": "That domain must publish an authorization record; the result lists it."
    }
  ],
  "data": {
    "kind": "dmarc",
    "name": "_dmarc.example.com",
    "type": "TXT",
    "value": "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com,mailto:agg@reports.example.net",
    "strings": [
      "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com,mailto:agg@reports.example.net"
    ],
    "length": 83,
    "zone_line": "_dmarc.example.com. 3600 IN TXT \"v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com,mailto:agg@reports.example.net\"",
    "mode": "build",
    "dmarc": {
      "rollout": [
        {
          "stage": 1,
          "policy": "none",
          "value": "v=DMARC1; p=none; rua=mailto:dmarc@example.com,mailto:agg@reports.example.net",
          "when": "Now: collect reports for two to four weeks and fix any sender that fails."
        },
        {
          "stage": 2,
          "policy": "quarantine",
          "value": "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com,mailto:agg@reports.example.net",
          "when": "When reports show all your own mail passes."
        },
        {
          "stage": 3,
          "policy": "reject",
          "value": "v=DMARC1; p=reject; rua=mailto:dmarc@example.com,mailto:agg@reports.example.net",
          "when": "After a few weeks on quarantine without surprises."
        }
      ],
      "report_authorizations": [
        {
          "domain": "reports.example.net",
          "name": "example.com._report._dmarc.reports.example.net",
          "value": "v=DMARC1"
        }
      ]
    }
  },
  "credits_remaining": 498
}
```

## MCP

```json
{
  "tool": "build_dns_record",
  "arguments": {
    "domain": "example.com"
  }
}
```

```text
Your DMARC record is ready: publish it as a TXT record at _dmarc.example.com. The report domains it names must publish the authorization records listed.
Name: _dmarc.example.com (TXT)
Value: v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com,mailto:agg@reports.example.net
Zone line: _dmarc.example.com. 3600 IN TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com,mailto:agg@reports.example.net"
Authorization needed: example.com._report._dmarc.reports.example.net TXT "v=DMARC1"
- info: Reports go to another domain
Free | checked 2026-11-14 10:00 UTC
```
