{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/eusend-dev/json-schema/eusend-dev-domain-schema.json",
  "title": "Domain",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/eusend-dev-openapi.json#/components/schemas/Domain",
  "type": "object",
  "required": [
    "id",
    "name",
    "status",
    "createdAt",
    "verification",
    "records"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "dkimPublicKey": {
      "type": "string"
    },
    "dkimSelector": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "verified",
        "failed"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "verifiedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "returnPathAligned": {
      "type": "boolean"
    },
    "verification": {
      "type": "object",
      "description": "Whether a DNS polling chain is running for this domain right now.",
      "required": [
        "running",
        "startedAt"
      ],
      "properties": {
        "running": {
          "type": "boolean"
        },
        "startedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    },
    "diagnostic": {
      "type": [
        "object",
        "null"
      ],
      "description": "What the last unmatched DNS check found, when it found a mistake rather than an absence — the record published under the domain twice because the control panel appends it, a key cut off at the 255-character limit for one DNS string, a DKIM key we did not issue on the same selector. Null is the ordinary “not published yet”, and it clears once the record is right. New codes may be added, so treat an unknown one as generic.",
      "required": [
        "code"
      ],
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "doubled_domain",
            "truncated_key",
            "foreign_key",
            "quoted_value",
            "multiple_records",
            "cname_at_selector"
          ]
        },
        "foundAt": {
          "type": "string",
          "description": "The name the record actually resolved at (`doubled_domain`)."
        },
        "publishedChars": {
          "type": "integer"
        },
        "expectedChars": {
          "type": "integer"
        },
        "target": {
          "type": "string",
          "description": "Where the CNAME points (`cname_at_selector`)."
        },
        "provider": {
          "type": "object",
          "description": "The DNS host serving the zone, recognised from its nameservers. Absent when none of them is one we know.",
          "required": [
            "id",
            "label",
            "guide"
          ],
          "properties": {
            "id": {
              "type": "string"
            },
            "label": {
              "type": "string"
            },
            "guide": {
              "type": [
                "string",
                "null"
              ],
              "description": "Path to the setup guide for this panel on eusend.dev, or null where there is none."
            }
          }
        }
      }
    },
    "records": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DnsRecord"
      }
    }
  },
  "$defs": {
    "DnsRecord": {
      "type": "object",
      "description": "One record to publish on the sending domain.",
      "required": [
        "id",
        "type",
        "name",
        "value",
        "purpose",
        "description"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Stable key: `dkim`, `dmarc`, `returnPathSpf`, `returnPathMx`."
        },
        "type": {
          "type": "string",
          "enum": [
            "TXT",
            "MX"
          ]
        },
        "name": {
          "type": "string"
        },
        "value": {
          "type": "string"
        },
        "priority": {
          "type": "integer",
          "description": "MX records only."
        },
        "purpose": {
          "type": "string",
          "enum": [
            "authentication",
            "policy",
            "alignment"
          ],
          "description": "`authentication` blocks sending when missing; `policy` is recommended; `alignment` is optional and enables Return-Path SPF alignment when both alignment records are published."
        },
        "description": {
          "type": "string"
        }
      }
    }
  }
}