{
  "openapi": "3.1.0",
  "info": {
    "title": "Taşyaka Gayrimenkul — açık ilan API'si (demo)",
    "version": "1.0.0",
    "description": "Taşyaka Gayrimenkul sitesinin salt okunur ilan API'si. Yalnız yayındaki kayıtlar; kişisel veri içermez. Alan adları Türkçedir. Aynı veri MCP uç noktasından (https://tasyaka-gayrimenkul.pages.dev/mcp) ve Markdown (.md) sayfalarından da okunabilir. Demo ortamı: firma ve ilanlar kurgusaldır.",
    "contact": {
      "name": "Taşyaka Gayrimenkul",
      "email": "merhaba@tasyaka.example"
    }
  },
  "servers": [
    {
      "url": "https://tasyaka-gayrimenkul.pages.dev",
      "description": "Yerel demo sunucusu"
    }
  ],
  "paths": {
    "/api/ilanlar": {
      "get": {
        "operationId": "ilanAra",
        "summary": "İlan ara",
        "description": "Sitedeki /ilanlar sayfasıyla aynı filtreler ve aynı sonuç. Yalnız yayındaki ilanlar.",
        "parameters": [
          {
            "name": "islem",
            "in": "query",
            "required": false,
            "description": "satilik | kiralik",
            "schema": {
              "type": "string",
              "enum": [
                "satilik",
                "kiralik"
              ]
            }
          },
          {
            "name": "tip",
            "in": "query",
            "required": false,
            "description": "Emlak tipi (virgülle birden çok)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "il",
            "in": "query",
            "required": false,
            "description": "İl",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ilce",
            "in": "query",
            "required": false,
            "description": "İlçe (virgülle birden çok)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "odaMin",
            "in": "query",
            "required": false,
            "description": "En az yatak odası (3+1 → 3)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fiyatMin",
            "in": "query",
            "required": false,
            "description": "En düşük fiyat (TL)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fiyatMax",
            "in": "query",
            "required": false,
            "description": "En yüksek fiyat (TL)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "m2Min",
            "in": "query",
            "required": false,
            "description": "En az brüt m² / arsa alanı",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "m2Max",
            "in": "query",
            "required": false,
            "description": "En çok m²",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "turlu",
            "in": "query",
            "required": false,
            "description": "Yalnız 3B/360° turu olanlar",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "metin",
            "in": "query",
            "required": false,
            "description": "Serbest metin (mahalle vb.)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sirala",
            "in": "query",
            "required": false,
            "description": "Sıralama",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sayfa",
            "in": "query",
            "required": false,
            "description": "Sayfa (1’den başlar)",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "boyut",
            "in": "query",
            "required": false,
            "description": "Sayfa boyutu (en çok 100, varsayılan 12)",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "İlan listesi",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IlanListesi"
                }
              }
            }
          }
        }
      }
    },
    "/api/ilanlar/{id}": {
      "get": {
        "operationId": "ilanGetir",
        "summary": "Tek ilan",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "İlan no (TY-1001) ya da kısa ad",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "İlan",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ilan"
                }
              }
            }
          },
          "404": {
            "description": "Bulunamadı",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hata"
                }
              }
            }
          },
          "410": {
            "description": "Yayından kaldırıldı",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hata"
                }
              }
            }
          }
        }
      }
    },
    "/api/bolgeler": {
      "get": {
        "operationId": "bolgeler",
        "summary": "Yayındaki kayıtların ilçeleri ve sayıları",
        "responses": {
          "200": {
            "description": "Bölgeler",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Bolgeler"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Ilan": {
        "type": "object",
        "description": "Yayındaki ilan (herkese açık alanlar). Fiyat tamsayı TL; kiralıkta fiyat.donem = \"ay\".",
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "TY-1001"
            ]
          },
          "slug": {
            "type": "string"
          },
          "durum": {
            "type": "string",
            "const": "yayinda"
          },
          "islem": {
            "type": "string",
            "enum": [
              "satilik",
              "kiralik"
            ]
          },
          "tip": {
            "type": "string",
            "enum": [
              "daire",
              "mustakil",
              "villa",
              "arsa",
              "isyeri"
            ]
          },
          "baslik": {
            "type": "string"
          },
          "aciklama": {
            "type": "string"
          },
          "fiyat": {
            "type": "object",
            "properties": {
              "tutar": {
                "type": "integer"
              },
              "birim": {
                "type": "string",
                "const": "TRY"
              },
              "donem": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "ay",
                  null
                ]
              }
            }
          },
          "ozellik": {
            "type": "object",
            "description": "Konut/işyeri özellikleri (arsada yok)"
          },
          "arsa": {
            "type": "object",
            "description": "Arsa bilgileri (ada/parsel örnek değerlerdir)"
          },
          "konum": {
            "$ref": "#/components/schemas/Konum"
          },
          "medya": {
            "type": "object"
          },
          "turIdleri": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "danisman": {
            "type": "object",
            "description": "Danışman adı + OFİS telefonu (kişisel numara verilmez)"
          },
          "iletisim": {
            "$ref": "#/components/schemas/Iletisim"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "markdown": {
            "type": "string",
            "format": "uri"
          },
          "olusturma": {
            "type": "string"
          },
          "guncelleme": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "slug",
          "islem",
          "tip",
          "baslik",
          "fiyat",
          "konum",
          "url"
        ]
      },
      "IlanListesi": {
        "type": "object",
        "properties": {
          "toplam": {
            "type": "integer"
          },
          "sayfa": {
            "type": "integer"
          },
          "sayfaSayisi": {
            "type": "integer"
          },
          "boyut": {
            "type": "integer"
          },
          "ilanlar": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Ilan"
            }
          }
        }
      },
      "Hata": {
        "type": "object",
        "properties": {
          "hata": {
            "type": "string"
          },
          "mesaj": {
            "type": "string"
          }
        },
        "required": [
          "hata",
          "mesaj"
        ]
      },
      "Konum": {
        "type": "object",
        "description": "Konum. hassasiyet \"yaklasik\" ise koordinat bilinçli olarak kaydırılmıştır (kapı numarası paylaşılmaz).",
        "properties": {
          "il": {
            "type": "string"
          },
          "ilce": {
            "type": "string"
          },
          "mahalle": {
            "type": "string"
          },
          "adresMetni": {
            "type": "string"
          },
          "lat": {
            "type": "number"
          },
          "lng": {
            "type": "number"
          },
          "hassasiyet": {
            "type": "string",
            "enum": [
              "tam",
              "yaklasik"
            ]
          },
          "yaklasikYaricapM": {
            "type": "integer"
          }
        }
      },
      "Bolgeler": {
        "type": "object",
        "properties": {
          "bolgeler": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ad": {
                  "type": "string"
                },
                "il": {
                  "type": "string"
                },
                "sayi": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "Iletisim": {
        "type": "object",
        "properties": {
          "ofis": {
            "type": "string"
          },
          "tel": {
            "type": "string"
          },
          "eposta": {
            "type": "string"
          }
        }
      }
    }
  }
}