{"openapi":"3.1.0","info":{"title":"clickly API","version":"1.0.0","description":"Kısa bağlantı oluşturma, yönetme, QR kodu ve tıklama istatistikleri. Her istek bir çalışma alanına bağlı API anahtarıyla yapılır: `Authorization: Bearer ck_live_...`."},"servers":[{"url":"https://api.clickly.tr/v1"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Bağlantılar"},{"name":"İstatistik"},{"name":"QR"},{"name":"Hesap"}],"paths":{"/links":{"get":{"tags":["Bağlantılar"],"operationId":"listLinks","summary":"Bağlantıları listele","description":"En yeniden eskiye. Sonraki sayfa için `starting_after` olarak `next_cursor` değerini gönder. Yetki: links:read","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"starting_after","in":"query","schema":{"type":"string","example":"lnk_8xKq2mPa9Lr4Tb7Z"}}],"responses":{"200":{"description":"Liste","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkList"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}}},"post":{"tags":["Bağlantılar"],"operationId":"createLink","summary":"Bağlantı oluştur","description":"Yetki: links:write. Ağ hatasında güvenle tekrar denemek için `Idempotency-Key` başlığı gönder.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkCreate"}}}},"responses":{"201":{"description":"Oluşturuldu","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Link"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"409":{"$ref":"#/components/responses/E409"},"422":{"$ref":"#/components/responses/E422"},"429":{"$ref":"#/components/responses/E429"}}}},"/links/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Bağlantı kimliği (lnk_…) ya da kısa ad (ör. kampanya)","schema":{"type":"string"}}],"get":{"tags":["Bağlantılar"],"operationId":"getLink","summary":"Bağlantıyı getir","responses":{"200":{"description":"Bağlantı","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Link"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}},"patch":{"tags":["Bağlantılar"],"operationId":"updateLink","summary":"Bağlantıyı güncelle","description":"Hedef adresi ya da son kullanma tarihini değiştirir. Kısa ad değiştirilemez. Yetki: links:write","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkUpdate"}}}},"responses":{"200":{"description":"Güncellendi","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Link"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}},"delete":{"tags":["Bağlantılar"],"operationId":"deleteLink","summary":"Bağlantıyı sil","description":"Bağlantı ve tıklama geçmişi kalıcı olarak silinir. Yetki: links:write","responses":{"200":{"description":"Silindi","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}},"/links/{id}/stats":{"parameters":[{"name":"id","in":"path","required":true,"description":"Bağlantı kimliği (lnk_…) ya da kısa ad (ör. kampanya)","schema":{"type":"string"}}],"get":{"tags":["İstatistik"],"operationId":"getLinkStats","summary":"Tıklama istatistikleri","description":"Tarihler Türkiye saatine göredir; varsayılan aralık son 30 gün. Yetki: stats:read","parameters":[{"name":"from","in":"query","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","schema":{"type":"string","format":"date"}},{"name":"group_by","in":"query","schema":{"type":"string","enum":["day","device","os","browser","referrer","country","city","isp","language"],"default":"day","description":"country: ISO 3166 iki harf (bilinmeyen: unknown); city, isp, language: Pro ve üstü (city satırlarında country de döner). Önizlemeler (WhatsApp, Telegram, botlar) sayılmaz."}}],"responses":{"200":{"description":"İstatistik","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Stats"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}},"/qr/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"Bağlantı kimliği (lnk_…) ya da kısa ad (ör. kampanya)","schema":{"type":"string"}}],"get":{"tags":["QR"],"operationId":"getQr","summary":"QR kodu görseli","description":"Yetki: links:read","parameters":[{"name":"format","in":"query","schema":{"type":"string","enum":["png","svg"],"default":"png"}},{"name":"size","in":"query","schema":{"type":"integer","minimum":128,"maximum":4096,"default":1024}},{"name":"fg","in":"query","schema":{"type":"string","example":"16181d"}},{"name":"bg","in":"query","schema":{"type":"string","example":"ffffff","description":"Onaltılık renk ya da transparent"}},{"name":"ecc","in":"query","schema":{"type":"string","enum":["L","M","Q","H"],"default":"M"}}],"responses":{"200":{"description":"Görsel","content":{"image/png":{"schema":{"type":"string","format":"binary"}},"image/svg+xml":{"schema":{"type":"string"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}},"/domains":{"get":{"tags":["Hesap"],"operationId":"listDomains","summary":"Alan adlarını listele","description":"Yetki: domains:read","responses":{"200":{"description":"Liste","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainList"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}}}},"/workspace":{"get":{"tags":["Hesap"],"operationId":"getWorkspace","summary":"Çalışma alanı, plan ve kullanım","responses":{"200":{"description":"Çalışma alanı","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"401":{"$ref":"#/components/responses/E401"},"429":{"$ref":"#/components/responses/E429"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API anahtarı (ck_live_…). Yetkiler: links:read, links:write, stats:read, domains:read"}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"description":"Aynı anahtarla 24 saat içinde tekrarlanan istek, ilk yanıtı döndürür (yeni bağlantı oluşturmaz).","schema":{"type":"string","maxLength":255}}},"schemas":{"Link":{"type":"object","required":["id","object","alias","short_url","url","clicks","qr_url","created_at"],"properties":{"id":{"type":"string","example":"lnk_8xKq2mPa9Lr4Tb7Z"},"object":{"type":"string","const":"link"},"alias":{"type":"string","example":"kampanya"},"short_url":{"type":"string","format":"uri","example":"https://clickly.tr/kampanya"},"url":{"type":"string","format":"uri"},"domain":{"type":["string","null"],"example":"git.markam.com"},"clicks":{"type":"integer"},"qr_url":{"type":"string","format":"uri"},"expires_at":{"type":["string","null"],"format":"date-time"},"last_clicked_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"LinkCreate":{"type":"object","required":["url"],"properties":{"url":{"type":"string","description":"Hedef adres (http/https)","example":"https://markam.com/kampanya?utm_source=api"},"alias":{"type":"string","pattern":"^[A-Za-z0-9_-]{3,32}$","description":"Özel kısa ad; verilmezse rastgele üretilir"},"domain":{"type":"string","description":"Doğrulanmış özel alan adın (ör. git.markam.com)"},"expires_at":{"type":"string","format":"date-time","description":"Bu zamandan sonra bağlantı çalışmaz (Pro ve üstü; Free planda 403 plan_required)"}}},"LinkUpdate":{"type":"object","description":"Pro ve üstü planlarda; Free planda 403 plan_required","properties":{"url":{"type":"string"},"expires_at":{"type":["string","null"],"format":"date-time","description":"null: süresiz"}}},"LinkList":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Link"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}},"Deleted":{"type":"object","properties":{"id":{"type":"string"},"object":{"type":"string","const":"link"},"deleted":{"type":"boolean","const":true}}},"Stats":{"type":"object","properties":{"object":{"type":"string","const":"stats"},"link":{"type":"string"},"alias":{"type":"string"},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"timezone":{"type":"string","example":"Europe/Istanbul"},"group_by":{"type":"string","enum":["day","device","os","browser","referrer","country","city","isp","language"]},"total_clicks":{"type":"integer"},"unique_visitors":{"type":"integer"},"data":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"clicks":{"type":"integer"}}}}}},"DomainList":{"type":"object","properties":{"object":{"type":"string","const":"list"},"data":{"type":"array","items":{"type":"object","properties":{"object":{"type":"string","const":"domain"},"hostname":{"type":"string"},"status":{"type":"string","enum":["pending","verified"]},"links":{"type":"integer"},"verified_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}}},"has_more":{"type":"boolean"}}},"Workspace":{"type":"object","properties":{"object":{"type":"string","const":"workspace"},"name":{"type":"string"},"plan":{"type":"string","enum":["free","pro","business"]},"links":{"type":"integer"},"api":{"type":"object","properties":{"scopes":{"type":"array","items":{"type":"string"}},"rate_limit_per_minute":{"type":"integer"},"monthly_quota":{"type":"integer"},"used_this_month":{"type":"integer"}}}}},"Error":{"type":"object","properties":{"error":{"type":"object","required":["type","code","message"],"properties":{"type":{"type":"string","enum":["invalid_request_error","authentication_error","permission_error","rate_limit_error","api_error"]},"code":{"type":"string","example":"alias_taken"},"message":{"type":"string"},"param":{"type":"string"}}},"request_id":{"type":"string"}}}},"responses":{"E400":{"description":"Geçersiz istek","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E401":{"description":"Anahtar eksik ya da geçersiz","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E403":{"description":"Anahtarın bu işlem için yetkisi yok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E404":{"description":"Bulunamadı","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E409":{"description":"Kısa ad kullanımda","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E422":{"description":"Idempotency-Key başka bir istekle kullanılmış","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E429":{"description":"Hız sınırı ya da aylık kota aşıldı (Retry-After başlığına bak)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}