{"openapi":"3.1.0","info":{"title":"Legalitify Compliance API","version":"v1","description":"Türk hukuku (KVKK, 6563 ETK, 6502 TKHK, Reklam Kurulu) uyum ön taraması: web sitesi taraması, reklam/içerik metni kontrolü, düzeltme metni ve emsal karar araması. Sonuçlar otomatik ön taramadır; hukuki görüş değildir. Web taraması birkaç dakika sürer: startWebScan ile başlatın, getScanStatus ile is_terminal=true olana dek (yaklaşık 20 saniyede bir) sorgulayın, sonra getScanReport ile bulguları alın."},"servers":[{"url":"https://legalitify.com/api/kyl/v1"}],"security":[{"bearerAuth":[]}],"paths":{"/scans":{"post":{"operationId":"startWebScan","summary":"Web sitesi uyum taramasını başlat","description":"Bir alan adını KVKK/çerez/mesafeli satış/reklam kurallarına göre taramaya alır. Asenkron: scan_id döner. Sonuç için getScanStatus ile is_terminal=true olana dek sorgulayın. Kullanıcının aylık tarama hakkından düşer.","x-openai-isConsequential":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScanRequest"}}}},"responses":{"202":{"description":"Tarama kuyruğa alındı","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScanStarted"}}}},"402":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"get":{"operationId":"listScans","summary":"Kullanıcının son taramalarını listele","description":"Bu hesabın en son 20 web taramasını (id, alan adı, durum, skor) döndürür. Kullanıcı scan_id vermediyse önce bunu çağırın.","x-openai-isConsequential":false,"responses":{"200":{"description":"Tarama listesi","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScanList"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/scans/{id}":{"get":{"operationId":"getScanStatus","summary":"Tarama durumunu sorgula","description":"Taramanın durumunu döndürür (queued, crawling, extracting, analyzing, completed, failed). is_terminal=false ise poll_after_seconds kadar bekleyip tekrar çağırın; true ise getScanReport çağırın.","x-openai-isConsequential":false,"parameters":[{"name":"id","in":"path","required":true,"description":"startWebScan yanıtındaki scan_id.","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Durum","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScanStatus"}}}},"404":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/reports/{id}":{"get":{"operationId":"getScanReport","summary":"Tarama raporunu (skor + bulgular) getir","description":"Tamamlanan taramanın skorunu, kritik/yüksek bulgu sayısını, bulguları (önem, gerekçe, hukuki dayanak, kanıt) ve emsal kararları döndürür.","x-openai-isConsequential":false,"parameters":[{"name":"id","in":"path","required":true,"description":"startWebScan yanıtındaki scan_id.","schema":{"type":"integer","minimum":1}},{"name":"severity","in":"query","required":false,"description":"Yalnız bu önem düzeyi.","schema":{"type":"string","enum":["critical","high","medium","low"]}},{"name":"limit","in":"query","required":false,"description":"En fazla bulgu (varsayılan 50, en çok 200).","schema":{"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Rapor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Report"}}}},"404":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/reports/{id}/pdf":{"get":{"operationId":"getScanReportPdfLink","summary":"PDF ve web rapor bağlantısı al","description":"Rapor PDF'i ve paylaşılabilir web raporu için süreli (imzalı) bağlantılar döndürür. Bağlantıyı kullanıcıya verin; içerik indirmeye çalışmayın.","x-openai-isConsequential":false,"parameters":[{"name":"id","in":"path","required":true,"description":"startWebScan yanıtındaki scan_id.","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Bağlantılar","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportLinks"}}}},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/check-content":{"post":{"operationId":"checkAdContent","summary":"Reklam/içerik metnini hukuka uygunluk açısından kontrol et","description":"Reklam, sosyal medya, e-posta veya sayfa metnini Türk reklam/tüketici/KVKK kurallarına göre denetler; skor, bulgular ve öneriler döner. Krediden düşer.","x-openai-isConsequential":false,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentRequest"}}}},"responses":{"200":{"description":"Analiz","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentResult"}}}},"402":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/fix":{"post":{"operationId":"fixAdContent","summary":"Uyumsuz metnin düzeltilmiş sürümünü üret","description":"Metni hukuka uygun biçimde yeniden yazar (rewritten_text); kritik bulgu varsa requires_review=true döner ve avukat incelemesi önerilir. Krediden düşer.","x-openai-isConsequential":false,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentRequest"}}}},"responses":{"200":{"description":"Düzeltme","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FixResult"}}}},"402":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"503":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/precedents":{"get":{"operationId":"searchPrecedents","summary":"Emsal karar ara (Yargıtay/Danıştay + KVKK Kurul)","description":"Bir konu (query) veya bulgu ailesi (family, ör. cayma_hakki, kvkk_aydinlatma) için gerçek Türk emsal kararlarını ve KVKK Kurul kararlarını getirir.","x-openai-isConsequential":false,"parameters":[{"name":"query","in":"query","required":false,"schema":{"type":"string","maxLength":200},"description":"Serbest arama ifadesi."},{"name":"family","in":"query","required":false,"schema":{"type":"string","maxLength":64},"description":"Rapordaki bulgu ailesi (findings[].family)."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":10}}],"responses":{"200":{"description":"Kararlar","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Precedents"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/health":{"get":{"operationId":"getHealth","summary":"Sağlık kontrolü","description":"Servisin çalıştığını doğrular; kimlik gerektirmez.","security":[],"x-openai-isConsequential":false,"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Panel → API Anahtarları sayfasından alınan anahtar (legk_live_...). Eski istemciler X-KYL-Key başlığını da kullanabilir."}},"responses":{"Error":{"description":"Hata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"ok":{"type":"boolean"},"error":{"type":"string","description":"unauthorized, insufficient_scope, insufficient_credit, quota_exceeded, rate_limited, daily_quota_exceeded, validation_failed, scan_not_found, analysis_unavailable"},"message":{"type":"string"},"retry_after":{"type":"integer"}}},"ScanRequest":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","maxLength":512,"description":"Alan adı veya URL, ör. ornek.com.tr"},"sector":{"type":"string","description":"İsteğe bağlı: ecommerce, health, finance, education... Boşsa otomatik tespit."},"pages":{"type":"integer","minimum":1,"maximum":50,"description":"İstenen sayfa; paket sınırına kırpılır."},"webhook_url":{"type":"string","format":"uri","description":"Bitince POST edilecek herkese açık https adresi (HMAC-SHA256 imzalı, X-Legalitify-Signature)."}}},"ScanStarted":{"type":"object","properties":{"ok":{"type":"boolean"},"scan_id":{"type":"integer"},"status":{"type":"string"},"status_url":{"type":["string","null"]},"poll_after_seconds":{"type":"integer"}}},"ScanStatus":{"type":"object","properties":{"ok":{"type":"boolean"},"scan_id":{"type":"integer"},"domain":{"type":"string"},"status":{"type":"string"},"is_terminal":{"type":"boolean"},"pages_scanned":{"type":"integer"},"pages_requested":{"type":"integer"},"overall_score":{"type":["number","null"]},"poll_after_seconds":{"type":["integer","null"]},"notice":{"type":"string"}}},"ScanList":{"type":"object","properties":{"ok":{"type":"boolean"},"scans":{"type":"array","items":{"type":"object","properties":{"scan_id":{"type":"integer"},"domain":{"type":"string"},"status":{"type":"string"},"overall_score":{"type":["number","null"]},"created_at":{"type":"string"}}}}}},"Finding":{"type":"object","properties":{"title":{"type":"string"},"family":{"type":["string","null"]},"severity":{"type":"string"},"status":{"type":"string"},"needs_review":{"type":"boolean"},"reason":{"type":"string"},"legal_basis":{"type":"array","items":{"type":"string"}},"evidence":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"snippet":{"type":"string"}}}}}},"Report":{"type":"object","properties":{"ok":{"type":"boolean"},"scan_id":{"type":"integer"},"domain":{"type":"string"},"status":{"type":"string"},"is_terminal":{"type":"boolean"},"overall_score":{"type":["number","null"]},"counts":{"type":"object","properties":{"critical":{"type":"integer"},"high":{"type":"integer"},"total":{"type":"integer"}}},"findings":{"type":"array","items":{"$ref":"#/components/schemas/Finding"}},"findings_truncated":{"type":"boolean"},"disclaimer":{"type":"string"}}},"ReportLinks":{"type":"object","properties":{"ok":{"type":"boolean"},"scan_id":{"type":"integer"},"pdf_url":{"type":"string"},"web_report_url":{"type":"string"},"expires_at":{"type":"string"}}},"ContentRequest":{"type":"object","required":["text"],"properties":{"text":{"type":"string","minLength":10,"maxLength":8000,"description":"Denetlenecek metnin tamamı."},"sector":{"type":"string","description":"İsteğe bağlı: general, ecommerce, health, finance, food, cosmetics..."},"jurisdiction":{"type":"string","description":"Varsayılan TR."}}},"ContentResult":{"type":"object","properties":{"ok":{"type":"boolean"},"result":{"type":"object","additionalProperties":true},"meta":{"type":"object","properties":{"credits_charged":{"type":"integer"}}}}},"FixResult":{"type":"object","properties":{"ok":{"type":"boolean"},"rewritten_text":{"type":"string"},"requires_review":{"type":"boolean"},"issues":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"Precedents":{"type":"object","properties":{"ok":{"type":"boolean"},"total":{"type":"integer"},"items":{"type":"array","items":{"type":"object","additionalProperties":true}},"kvkk":{"type":"object","additionalProperties":true}}}}}}