{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cavuno-com/json-schema/cavuno-com-email-domain-schema.json",
  "title": "EmailDomain",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cavuno-com-domains-api-openapi.yml#/components/schemas/EmailDomain",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "type": "string",
      "enum": [
        "email_domain"
      ]
    },
    "domain": {
      "type": "string",
      "description": "The sending hostname."
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "verified",
        "failed"
      ],
      "description": "`pending` until the required DNS records verify, `verified` once board email sends from this domain, `failed` when the last check found a problem (see `statusReason`; publish or fix the records and verify again)."
    },
    "senderName": {
      "type": "string"
    },
    "senderLocalPart": {
      "type": "string"
    },
    "senderAddress": {
      "type": "string",
      "description": "The From address once the domain is verified."
    },
    "dnsRecords": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EmailDomainDnsRecord"
      },
      "description": "Records to publish at the domain’s DNS provider. Empty while the domain is still being set up with the email provider; call verify to retry."
    },
    "statusReason": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "setup_required",
        "dns_verification_failed",
        null
      ],
      "description": "Why the last check failed, when it did. `setup_required`: the domain must be set up with the email provider again; call verify, which re-stages it and returns fresh DNS records. `dns_verification_failed`: the published records do not match yet; check each record’s `status`, fix them and verify again."
    },
    "verifiedAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "lastCheckedAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "object",
    "domain",
    "status",
    "senderName",
    "senderLocalPart",
    "senderAddress",
    "dnsRecords",
    "statusReason",
    "verifiedAt",
    "lastCheckedAt",
    "createdAt"
  ],
  "$defs": {
    "EmailDomainDnsRecord": {
      "type": "object",
      "properties": {
        "purpose": {
          "type": "string",
          "enum": [
            "dkim",
            "return_path",
            "dmarc"
          ],
          "description": "`dkim` signs outgoing mail, `return_path` receives bounces and complaints, `dmarc` is an optional policy record."
        },
        "type": {
          "type": "string",
          "description": "DNS record type, for example `CNAME` or `TXT`."
        },
        "name": {
          "type": "string",
          "description": "Host to create the record on, relative to the DNS zone the domain lives in (`@` is the zone itself), as most DNS providers expect it typed."
        },
        "value": {
          "type": "string",
          "description": "Exact value to publish."
        },
        "ttl": {
          "type": "string",
          "description": "Suggested TTL. `Auto` means the DNS provider’s default."
        },
        "required": {
          "type": "boolean",
          "description": "Whether the domain needs this record to send. DMARC is recommended but optional."
        },
        "status": {
          "type": "string",
          "description": "Last check of this record: `pending`, `verified`, or `failed`."
        }
      },
      "required": [
        "purpose",
        "type",
        "name",
        "value",
        "ttl",
        "required",
        "status"
      ]
    }
  }
}