@@ -18,7 +18,7 @@ export class Sessions extends APIResource {
1818 /**
1919 * Create a Session
2020 */
21- create ( body : SessionCreateParams , options ?: Core . RequestOptions ) : Core . APIPromise < Session > {
21+ create ( body : SessionCreateParams , options ?: Core . RequestOptions ) : Core . APIPromise < SessionCreateResponse > {
2222 return this . _client . post ( '/v1/sessions' , { body, ...options } ) ;
2323 }
2424
@@ -93,6 +93,72 @@ export namespace SessionLiveURLs {
9393 }
9494}
9595
96+ export interface SessionCreateResponse {
97+ id : string ;
98+
99+ /**
100+ * WebSocket URL to connect to the Session.
101+ */
102+ connectUrl : string ;
103+
104+ createdAt : string ;
105+
106+ expiresAt : string ;
107+
108+ /**
109+ * Indicates if the Session was created to be kept alive upon disconnections
110+ */
111+ keepAlive : boolean ;
112+
113+ /**
114+ * The Project ID linked to the Session.
115+ */
116+ projectId : string ;
117+
118+ /**
119+ * Bytes used via the [Proxy](/features/stealth-mode#proxies-and-residential-ips)
120+ */
121+ proxyBytes : number ;
122+
123+ /**
124+ * The region where the Session is running.
125+ */
126+ region : 'us-west-2' | 'us-east-1' | 'eu-central-1' | 'ap-southeast-1' ;
127+
128+ /**
129+ * HTTP URL to connect to the Session.
130+ */
131+ seleniumRemoteUrl : string ;
132+
133+ /**
134+ * Signing key to use when connecting to the Session via HTTP.
135+ */
136+ signingKey : string ;
137+
138+ startedAt : string ;
139+
140+ status : 'RUNNING' | 'ERROR' | 'TIMED_OUT' | 'COMPLETED' ;
141+
142+ updatedAt : string ;
143+
144+ /**
145+ * CPU used by the Session
146+ */
147+ avgCpuUsage ?: number ;
148+
149+ /**
150+ * Optional. The Context linked to the Session.
151+ */
152+ contextId ?: string ;
153+
154+ endedAt ?: string ;
155+
156+ /**
157+ * Memory used by the Session
158+ */
159+ memoryUsage ?: number ;
160+ }
161+
96162export type SessionListResponse = Array < Session > ;
97163
98164export interface SessionCreateParams {
@@ -120,9 +186,12 @@ export interface SessionCreateParams {
120186 * Proxy configuration. Can be true for default proxy, or an array of proxy
121187 * configurations.
122188 */
123- proxies ?:
124- | boolean
125- | Array < SessionCreateParams . BrowserbaseProxyConfig | SessionCreateParams . ExternalProxyConfig > ;
189+ proxies ?: unknown ;
190+
191+ /**
192+ * The region where the Session should run.
193+ */
194+ region ?: 'us-west-2' | 'us-east-1' | 'eu-central-1' | 'ap-southeast-1' ;
126195
127196 /**
128197 * Duration in seconds after which the session will automatically end. Defaults to
@@ -180,7 +249,7 @@ export namespace SessionCreateParams {
180249 /**
181250 * Whether or not to persist the context after browsing. Defaults to `false`.
182251 */
183- persist : boolean ;
252+ persist ? : boolean ;
184253 }
185254
186255 /**
@@ -227,75 +296,6 @@ export namespace SessionCreateParams {
227296 width ?: number ;
228297 }
229298 }
230-
231- export interface BrowserbaseProxyConfig {
232- /**
233- * Type of proxy. Always use 'browserbase' for the Browserbase managed proxy
234- * network.
235- */
236- type : 'browserbase' ;
237-
238- /**
239- * Domain pattern for which this proxy should be used. If omitted, defaults to all
240- * domains. Optional.
241- */
242- domainPattern ?: string ;
243-
244- /**
245- * Configuration for geolocation
246- */
247- geolocation ?: BrowserbaseProxyConfig . Geolocation ;
248- }
249-
250- export namespace BrowserbaseProxyConfig {
251- /**
252- * Configuration for geolocation
253- */
254- export interface Geolocation {
255- /**
256- * Country code in ISO 3166-1 alpha-2 format
257- */
258- country : string ;
259-
260- /**
261- * Name of the city. Use spaces for multi-word city names. Optional.
262- */
263- city ?: string ;
264-
265- /**
266- * US state code (2 characters). Must also specify US as the country. Optional.
267- */
268- state ?: string ;
269- }
270- }
271-
272- export interface ExternalProxyConfig {
273- /**
274- * Server URL for external proxy. Required.
275- */
276- server : string ;
277-
278- /**
279- * Type of proxy. Always 'external' for this config.
280- */
281- type : 'external' ;
282-
283- /**
284- * Domain pattern for which this proxy should be used. If omitted, defaults to all
285- * domains. Optional.
286- */
287- domainPattern ?: string ;
288-
289- /**
290- * Password for external proxy authentication. Optional.
291- */
292- password ?: string ;
293-
294- /**
295- * Username for external proxy authentication. Optional.
296- */
297- username ?: string ;
298- }
299299}
300300
301301export interface SessionUpdateParams {
@@ -319,6 +319,7 @@ export interface SessionListParams {
319319export namespace Sessions {
320320 export import Session = SessionsAPI . Session ;
321321 export import SessionLiveURLs = SessionsAPI . SessionLiveURLs ;
322+ export import SessionCreateResponse = SessionsAPI . SessionCreateResponse ;
322323 export import SessionListResponse = SessionsAPI . SessionListResponse ;
323324 export import SessionCreateParams = SessionsAPI . SessionCreateParams ;
324325 export import SessionUpdateParams = SessionsAPI . SessionUpdateParams ;
0 commit comments