How can I check if an offline user has Premium Membership?

Hello, this is the third topic I made so if there is something wrong you can tell me.

I want to know how to see if a user that is not in-game has Premium Membership.
I’ve done a lot of research and I found this API: PremiumFeatures Api
I tried it with the proxy but it responds with Code 401 (Unauthorized) even though I was logged in, but when I tried the original from the browser it worked.
I looked through other topics like this and I found the same API.
I want to achieve this because I’m working on a model that will create a GUI that shows the info of any player that is put on a TextBox.

This is the code I used:

local HttpService = game:GetService("HttpService") 

print(HttpService:GetAsync("")) -- Check if ROBLOX has Premium Membership.

How can I fix this error? Are there any other ways to check if an offline user has Premium Membership?

Any help will be appreciated.

The proxy version doesn’t work for me from the browser.

I think ROBLOX just doesn’t allow you to use a proxy for this one API. I couldn’t find a good reason why it failed for this specific API.

Roblox doesn’t allow you to send http requests to their own servers from Roblox’s Http Service. You need to setup an external server, send request to that server, which will send request to Roblox.

That’s why I used the proxy, which works for most APIs but not with this one.

The reason this one doesn’t work with a proxy is due to the fact that it requires a login cookie. You cannot make requests to this endpoint without being logged in.

You will have to either make your own proxy which is authenticated with a disposable account, or scrape the profile HTML to check for the Premium icon of the user.

Although it’s not a solution, for older user accounts that were previously BC, you can always check if they own any of the BC hard hats.

1 Like

And how can I check for the Premium icon from the profile?
I tried searching that too before but with no success.

Nice… I completely missed that. I am over here reading through rprxy’s source code to see who’s at fault. Ridiculous that ROBLOX doesn’t document ANYTHING PROPERLY. How could they leave out that you need the proper cookies/authentication for the endpoint? Or am I the idiot here?

EDIT I am just going to blame ROBLOX here they could’ve at least added cookies to the cURL example they show.

If you right click on the Premium icon on someone’s profile, you can generally use an Inspect Element option to identify the HTML. You can use things like the class name of the icon to reference it. It’s likely that this icon doesn’t exist on non-Premium profiles.

@hamsterloverboy3 not your fault at all. Roblox APIs are generally lacking in documentation, but then I would assume the APIs are there for their own developers to use more than us. If Roblox were keen on us to create bots, automate and pull data, they’d document it all properly (or even create an official framework for it).

So I have to use things like string.find() or string.match() on the HTML?

1 Like

For a really crude attempt you could create your own service to scrape to look for an element with classes icon-premium-medium or icon-premium-small

This works when logged out without cookies, but obviously is a bit slower and clunkier and requires you to either make your own scraper to do it on your own web server, or in Lua if you want to continue using the proxy.

Edit: Didn’t see that someone had suggested similar in the last reply.

If you want to do it in Lua and still use the proxy then yes, exactly that.

1 Like

I tried this code:

local HttpService = game:GetService("HttpService")

print(string.find(string.lower(HttpService:GetAsync("")), "icon-premium"))

ROBLOX has Premium Membership but this printed nil.

You have to escape the hyphen due to its special (or “magic”) meaning in string patterns. Check out the documentation for string.find and string.match if you’re unsure how they work.

Try the following:

local HttpService = game:GetService("HttpService")

print(string.find(string.lower(HttpService:GetAsync("")), "icon%-premium"))
-- Note % is used to escape special characters that have extra meaning in string patterns

Thank you, now it’s working!
I’m not very experienced with string formatting, I will look for some information about it.
Thanks also to the others who replied (@hamsterloverboy3, @csqrl, @StrategicPlayZ).