Class: Universes
Defined in: src/resources/universes.ts:25
API client for Roblox universe endpoints.
See
https://create.roblox.com/docs/cloud/reference/Universe
Constructors
Constructor
new Universes(http): Universes;Defined in: src/resources/universes.ts:31
Creates a new Universes API client.
Parameters
| Parameter | Type | Description |
|---|---|---|
http | HttpClient | HTTP client for making API requests |
Returns
Universes
Methods
get()
get(universeId): Promise<Universe>;Defined in: src/resources/universes.ts:49
Retrieves a universe's information by universe ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
universeId | string | The unique universe ID (numeric string) |
Returns
Promise<Universe>
Promise resolving to the universe's data
Throws
If API key is invalid
Throws
If the universe is not found or other API error occurs
Example
const universe = await client.universes.get('123456789');
console.log(universe.displayName); // "Roblox"See
https://create.roblox.com/docs/cloud/reference/universe#Cloud_Getuniverse
update()
update(universeId, body): Promise<Universe>;Defined in: src/resources/universes.ts:73
Updates universe by universe ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
universeId | string | The unique universe ID (numeric string) |
body | UniverseBody | The universe data to update |
Returns
Promise<Universe>
Promise resolving to the updated universe's data
Throws
If API key is invalid
Throws
If the universe is not found or other API error occurs
Example
const updatedUniverse = await client.universes.update('123456789', {
voiceChatEnabled: true,
desktopEnabled: true
});
console.log(updatedUniverse.voiceChatEnabled); // trueSee
https://create.roblox.com/docs/cloud/reference/universe#Cloud_UpdateUniverse
listUserRestrictions()
listUserRestrictions(universeId, options): Promise<UserRestrictionPage>;Defined in: src/resources/universes.ts:105
List user restrictions for users that have ever been banned in either a universe or a specific place.
Parameters
| Parameter | Type | Description |
|---|---|---|
universeId | string | The unique universe ID (numeric string) |
options | ListOptions | List options for pagination |
Returns
Promise<UserRestrictionPage>
Promise resolving to a page of user restrictions
Throws
If API key is invalid
Throws
If the universe is not found or other API error occurs
Example
const userRestrictions = await client.universes.listUserRestrictions('123456789');
console.log(userRestrictions);See
getUserRestriction()
getUserRestriction(universeId, userRestrictionId): Promise<UserRestriction>;Defined in: src/resources/universes.ts:142
Get the user restriction.
Requires universe.user-restriction:read scope.
Parameters
| Parameter | Type | Description |
|---|---|---|
universeId | string | The universe ID. (numeric string) |
userRestrictionId | string | The user ID. (numeric string) |
Returns
Promise<UserRestriction>
Promise resolving to the user restriction response
Throws
If API key is invalid
Throws
If an API error occurs
Example
const userRestriction = await client.universes.getUserRestriction('123456789', '123456789');
console.log(userRestriction);See
updateUserRestriction()
updateUserRestriction(
universeId,
userRestrictionId,
body): Promise<UserRestriction>;Defined in: src/resources/universes.ts:179
Update the user restriction.
Requires universe.user-restriction:write scope.
Parameters
| Parameter | Type | Description |
|---|---|---|
universeId | string | The universe ID (numeric string) |
userRestrictionId | string | The user ID (numeric string) |
body | GameJoinRestriction | The user restriction data to update |
Returns
Promise<UserRestriction>
Promise resolving to the user restriction response
Throws
If API key is invalid
Throws
If an API error occurs
Example
const userRestriction = await client.universes.updateUserRestriction('123456789', '123456789', {
active: true,
duration: "3s",
privateReason: "some private reason",
displayReason: "some display reason",
excludeAltAccounts: true
});See
listUserRestrictionLogs()
listUserRestrictionLogs(universeId, options): Promise<UserRestrictionLogPage>;Defined in: src/resources/universes.ts:230
List changes to UserRestriction resources within a given universe. This includes both universe-level and place-level restrictions. For universe-level restriction logs, the place field will be empty.
Requires universe.user-restriction:read scope.
Parameters
| Parameter | Type | Description |
|---|---|---|
universeId | string | The universe ID (numeric string) |
options | ListOptions & { filter?: string; } | List options including pagination and filtering |
Returns
Promise<UserRestrictionLogPage>
Promise resolving to the user restriction response
Throws
If API key is invalid
Throws
If the universeId is invalid or other API error occurs
Example
const userRestrictionLogs = await client.universes.listUserRestrictionLogs('123456789', {
maxPageSize: 50,
filter: `"user == 'users/123'" && "place == 'places/456'"`
});
console.log(userRestrictionLogs);See
https://create.roblox.com/docs/cloud/reference/UserRestriction#Cloud_ListUserRestrictionLogs
generateSpeechAsset()
generateSpeechAsset(universeId, body): Promise<SpeechAssetResponse>;Defined in: src/resources/universes.ts:275
Generates an English speech audio asset from the specified text.
This endpoint requires the asset:read and asset:write scopes in addition to the universe:write scope.
Parameters
| Parameter | Type | Description |
|---|---|---|
universeId | string | The universe ID (numeric string) |
body | SpeechAssetBody | The speech asset generation request body |
Returns
Promise<SpeechAssetResponse>
Promise resolving to the speech asset response
Throws
If API key is invalid
Throws
If the universeId is invalid or other API error occurs
Example
const speechAsset = await client.universes.generateSpeechAsset('123456789', {
text: "Hello, world!",
speechStyle: {
voiceId: "rbx_voice_001",
pitch: 1,
speed: 1
}
});
console.log(speechAsset);See
https://create.roblox.com/docs/cloud/reference/Universe#Cloud_GenerateSpeechAsset
publishMessage()
publishMessage(universeId, body): Promise<void>;Defined in: src/resources/universes.ts:309
Publishes a message to the universe's live servers. Servers can consume messages via MessagingService.
Parameters
| Parameter | Type | Description |
|---|---|---|
universeId | string | The universe ID (numeric string) |
body | PublishMessageBody | The publish message request body |
Returns
Promise<void>
Promise resolving to void
Throws
If API key is invalid
Throws
If the universeId is invalid or other API error occurs
Example
await client.universes.publishMessage('123456789', {
topic: "UpdateAvailable",
message: "New update has been deployed!"
});See
https://create.roblox.com/docs/cloud/reference/Universe#Cloud_PublishUniverseMessage
restartUniverseServers()
restartUniverseServers(universeId): Promise<void>;Defined in: src/resources/universes.ts:338
Restarts all active servers for a specific universe if and only if a new version of the experience has been published. Used for releasing experience updates.
Parameters
| Parameter | Type | Description |
|---|---|---|
universeId | string | The universe ID (numeric string) |
Returns
Promise<void>
Promise resolving to void
Throws
If API key is invalid
Throws
If the universeId is invalid or other API error occurs
Example
await client.universes.restartUniverseServers('123456789');See
https://create.roblox.com/docs/cloud/reference/Universe#Cloud_RestartUniverseServers
translateText()
translateText(universeId, body): Promise<TranslateTextResponse>;Defined in: src/resources/universes.ts:389
Translates the provided text from one language to another.
The language codes are represented as IETF BCP-47 language tags. The currently supported language codes are:
- English (en-us)
- French (fr-fr)
- Vietnamese (vi-vn)
- Thai (th-th)
- Turkish (tr-tr)
- Russian (ru-ru)
- Spanish (es-es)
- Portuguese (pt-br)
- Korean (ko-kr)
- Japanese (ja-jp)
- Chinese Simplified (zh-cn)
- Chinese Traditional (zh-tw)
- German (de-de)
- Polish (pl-pl)
- Italian (it-it)
- Indonesian (id-id).
If a source language code is not provided, the API will attempt to auto-detect the source language.
Parameters
| Parameter | Type | Description |
|---|---|---|
universeId | string | The universe ID (numeric string) |
body | TranslateTextBody | The translate text request body |
Returns
Promise<TranslateTextResponse>
Promise resolving to the text translation response
Throws
If API key is invalid
Throws
If the universeId is invalid or other API error occurs
Example
const translation = await client.universes.translateText('123456789', {
text: "Hello, world!",
sourceLanguageCode: "en-us",
targetLanguageCodes: ["fr-fr", "ja-jp"]
});
console.log(translation);See
https://create.roblox.com/docs/cloud/reference/Universe#Cloud_TranslateText