{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/politicalcomms-com/json-schema/politicalcomms-com-email-domain-schema.json",
  "title": "EmailDomain",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/politicalcomms-com-openapi.json#/components/schemas/EmailDomain",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "domain": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "active",
        "failed"
      ],
      "description": "`pending` until every record is observed, then `active`. `failed` means verification was abandoned; delete and re-add to retry."
    },
    "dns_records": {
      "description": "DNS records to publish. Besides the DKIM, bounce, and DMARC records, a new domain carries a per-organization domain verification TXT record (`key` `ownership_txt`, host `_sender-verification.<domain>`). Publish it even if the other records already show verified; the domain stays pending until it is seen. Domains added before this record existed, and the platform organization's own domain, do not have one.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/DnsRecord"
      }
    },
    "verification": {
      "type": "object",
      "properties": {
        "dkim": {
          "type": [
            "string",
            "null"
          ]
        },
        "mail_from": {
          "type": [
            "string",
            "null"
          ]
        },
        "dmarc": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "description": "Per-signal verification state.",
      "additionalProperties": true
    },
    "error_message": {
      "type": [
        "string",
        "null"
      ]
    },
    "last_checked_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "domain",
    "status"
  ],
  "additionalProperties": true,
  "$defs": {
    "DnsRecord": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "CNAME",
            "TXT",
            "MX"
          ]
        },
        "name": {
          "type": "string",
          "description": "Host name to create, as published in your zone."
        },
        "value": {
          "type": "string",
          "description": "Record value."
        },
        "purpose": {
          "type": [
            "string",
            "null"
          ],
          "description": "What the record proves: `dkim`, `mail_from`, or `dmarc`."
        }
      },
      "required": [
        "type",
        "name",
        "value"
      ],
      "description": "One DNS record to publish. We never write DNS on your behalf: you publish these in your own zone.",
      "additionalProperties": true
    }
  }
}