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

# Take screenshot

> Captures a screenshot of the current box screen



## OpenAPI

````yaml post /boxes/{boxId}/actions/screenshot
openapi: 3.0.0
info:
  title: GBOX Open API
  description: GBOX Open API Documentation
  version: '1.0'
  contact: {}
servers:
  - url: https://gbox.ai/api/v1
    description: Production Server
security: []
tags: []
paths:
  /boxes/{boxId}/actions/screenshot:
    post:
      tags:
        - UI Action
      summary: Take screenshot
      description: Captures a screenshot of the current box screen
      operationId: UIActionController_screenshot
      parameters:
        - name: boxId
          required: true
          in: path
          description: Box ID
          schema:
            example: c9bdc193-b54b-4ddb-a035-5ac0c598d32d
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Screenshot'
            examples:
              Basic:
                summary: Take screenshot
                value:
                  type: png
              Jpeg:
                summary: Take jpeg screenshot
                value:
                  type: jpeg
              OutputFormat:
                summary: Output format
                value:
                  outputFormat: storageKey
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScreenshotResult'
              examples:
                Basic:
                  summary: Basic screenshot
                  value:
                    uri: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...
                StorageKey:
                  summary: Storage key screenshot
                  value:
                    uri: gbox://storage/screenshot/1234567890
      security:
        - bearer: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import GboxSDK from "gbox-sdk";

            const gboxSDK = new GboxSDK({
              apiKey: process.env["GBOX_API_KEY"] // This is the default and can be omitted
            });

            async function main() {
              const box = await gboxSDK.create({ type: "android" });

              // Take full screenshot
              const screenshot = await box.action.screenshot({
                outputFormat: "base64"
              });

            }

            main();
        - lang: Python
          source: |-
            import os
            from gbox_sdk import GboxSDK


            def main():
                gbox_sdk = GboxSDK(api_key=os.environ["GBOX_API_KEY"])

                # Create Android box
                box = gbox_sdk.create(type="android")

                # Take full screenshot
                screenshot = box.action.screenshot(output_format="base64")


            if __name__ == "__main__":
                main()
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/gbox/gbox-sdk-go\"\n)\n\nfunc main() {\n\tgboxSDK := gbox.NewGboxSDK(os.Getenv(\"GBOX_API_KEY\"))\n\n\tbox, err := gboxSDK.Create(context.Background(), gbox.CreateBoxRequest{\n\t\tType: \"android\",\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create box: %v\", err)\n\t}\n\n\t// Take full screenshot\n\tscreenshot, err := box.Action.Screenshot(context.Background(), gbox.ScreenshotRequest{\n\t\tOutputFormat: \"base64\",\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to take screenshot: %v\", err)\n\t}\n\n\tfmt.Printf(\"Screenshot URI: %s\\n\", screenshot.URI)\n}"
components:
  schemas:
    Screenshot:
      type: object
      properties:
        outputFormat:
          type: string
          enum:
            - base64
            - storageKey
          description: Type of the URI. default is base64.
          default: base64
          example: base64
        presignedExpiresIn:
          type: string
          description: >-
            Presigned url expires in. Only takes effect when outputFormat is
            storageKey.


            Supported time units: ms (milliseconds), s (seconds), m (minutes), h
            (hours)

            Example formats: "500ms", "30s", "5m", "1h"

            Default: 30m
          example: 30m
          default: 30m
          title: PresignedExpiresIn
        saveToAlbum:
          type: boolean
          description: Whether to save the screenshot to the device screenshot album
          example: false
          default: false
        scrollCapture:
          description: Scroll capture parameters
          example:
            maxHeight: 4000
            scrollBack: true
          allOf:
            - $ref: '#/components/schemas/ScreenshotScrollCapture'
        clip:
          description: clip of the screenshot
          example:
            x: 100
            'y': 50
            width: 800
            height: 600
          allOf:
            - $ref: '#/components/schemas/ScreenshotClip'
      title: Screenshot Action
      description: Screenshot capture action configuration
    ScreenshotResult:
      type: object
      properties:
        uri:
          type: string
          description: URL of the screenshot
          example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...
        presignedUrl:
          type: string
          description: Presigned url of the screenshot
          example: https://example.com/xxxxx/xxxxx/xxxxx
      title: Screenshot Result
      description: Result of screenshot capture action
      required:
        - uri
    ScreenshotScrollCapture:
      type: object
      properties:
        maxHeight:
          type: number
          description: >-
            Maximum height of the screenshot in pixels. Limits the maximum
            height of the automatically scrolled content. Useful for managing
            memory usage when capturing tall content like long web pages.
            Default: 4000px
          example: 4000
          default: 4000
        scrollBack:
          type: boolean
          description: >-
            Whether to scroll back to the original position after capturing the
            screenshot
          example: false
          default: false
      title: Screenshot Scroll Capture
      description: Scroll capture parameters
    ScreenshotClip:
      type: object
      properties:
        x:
          type: number
          description: X coordinate of the clip
          example: 100
        'y':
          type: number
          description: Y coordinate of the clip
          example: 50
        width:
          type: number
          description: Width of the clip
          example: 800
        height:
          type: number
          description: Height of the clip
          example: 600
      title: Screenshot Clip
      description: Clipping region for screenshot capture
      required:
        - x
        - 'y'
        - width
        - height
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: >-
        Enter your API Key in the format: Bearer <token>. Get it from
        https://gbox.ai

````