> ## Documentation Index
> Fetch the complete documentation index at: https://hyperbrowser.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a session with X402 payment

> Purchase one browser session at 0.10 USDC per hour, paid upfront for timeoutMinutes (5–60, default 30). No Hyperbrowser account or API key is required. A valid unpaid request returns 402 with payment requirements. Retry with a signed PAYMENT-SIGNATURE authorization. Payment is settled before connection credentials and a managementToken are returned. One authorization can create only one session. Invalid options are rejected before payment verification. See /integrations/x402/sessions for connection examples and lifetime behavior.

Purchase a browser session at \$0.10/hour, paid upfront for `timeoutMinutes` (5–60, default 30), without a Hyperbrowser API key. See the
[X402 session guide](/docs/integrations/x402/sessions) for signing the payment request, connecting
to the returned browser, and session lifetime behavior.


## OpenAPI

````yaml openapi.json POST /x402/session
openapi: 3.0.1
info:
  title: Hyperbrowser API
  version: 1.0.0
servers:
  - url: https://api.hyperbrowser.ai
    description: Production server
security: []
paths:
  /x402/session:
    post:
      summary: Create a session with X402 payment
      description: >-
        Purchase one browser session at 0.10 USDC per hour, paid upfront for
        timeoutMinutes (5–60, default 30). No Hyperbrowser account or API key is
        required. A valid unpaid request returns 402 with payment requirements.
        Retry with a signed PAYMENT-SIGNATURE authorization. Payment is settled
        before connection credentials and a managementToken are returned. One
        authorization can create only one session. Invalid options are rejected
        before payment verification. See /integrations/x402/sessions for
        connection examples and lifetime behavior.
      parameters:
        - name: PAYMENT-SIGNATURE
          in: header
          required: false
          description: >-
            Base64-encoded payment authorization generated by an X402 client
            from the advertised PAYMENT-REQUIRED requirements. Omit on the
            initial request to obtain a quote.
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/X402SessionParams'
            examples:
              defaults:
                summary: Default 30-minute browser session
                value: {}
              customized:
                summary: Five-minute session with browser preferences
                value:
                  screen:
                    width: 1920
                    height: 1080
                  viewOnlyLiveView: true
                  timeoutMinutes: 5
      responses:
        '200':
          description: >-
            Browser created and payment settled. Use the returned connection
            details to control it without further X402 payments.
          headers:
            PAYMENT-RESPONSE:
              description: Base64-encoded JSON with settlement information.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402SessionResponse'
        '400':
          description: >-
            Invalid or unsupported request parameters or malformed payment
            proof. Invalid options are rejected before payment verification or
            reservation of the proof.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: >-
            Payment is missing or invalid, or settlement failed. Connection
            credentials are not returned. On settlement failure, the server
            attempts to stop the browser.
          headers:
            PAYMENT-REQUIRED:
              description: >-
                Base64-encoded JSON with payment requirements, including
                accepted networks, assets, amounts, and recipients. Returned
                with the initial payment challenge.
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
        '409':
          description: >-
            This payment authorization is already reserved or used, including by
            a request still in progress. No additional session is launched.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Session capacity is currently unavailable. A request rejected before
            settlement can be retried with the same unexpired authorization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Session creation or payment processing failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: >-
            The service or payment facilitator is temporarily unavailable. If
            settlement was attempted, the authorization stays reserved; an error
            response alone does not establish that payment was not settled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security: []
components:
  schemas:
    X402SessionParams:
      type: object
      additionalProperties: false
      description: >-
        Optional preferences for a browser session priced at 0.10 USDC per hour,
        paid upfront for timeoutMinutes. Unknown fields are rejected before
        payment verification. Web recording is disabled. Other regular session
        creation options are not supported.
      default: {}
      properties:
        screen:
          type: object
          additionalProperties: false
          description: Browser screen dimensions. An omitted dimension uses its default.
          default:
            width: 1280
            height: 720
          properties:
            width:
              type: number
              minimum: 500
              maximum: 3840
              default: 1280
            height:
              type: number
              minimum: 360
              maximum: 2160
              default: 720
        viewOnlyLiveView:
          type: boolean
          default: false
          description: >-
            Make the live-view link read-only. CDP, WebDriver, and the computer
            action endpoint still allow browser control.
        timeoutMinutes:
          type: integer
          minimum: 5
          maximum: 60
          default: 30
          description: >-
            Maximum session lifetime in minutes, from 5 through 60. Defaults to
            30. Determines the session duration and upfront price at 0.10 USDC
            per hour. Connection token lifetimes and expiresAt follow this
            value.
    X402SessionResponse:
      type: object
      additionalProperties: false
      description: >-
        Connection credentials and a management token for the purchased browser.
        Save this response; get does not reissue connection credentials. These
        tokens cannot authenticate regular account APIs.
      required:
        - id
        - wsEndpoint
        - webdriverEndpoint
        - liveUrl
        - computerActionEndpoint
        - token
        - expiresAt
        - managementToken
      properties:
        id:
          type: string
          format: uuid
          description: Purchased session ID.
        wsEndpoint:
          type: string
          format: uri
          description: >-
            CDP WebSocket URL for Playwright, Puppeteer, or another CDP client.
            Includes its authentication token.
        webdriverEndpoint:
          type: string
          format: uri
          description: >-
            Selenium/WebDriver endpoint. Send token in the x-hyperbrowser-token
            header.
        liveUrl:
          type: string
          format: uri
          description: >-
            Authenticated live-view URL. Interaction is disabled when
            viewOnlyLiveView is true.
        computerActionEndpoint:
          type: string
          format: uri
          description: >-
            Endpoint for mouse, keyboard, and screenshot actions. Includes its
            authentication token.
        token:
          type: string
          description: >-
            Credential scoped to this browser session. Use it for WebDriver
            authentication, not the regular get/list/stop/update/extend session
            APIs.
        expiresAt:
          type: string
          format: date-time
          description: >-
            Returned session expiry timestamp based on timeoutMinutes. The
            browser can stop earlier if closed or disconnected.
        managementToken:
          type: string
          description: >-
            Bearer token for GET /x402/session/{id} and PUT
            /x402/session/{id}/stop only. Valid for 24 hours from purchase,
            including after browser expiry. Does not authenticate browser
            connections or regular account APIs.
    ErrorResponse:
      type: object
      properties:
        message:
          type: string

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.