Skip to content
Start free trial

Node.js SDK reference

import { Rayobrowse } from 'rayobrowse';
const client = new Rayobrowse({ apiKey: 'rb_live_YOUR_KEY' });
PropertyTypeDescription
endpointstringOptional. Gateway base URL. Left out, the client uses DEFAULT_ENDPOINT
apiKeystringYour rb_live_ key

DEFAULT_ENDPOINT is exported from the package and is https://browser.rayobyte.com.

Creates a browser and resolves to its CDP WebSocket URL.

OptionTypeDescription
proxystringRequired by the gateway, though the type marks it optional. scheme://user:pass@host:port
osstringwindows, android, linux, macos. Defaults to windows
headlessbooleanRun without a window
vncbooleanRequest a live-view URL
maxLifetimenumberSeconds. Omitted means 7200, clamped into 120 to 86400
browserLanguagestringAccept-Language value
uiLanguagestringUI locale
browserVersionMinnumberLowest Chromium major version the profile may claim. Defaults to the running version
browserVersionMaxnumberHighest Chromium major version the profile may claim. Defaults to the running version
screenWidthMinnumberLowest screen width
screenHeightMinnumberLowest screen height
forceVisibilitybooleanKeep a background tab reporting itself visible and focused
metadataobjectStored on the session, JSON-stringified on the way out

The CDP URL of a running session. Creates nothing. Pass the sessionId value, not the br_ id inside a CDP URL, which returns 404.

Closes a session, defaulting to the most recent one. Either id works: the sessionId value or the br_ id at the end of the CDP URL. Throws RayobrowseError when there is no id to use.

Your running sessions. Each carries browserId, cdpUrl, status, createdAt and expiresAt.

The gateway’s health response.

await client.getSessionCount(); // { limit: 5, remaining: 4, active: 1 }

Your concurrent browser limit, the browsers running now, and the slots free. remaining is limit - active and never goes below 0. The numbers come from GET /user/api/limits, which does not count against the per-minute launch limit, so polling it is free.

PropertyTypeDescription
sessionIdstring | nullbr_ id from the last connectUrl()
vncUrlstring | nullLive-view URL, set only when vnc: true was passed and the browser came up with one
interface ConnectOptions {
proxy?: string;
os?: string;
headless?: boolean;
vnc?: boolean;
maxLifetime?: number;
browserLanguage?: string;
uiLanguage?: string;
browserVersionMin?: number;
browserVersionMax?: number;
screenWidthMin?: number;
screenHeightMin?: number;
forceVisibility?: boolean;
metadata?: Record<string, unknown>;
}
interface SessionCount {
limit: number;
remaining: number;
active: number;
}
interface HealthStatus {
status: string;
uptime: number;
}
ErrorStatusProperties
RayobrowseErroranystatusCode, body
AuthError401statusCode. No body; the gateway’s message is on message
ConcurrencyLimitError429limit, active, retryAfter. No body
RateLimitError429retryAfter. No body
BrowserCreateErrorany otherstatusCode, body

Each 429 class names the limit that was hit: ConcurrencyLimitError when your browsers are all running, RateLimitError when more than 60 launches went out in the last minute. retryAfter comes from the retry-after header, is a whole number of seconds and is never negative. It is 5 for a full account and 60 for the rate limit. See Limits.

The Python SDK has no AuthError. It raises BrowserCreateError with status_code 401 for a rejected key, so code ported between the two has to change here.

A missing or malformed proxy throws BrowserCreateError with statusCode 400, and a proxy the browser cannot get through throws it with statusCode 422. body is the plain-text message from /connect, a string, so there is no body.code to read. Match on the status. Neither is worth retrying.

Was this page helpful?