API Reference

Client Session

class roblox.RobloxSession(username=None, password=None, proxies=None, check_login=False)

The RobloxSession, often referred to in these docs as the Client, is the interface between the program and Roblox. Everything should be accessed from the RobloxSession, including users, assets, and groups, instead of directly creating those objects.

Parameters:
  • username (str) – Keyword username to login with. This is not required. If no username & password are given, you can use login() after the session is created.
  • password (str) – Keyword password to login with. Same applies as above.
  • proxies (dict) – Keyword argument telling the session what proxy to use. The proxies should contain the schema.
  • check_login (bool) – Keyword argument. If True, the session will be verified every time a function is used that requires login, with logged_in() . Defaults to False

Proxy example:

proxies = {
    'http': 'http://host:port',
    'https': 'https://host:port',
}

roblox.py also natively supports the SOCKS protocol.

proxies = {
‘http’: ‘socks5://host:port’, ‘https’: ‘socks5://host:port’

}

Or, with auth:

proxies = {
    'http': 'socks5://user:pass@host:port',
    'https': 'socks5://user:pass@host:port'
}

In case you use proxies that may go down, you can change the proxy at any time by changing RobloxSession.http.proxies

This class can also be used as a context manager, if you provide username and password on init.

with roblox.RobloxSession(username="iLoveBricks", password="rawrXD123") as rbx:  # create session as rbx
    rbx.post_status("i love bricks!")  # post status

# session is automatically invalidated once the block is complete
username

Optional[str] – Username of logged in user

password

Optional[str] – Password of logged in user

user_id

Optional[int] – ID of logged in user

me

Optional[User] – User object for logged in user

chat

RobloxChatManager – Chat object, allows communication on roblox site

logged_in

If keyword check_login is True, this will check if the client is still logged in. Otherwise, it will just return whether the client has used login()

login(username: str, password: str)

Logs the session into Roblox with given info.

Parameters:
  • username (str) – Username to login with
  • password (str) – Password to login with
Raises:

LoginException – if login failed. Could be for several reasons

Returns:

True if login successful

logout()

Logs out of the signed in account.

Resets username, user_id, and user attributes.

create_account(username, password, birthday, gender)

Creates a new Roblox account with the username and password given.

Parameters:
  • username (str) – Username
  • password (str) – Password
  • birthday (datetime.date or datetime.datetime) – Birthday to sign up with
  • gender (roblox.Gender) – Gender
Returns:

True if successful

verify_session()

Checks if client session is still logged in.

Returns:True if session is logged in.
get_self()

Returns updated class:User for the logged in user.

Returns:User
is_username_taken(username)

Checks if username is taken.

Returns:boolean
get_user(username=None, user_id=None)

Gets user by username or user id.

Keyword Arguments:
 
  • username (str) – Username
  • user_id (str) – User ID
Returns:

User

get_asset(asset_id)

Gets asset object by its asset id

Parameters:asset_id (int) – Asset ID to get asset from.
Returns:Asset
get_group(group_id)

Gets group by its group id (the one in the URL)

Parameters:group_id (int) – Group ID to get group from.
Returns:Group
robux()

Gets amount of ROBUX the client user has.

Returns:int
unread_message_count()

Gets client user’s unread message count.

Returns:int
friend_request_count()

Gets client user’s incoming friend request count.

Returns:int
block(user)

Blocks other user, preventing any direct communication.

Parameters:user (User) – User to block
Returns:True if successful.
unblock(user)

Unlocks other user

Parameters:user (User) – User to unblock
Returns:True if successful.
post_status(status)

Updates user status

Parameters:status (str) – New status to set
Returns:True if successful
set_blurb(blurb)

Sets profile’s blurb/decsription

Parameters:blurb (str) – Blurb to set
Returns:True if successful
set_description(description)

Alias for RobloxSession.set_blurb()

friend_requests()

Generator yielding FriendRequest

Returns:FriendRequest
send_friend_request(user)

Sends friend request to other user.

Parameters:user (User) – User to send to friend request to.
Returns:Friend request that was sent.
Return type:FriendRequest
accept_friend_request(user)

Accepts friend request from user

Parameters:user (User) – User to accept friend request from.
Returns:True if successful
decline_friend_request(user)

Declines friend request from user

Parameters:user (User) – User to decline friend request from.
Returns:True if successful
unfriend(user)

Unfriends user

Parameters:user (User) – User to unfriend
Returns:True if successful
follow_user(user)

Follows other user

Parameters:user (User) – User to follow
Returns:True if successful
unfollow_user(user)

Unfollows user

Parameters:user (User) – User to unfollow
Returns:True if successful
send_private_message(user, subject: str, body: str)

Sends private message

Parameters:
  • user (User) – User to send message to
  • subject (str) – Message subject
  • body (str) – Message body
Returns:

PrivateMessage if successful

private_messages(inbox=0)

Generator yielding private messages in inbox

Parameters:inbox (roblox.MessageInbox) – Inbox tab to get
Returns:PrivateMessage
leave_group(group)

Leaves group.

Parameters:group (Group) – Group to leave
Returns:True if successful
join_group(group)

Joins group.

Parameters:group (Group) – Group to join
Returns:True if successful
get_presences(*users)

Gets UserPresence for each user

Parameters:users (User) – Users to get presences from
Returns:List[UserPresence]
friendship(*args, **kwargs)

Gets Friendship between two users if they are friends. Returns None if the friendship doesn’t exist.

Parameters:
Returns:

Optional[Friendship]

Roblox Objects

Don’t create any instances of these directly. Instead, get them from the RobloxSession object.

User

class roblox.User(client, user_id=None, username=None)

Object representing a ROBLOX user.

Use RobloxSession.get_user() to get a specific user.

username

str – Username

id

int – User ID

absolute_url

str – URL to user’s profile

primary_group

User’s primary group

Returns:Group
membership

Get what membership the user has (or NBC)

Returns:enums.BuildersClubStatus
join_date

datetime for when the user joined Roblox.

Returns:datetime.datetime
place_visits

Place visits across every place by user

Returns:int
forum_post_count

Number of users’s forum posts

Returns:int
groups()

Generator yielding groups the user is in

Returns:Group
friend_count

Number of friends user has

friendships()

Generator yielding user’s friends

Returns:Friendship
can_manage(asset)

Checks if user can manage an asset

Parameters:asset (Asset) – Asset to check
Returns:True if can manage.
has_asset(asset)

Checks if user owns asset

Parameters:asset (Asset) – Asset to check
Returns:True if user has asset
presence

User’s presence (UserPresence)

send_friend_request()

Alias for RobloxSession.send_friend_request()

unfriend()

Removes friendship between User and client

Returns:True if successful
followers()

Generator yielding followers

Returns:User
followings()

Generator yielding users this user is following

Returns:User
follow()

Follows user

Returns:True if successful
unfollow()

Unfollows user

Returns:True if successful
friendship(user)

Gets friendship with other user if it exists. None it doesn’t exist.

Parameters:user (User) – User to check for friendship
Returns:Optional[Friendship]
send_private_message(subject: str, body: str)

Alias for RobloxSession.send_private_message()

block()

Alias for RobloxSession.block()

unblock()

Alias for RobloxSession.unblock()

get_status()

Gets user’s status.

Returns:Optional[str]
get_blurb()

Gets user’s blurb/description

Returns:Optional[str]
get_description()

Alias for User.get_blurb()

inventory(asset_type=<AssetType.Shirt: 11>)

Generator yielding items from user’s inventory.

Parameters:asset_type (enums.AssetType) – Keyword: asset type to get from inventory. Defaults to enums.AssetType.Shirt

Asset

class roblox.Asset(client, asset_id=0)

Roblox Asset object.

Use RobloxSession.get_asset() to get a specific asset.

name

str – Asset name

description

str – Asset description

id

int – Asset ID

product_id

Optional[int] – Product ID

asset_type

roblox.AssetType – Asset type

created

datetime.datetime – When the asset was first created

updated

datetime.datetime – When the asset was last updated

price

Optional[int] – Price of the asset in ROBUX

sales

Optional[int] – Total sales of the asset

is_new

bool – Whether Roblox considers the asset ‘new’

for_sale

bool – Whether asset can be taken/bought

public_domain

bool – If the asset is public domain / publicly viewable

limited

bool – If the asset is limited

limited_unique

bool – If the asset is limited and unique

remaining

Optional[int] – How many are remaining, if the asset is limited

membership_level

roblox.Membership – Minimum Builders Club needed to take the asset

creator

Asset creator

Returns:User or Group
buy()

Takes/buys asset.

Returns:True if successful
remove_from_inventory()

Deletes asset from inventory of client user.

Returns:True if successful
post_comment(content)

Posts comment on asset

Parameters:content (str) – Comment text
Returns:Comment
owned_by(user)

Checks if asset is owned by user.

Parameters:user (User) – User
Returns:True if user owns asset
icon

Asset for icon

Returns:Optional[Asset]
favorites

Favorite count of asset

Returns:int
is_favorited()

Whether asset is favorited by client

Returns:bool
favorite()

Favorites asset if it isn’t favorited already.

Returns:return value of is_favorited() (bool)
unfavorite()

Unfavorites asset if it’s favorited.

Returns:return value of is_favorited() (bool)
recent_average_price()

Gets RAP of asset, if it is a collectible.

Returns:Optional[int]
RAP()

Alias for :meth:recent_average_pice

sales_chart()

Gets SalesChart for asset, if it’s a collectible.

Group

class roblox.Group(client, group_id=0)

Group Object.

Use RobloxSession.get_group() to get a specific group.

name

str – Group name

description

str – Group description

id

int – Group ID (in URL)

roles

List[GroupRoleSet] – List of group’s RoleSets

owner

Group’s owner, if any.

Returns:Optional[User]
emblem

Group emblem asset.

Returns:Asset
role_of(user)

Gets role of User in group. None if the user isn’t in the group.

Parameters:user (User) – User to get role of
Returns:Optional[GroupRoleSet]
my_role

Role of client user in group. None if the user isn’t in the group.

Returns:Optional[GroupRoleSet]
group_funds

Gets group funds, if they are visible to the logged in user. If group funds aren’t visible, returns None

Returns:Optional[int]
member_count

Number of members in group

Returns:int
get_shout()

Group’s current shout (text in yellow box.)

Returns:Optional[GroupShout]
post_shout(shout)

Posts to group shout if logged in user has permission.

Parameters:shout (str) – Shout to post
Returns:Optional[GroupShout]
leave()

Alias for RobloxSession.leave_group()

join()

Alias for RobloxSession.join_group()

Data Classes

Don’t create any instances of these directly. Instead, get them from the RobloxSession or their respective objects

class roblox.SalesChart(client, asset)

Asset sales chart, representing user sales of a collectible.

You can also iterate over this object, and index it. SalesChart[0] will return the first sales point. You can also use

>>> list(chart)
>>> reversed(chart)
>>> dict(chart)
>>> len(chart)
>>> datetime.date in chart

The dict version and list versions’ values are namedtuples representing sales points, with sales_point.date , sales_point.price , and sales_point.volume

The dict’s keys are datetime.date

asset

Asset – Asset the sales chart belongs to

chart_dict

dict – dict version of the sales chart

class roblox.PrivateMessage(client, subject=None, body=None, read=None, message_id=None, recipient=None, sender=None, created=None)

Private message object.

Note: RobloxSession.send_private_message() and User.send_private_message() give message objects with very minimal information.

It is recommended to use RobloxSession.private_messages() to get info about a message.

TODO: Message Replies

subject

str – Message subject

body

str – Message body

created

Optional[datetime.datetime] – When the message was created/sent

read

Optional[bool] – Whether the message is marked as read

id

Optional[int] – Specific Message ID

recipient

Message recipient

Returns:Optional[User]
sender

Message sender

Returns:Optional[User]
archive()

Moves message to archive tab of inbox

Returns:bool (success)
mark_read()

Marks message as read

Returns:bool (success)
mark_unread()

Marks message as unread

Returns:bool (success)
class roblox.UserPresence(client, user=None, **kwargs)

User presence object

user

User – User the presence object is for

user_presence

roblox.UserPresenceType – User’s presence type

absolute_place_url

Optional[str] – URL to place the user is at, if any

place_id

Optional[int] – ID of the place the user is at, if any

location_str

str – String representing the user location. Usually 'Online' or 'Offline'

as_of

datetime.datetime – Datetime of when this presence was updated

class roblox.UserRelationship(client, user0, user1)

User Relationship base class

user0

returnsUser

user1

returnsUser

class roblox.Friendship(client, user0, user1)

Inherits from UserRelationship

Represents a friendship between two users 💕

remove()

Removes friendship if one of the users is the session user

Returns:True if successful
class roblox.FriendRequest(client, user0, user1)

Inherits from UserRelationship

Friend Request object

sender

Friend request sender

Returns:User
recipient

Friend request recipient

Returns:User
accept()

Accepts friend request if the recipient is session user.

Returns:True if successful
decline()

Declines friend request if the recipient is session user.

Returns:True if successful
class roblox.GroupRoleSet(group, **kwargs)

Group RoleSet object.

group

Group – Group the RoleSet belongs to

name

str – Name of the RoleSet

rank

int – Rank of the RoleSet in the group

roleset_id

int – Explicit RoleSet ID. This is used internally by the Roblox site

class roblox.GroupShout(group, content=None, created=None, author=None)

Group Shout object

content

str – Post content

created

Optional[datetime.datetime] – Time the post was made

author

User who made the post.

Returns:Optional[User]
class roblox.Comment(asset, content=None, created=None, author=None)

Asset comment.

asset

Asset – Asset the comment belongs to

content

str – Comment content

created

datetime.datetime – When the comment was posted

author

User who made the post.

Returns:User

Enums

class roblox.UserPresenceType

Site presences that a user can have.

  • Offline = 0
  • Online = 1
  • Playing = 2
class roblox.MessageInbox

Message inbox tabs

  • Inbox = 0
  • Sent = 1
  • News = 2
  • Archive = 3
class roblox.AssetType

Asset type reference

class roblox.Gender

Genders - there’s only two.

  • Male = 2
  • Female = 3
class roblox.ConversationType

Site conversation types

  • User = “OneToOneConversation”
  • Multi = “MultiUserConversation”

Site Chat

roblox.py supports in depth interaction with the Roblox site chat.

class roblox.chat.RobloxChatManager(client)

Class with Roblox Chat functions. Access this via roblox.RobloxSession.chat

enabled(*args, **kwargs)

Gets whether chat is enabled (privacy setting)

Returns:bool
get_conversation(conversation_id)

Gets conversation by id

Parameters:conversation_id (int) – Id
Returns:Conversation
conversations()

Gets list of conversations the user has with others

Returns:list[Conversation, MultiUserConversation]
multi_user_conversations()

Returns all mutli user conversations

Returns:list[MultiUserConversation]
one_to_one_conversations()

Returns all one to one conversations

Returns:list[Conversation]
unread_conversation_count()

Gets number of conversations with unread messages

Returns:int
unread_conversations()

Gets list of conversations with unread messages.

Returns:List[Conversation]
start_conversation(*users)

Starts conversation with user(s). Returns existing conversation if it already exists.

Parameters:users (roblox.User) – User to start conversation with
Returns:Conversation or MultiUserConversation
class roblox.chat.Conversation(client, model)

Conversation object for roblox’s site chat.

Conversations can be indexed and iterated over. You can also test if a user or a message is in a conversation with in

id

str – Conversation Id, used internally

title

str – Conversation title

type

roblox.enums.ConversationType – Type of conversation

last_updated

datetime.datetime – Last time the conversation was updated in any form

participants

Conversation participants

Returns:List[roblox.User]
initiator

User who started the conversation

Returns:roblox.User
recent_messages(limit=10)

Recent messages in a conversation.

Parameters:limit (int) – Number of messages to fetch. Max 150
Returns:List[Message]
send_message(content)

Sends message to conversation

Parameters:content – Message to send.
Returns:Message
unread_messages()

Gets unread messages from conversation

Returns:List[Message]
start_typing()

Shows typing indicator in conversation.

You can also use the context manager to make things simpler. typing()

Returns:status message
stop_typing()

Hides typing indicator in conversation

Returns:status message
typing()

Context manager to make the typing indicator easy to use. It will hide the typing indicator when the block is done.

Example:

with conversation.typing():
    text = this_function_takes_a_long_time()

    conversation.send_message(text)
wait_for_message(timeout=15)

Waits for message and returns the meesage.

Returns:str
mark_as_seen()

Marks messages in conversation as read.

Returns:bool (success)
class roblox.chat.MultiUserConversation(client, model)

Conversation with multiple users, inheriting from Conversation

rename(title)

Renames group conversation

Parameters:title (str) – New title
Returns:Conversation title after change attempt
add_participants(*users)

Adds users to the conversation.

Parameters:users (roblox.User) – Users to add
remove_participant(user)

Removes user from conversation

Parameters:user (roblox.User) – User to remove
Returns:bool (success)
class roblox.chat.Message(conversation, model)

Message on the roblox site chat (different than a PM)

conversation

Conversation – Conversation the message belongs to

id

uuid.UUID – Message’s UUID

read

Optional[bool] – Whether message has been read. Not present for messages returned by Conversation.send_message()

sender

User who sent the message (property)

Returns:User

Utils

roblox.utils.get(iterator, **kwargs)

Finds an object in the given iterator with matching attributes to **kwargs

Keyword Arguments:
 kwargs – Attributes to match
Returns:Object found or None
roblox.utils.robux_parse(st)

Converts Roblox format ROBUX strings to floats.

Example:

>>> robux_parse("93.6k")
93600
>>> robux_parse("21m")
21000000
>>> robux_parse("50")
50
Parameters:st (str) – String to parse
Returns:int