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

# Open the desktop of a sandbox

> Gives a URL that shows the desktop of a running sandbox in a browser, at 1080p and 60 frames each second. The URL contains a token. It stops working 10 minutes after the create if nobody opens it. A browser that opens it keeps the desktop for 12 hours, while the sandbox runs. Needs the `sandboxes:desktop` scope.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/sandboxes/{id}/desktop-sessions
openapi: 3.1.0
info:
  title: VMS API
  version: 1.0.0
  description: >-
    The public API of a VMS workspace. Each request needs an API key of the
    workspace in the Authorization header.
servers:
  - url: https://vms.dev/api
    description: The VMS API
security:
  - apiKey: []
paths:
  /v1/sandboxes/{id}/desktop-sessions:
    post:
      tags:
        - Sandboxes
      summary: Open the desktop of a sandbox
      description: >-
        Gives a URL that shows the desktop of a running sandbox in a browser, at
        1080p and 60 frames each second. The URL contains a token. It stops
        working 10 minutes after the create if nobody opens it. A browser that
        opens it keeps the desktop for 12 hours, while the sandbox runs. Needs
        the `sandboxes:desktop` scope.
      operationId: createDesktopSession
      parameters:
        - in: path
          name: id
          schema:
            type: string
            example: sbx_06d8k3m7q2v9x4b1n5c0e8f2ja
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDesktopSessionBody'
      responses:
        '201':
          description: The desktop session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DesktopSession'
        '400':
          description: The body is not valid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: The API key is missing, not correct, revoked, or expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: The API key does not have the scope of the endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: The workspace has no sandbox with this ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The sandbox is not running (`sandbox_not_running`), is starting
            (`sandbox_starting`), or is stopping (`sandbox_stopping`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: The API key sent more than 1,200 requests in one minute.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreateDesktopSessionBody:
      type: object
      properties:
        mode:
          type: string
          enum:
            - desktop
            - browser
          description: >-
            What the session shows. `desktop` shows the full desktop. `browser`
            shows only the Chrome window.
          example: desktop
    DesktopSession:
      type: object
      properties:
        id:
          type: string
          example: dsk_06d8k3m7q2v9x4b1n5c0e8f2jc
        sandboxId:
          type: string
          example: sbx_06d8k3m7q2v9x4b1n5c0e8f2ja
        mode:
          type: string
          enum:
            - desktop
            - browser
          description: >-
            What the session shows. `desktop` shows the full desktop. `browser`
            shows only the Chrome window.
          example: desktop
        url:
          type: string
          format: uri
          description: >-
            Open this URL in a browser to see the desktop. It contains a token.
            Do not share it.
          example: >-
            https://agent-42-desktop-k3m7q2v9.vmsdev.run/?_token=vmsd_Gq3n0Yb1c2d3e4f5g6h7i8j9k0l1m2n3o4p5q6r7s8t
        expiresAt:
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
          description: >-
            The URL stops working at this time if nobody opens it. A browser
            that opened it keeps the desktop for 12 hours.
        createdAt:
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
      required:
        - id
        - sandboxId
        - mode
        - url
        - expiresAt
        - createdAt
      additionalProperties: false
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: no_capacity
            message:
              type: string
            requestId:
              type:
                - string
                - 'null'
            retryAfterSeconds:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            sandboxId:
              description: The sandbox that the error is about.
              type: string
          required:
            - code
            - message
            - requestId
          additionalProperties: false
      required:
        - error
      additionalProperties: false
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: An API key that starts with vms_. Make one in Settings > API keys.

````

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