{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/groundmail-dev/json-schema/groundmail-dev-domain-schema.json",
  "title": "Domain",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/groundmail-dev-openapi.yaml#/components/schemas/Domain",
  "type": "object",
  "required": [
    "id",
    "name",
    "status",
    "created_at",
    "verified_at",
    "open_tracking",
    "click_tracking",
    "tracking_status",
    "tracking_error",
    "tls_mode",
    "inbound_enabled",
    "inbound_status",
    "inbound_error"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "verified",
        "failed"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "verified_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "open_tracking": {
      "type": "boolean",
      "description": "Open tracking preference for this domain."
    },
    "click_tracking": {
      "type": "boolean",
      "description": "Click tracking preference for this domain."
    },
    "tracking_status": {
      "type": "string",
      "enum": [
        "disabled",
        "pending",
        "active",
        "error"
      ],
      "description": "Whether open/click tracking is applied to outgoing mail. `disabled` when both preferences are off, `pending` until the tracking CNAME is accepted and a certificate is issued for the tracking hostname (links and opens are not tracked yet; this takes a few minutes after the CNAME is added), `active` once both are done, `error` when tracking or the certificate could not be set up. Re-checked when you verify the domain and when you read it."
    },
    "tracking_error": {
      "type": [
        "string",
        "null"
      ],
      "description": "Why tracking is not active yet, when `tracking_status` is `pending` or `error`."
    },
    "tls_mode": {
      "type": "string",
      "enum": [
        "opportunistic",
        "enforced"
      ],
      "description": "Preferred outbound TLS behavior for this domain."
    },
    "inbound_enabled": {
      "type": "boolean",
      "description": "True when Groundmail should accept inbound mail for this domain."
    },
    "inbound_status": {
      "type": "string",
      "enum": [
        "disabled",
        "pending",
        "active",
        "error"
      ],
      "description": "`pending` before verification, `active` once inbound receiving is configured, or `error` when setup fails."
    },
    "inbound_error": {
      "type": [
        "string",
        "null"
      ],
      "description": "Last inbound configuration error, if any."
    },
    "inbound_spam_threshold": {
      "type": [
        "number",
        "null"
      ],
      "description": "Received mail scoring at or above this is `spam` (and dropped when `inbound_spam_action` is `drop`). Null uses the default (10) and drops nothing."
    },
    "inbound_spam_action": {
      "type": "string",
      "enum": [
        "flag",
        "drop"
      ],
      "description": "`flag` keeps spam with `spam_status: spam`; `drop` discards it (no stored email, no webhook)."
    },
    "tenant": {
      "type": "string",
      "description": "The `external_id` of the tenant that owns this domain. Present only on a tenant's domain."
    }
  }
}