Skip to content

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

ts
new Users(http): Users;

Defined in: src/resources/users.ts:25

Creates a new Users API client.

Parameters

ParameterTypeDescription
httpHttpClientHTTP client for making API requests

Returns

Users

Methods

get()

ts
get(userId): Promise<User>;

Defined in: src/resources/users.ts:43

Retrieves a Roblox user's profile information by user ID.

Parameters

ParameterTypeDescription
userIdstringThe 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

typescript
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()

ts
generateThumbnail(userId, options): Promise<UserThumbnail>;

Defined in: src/resources/users.ts:71

Generates and returns the URL for the user's avatar thumbnail.

Parameters

ParameterTypeDescription
userIdstringThe unique user ID (numeric string)
optionsGenerateThumbnailOptionsOptions 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

typescript
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()

ts
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

ParameterTypeDescription
userIdstringThe unique user ID (numeric string)
optionsListOptions & { 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

typescript
// 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()

ts
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

ParameterTypeDescription
userIdstringThe unique user ID (numeric string)
optionsListOptionsList 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

typescript
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()

ts
createNotification(userId, body): Promise<UserNotificationResponse>;

Defined in: src/resources/users.ts:218

Sends a notification to a user.

Parameters

ParameterTypeDescription
userIdstringThe unique user ID (numeric string)
bodyUserNotificationBodyThe 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

typescript
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