Skip to content

User

rblxopencloud.User(id, api_key)

Bases: Creator

Represents a user on Roblox. It is used to provide information about a user in OAuth2, fetch information about a user, and access their resources.

Parameters:

Name Type Description Default
id int

The user's ID.

required
api_key str

The API key created on the Creator Dashboard with access to the user.

required

Attributes:

Name Type Description
id int

The user's ID. The openid scope is required for OAuth2 authorization.

username Optional[str]

The user's username, only avalible from OAuth2 with the profile scope.

display_name Optional[str]

The user's display name, only avalible from OAuth2 with the profile scope.

profile_uri str

A URL to the user's profile on Roblox. The openid scope is required for OAuth2 authorization.

headshot_uri Optional[str]

A URI to Roblox's CDN for the user's avatar headshot, only avalible from OAuth2 with the profile scope. Example value: https://tr.rbxcdn.com/0f00ba3ab40808dbbbf3410a5a637d2e/150/150/AvatarHeadshot/Png

created_at Optional[datetime]

The timestamp the user created their account, only avalible from OAuth2 with the profile scope.

upload_asset(file, asset_type, name, description, expected_robux_price=0)

Uploads the file requested file onto roblox as an asset with the provided name and description. The following asset types and file formats are accepted:

Asset Type File Formats
rblxopencloud.AssetType.Decal .png, .jpeg, .bmp, .tga
rblxopencloud.AssetType.Audio .mp3, .ogg
rblxopencloud.AssetType.Model .fbx

The asset:read and asset:write scopes are required for OAuth2 authorization.

Example

You can upload a file stored on your computer like this:

with open('path-to/file.png', 'rb') as file:
    creator.upload_asset(file, AssetType.Decal, "Asset Name", "This is the description")

if not isinstance(asset, Asset):
    while True:
        status = asset.fetch_status()
        if status: 
            asset = status
            break

print(asset)
If the asset is from hosted from a URL on the internet, you could use this:
import requests, io

response = requests.get('https://example.com/file.png')
response.raise_for_status()

file = io.BytesIO(response.content)
file.name = "file.png"

creator.upload_asset(file, AssetType.Decal, "Asset Name", "This is the description")

Parameters:

Name Type Description Default
file BytesIO

The file opened in bytes to be uploaded.

required
asset_type Union[AssetType, str]

The type of asset you're uploading.

required
name str

The name of your asset.

required
description str

The description of your asset.

required
expected_robux_price int

The amount of robux expected to upload. Fails if lower than actual price.

0

Returns:

Type Description
Union[Asset, PendingAsset]

Returns rblxopencloud.Asset if the asset is processed instantly, otherwise it will return rblxopencloud.PendingAsset`.

Raises:

Type Description
InvalidAsset

The file is either an unsupported type, uploaded as the wrong rblxopencloud.AssetType, or has been corrupted.

ModeratedText

The name or description was moderated by Roblox's text filter.

InvalidKey

The API key isn't valid, doesn't have access to upload assets, or is from an invalid IP address.

RateLimited

You've exceeded the rate limits.

ServiceUnavailable

The Roblox servers ran into an error, or are unavailable right now.

rblx_opencloudException

Roblox returned an unexpected error.

Danger

Avoid uploading assets to Roblox that you don't have full control over, such as AI generated assets or content created by unknown people. Assets uploaded that break Roblox's Terms of Services can get your account moderated.

For OAuth2 developers, it has been confirmed by Roblox staff in this DevForum post, that your app will not be punished if a malicious user uses it to upload Terms of Service violating content, and instead the authorizing user's account will be punished.

update_asset(asset_id, file)

Uploads the file requested file onto roblox, replacing the existing asset. The following asset types and file formats can be updated:

Asset Type File Formats
rblxopencloud.AssetType.Model .fbx

The asset:read and asset:write scopes are required for OAuth2 authorization.

Parameters:

Name Type Description Default
asset_id int

The ID of the asset to update.

required
file BytesIO

The file opened in bytes to be replace the old one.

required

Returns:

Type Description
Union[Asset, PendingAsset]

Returns rblxopencloud.Asset if the asset is processed instantly, otherwise it will return rblxopencloud.PendingAsset`.

Raises:

Type Description
InvalidAsset

The file is either an unsupported type, uploaded as the wrong rblxopencloud.AssetType, or has been corrupted.

ModeratedText

The name or description was moderated by Roblox's text filter.

InvalidKey

The API key isn't valid, doesn't have access to upload assets, or is from an invalid IP address.

RateLimited

You've exceeded the rate limits.

ServiceUnavailable

The Roblox servers ran into an error, or are unavailable right now.

rblx_opencloudException

Roblox returned an unexpected error.

Danger

Avoid uploading assets to Roblox that you don't have full control over, such as AI generated assets or content created by unknown people. Assets uploaded that break Roblox's Terms of Services can get your account moderated.

For OAuth2 developers, it has been confirmed by Roblox staff in this DevForum post, that your app will not be punished if a malicious user uses it to upload Terms of Service violating content, and instead the authorizing user's account will be punished.

list_groups(limit=None)

Returns an Iterable of rblxopencloud.GroupMember for every group the user is a member of.

The openid and group:read scopes are required for OAuth2 authorization.

Example

This will print every group the user is a member of, and their role ID in that group.

for member in user.list_groups():
    print(member.group, member.role_id)
If you'd like the keys in a list, you can use the list method:
list(user.list_groups())

Parameters:

Name Type Description Default
limit Optional[int]

Will not return more groups than this number. Set to None for no limit.

None

Returns:

Type Description
Iterable[GroupMember]

An Iterable of group memberships.

Raises:

Type Description
InvalidKey

The API key isn't valid, doesn't have access to list data store keys, or is from an invalid IP address.

NotFound

The user does not exist.

RateLimited

You've exceeded the rate limits.

ServiceUnavailable

The Roblox servers ran into an error, or are unavailable right now.

rblx_opencloudException

Roblox returned an unexpected error.

list_inventory(limit=None, only_collectibles=False, assets=None, badges=False, game_passes=False, private_servers=False)

Returns an Iterable of rblxopencloud.InventoryItem for every item in the user's inventory. If only_collectibles, assets, badges, game_passes, and private_servers are all False/None, then all inventory items are returned.

The openid and user.inventory-item:read scopes are required for OAuth2 authorization.

Example

This will print every item in the user's inventory.

for item in user.list_inventory():
    print(item)
If you'd like the items in a list, you can use the list method:
list(user.list_inventory())

Parameters:

Name Type Description Default
only_collectibles Optional[bool]

Wether the only inventory assets iterated are collectibles (limited items). If True and assets is None, then assets will default to True.

False
assets Optional[Union[list[InventoryAssetType], list[int], bool]]

If this is True, then it will return all assets, if it is a list of IDs, it will only return assets with the provided IDs, and if it is a list of rblxopencloud.InventoryAssetType then it will only return assets of these types.

None
badges Optional[Union[list[int], bool]]

If this is True, then it will return all badges, but if it is a list of IDs, it will only return badges with the provided IDs.

False
game_passes Optional[Union[list[int], bool]]

If this is True, then it will return all game passes, but if it is a list of IDs, it will only return game passes with the provided IDs.

False
private_servers Optional[Union[list[int], bool]]

If this is True, then it will return all private servers, but if it is a list of IDs, it will only return private servers with the provided IDs.

False
limit Optional[int]

Will not return more groups than this number. Set to None for no limit.

None

Returns:

Type Description
Iterable[Union[InventoryAsset, InventoryBadge, InventoryGamePass, InventoryPrivateServer]]

An Iterable of all the items in the user's inventory.

Raises:

Type Description
InvalidKey

The API key isn't valid, doesn't have access to list data store keys, or is from an invalid IP address.

PermissionDenied

The user's inventory is private, and you do not have authorization to access it.

NotFound

The user does not exist.

RateLimited

You've exceeded the rate limits.

ServiceUnavailable

The Roblox servers ran into an error, or are unavailable right now.

rblx_opencloudException

Roblox returned an unexpected error.

Note

If the user's inventory is private, then you need to gain consent from either OAuth2, or by owning the API key. Otherwise, this method will raise rblxopencloud.PermissionDenied!

rblxopencloud.InventoryItem

Represents a base item in a user's inventory. This method is usually not returned, however it bases multiple other classes.

Warning

This class isn't designed to be created by users. It is returned by User.list_inventory().

Attributes:

Name Type Description
id int

The ID of the inventory item.

rblxopencloud.InventoryAsset

Bases: InventoryItem

Represents a basic inventory item, such as avatar items, and development items.

Warning

This class isn't designed to be created by users. It is returned by User.list_inventory().

Attributes:

Name Type Description
id int

The ID of the inventory item.

type InventoryAssetType

The asset's type.

instance_id int

The unique ID of this asset's instance.

collectable_item_id Optional[str]

A unique item UUID for collectables.

collectable_instance_id Optional[str]

A unique instance UUID for collectables.

serial_number Optional[int]

The serial number of the collectable.

collectable_state Optional[InventoryItemState]

Wether the item is ready for sale or in hold.

rblxopencloud.InventoryBadge

Bases: InventoryItem

Represents a badge in a user's inventory.

Warning

This class isn't designed to be created by users. It is returned by User.list_inventory().

Attributes:

Name Type Description
id int

The ID of the badge.

rblxopencloud.InventoryGamePass

Bases: InventoryItem

Represents a game pass in a user's inventory.

Warning

This class isn't designed to be created by users. It is returned by User.list_inventory().

Attributes:

Name Type Description
id int

The ID of the game pass.

rblxopencloud.InventoryPrivateServer

Bases: InventoryItem

Represents a private server in a user's inventory.

Warning

This class isn't designed to be created by users. It is returned by User.list_inventory().

Attributes:

Name Type Description
id int

The ID of the private server item.

rblxopencloud.InventoryItemState

Bases: Enum

Enum representing wether the collectable item is in hold, or if the user can sell it.

Attributes:

Name Type Description
Unknown 1

The current state is unknown.

Available 2

The user could list the collectable for sale if they have premium.

Hold 3

The user recently purchased the collectable and can't be sold yet.

rblxopencloud.InventoryAssetType

Bases: Enum

Enum denoting what type a rblxopencloud.InventoryAsset is.

Attributes:

Name Type Description
Unknown 0

The asset type is unknown.

ClassicTShirt 1
Audio 2
Hat 3
Model 4
ClassicShirt 5
ClassicPants 6
Decal 7
ClassicHead 8
Face 9
Gear 10
Animation 11
Torso 12
RightArm 13
LeftArm 14
LeftLeg 15
RightLeg 16
Package 17
Plugin 18
MeshPart 19
HairAccessory 20
FaceAccessory 21
NeckAccessory 22
ShoulderAccessory 23
FrontAccessory 24
BackAccessory 25
WaistAccessory 26
ClimbAnimation 27
DeathAnimation 28
FallAnimation 29
IdleAnimation 30
JumpAnimation 31
RunAnimation 32
SwimAnimation 33
WalkAnimation 34
PoseAnimation 35
EmoteAnimation 36
Video 37
TShirtAccessory 38
ShirtAccessory 39
PantsAccessory 40
JacketAccessory 41
SweaterAccessory 42
ShortsAccessory 43
LeftShoeAccessory 44
RightShoeAccessory 45
DressSkirtAccessory 46
EyebrowAccessory 47
EyelashAccessory 48
MoodAnimation 49
DynamicHead 50
CreatedPlace 51
PurchasedPlace 52