Skip to content

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

ts
new Universes(http): Universes;

Defined in: src/resources/universes.ts:31

Creates a new Universes API client.

Parameters

ParameterTypeDescription
httpHttpClientHTTP client for making API requests

Returns

Universes

Methods

get()

ts
get(universeId): Promise<Universe>;

Defined in: src/resources/universes.ts:49

Retrieves a universe's information by universe ID.

Parameters

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

typescript
const universe = await client.universes.get('123456789');
console.log(universe.displayName); // "Roblox"

See

https://create.roblox.com/docs/cloud/reference/universe#Cloud_Getuniverse


update()

ts
update(universeId, body): Promise<Universe>;

Defined in: src/resources/universes.ts:73

Updates universe by universe ID.

Parameters

ParameterTypeDescription
universeIdstringThe unique universe ID (numeric string)
bodyUniverseBodyThe 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

typescript
const updatedUniverse = await client.universes.update('123456789', {
  voiceChatEnabled: true,
  desktopEnabled: true
});
console.log(updatedUniverse.voiceChatEnabled); // true

See

https://create.roblox.com/docs/cloud/reference/universe#Cloud_UpdateUniverse


listUserRestrictions()

ts
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

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

typescript
const userRestrictions = await client.universes.listUserRestrictions('123456789');
console.log(userRestrictions);

See

https://create.roblox.com/docs/cloud/reference/UserRestriction#Cloud_ListUserRestrictions__Using_Universes


getUserRestriction()

ts
getUserRestriction(universeId, userRestrictionId): Promise<UserRestriction>;

Defined in: src/resources/universes.ts:142

Get the user restriction.

Requires universe.user-restriction:read scope.

Parameters

ParameterTypeDescription
universeIdstringThe universe ID. (numeric string)
userRestrictionIdstringThe 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

typescript
const userRestriction = await client.universes.getUserRestriction('123456789', '123456789');
console.log(userRestriction);

See

https://create.roblox.com/docs/cloud/reference/UserRestriction#Cloud_GetUserRestriction__Using_Universes


updateUserRestriction()

ts
updateUserRestriction(
   universeId, 
   userRestrictionId, 
body): Promise<UserRestriction>;

Defined in: src/resources/universes.ts:179

Update the user restriction.

Requires universe.user-restriction:write scope.

Parameters

ParameterTypeDescription
universeIdstringThe universe ID (numeric string)
userRestrictionIdstringThe user ID (numeric string)
bodyGameJoinRestrictionThe 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

typescript
const userRestriction = await client.universes.updateUserRestriction('123456789', '123456789', {
  active: true,
  duration: "3s",
  privateReason: "some private reason",
  displayReason: "some display reason",
  excludeAltAccounts: true
});

See

https://create.roblox.com/docs/cloud/reference/UserRestriction#Cloud_UpdateUserRestriction__Using_Universes_Places


listUserRestrictionLogs()

ts
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

ParameterTypeDescription
universeIdstringThe universe ID (numeric string)
optionsListOptions & { 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

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

ts
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

ParameterTypeDescription
universeIdstringThe universe ID (numeric string)
bodySpeechAssetBodyThe 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

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

ts
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

ParameterTypeDescription
universeIdstringThe universe ID (numeric string)
bodyPublishMessageBodyThe 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

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

ts
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

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

typescript
await client.universes.restartUniverseServers('123456789');

See

https://create.roblox.com/docs/cloud/reference/Universe#Cloud_RestartUniverseServers


translateText()

ts
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

ParameterTypeDescription
universeIdstringThe universe ID (numeric string)
bodyTranslateTextBodyThe 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

typescript
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