Class: Users
Defined in: src/resources/users.ts:19
API client for Roblox Users endpoints. Provides methods to retrieve user information, inventory, and asset quotas.
See
https://create.roblox.com/docs/cloud/reference/User
Constructors
Constructor
new Users(http): Users;Defined in: src/resources/users.ts:25
Creates a new Users API client.
Parameters
| Parameter | Type | Description |
|---|---|---|
http | HttpClient | HTTP client for making API requests |
Returns
Users
Methods
get()
get(userId): Promise<User>;Defined in: src/resources/users.ts:43
Retrieves a Roblox user's profile information by user ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
userId | string | The unique user ID (numeric string) |
Returns
Promise<User>
Promise resolving to the user's profile data
Throws
If API key is invalid
Throws
If the user is not found or other API error occurs
Example
const user = await client.users.get('123456789');
console.log(user.displayName); // "John Doe"See
https://create.roblox.com/docs/cloud/reference/User#Cloud_GetUser
generateThumbnail()
generateThumbnail(userId, options): Promise<UserThumbnail>;Defined in: src/resources/users.ts:71
Generates and returns the URL for the user's avatar thumbnail.
Parameters
| Parameter | Type | Description |
|---|---|---|
userId | string | The unique user ID (numeric string) |
options | GenerateThumbnailOptions | Options for thumbnail generation |
Returns
Promise<UserThumbnail>
Promise resolving to the user's thumbnail data
Throws
If API key is invalid
Throws
If the user is not found or other API error occurs
Example
const thumbnail = await client.users.generateThumbnail('123456789', {
size: 100,
format: 'PNG',
shape: 'ROUND'
});
console.log(thumbnail.response.imageUri);See
https://create.roblox.com/docs/cloud/reference/User#Cloud_GenerateUserThumbnail
listInventoryItems()
listInventoryItems(userId, options): Promise<InventoryItemsPage>;Defined in: src/resources/users.ts:122
Lists items in a user's Roblox inventory with optional filtering. Supports pagination for large inventories.
Parameters
| Parameter | Type | Description |
|---|---|---|
userId | string | The unique user ID (numeric string) |
options | ListOptions & { filter?: string; } | List options including pagination and filtering |
Returns
Promise<InventoryItemsPage>
Promise resolving to a page of inventory items
Throws
If API key is invalid
Throws
If the user is not found or other API error occurs
Example
// Get first page of inventory
const page1 = await client.users.listInventoryItems('123456789', {
maxPageSize: 50
});
// Get next page
const page2 = await client.users.listInventoryItems('123456789', {
pageToken: page1.nextPageToken
});
// Filter for specific asset types
const hats = await client.users.listInventoryItems('123456789', {
filter: "inventoryItemAssetTypes=HAT,CLASSIC_PANTS,TSHIRT_ACCESSORY"
});See
https://create.roblox.com/docs/cloud/reference/InventoryItem#Cloud_ListInventoryItems
listAssetQuotas()
listAssetQuotas(userId, options): Promise<AssetQuotasPage>;Defined in: src/resources/users.ts:165
Lists asset upload and distribution quotas for a user. Quotas track rate limits for operations like uploading assets.
Parameters
| Parameter | Type | Description |
|---|---|---|
userId | string | The unique user ID (numeric string) |
options | ListOptions | List options for pagination |
Returns
Promise<AssetQuotasPage>
Promise resolving to a page of asset quotas
Throws
If API key is invalid
Throws
If the user is not found or other API error occurs
Example
const quotas = await client.users.listAssetQuotas('123456789');
for (const quota of quotas.assetQuotas) {
console.log(`${quota.assetType}: ${quota.usage} used`);
console.log(`Resets at: ${quota.usageResetTime}`);
}See
https://create.roblox.com/docs/cloud/reference/AssetQuota#Cloud_ListAssetQuotas
createNotification()
createNotification(userId, body): Promise<UserNotificationResponse>;Defined in: src/resources/users.ts:218
Sends a notification to a user.
Parameters
| Parameter | Type | Description |
|---|---|---|
userId | string | The unique user ID (numeric string) |
body | UserNotificationBody | The notification body containing source and payload |
Returns
Promise<UserNotificationResponse>
Promise resolving to the notification response
Throws
If API key is invalid
Throws
If the user is not found or other API error occurs
Example
const notification = await client.users.createNotification('123456789', {
source: {
universe: 'universes/96623001'
},
payload: {
type: "TYPE_UNSPECIFIED",
messageId: "5dd7024b-68e3-ac4d-8232-4217f86ca244",
parameters: {
key: {
stringValue: "bronze egg"
}
},
joinExperience: {
launchData: "Launch Data"
},
analyticsData: {
category: "Bronze egg hatched"
}
}
});See
https://create.roblox.com/docs/cloud/reference/UserNotification#Cloud_CreateUserNotification