@@ -18,7 +18,7 @@ export class Sessions extends APIResource {
18
18
/**
19
19
* Create a Session
20
20
*/
21
- create ( body : SessionCreateParams , options ?: Core . RequestOptions ) : Core . APIPromise < Session > {
21
+ create ( body : SessionCreateParams , options ?: Core . RequestOptions ) : Core . APIPromise < SessionCreateResponse > {
22
22
return this . _client . post ( '/v1/sessions' , { body, ...options } ) ;
23
23
}
24
24
@@ -93,6 +93,72 @@ export namespace SessionLiveURLs {
93
93
}
94
94
}
95
95
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
+
96
162
export type SessionListResponse = Array < Session > ;
97
163
98
164
export interface SessionCreateParams {
@@ -120,9 +186,12 @@ export interface SessionCreateParams {
120
186
* Proxy configuration. Can be true for default proxy, or an array of proxy
121
187
* configurations.
122
188
*/
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' ;
126
195
127
196
/**
128
197
* Duration in seconds after which the session will automatically end. Defaults to
@@ -180,7 +249,7 @@ export namespace SessionCreateParams {
180
249
/**
181
250
* Whether or not to persist the context after browsing. Defaults to `false`.
182
251
*/
183
- persist : boolean ;
252
+ persist ? : boolean ;
184
253
}
185
254
186
255
/**
@@ -227,75 +296,6 @@ export namespace SessionCreateParams {
227
296
width ?: number ;
228
297
}
229
298
}
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
- }
299
299
}
300
300
301
301
export interface SessionUpdateParams {
@@ -319,6 +319,7 @@ export interface SessionListParams {
319
319
export namespace Sessions {
320
320
export import Session = SessionsAPI . Session ;
321
321
export import SessionLiveURLs = SessionsAPI . SessionLiveURLs ;
322
+ export import SessionCreateResponse = SessionsAPI . SessionCreateResponse ;
322
323
export import SessionListResponse = SessionsAPI . SessionListResponse ;
323
324
export import SessionCreateParams = SessionsAPI . SessionCreateParams ;
324
325
export import SessionUpdateParams = SessionsAPI . SessionUpdateParams ;
0 commit comments