{
  "openapi": "3.0.1",
  "info": {
    "title": "ParselSorgu.net - Türkiye TKGM & İmar Yapay Zeka API",
    "description": "Türkiye 81 il, 973 ilçe ve 50.799 mahalle/köyde canlı TKGM MEGSİS ada/parsel sorgulama, 2026 imar/inşaat/kadastro verileri ve iLya Harita & İmar Mühendisi servisi.",
    "version": "2026.11.2"
  },
  "servers": [
    {
      "url": "https://www.parselsorgu.net",
      "description": "ParselSorgu.net Canlı Sunucu"
    }
  ],
  "paths": {
    "/api/health": {
      "get": {
        "operationId": "getSystemHealth",
        "summary": "Canlı API Sağlık ve Servis Doğrulama Testi",
        "description": "2026 Kadastro Endeksi, OpenAPI, TKGM MEGSİS 81 il ve iLya AI servislerinin canlı durumunu döndürür.",
        "responses": {
          "200": {
            "description": "Sistem sağlık raporu",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenericJsonResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/tkgm": {
      "get": {
        "operationId": "queryTkgmCadastral",
        "summary": "Canlı TKGM MEGSİS İdari Yapı veya Ada/Parsel Sorgulama",
        "description": "action=get_il, get_ilce (il_id), get_mahalle (ilce_id) veya get_parsel (mahalle_id, ada, parsel) ile canlı kadastro verisi getirir.",
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": ["get_il", "get_ilce", "get_mahalle", "get_parsel"]
            },
            "description": "Sorgu türü"
          },
          {
            "name": "il_id",
            "in": "query",
            "required": false,
            "schema": { "type": "integer" },
            "description": "get_ilce için il ID"
          },
          {
            "name": "ilce_id",
            "in": "query",
            "required": false,
            "schema": { "type": "integer" },
            "description": "get_mahalle için ilçe ID"
          },
          {
            "name": "mahalle_id",
            "in": "query",
            "required": false,
            "schema": { "type": "integer" },
            "description": "get_parsel için mahalle ID"
          },
          {
            "name": "ada",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "Ada numarası"
          },
          {
            "name": "parsel",
            "in": "query",
            "required": false,
            "schema": { "type": "string" },
            "description": "Parsel numarası"
          }
        ],
        "responses": {
          "200": {
            "description": "TKGM GeoJSON ve parsel özellikleri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenericJsonResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/2026-kadastro-endeks.json": {
      "get": {
        "operationId": "get2026CadastreReferenceIndex",
        "summary": "2026 Türkiye Resmi İmar, ÇŞİDB Maliyet, SGK ve 5403 Tarım Verileri",
        "description": "2026 yapı birim maliyetleri, 5403 tarım bölünme sınırları, tapu harcı, miras ve şufa parametrelerini döndürür.",
        "responses": {
          "200": {
            "description": "Resmi 2026 endeks verileri",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenericJsonResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/ilya": {
      "post": {
        "operationId": "askIlyaAiEngineer",
        "summary": "iLya Harita & İmar Yapay Zekâ Asistanına Danış",
        "description": "3194 Sayılı İmar Kanunu, 18. Madde DOP, 5403 tarla ifrazı ve 2026 inşaat maliyetleri hakkında teknik mühendislik analizi döndürür.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IlyaChatRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "iLya AI yanıtı ve hesaplama kartı",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IlyaChatResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "GenericJsonResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "description": "İşlem durumu"
          }
        }
      },
      "ParcelContext": {
        "type": "object",
        "properties": {
          "il": { "type": "string", "description": "İl adı" },
          "ilce": { "type": "string", "description": "İlçe adı" },
          "mahalle_id": { "type": "string", "description": "TKGM Mahalle ID" },
          "ada": { "type": "string", "description": "Ada numarası" },
          "parsel": { "type": "string", "description": "Parsel numarası" }
        }
      },
      "IlyaChatRequest": {
        "type": "object",
        "required": ["message"],
        "properties": {
          "message": {
            "type": "string",
            "description": "Kullanıcının imar, parsel veya inşaat maliyeti sorusu"
          },
          "session_id": {
            "type": "string",
            "description": "Oturum kimliği"
          },
          "parcel_context": {
            "$ref": "#/components/schemas/ParcelContext"
          }
        }
      },
      "IlyaChatResponse": {
        "type": "object",
        "properties": {
          "status": { "type": "string" },
          "reply": { "type": "string" },
          "session_id": { "type": "string" }
        }
      }
    }
  }
}
