{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/qelka-com/json-schema/qelka-com-email-auth-result-schema.json",
  "title": "EmailAuthResult",
  "description": "Email authentication grade of a sending domain. Results are cached 60 minutes.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/qelka-com-openapi.yml#/components/schemas/EmailAuthResult",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^lkp_[0-9A-HJKMNP-TV-Z]{10,26}$",
      "description": "Unique identifier of this lookup."
    },
    "object": {
      "type": "string",
      "const": "email_auth"
    },
    "input": {
      "type": "string"
    },
    "domain": {
      "type": "string"
    },
    "grade": {
      "type": "string",
      "enum": [
        "A",
        "B",
        "C",
        "D",
        "F"
      ],
      "description": "A to F from the score. A needs DMARC enforcement (quarantine or reject on every message), so a domain without it is capped at B; a domain missing SPF or DMARC is capped at D."
    },
    "score": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100
    },
    "mx": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "NOERROR",
            "NXDOMAIN",
            "SERVFAIL",
            "REFUSED",
            "TIMEOUT"
          ]
        },
        "records": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "priority": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991
              },
              "exchange": {
                "type": "string"
              }
            },
            "required": [
              "priority",
              "exchange"
            ],
            "additionalProperties": false
          }
        },
        "null_mx": {
          "type": "boolean"
        },
        "provider": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "status",
        "records",
        "null_mx",
        "provider"
      ],
      "additionalProperties": false
    },
    "spf": {
      "type": "object",
      "properties": {
        "record": {
          "type": [
            "string",
            "null"
          ]
        },
        "records_found": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "valid": {
          "type": "boolean"
        },
        "all": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "pass",
                "fail",
                "softfail",
                "neutral"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "mechanisms": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "qualifier": {
                "type": "string",
                "enum": [
                  "+",
                  "-",
                  "~",
                  "?"
                ]
              },
              "type": {
                "type": "string",
                "enum": [
                  "all",
                  "include",
                  "a",
                  "mx",
                  "ptr",
                  "ip4",
                  "ip6",
                  "exists",
                  "redirect",
                  "exp",
                  "unknown"
                ]
              },
              "value": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "qualifier",
              "type",
              "value"
            ],
            "additionalProperties": false
          }
        },
        "dns_lookups": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "lookup_limit": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "record",
        "records_found",
        "valid",
        "all",
        "mechanisms",
        "dns_lookups",
        "lookup_limit",
        "issues"
      ],
      "additionalProperties": false
    },
    "dmarc": {
      "type": "object",
      "properties": {
        "record": {
          "type": [
            "string",
            "null"
          ]
        },
        "valid": {
          "type": "boolean"
        },
        "policy": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "none",
                "quarantine",
                "reject"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "subdomain_policy": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "none",
                "quarantine",
                "reject"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "pct": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 100
            },
            {
              "type": "null"
            }
          ]
        },
        "rua": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "ruf": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "adkim": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "r",
                "s"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "aspf": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "r",
                "s"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "record",
        "valid",
        "policy",
        "subdomain_policy",
        "pct",
        "rua",
        "ruf",
        "adkim",
        "aspf",
        "issues"
      ],
      "additionalProperties": false
    },
    "dkim": {
      "type": "object",
      "properties": {
        "selectors_checked": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Selectors queried: common ones of the main sending services, then the ones sent in the request."
        },
        "keys": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "selector": {
                "type": "string"
              },
              "valid": {
                "type": "boolean"
              },
              "key_type": {
                "anyOf": [
                  {
                    "type": "string",
                    "enum": [
                      "rsa",
                      "ed25519"
                    ]
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "key_bits": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "testing": {
                "type": "boolean"
              },
              "revoked": {
                "type": "boolean"
              },
              "issues": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "selector",
              "valid",
              "key_type",
              "key_bits",
              "testing",
              "revoked",
              "issues"
            ],
            "additionalProperties": false
          },
          "description": "Selectors that publish a DKIM key record. A single selector \"*\" means every selector returned the same record (a wildcard, often a revoked key on a domain that sends no mail)."
        }
      },
      "required": [
        "selectors_checked",
        "keys"
      ],
      "additionalProperties": false
    },
    "bimi": {
      "type": "object",
      "properties": {
        "record": {
          "type": [
            "string",
            "null"
          ]
        },
        "valid": {
          "type": "boolean"
        },
        "logo_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "authority_url": {
          "description": "URL of the Verified Mark Certificate (a= tag), when there is one.",
          "type": [
            "string",
            "null"
          ]
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "record",
        "valid",
        "logo_url",
        "authority_url",
        "issues"
      ],
      "additionalProperties": false
    },
    "mta_sts": {
      "type": "object",
      "properties": {
        "record": {
          "type": [
            "string",
            "null"
          ]
        },
        "id": {
          "type": [
            "string",
            "null"
          ]
        },
        "policy_status": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "ok",
                "not_found",
                "invalid",
                "unreachable"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Result of fetching https://mta-sts.<domain>/.well-known/mta-sts.txt, or null when no _mta-sts record exists."
        },
        "mode": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "enforce",
                "testing",
                "none"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "max_age": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "mx": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "record",
        "id",
        "policy_status",
        "mode",
        "max_age",
        "mx",
        "issues"
      ],
      "additionalProperties": false
    },
    "tls_rpt": {
      "type": "object",
      "properties": {
        "record": {
          "type": [
            "string",
            "null"
          ]
        },
        "valid": {
          "type": "boolean"
        },
        "rua": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "record",
        "valid",
        "rua",
        "issues"
      ],
      "additionalProperties": false
    },
    "fixes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "add_spf",
              "merge_spf_records",
              "fix_spf_syntax",
              "reduce_spf_lookups",
              "restrict_spf_all",
              "add_dmarc",
              "merge_dmarc_records",
              "fix_dmarc_syntax",
              "enforce_dmarc",
              "raise_dmarc_pct",
              "add_dmarc_rua",
              "add_dkim",
              "fix_dkim_key",
              "rotate_dkim_key",
              "leave_dkim_testing",
              "add_mx",
              "add_mta_sts",
              "fix_mta_sts_policy",
              "enforce_mta_sts",
              "add_tls_rpt",
              "fix_tls_rpt",
              "add_bimi",
              "fix_bimi"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "warning",
              "info"
            ]
          },
          "area": {
            "type": "string",
            "enum": [
              "mx",
              "spf",
              "dmarc",
              "dkim",
              "bimi",
              "mta_sts",
              "tls_rpt"
            ]
          },
          "message": {
            "type": "string"
          },
          "record": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "const": "TXT"
                  },
                  "value": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "type",
                  "value"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "A DNS record to publish, when the fix is one. Placeholders in angle brackets are values only the domain owner knows."
          }
        },
        "required": [
          "code",
          "severity",
          "area",
          "message",
          "record"
        ],
        "additionalProperties": false
      },
      "description": "What to change, most important first."
    },
    "checked_at": {
      "type": "string"
    },
    "credits_used": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991,
      "description": "Credits debited for this call. Cached results cost the same; failed upstream calls cost 0."
    },
    "cached": {
      "type": "boolean",
      "description": "True when the result was served from the 7-day result cache. Send `fresh: true` to bypass it."
    }
  },
  "required": [
    "id",
    "object",
    "input",
    "domain",
    "grade",
    "score",
    "mx",
    "spf",
    "dmarc",
    "dkim",
    "bimi",
    "mta_sts",
    "tls_rpt",
    "fixes",
    "checked_at",
    "credits_used",
    "cached"
  ],
  "additionalProperties": false
}