{
  "openapi": "3.1.0",
  "info": {
    "title": "Mailskop API",
    "version": "1",
    "summary": "Domain email security analysis.",
    "description": "Audits SPF, DKIM, DMARC, BIMI, MTA-STS and DNSSEC records. DMARC is evaluated against RFC 9989. No authentication. Text fields in the report carry both languages as {tr, en}.",
    "contact": {
      "name": "Kinetik Bilişim",
      "url": "https://kinetikbilisim.net",
      "email": "contact@mailskop.com"
    }
  },
  "servers": [
    {
      "url": "https://mailskop.com"
    }
  ],
  "paths": {
    "/api/check": {
      "get": {
        "operationId": "checkDomain",
        "summary": "Audits the email security of a domain.",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "description": "The domain to audit, e.g. \"example.com\".",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Report"
                }
              }
            }
          },
          "400": {
            "description": "Invalid domain."
          },
          "429": {
            "description": "Rate limit; automation gets 12 scans per minute. Wait for Retry-After."
          }
        }
      }
    },
    "/api/header": {
      "post": {
        "operationId": "analyzeHeader",
        "summary": "Decodes the raw header of an email message.",
        "description": "Body: the header text itself (text/plain) or {\"header\": \"...\"} (application/json). The header is processed in the request and never stored. Network names are looked up for at most 4 public IPs; today’s DKIM/SPF re-checks are not included. `?format=md` or `Accept: text/markdown` returns a Markdown summary.",
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "tr"
              ],
              "default": "en"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "md"
              ],
              "default": "json"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "text/plain": {
              "schema": {
                "type": "string",
                "maxLength": 262144
              }
            },
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "header"
                ],
                "properties": {
                  "header": {
                    "type": "string",
                    "maxLength": 262144
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Header report: verdict (evidence/warning/clean), hops, authentication results, findings.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Empty body, or not an email header."
          },
          "413": {
            "description": "The body exceeds 256 KB."
          },
          "429": {
            "description": "Rate limit: 12 requests per minute. Wait for Retry-After."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Report": {
        "type": "object",
        "required": [
          "domain",
          "scannedAt",
          "score",
          "headline",
          "sections"
        ],
        "properties": {
          "domain": {
            "type": "string"
          },
          "scannedAt": {
            "type": "integer",
            "description": "Unix milliseconds."
          },
          "headline": {
            "type": "object",
            "properties": {
              "tr": {
                "type": "string"
              },
              "en": {
                "type": "string"
              }
            },
            "description": "One-sentence summary."
          },
          "platform": {
            "type": [
              "string",
              "null"
            ],
            "description": "Detected mail platform (from the MX signature)."
          },
          "securityVendor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Detected email security product."
          },
          "score": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "grade": {
                "type": "string",
                "enum": [
                  "A+",
                  "A",
                  "B",
                  "C",
                  "D",
                  "E",
                  "F"
                ]
              },
              "uncertain": {
                "type": "boolean",
                "description": "True when a component could not be measured with certainty. A DKIM selector that was not found does not prove DKIM is absent; partial points are given in that case."
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string"
                    },
                    "label": {
                      "type": "object",
                      "properties": {
                        "tr": {
                          "type": "string"
                        },
                        "en": {
                          "type": "string"
                        }
                      }
                    },
                    "points": {
                      "type": "integer"
                    },
                    "max": {
                      "type": "integer"
                    },
                    "note": {
                      "type": "object",
                      "properties": {
                        "tr": {
                          "type": "string"
                        },
                        "en": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "sections": {
            "type": "object",
            "description": "dmarc, reporting, spf, dkim, mx, bimi, dns — each {findings, data}."
          }
        }
      }
    }
  }
}