{
  "openapi": "3.1.0",
  "info": {
    "title": "InboxSetup Email DNS Check API",
    "version": "1.0.0",
    "description": "Free API that checks SPF, DKIM, DMARC, MX and BIMI for a domain and returns a score, a plain-English verdict and an ordered fix list. No key required. About 20 requests per minute per IP. Docs: https://inboxsetup.org/api/",
    "contact": {
      "name": "InboxSetup",
      "url": "https://inboxsetup.org"
    }
  },
  "servers": [
    {
      "url": "https://inboxsetup.org"
    }
  ],
  "paths": {
    "/api/check": {
      "get": {
        "operationId": "checkEmailDomain",
        "summary": "Check a domain's email DNS records",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "description": "Domain to check, for example example.com. An email address or URL is also accepted.",
            "schema": {
              "type": "string",
              "maxLength": 253,
              "examples": [
                "example.com"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Check result (cached up to 5 minutes).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckResult"
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid domain.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "DNS lookup failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Lookup timed out.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "error",
          "message"
        ]
      },
      "Finding": {
        "type": "object",
        "properties": {
          "severity": {
            "type": "string",
            "enum": [
              "ok",
              "info",
              "warn",
              "error"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Status": {
        "type": "string",
        "enum": [
          "pass",
          "warning",
          "fail",
          "missing",
          "info"
        ]
      },
      "CheckResult": {
        "type": "object",
        "properties": {
          "domain": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "grade": {
            "type": "string",
            "enum": [
              "A",
              "B",
              "C",
              "D",
              "F"
            ]
          },
          "verdict": {
            "type": "string"
          },
          "level": {
            "type": "string",
            "enum": [
              "good",
              "ok",
              "risk"
            ]
          },
          "summary": {
            "type": "string"
          },
          "fixes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "priority": {
                  "type": "string",
                  "enum": [
                    "urgent",
                    "recommended",
                    "optional"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "why": {
                  "type": "string"
                },
                "steps": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "guide_url": {
                  "type": "string",
                  "format": "uri"
                },
                "dns_help_url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "spf": {
            "type": "object",
            "properties": {
              "status": {
                "$ref": "#/components/schemas/Status"
              },
              "record": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "dns_lookups": {
                "type": "integer"
              },
              "findings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Finding"
                }
              }
            }
          },
          "dmarc": {
            "type": "object",
            "properties": {
              "status": {
                "$ref": "#/components/schemas/Status"
              },
              "record": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "policy": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "inherited_from": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "findings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Finding"
                }
              }
            }
          },
          "dkim": {
            "type": "object",
            "properties": {
              "status": {
                "$ref": "#/components/schemas/Status"
              },
              "selectors_found": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "findings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Finding"
                }
              },
              "selectors_checked": {
                "type": "integer",
                "description": "How many DKIM selectors were tested. The API runs a quick check (about 30-40 of the most common selectors, chosen by the services detected in SPF and MX); the website tests more."
              }
            }
          },
          "bimi": {
            "type": "object",
            "properties": {
              "status": {
                "$ref": "#/components/schemas/Status"
              },
              "record": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "findings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Finding"
                }
              }
            }
          },
          "mx": {
            "type": "object",
            "properties": {
              "status": {
                "$ref": "#/components/schemas/Status"
              },
              "records": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "priority": {
                      "type": "integer"
                    },
                    "host": {
                      "type": "string"
                    }
                  }
                }
              },
              "findings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Finding"
                }
              }
            }
          },
          "detected_services": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "evidence": {
                  "type": "string"
                }
              }
            }
          },
          "mailbox_provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "dns_host": {
            "type": [
              "string",
              "null"
            ]
          },
          "nameservers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "guide_urls": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "report_url": {
            "type": "string",
            "format": "uri"
          },
          "source": {
            "type": "string"
          },
          "limits": {
            "type": "object",
            "description": "Quick-check bookkeeping for this request.",
            "properties": {
              "dns_queries_used": {
                "type": "integer",
                "description": "DNS lookups made for this result (never more than 45)."
              },
              "dns_queries_skipped": {
                "type": "integer",
                "description": "Lookups skipped because the budget was used up."
              },
              "mode": {
                "type": "string",
                "enum": [
                  "quick",
                  "full"
                ]
              }
            }
          }
        },
        "required": [
          "domain",
          "checked_at",
          "score",
          "grade",
          "verdict",
          "summary",
          "fixes",
          "spf",
          "dmarc",
          "dkim",
          "bimi",
          "mx",
          "report_url",
          "source"
        ]
      }
    }
  }
}
