{
  "openapi": "3.1.0",
  "info": {
    "title": "Mailskop API",
    "version": "1",
    "summary": "Alan adı e-posta güvenliği analizi.",
    "description": "SPF, DKIM, DMARC, BIMI, MTA-STS ve DNSSEC kayıtlarını inceler. DMARC değerlendirmesi RFC 9989 esas alınarak yapılır. Kimlik doğrulama gerekmez.",
    "contact": {
      "name": "Kinetik Bilişim",
      "url": "https://kinetikbilisim.net",
      "email": "contact@mailskop.com"
    }
  },
  "servers": [
    {
      "url": "https://mailskop.com"
    }
  ],
  "paths": {
    "/api/tara": {
      "get": {
        "operationId": "alanAdiIncele",
        "summary": "Bir alan adının e-posta güvenliğini inceler.",
        "parameters": [
          {
            "name": "d",
            "in": "query",
            "required": true,
            "description": "İncelenecek alan adı, örn. \"example.com\".",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rapor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rapor"
                }
              }
            }
          },
          "400": {
            "description": "Geçersiz alan adı."
          },
          "429": {
            "description": "Hız sınırı aşıldı; otomasyon için dakikada 12 tarama. Retry-After kadar bekleyin."
          }
        }
      }
    },
    "/api/baslik": {
      "post": {
        "operationId": "baslikAnalizi",
        "summary": "Bir e-postanın ham header’ını çözümler.",
        "description": "Gövde: header metninin kendisi (text/plain) ya da {\"baslik\": \"...\"} (application/json). Header istekte işlenir, saklanmaz. En çok 4 genel IP için ağ adı sorulur; bugünkü DKIM/SPF denetimleri bu uçta yok. `?bicim=md` ya da `Accept: text/markdown` Markdown özet döner.",
        "parameters": [
          {
            "name": "dil",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "tr",
                "en"
              ],
              "default": "tr"
            }
          },
          {
            "name": "bicim",
            "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": [
                  "baslik"
                ],
                "properties": {
                  "baslik": {
                    "type": "string",
                    "maxLength": 262144
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Header raporu: hüküm (kanit/isaret/temiz), duraklar, kimlik sonuçları, bulgular.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Boş ya da header olmayan gövde."
          },
          "413": {
            "description": "Gövde 256 KB sınırını aşıyor."
          },
          "429": {
            "description": "Hız sınırı: dakikada 12 istek. Retry-After kadar bekleyin."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Rapor": {
        "type": "object",
        "required": [
          "domain",
          "scannedAt",
          "score",
          "headline",
          "sections"
        ],
        "properties": {
          "domain": {
            "type": "string"
          },
          "scannedAt": {
            "type": "integer",
            "description": "Unix milisaniye."
          },
          "headline": {
            "type": "object",
            "properties": {
              "tr": {
                "type": "string"
              },
              "en": {
                "type": "string"
              }
            },
            "description": "Tek cümlelik özet."
          },
          "platform": {
            "type": [
              "string",
              "null"
            ],
            "description": "Tespit edilen posta platformu (MX imzasından)."
          },
          "securityVendor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Tespit edilen e-posta güvenlik ürünü."
          },
          "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": "Bir bileşen kesin ölçülemediyse true. DKIM seçicisi bulunamaması DKIM’in olmadığını kanıtlamaz; bu durumda kısmi puan verilir."
              },
              "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 — her biri {findings, data}."
          }
        }
      }
    }
  }
}