Browserbase

Create a session

Create a session

POST /browserbase/v1/sessions● Supported

Browserbase

Request parameters

  • projectIdstring可选

    The Project ID. Can be found in [Settings](https://www.browserbase.com/settings). Optional - if not provided, the project will be inferred from the API key.

  • extensionIdstring可选○ 未支持

    This configuration is unavailable.

  • browserSettingsobject可选
    ▸ 展开子字段(14)
    • contextobject可选
      ▸ 展开子字段(2)
      • idstring必填

        The Context ID.

      • persistboolean可选

        Whether or not to persist the context after browsing. Defaults to `false`.

    • extensionIdstring可选○ 未支持

      This configuration is unavailable.

    • viewportobject可选
      ▸ 展开子字段(2)
      • widthinteger可选

        The width of the browser.

      • heightinteger可选

        The height of the browser.

    • blockAdsboolean可选◐ 部分支持

      Accepted but ignored; does not enable this capability.

    • solveCaptchasboolean可选◐ 部分支持

      Accepted but ignored; does not enable this capability.

    • recordSessionboolean可选◐ 部分支持

      Accepted but ignored; does not enable this capability.

    • logSessionboolean可选◐ 部分支持

      Accepted but ignored; does not enable this capability.

    • advancedStealthboolean可选○ 未支持

      This configuration is unavailable.

    • verifiedboolean可选○ 未支持

      This configuration is unavailable.

    • captchaImageSelectorstring可选

      Custom selector for captcha image. See [Custom Captcha Solving](/features/stealth-mode#custom-captcha-solving)

    • captchaInputSelectorstring可选

      Custom selector for captcha input. See [Custom Captcha Solving](/features/stealth-mode#custom-captcha-solving)

    • osstring可选○ 未支持

      This configuration is unavailable.

      取值 windowsmaclinuxmobiletablet
    • allowedDomainsarray可选○ 未支持
      默认 []

      This configuration is unavailable.

    • ignoreCertificateErrorsboolean可选○ 未支持

      This configuration is unavailable.

  • timeoutinteger可选

    Duration in seconds after which the session will automatically end. Defaults to the Project's `defaultTimeout`. Minimum 60 seconds, maximum 21600 seconds (6 hours).

  • keepAliveboolean可选

    Set to true to keep the session alive even after disconnections. Available on the Hobby Plan and above.

  • proxiesunion可选◐ 部分支持

    Only omission, false or [{type: 'none'}] is accepted; other proxy configurations return 501.

  • proxySettingsobject可选

    Supplementary proxy settings. Optional.

    ▸ 展开子字段(1)
    • caCertificatesarray可选
      默认 []

      The TLS certificate IDs to trust. Optional.

  • regionstring可选◐ 部分支持
    默认 "us-west-2"

    Accepted but ignored; does not enable this capability.

    取值 us-west-2us-east-1eu-central-1ap-southeast-1
  • userMetadataobject可选

    Arbitrary user metadata to attach to the session. To learn more about user metadata, see [User Metadata](/features/sessions#user-metadata).

Returns

201

Only the capabilities in the service guide are available; some upstream options are unavailable.

Errors contain statusCode, error and message; the native API adds code. The request ID is in X-Request-Id. Errors

Connection guide

Proxies, stealth options, extensions and Selenium are unavailable. region and solveCaptchas are accepted but ignored; region selection and CAPTCHA solving are not provided.

Response

HTTP 201

The request has succeeded and a new resource has been created as a result.

application/json

NameTypeDescription
idstring
createdAtstring
updatedAtstring
projectIdstringThe Project ID linked to the Session.
startedAtstring
endedAtstring
expiresAtstring
statusstring
proxyBytesintegerBytes used via the Proxy
keepAlivebooleanIndicates if the Session was created to be kept alive upon disconnections
contextIdstringOptional. The Context linked to the Session.
regionstringThe region where the Session is running.
userMetadataobjectArbitrary user metadata to attach to the session. To learn more about user metadata, see User Metadata.
connectUrlstringWebSocket URL to connect to the Session.
seleniumRemoteUrlstringHTTP URL to connect to the Session.
signingKeystringSigning key to use when connecting to the Session via HTTP.