Skip to main content

configureServer

Configures RoZod for server/Node.js environments. Sets default cookies and user agents that will be automatically applied to all requests.
function configureServer(config: ServerConfig): void

Parameters

config
ServerConfig
required
The server configuration options.

Examples

import { configureServer } from 'rozod';

configureServer({ 
  cookies: '_|WARNING:-DO-NOT-SHARE-THIS...' 
});
RoZod includes built-in browser user agents that are automatically applied in server environments. You can customize this behavior with the userAgents and userAgentRotation options.

clearServerConfig

Clears the server configuration, removing all cookies, API keys, and user agents.
function clearServerConfig(): void

Example

import { clearServerConfig } from 'rozod';

// Clear all server configuration
clearServerConfig();

getServerConfig

Gets the current server configuration as a read-only copy (excluding internal state).
function getServerConfig(): Readonly<ServerConfig>

Returns

config
Readonly<ServerConfig>
A read-only copy of the current server configuration.

Example

import { configureServer, getServerConfig } from 'rozod';

configureServer({
  cookies: 'my_cookie',
  cloudKey: 'my_api_key',
});

const config = getServerConfig();
console.log(config.cookies); // 'my_cookie'
console.log(config.cloudKey); // 'my_api_key'

Types

PoolRotation

type PoolRotation = 'none' | 'random' | 'round-robin'
Defines how items are selected from a pool (cookies or user agents).

CookieRefreshEvent

type CookieRefreshEvent = {
  /** The old cookie value that was used in the request */
  oldCookie: string;
  /** The new cookie value received from Roblox */
  newCookie: string;
  /** The index in the cookie pool that was updated (0 for single cookie) */
  poolIndex: number;
}
Event data passed to the cookie refresh callback when Roblox rotates a cookie.

CookieRefreshCallback

type CookieRefreshCallback = (event: CookieRefreshEvent) => void | Promise<void>
Callback function invoked when Roblox rotates a .ROBLOSECURITY cookie. Use this to persist the new cookie value to your storage (env vars, database, etc.).

Build docs developers (and LLMs) love