You can use the version check that’s in the Discourse code.
https://api.discourse.org/api/version_check?installed_version=X
where X is a known version on the branch that you want to get information about.
If you just want to get the latest 5 beta version numbers, simply use an old version like
https://api.discourse.org/api/version_check?installed_version=3.1.0.beta1
If you want the latest stable, omit the installed_version parameter
https://api.discourse.org/api/version_check
Alternatively, retrieve https://github.com/discourse/discourse/blob/main/lib/version.rb and look for the STRING = line.
STRING = "3.6.0.beta3-latest"
(For beta use https://github.com/discourse/discourse/blob/beta/lib/version.rb, for stable use https://github.com/discourse/discourse/blob/stable/lib/version.rb)
