{"openapi":"3.1.0","info":{"title":"Telegram Views API","version":"1.0.0","description":"Reads the view counter of a public Telegram post from Telegram's official embed page. Compact counters such as 1.76K are returned as an approximate integer together with their original display value."},"servers":[{"url":"https://tgviews.devpreview.info"}],"paths":{"/views":{"get":{"summary":"Get a public Telegram post view counter","operationId":"getTelegramPostViews","parameters":[{"name":"url","in":"query","required":true,"description":"A public t.me post URL.","schema":{"type":"string","format":"uri"},"examples":{"direct":{"value":"https://t.me/RoseSA/3977"},"preview":{"value":"https://t.me/s/RoseSA/3977"}}}],"responses":{"200":{"description":"The post counter was read successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ViewResult"}}}},"400":{"description":"The URL is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"The public post is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"Telegram could not be reached or returned an unexpected response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Get a view counter using a JSON request","operationId":"postTelegramPostViews","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"additionalProperties":false,"properties":{"url":{"type":"string","format":"uri","examples":["https://t.me/RoseSA/3977"]}}}}}},"responses":{"200":{"description":"The post counter was read successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ViewResult"}}}},"400":{"description":"The URL is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"The public post is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"Telegram could not be reached or returned an unexpected response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/health":{"get":{"summary":"Health check","operationId":"healthCheck","responses":{"200":{"description":"The API process is running.","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","const":true}}}}}}}}}},"components":{"schemas":{"ViewResult":{"type":"object","required":["ok","url","channel","post_id","views","views_display","approximate","source","fetched_at","cached"],"properties":{"ok":{"type":"boolean","const":true},"url":{"type":"string","format":"uri"},"channel":{"type":"string"},"post_id":{"type":"integer","minimum":1},"views":{"type":"integer","minimum":0,"description":"Parsed numeric value. Approximate when `approximate` is true."},"views_display":{"type":"string","description":"Counter exactly as displayed by Telegram, for example 1.76K."},"approximate":{"type":"boolean","description":"True when Telegram abbreviated the counter with K, M or B."},"source":{"type":"string","const":"telegram_embed"},"fetched_at":{"type":"string","format":"date-time"},"cached":{"type":"boolean"}},"example":{"ok":true,"url":"https://t.me/RoseSA/3977","channel":"RoseSA","post_id":3977,"views":1760,"views_display":"1.76K","approximate":true,"source":"telegram_embed","fetched_at":"2026-07-21T11:55:33.833Z","cached":false}},"ErrorResponse":{"type":"object","required":["ok","error"],"properties":{"ok":{"type":"boolean","const":false},"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}}