{
  "openapi": "3.1.0",
  "info": {
    "title": "Selector7 Domain Findings API",
    "version": "1.0.0",
    "description": "Open, keyless API for live e-mail-security findings (SPF/DKIM/DMARC/BIMI/MTA-STS/TLS-RPT/DNSSEC) of any domain."
  },
  "servers": [
    {
      "url": "https://selector7.com"
    }
  ],
  "paths": {
    "/api/v1/check": {
      "get": {
        "summary": "Check a domain",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "selector7.com"
          }
        ],
        "responses": {
          "200": {
            "description": "Check result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid domain"
          },
          "429": {
            "description": "Rate limit exceeded (30/hour/IP)"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Finding": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "dmarc_missing",
              "dmarc_policy_none",
              "dmarc_policy_quarantine",
              "dmarc_no_rua",
              "dmarc_pct_below_100",
              "spf_missing",
              "spf_no_all",
              "spf_softfail_all",
              "spf_too_many_lookups",
              "dkim_missing",
              "mtasts_missing",
              "tlsrpt_missing",
              "dnssec_disabled",
              "mx_missing"
            ]
          },
          "layer": {
            "type": "string"
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "warning",
              "info"
            ]
          },
          "title": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "layer",
          "severity",
          "title",
          "detail"
        ]
      },
      "CheckResult": {
        "type": "object",
        "properties": {
          "apiVersion": {
            "type": "string",
            "enum": [
              "1"
            ]
          },
          "domain": {
            "type": "string"
          },
          "score": {
            "type": "integer"
          },
          "grade": {
            "type": "string",
            "enum": [
              "A",
              "B",
              "C",
              "D",
              "F"
            ]
          },
          "checkedAt": {
            "type": "string",
            "format": "date-time"
          },
          "layers": {
            "type": "object"
          },
          "findings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Finding"
            }
          }
        },
        "required": [
          "apiVersion",
          "domain",
          "score",
          "grade",
          "checkedAt",
          "layers",
          "findings"
        ]
      }
    }
  }
}