{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ranla-ai/json-schema/ranla-ai-verify-domain-response-schema.json",
  "title": "VerifyDomainResponse",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ranla-ai-openapi.yml#/components/schemas/VerifyDomainResponse",
  "type": "object",
  "required": [
    "domain",
    "records",
    "verified",
    "inbound_records",
    "inbound_note"
  ],
  "properties": {
    "domain": {
      "$ref": "#/$defs/Domain"
    },
    "records": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DnsRecord"
      }
    },
    "analysis": {
      "$ref": "#/$defs/DomainDnsAnalysis"
    },
    "inbound_records": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DnsRecord"
      }
    },
    "inbound_note": {
      "type": "string"
    },
    "tracking_dns": {
      "$ref": "#/$defs/DomainTrackingDns"
    },
    "verified": {
      "type": "boolean"
    },
    "auto": {
      "type": "boolean"
    },
    "mail_server_registered": {
      "type": "boolean",
      "description": "Whether the domain is registered on the mail server. Always true on a successful verify."
    },
    "checks": {
      "type": "object",
      "description": "Public DNS checks. DMARC is reported but does not block verification.",
      "properties": {
        "ownership": {
          "type": "boolean"
        },
        "spf": {
          "type": "boolean"
        },
        "dkim": {
          "type": "boolean"
        },
        "dmarc": {
          "type": "boolean"
        },
        "return_path": {
          "type": "boolean"
        }
      }
    },
    "inbound_configured": {
      "type": "boolean"
    },
    "inbound_pending": {
      "type": "boolean"
    },
    "inbound_error": {
      "type": [
        "string",
        "null"
      ]
    },
    "signing_ready": {
      "type": "boolean",
      "description": "True when the mail server will DKIM-sign with this domain's key (not the shared pool fallback)."
    },
    "mail_server_signing": {
      "$ref": "#/$defs/MailServerSigningStatus"
    }
  },
  "$defs": {
    "DnsRecord": {
      "type": "object",
      "required": [
        "type",
        "host",
        "value",
        "purpose"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "TXT",
            "CNAME",
            "MX"
          ],
          "description": "DNS record type. The return path is always a single `CNAME`, set to DNS only (not\nproxied). Publish no other records on the return-path host.\n"
        },
        "host": {
          "type": "string"
        },
        "value": {
          "type": "string",
          "description": "Record content. For MX records, the mail server hostname (priority is in `priority`)."
        },
        "priority": {
          "type": "integer",
          "description": "MX preference when `type` is `MX` (lower is preferred)."
        },
        "purpose": {
          "type": "string",
          "description": "Human-readable purpose (`Domain ownership`, `DKIM`, `Return path`, `SPF`, `DMARC`, `Open/click tracking`, `Inbound receiving`)"
        }
      }
    },
    "Domain": {
      "type": "object",
      "required": [
        "id",
        "name",
        "status",
        "created_at",
        "verified_at",
        "open_tracking",
        "click_tracking",
        "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."
        },
        "tls_mode": {
          "type": "string",
          "enum": [
            "opportunistic",
            "enforced"
          ],
          "description": "Preferred outbound TLS behavior for this domain."
        },
        "inbound_enabled": {
          "type": "boolean",
          "description": "True when Ranla 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": "Why inbound setup failed when `inbound_status` is `error`. Verify the domain again to retry."
        }
      }
    },
    "DomainBimiAnalysis": {
      "type": "object",
      "required": [
        "host",
        "configured",
        "record",
        "location",
        "authority",
        "requires_dmarc_enforcement",
        "guidance"
      ],
      "properties": {
        "host": {
          "type": "string"
        },
        "configured": {
          "type": "boolean"
        },
        "record": {
          "type": [
            "string",
            "null"
          ]
        },
        "location": {
          "type": [
            "string",
            "null"
          ],
          "description": "Parsed BIMI `l=` logo URL when present"
        },
        "authority": {
          "type": [
            "string",
            "null"
          ],
          "description": "Parsed BIMI `a=` VMC URL when present"
        },
        "requires_dmarc_enforcement": {
          "type": "boolean",
          "description": "True when BIMI is unlikely to work until DMARC is set to p=quarantine or p=reject"
        },
        "guidance": {
          "type": "string"
        }
      }
    },
    "DomainDmarcAnalysis": {
      "type": "object",
      "required": [
        "host",
        "configured",
        "record",
        "policy",
        "rua",
        "guidance"
      ],
      "properties": {
        "host": {
          "type": "string"
        },
        "configured": {
          "type": "boolean"
        },
        "record": {
          "type": [
            "string",
            "null"
          ]
        },
        "policy": {
          "type": [
            "string",
            "null"
          ],
          "description": "Parsed DMARC `p=` policy when present (`none`, `quarantine`, or `reject`)"
        },
        "rua": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "guidance": {
          "type": "string"
        }
      }
    },
    "DomainDnsAnalysis": {
      "type": "object",
      "required": [
        "dmarc",
        "bimi"
      ],
      "properties": {
        "dmarc": {
          "$ref": "#/$defs/DomainDmarcAnalysis"
        },
        "bimi": {
          "$ref": "#/$defs/DomainBimiAnalysis"
        }
      }
    },
    "DomainTrackingDns": {
      "type": "object",
      "required": [
        "required",
        "host",
        "target",
        "ok"
      ],
      "properties": {
        "required": {
          "type": "boolean",
          "description": "True when open or click tracking is enabled for this domain."
        },
        "host": {
          "type": [
            "string",
            "null"
          ],
          "description": "Customer CNAME host (e.g. ps.example.com) when tracking is required."
        },
        "target": {
          "type": [
            "string",
            "null"
          ],
          "description": "Tracking CNAME target when tracking is required."
        },
        "ok": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Whether tracking DNS is live; null when tracking is disabled."
        }
      }
    },
    "MailServerSigningStatus": {
      "type": "object",
      "description": "Mail-server delivery DNS statuses recorded when verify re-checks the domain.",
      "properties": {
        "dkim_ok": {
          "type": "boolean"
        },
        "return_path_ok": {
          "type": "boolean"
        },
        "dkim_status": {
          "type": [
            "string",
            "null"
          ]
        },
        "return_path_status": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}