{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/domainee-dev/json-schema/domainee-dev-domain-schema.json",
  "title": "Domain",
  "description": "A customer hostname connected to one of your origins.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/domainee-dev-openapi.json#/components/schemas/Domain",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Domainee identifier."
    },
    "workspaceId": {
      "type": "string",
      "description": "Workspace the domain belongs to."
    },
    "hostname": {
      "type": "string"
    },
    "originUrl": {
      "type": "string",
      "format": "uri",
      "description": "Where verified traffic is sent."
    },
    "metadata": {
      "type": "object",
      "additionalProperties": true,
      "description": "Opaque key/value bag echoed back on reads and webhooks."
    },
    "mode": {
      "type": "string",
      "enum": [
        "proxy",
        "redirect"
      ],
      "description": "`proxy` serves the origin under the custom hostname; `redirect` sends a 301/302."
    },
    "keepHost": {
      "type": "boolean",
      "description": "Forward the original Host header to the origin instead of rewriting it."
    },
    "redirectWww": {
      "type": "boolean",
      "description": "Also answer for the www. variant."
    },
    "redirectStatus": {
      "type": "integer",
      "enum": [
        301,
        302
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "verified",
        "failed",
        "expired"
      ],
      "description": "Verification state. Traffic only flows once `verified`."
    },
    "dnsRecords": {
      "type": "array",
      "description": "The records the domain owner must create for verification to pass. Always the single CNAME. Unchanged and safe to keep rendering as-is; read `dnsRecordOptions` if you want to offer the apex A-record path.",
      "items": {
        "$ref": "#/$defs/DnsRecordInstruction"
      }
    },
    "dnsRecordOptions": {
      "type": "array",
      "description": "Every supported way to point this hostname at the edge, recommended first — take `[0]` to get the right one. For a subdomain that is the `cname` set. For an apex it is the `a` set: a root domain cannot hold a CNAME, and the ALIAS/ANAME/flattening substitutes all pin the name to a single region with no failover, whereas the anycast A records keep every region.",
      "items": {
        "$ref": "#/$defs/DnsRecordSet"
      }
    },
    "verificationToken": {
      "type": "string"
    },
    "verifiedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "lastCheckedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "isResolving": {
      "type": "boolean",
      "description": "The hostname resolves in public DNS."
    },
    "pointsToEdge": {
      "type": "boolean",
      "description": "It resolves to Domainee's edge."
    },
    "dnsPointedAt": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "What the hostname currently resolves to."
    },
    "sslActiveFrom": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "sslActiveUntil": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "monitorStatus": {
      "type": "string",
      "enum": [
        "unknown",
        "dns_not_resolving",
        "dns_incorrect",
        "pending_ssl",
        "active_ssl",
        "target_not_loading",
        "ssl_failed",
        "ssl_expired"
      ],
      "description": "Live health, refreshed by the DNS monitor and by POST /v1/domains/{id}/check."
    },
    "monitorMessage": {
      "type": [
        "string",
        "null"
      ]
    },
    "lastMonitoredAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "workspaceId",
    "hostname",
    "originUrl",
    "status",
    "createdAt"
  ],
  "$defs": {
    "DnsRecordInstruction": {
      "type": "object",
      "description": "A record the domain owner must create for verification to pass.",
      "properties": {
        "name": {
          "type": "string"
        },
        "value": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "purpose": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "value",
        "type"
      ]
    },
    "DnsRecordSet": {
      "type": "object",
      "description": "One way of pointing the hostname at the edge. Every record in `records` must be created for the set to work.",
      "properties": {
        "method": {
          "type": "string",
          "enum": [
            "cname",
            "a"
          ],
          "description": "`cname` works wherever the provider allows a CNAME at this position. `a` is for apex/root domains on providers with no ALIAS or ANAME support."
        },
        "label": {
          "type": "string"
        },
        "recommended": {
          "type": "boolean"
        },
        "note": {
          "type": "string"
        },
        "records": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DnsRecordInstruction"
          }
        }
      },
      "required": [
        "method",
        "label",
        "recommended",
        "records"
      ]
    }
  }
}