{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/proof-holdings/json-schema/proof-holdings-domain-schema.json",
  "title": "Domain",
  "description": "Domain record",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/proof-holdings-openapi.json#/components/schemas/Domain",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/ObjectId"
    },
    "domain": {
      "type": "string"
    },
    "status": {
      "$ref": "#/$defs/DomainStatus"
    },
    "detected_provider": {
      "type": "string",
      "description": "The DNS provider read from the nameservers; `unknown` when none matched."
    },
    "provider_name": {
      "type": "string"
    },
    "supports_auto_dns": {
      "type": "boolean",
      "description": "Whether the detected provider can create the verification record itself."
    },
    "verification_method": {
      "type": "string",
      "description": "`auto_dns`, `manual_dns`, `http_file` or `email`."
    },
    "verification_subtype": {
      "type": "string",
      "enum": [
        "dns_record",
        "ownership"
      ],
      "description": "How a provider verified the domain: by creating the record, or by confirming ownership without one."
    },
    "for_email_sending": {
      "type": "boolean"
    },
    "for_verification": {
      "type": "boolean"
    },
    "dns_records": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DomainDnsRecord"
      }
    },
    "actual_dns_host": {
      "type": "string",
      "description": "The host serving the zone, when it differs from the provider that verified it."
    },
    "actual_dns_host_name": {
      "type": "string"
    },
    "has_dns_mismatch": {
      "type": "boolean"
    },
    "dns_mismatch_warning": {
      "type": "string",
      "description": "Sent only while `has_dns_mismatch` is true."
    },
    "txt_record_name": {
      "type": "string"
    },
    "txt_record_value": {
      "type": "string"
    },
    "http_file_path": {
      "type": "string"
    },
    "http_file_content": {
      "type": "string"
    },
    "oauth_url": {
      "type": "string",
      "description": "Sent only by the add when Cloudflare sign-in is configured for the detected provider."
    },
    "oauth_connected": {
      "type": "boolean",
      "description": "Whether a Cloudflare connection is stored for this domain."
    },
    "godaddy_connected": {
      "type": "boolean",
      "description": "Whether a GoDaddy connection is stored for this domain."
    },
    "supports_api_token": {
      "type": "boolean"
    },
    "supports_api_key": {
      "type": "boolean"
    },
    "has_provider_credentials": {
      "type": "boolean",
      "description": "Sent only by the add: the account already holds credentials for the detected provider."
    },
    "provider_credential_name": {
      "type": "string",
      "description": "Sent only by the add, with `has_provider_credentials`."
    },
    "provider": {
      "type": "string",
      "deprecated": true,
      "description": "Never sent; read `detected_provider`. Kept for released SDK types; removed in the next major."
    },
    "email_sending_enabled": {
      "type": "boolean",
      "deprecated": true,
      "description": "Never sent; read `for_email_sending`. Kept for released SDK types; removed in the next major."
    },
    "profile_id": {
      "$ref": "#/$defs/ObjectId"
    },
    "from_email": {
      "type": "string"
    },
    "resend": {
      "$ref": "#/$defs/DomainResendStatus"
    },
    "email_verification": {
      "$ref": "#/$defs/DomainEmailVerificationState"
    },
    "verified_providers": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Every provider (or `email`) that has confirmed control."
    },
    "check_count": {
      "type": "integer"
    },
    "last_checked_at": {
      "type": "string",
      "format": "date-time"
    },
    "error_message": {
      "type": "string",
      "description": "Why the last check failed."
    },
    "publish_recheck_waiting_since": {
      "type": "string",
      "format": "date-time",
      "description": "When this domain joined its account's re-check line: present only while a record published at the DNS provider waits there, before its automatic re-check starts. Absent when it is not waiting."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "verified_at": {
      "type": "string",
      "format": "date-time"
    },
    "api_verification": {
      "anyOf": [
        {
          "$ref": "#/$defs/DomainApiVerification"
        },
        {
          "type": "null"
        }
      ],
      "description": "Set when the domain was added from an API verification, else null. Absent from an API that predates the field."
    },
    "proof_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Public handle of the control proof backing this domain (`ph_ctl_<32 hex>`), resolved through the domain's mirroring asset — the same source `GET /me/assets` reads, so the two surfaces cannot disagree. Null when the domain has no proof, or when its proof predates the registry."
    },
    "proof_status": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "active",
        "revoked",
        "expired",
        "suspended",
        null
      ],
      "description": "Registry status of that proof. A domain row can read `verified` while its proof is `revoked` — the row records that control was once shown, the proof records whether it still stands — so a client showing domain control must render THIS. Null means no registry record, which is NOT a revocation."
    },
    "proof_revoked_reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Reason the registry recorded, present only while `proof_status` is `revoked`."
    },
    "proof_expires_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When that proof expires — the signed token's own `exp`. `proof_status` stays `active` after this instant (nothing rewrites it), so a client must compare against the clock to tell a live proof from an expired one. Proofs inside 30 days of expiry are renewed automatically while control can still be confirmed. Carried even when `proof_id` is null (a proof that predates the registry still has a signed expiry); null when the domain has no proof, or its proof never stored one."
    }
  },
  "required": [
    "id",
    "domain",
    "status",
    "detected_provider",
    "provider_name",
    "supports_auto_dns",
    "verification_method",
    "for_email_sending",
    "for_verification",
    "dns_records",
    "has_dns_mismatch",
    "txt_record_name",
    "txt_record_value",
    "http_file_path",
    "http_file_content",
    "oauth_connected",
    "godaddy_connected",
    "supports_api_token",
    "supports_api_key",
    "verified_providers",
    "check_count",
    "created_at",
    "updated_at"
  ],
  "$defs": {
    "DomainApiVerification": {
      "type": "object",
      "properties": {
        "verification_id": {
          "type": "string",
          "description": "The domain verification (`POST /api/v1/verifications`) the domain was added from."
        },
        "channel": {
          "type": "string",
          "description": "How that verification proved the domain (`dns`, `http`, `auto` or `email`)."
        },
        "verified_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "proof_expires_at": {
          "type": "string",
          "format": "date-time",
          "description": "When that verification's own proof expires."
        }
      },
      "required": [
        "verification_id",
        "channel",
        "verified_at",
        "proof_expires_at"
      ],
      "description": "Where a domain added from an API verification came from. Provenance only: it does not verify the domain on this account and grants it no proof."
    },
    "DomainDnsRecord": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "TXT",
            "CNAME",
            "MX"
          ]
        },
        "name": {
          "type": "string"
        },
        "value": {
          "type": "string"
        },
        "purpose": {
          "type": "string",
          "enum": [
            "ownership",
            "dkim",
            "mx",
            "spf"
          ]
        },
        "priority": {
          "type": "integer",
          "description": "MX records only."
        },
        "verified": {
          "type": "boolean"
        },
        "verified_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "type",
        "name",
        "value",
        "purpose",
        "verified"
      ],
      "description": "A DNS record a domain needs, for ownership or for email sending"
    },
    "DomainEmailVerificationState": {
      "type": "object",
      "properties": {
        "email_prefix": {
          "type": "string",
          "enum": [
            "admin",
            "administrator",
            "webmaster",
            "hostmaster",
            "postmaster"
          ]
        },
        "email_address": {
          "type": "string"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time",
          "description": "When the emailed code expires."
        },
        "attempts": {
          "type": "integer",
          "description": "Wrong codes entered so far (five are allowed)."
        },
        "last_sent_at": {
          "type": "string",
          "format": "date-time"
        },
        "verified_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "email_prefix",
        "email_address",
        "expires_at",
        "attempts"
      ],
      "description": "An email verification of the domain. The code itself is never returned."
    },
    "DomainResendStatus": {
      "type": "object",
      "properties": {
        "domain_id": {
          "type": "string",
          "description": "The email provider's id for this domain."
        },
        "status": {
          "type": "string",
          "enum": [
            "not_registered",
            "pending",
            "verified",
            "failed"
          ]
        },
        "dkim_records": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DomainDnsRecord"
          },
          "description": "The DKIM and SPF records email sending needs."
        },
        "registered_at": {
          "type": "string",
          "format": "date-time"
        },
        "verified_at": {
          "type": "string",
          "format": "date-time"
        },
        "last_checked_at": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "status",
        "dkim_records"
      ],
      "description": "Email-sending setup for a domain. Present once email sending has been set up."
    },
    "DomainStatus": {
      "type": "string",
      "enum": [
        "pending",
        "verifying",
        "verified",
        "failed",
        "expired",
        "revoking",
        "reverification_required"
      ],
      "description": "Domain verification status. `verifying` while a check runs; `revoking` while the owner's removal or revocation cascade holds the domain; `reverification_required` after a revoked proof, until control is shown again."
    },
    "ObjectId": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{24}$",
      "description": "MongoDB ObjectId"
    }
  }
}