{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/beel-es/json-schema/beel-es-email-domain-response-schema.json",
  "title": "EmailDomainResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/beel-es-accountemaildomains-api-openapi.yml#/components/schemas/EmailDomainResponse",
  "type": "object",
  "required": [
    "success",
    "data"
  ],
  "properties": {
    "success": {
      "type": "boolean"
    },
    "data": {
      "$ref": "#/$defs/EmailDomain"
    },
    "meta": {
      "$ref": "#/$defs/ResponseMeta"
    }
  },
  "$defs": {
    "DnsRecord": {
      "type": "object",
      "description": "A DNS record the domain owner has to publish for the domain to be verified.",
      "required": [
        "type",
        "name",
        "value",
        "status"
      ],
      "properties": {
        "type": {
          "$ref": "#/$defs/DnsRecordType"
        },
        "name": {
          "type": "string",
          "description": "Host name of the record, relative to the domain."
        },
        "value": {
          "type": "string",
          "description": "Content the record must have."
        },
        "priority": {
          "type": "integer",
          "description": "Priority of the record. Only present on `MX` records."
        },
        "status": {
          "$ref": "#/$defs/EmailDomainStatus"
        }
      }
    },
    "DnsRecordType": {
      "type": "string",
      "enum": [
        "MX",
        "TXT",
        "CNAME"
      ],
      "description": "Type of a DNS record."
    },
    "EmailDomain": {
      "type": "object",
      "description": "A domain an account sends its emails from.",
      "required": [
        "id",
        "domain",
        "status",
        "is_default",
        "dns_records",
        "created_at"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Identifier of the email domain."
        },
        "domain": {
          "type": "string",
          "description": "Fully qualified domain name, in lowercase."
        },
        "status": {
          "$ref": "#/$defs/EmailDomainStatus"
        },
        "is_default": {
          "type": "boolean",
          "description": "Whether this is the domain the account's emails are sent from by default."
        },
        "dns_records": {
          "type": "array",
          "description": "Records to publish in the domain's DNS, with the verification status of each. Empty (`[]`) while\nthe domain is still registering, with `status: PENDING`: read it again in a few seconds, or\nremove it with `DELETE` if it stays empty.\n",
          "items": {
            "$ref": "#/$defs/DnsRecord"
          }
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "Moment the domain was registered."
        },
        "verified_at": {
          "type": "string",
          "format": "date-time",
          "description": "Moment the domain was verified. Absent until it is."
        },
        "last_checked_at": {
          "type": "string",
          "format": "date-time",
          "description": "Moment the records were last checked. Absent until the first check."
        }
      }
    },
    "EmailDomainStatus": {
      "type": "string",
      "enum": [
        "PENDING",
        "VERIFIED",
        "FAILED"
      ],
      "description": "Verification status of an email domain, and of each of its DNS records.\n\n- PENDING: the records have not been detected yet, or verification is in progress. A domain that\n  is not `VERIFIED` 72 hours after it was registered is removed\n- VERIFIED: the records were detected and the domain can be used to send\n- FAILED: verification did not succeed; check that the records are published as shown\n"
    },
    "ResponseMeta": {
      "type": "object",
      "properties": {
        "timestamp": {
          "type": "string",
          "format": "date-time"
        },
        "request_id": {
          "type": "string"
        }
      }
    }
  }
}