Real examples

Clean Python examples for common Roblox workflows.

From user lookups and authentication to friends, presence, and local database caching. The library provides a consistent, typed interface across all Roblox API modules.

Example: Fetch user info

from roboat import RoboatClient

client = RoboatClient()

# Fetch user by ID
user = client.users.get_by_id(156)
print(f"{user.username} ({user.display_name})")
print(f"Verified: {user.has_verified_badge}")

# Search users by keyword
results = client.users.search("builderman", limit=10)
for u in results.data:
    print(f"  {u.username}")

Example: Authenticated session

from roboat import RoboatClient

# Authenticate with .ROBLOSECURITY cookie
client = RoboatClient(cookie="your-roblosecurity-token")

# Get authenticated user info
me = client.users.get_authenticated_user()
print(f"Logged in as: {me.username}")

# Check Robux balance
balance = client.economy.get_robux_balance()
print(f"Robux: {balance}")

Example: Friends & presence

from roboat import RoboatClient

client = RoboatClient(cookie="...")

# Get friends list with online status
friends = client.friends.get_friends(user_id=156)
for friend in friends.data:
    print(f"{friend.username} - Online: {friend.is_online}")

# Check user presence (In Game, Online, Offline, In Studio)
presence = client.presence.get_user_presences([156, 1])
for p in presence:
    print(f"User {p.user_id}: {p.user_presence_type}")

Example: Database persistence

from roboat import RoboatClient
from roboat.database import SessionDatabase

# Create or load a local SQLite database
db = SessionDatabase.load_or_create("my_cache")

client = RoboatClient()

# Fetch and cache user data
user = client.users.get_by_id(156)
db.save_user(user)

# Fetch and cache game data
game = client.games.get_by_universe_id(2753915549)
db.save_game(game)

# Key-value storage for any data
db.set("last_sync", "2024-01-15T10:30:00")
print(db.stats())  # {'users': 1, 'games': 1, ...}