{"openapi":"3.1.0","info":{"title":"TNY API","version":"1.0.0","description":"Programmatic access to TNY links, analytics, and domains. Authenticate with an API key from your dashboard using `Authorization: Bearer <key>`. Scopes: links:read, links:write, analytics:read, domains:read."},"servers":[{"url":"https://tny.co.in/api/v1"}],"security":[{"bearerAuth":[]}],"paths":{"/links":{"get":{"summary":"List links","description":"Requires the `links:read` scope.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}],"responses":{"200":{"description":"A page of links","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Link"}}}}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Create a link","description":"Requires the `links:write` scope.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLink"}}}},"responses":{"201":{"description":"Created link","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Link"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/links/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get a link","description":"Requires the `links:read` scope.","responses":{"200":{"description":"Link","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Link"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Update a link","description":"Requires the `links:write` scope. Provide any of destination, title, active.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLink"}}}},"responses":{"200":{"description":"Updated link","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Link"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"summary":"Delete a link","description":"Requires the `links:write` scope.","responses":{"204":{"description":"Deleted"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/links/{id}/analytics":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get link analytics","description":"Device/geo/referrer breakdown + 14-day trend. Requires the `analytics:read` scope and a Pro or Team plan.","responses":{"200":{"description":"Analytics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkAnalytics"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/domains":{"get":{"summary":"List branded domains","description":"Requires the `domains:read` scope.","responses":{"200":{"description":"Domains","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Domain"}}}}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key"}},"schemas":{"Link":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"shortUrl":{"type":"string","format":"uri"},"destination":{"type":"string","format":"uri"},"domain":{"type":["string","null"]},"title":{"type":["string","null"]},"isQr":{"type":"boolean"},"clicks":{"type":"integer"},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}}},"CreateLink":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri"},"isQr":{"type":"boolean"},"title":{"type":"string"},"code":{"type":"string","description":"Custom slug (Pro/Team only)."}}},"UpdateLink":{"type":"object","properties":{"destination":{"type":"string","format":"uri"},"title":{"type":"string"},"active":{"type":"boolean"}}},"AnalyticsRow":{"type":"object","properties":{"label":{"type":"string"},"count":{"type":"integer"}}},"LinkAnalytics":{"type":"object","properties":{"total":{"type":"integer"},"last7Days":{"type":"integer"},"devices":{"type":"array","items":{"$ref":"#/components/schemas/AnalyticsRow"}},"countries":{"type":"array","items":{"$ref":"#/components/schemas/AnalyticsRow"}},"referrers":{"type":"array","items":{"$ref":"#/components/schemas/AnalyticsRow"}},"trend":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"count":{"type":"integer"}}}}}},"Domain":{"type":"object","properties":{"id":{"type":"string"},"host":{"type":"string"},"verified":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}}},"Error":{"type":"object","properties":{"error":{"type":"string"}}}}}}