> ## 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.

# Touch

> Performs more advanced touch gestures. Use this endpoint to simulate realistic behaviors.



## OpenAPI

````yaml post /boxes/{boxId}/actions/touch
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/touch:
    post:
      tags:
        - UI Action
      summary: Touch
      description: >-
        Performs more advanced touch gestures. Use this endpoint to simulate
        realistic behaviors.
      operationId: UIActionController_touch
      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/Touch'
            examples:
              Basic:
                summary: Basic touch
                value:
                  points:
                    - start:
                        x: 100
                        'y': 150
                      actions:
                        - type: move
                          x: 400
                          'y': 300
                          duration: 200ms
              WaitAtStart:
                summary: Wait at the start point
                value:
                  points:
                    - start:
                        x: 100
                        'y': 150
                      actions:
                        - type: wait
                          duration: 500ms
                        - type: move
                          x: 400
                          'y': 300
                          duration: 200ms
              MultiPoint:
                summary: Multi-point touch
                value:
                  points:
                    - start:
                        x: 100
                        'y': 150
                      actions:
                        - type: move
                          x: 400
                          'y': 300
                          duration: 200ms
                    - start:
                        x: 400
                        'y': 300
                      actions:
                        - type: move
                          x: 100
                          'y': 150
                          duration: 200ms
      responses:
        '200':
          description: Touch action result with actual parameters used
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TouchActionResult'
      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" });

              await box.action.touch({
                points: [
                  {
                    start: { x: 100, y: 150 },
                    actions: [{ x: 400, y: 300, duration: "200ms" }, { duration: "500ms" }]
                  }
                ]
              });
            }

            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")

                # Touch action
                box.action.touch(
                    points=[
                        {
                            "start": {"x": 100, "y": 150},
                            "actions": [
                                {"x": 400, "y": 300, "duration": "200ms"},
                                {"duration": "500ms"}
                            ]
                        }
                    ]
                )


            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\terr = box.Action.Touch(context.Background(), gbox.TouchRequest{\n\t\tPoints: []gbox.TouchPoint{\n\t\t\t{\n\t\t\t\tStart: gbox.TouchPointStart{X: 100, Y: 150},\n\t\t\t\tActions: []gbox.TouchPointAction{\n\t\t\t\t\t{X: 400, Y: 300, Duration: \"200ms\"},\n\t\t\t\t\t{Duration: \"500ms\"},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to perform touch action: %v\", err)\n\t}\n}"
components:
  schemas:
    Touch:
      type: object
      properties:
        points:
          description: Array of touch points and their actions
          type: array
          items:
            $ref: '#/components/schemas/TouchPoint'
        options:
          description: >-
            Action options. When `options.screenshot` is provided, ALL
            deprecated screenshot fields (outputFormat, presignedExpiresIn,
            screenshotDelay, screenshotRange, includeScreenshot) will be
            completely ignored.
          example:
            screenshot:
              outputFormat: base64
              presignedExpiresIn: 30m
              delay: 500ms
              phases:
                - before
                - after
          allOf:
            - $ref: '#/components/schemas/ActionCommonOptions'
      title: Touch Action
      description: Multi-touch action configuration
      required:
        - points
    TouchActionResult:
      type: object
      properties:
        message:
          type: string
          description: message
          example: Action executed successfully
        actionId:
          type: string
          description: >-
            Unique identifier for each action. Use this ID to locate the action
            and report issues.
          example: c9bdc193-b54b-4ddb-a035-5ac0c598d32d
        screenshot:
          description: >-
            Optional screenshot data. Only present when screenshots are
            requested via options.screenshot.phases or deprecated fields
          example:
            trace:
              uri: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...
            before:
              uri: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...
            after:
              uri: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...
          allOf:
            - $ref: '#/components/schemas/ActionResultScreenshot'
        actual:
          description: Actual parameters used when executing the touch action
          example:
            points:
              - start:
                  x: 100
                  'y': 150
                actions:
                  - type: move
                    x: 400
                    'y': 300
                    duration: 200ms
                  - type: wait
                    duration: 500ms
          allOf:
            - $ref: '#/components/schemas/TouchActionActual'
      title: Touch Action Result
      description: Result of touch action execution with actual parameters used
      required:
        - message
        - actionId
        - actual
    TouchPoint:
      type: object
      properties:
        start:
          description: Starting position for touch
          example:
            x: 100
            'y': 150
          allOf:
            - $ref: '#/components/schemas/TouchPointStart'
        actions:
          description: Sequence of actions to perform after initial touch
          example:
            - x: 400
              'y': 300
              duration: 200ms
            - duration: 500ms
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/TouchPointMoveAction'
                example:
                  x: 400
                  'y': 300
                  duration: 200ms
              - $ref: '#/components/schemas/TouchPointWaitAction'
                example:
                  duration: 500ms
      title: Touch Point
      description: Touch point configuration with start position and actions
      required:
        - start
    ActionCommonOptions:
      type: object
      properties:
        screenshot:
          description: >-
            Screenshot options. Can be a boolean to enable/disable screenshots,
            or an object to configure screenshot options.
          oneOf:
            - $ref: '#/components/schemas/ActionScreenshotOptions'
              example:
                outputFormat: base64
                presignedExpiresIn: 30m
                delay: 500ms
                phases:
                  - before
                  - after
            - type: boolean
              example: true
        model:
          type: string
          description: >-
            Model to use for natural-language target resolution. Defaults to
            'uitars'.
          enum:
            - gpt-5
            - gpt-4o
            - gelato
            - ui-tars
            - openai-computer-use
          default: gelato
      title: Action Common Options
      description: Action common options
    ActionResultScreenshot:
      type: object
      properties:
        trace:
          description: URI of the screenshot before the action with operation trace
          example:
            uri: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...
          allOf:
            - $ref: '#/components/schemas/ActionResultOperationTrace'
        before:
          description: URI of the screenshot before the action
          example:
            uri: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...
          allOf:
            - $ref: '#/components/schemas/ActionResultScreenshotBefore'
        after:
          description: URI of the screenshot after the action
          example:
            uri: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...
          allOf:
            - $ref: '#/components/schemas/ActionResultScreenshotAfter'
      title: Action Result Screenshot
      description: Complete screenshot result with operation trace, before and after images
    TouchActionActual:
      type: object
      properties:
        points:
          description: Array of touch points with their normalized coordinates and actions
          example:
            - start:
                x: 100
                'y': 150
              actions:
                - type: move
                  x: 400
                  'y': 300
                  duration: 200ms
                - type: wait
                  duration: 500ms
          type: array
          items:
            $ref: '#/components/schemas/TouchPoint'
      title: Touch Action Actual Parameters
      description: Actual parameters used when executing the touch action
      required:
        - points
    TouchPointStart:
      type: object
      properties:
        x:
          type: number
          description: Starting X coordinate
          example: 100
        'y':
          type: number
          description: Starting Y coordinate
          example: 150
      title: Touch Point Start
      description: Initial touch point position
      required:
        - x
        - 'y'
    TouchPointMoveAction:
      type: object
      properties:
        type:
          type: string
          description: Type of the action
          example: move
        x:
          type: number
          description: Target X coordinate
          example: 400
        'y':
          type: number
          description: Target Y coordinate
          example: 300
        duration:
          type: string
          description: >-
            Duration of the movement (e.g. "200ms")


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

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

            Default: 200ms
          example: 200ms
          default: 200ms
          title: MovementDuration
      title: Touch Point Move Action
      description: Touch point movement action configuration
      required:
        - type
        - x
        - 'y'
        - duration
    TouchPointWaitAction:
      type: object
      properties:
        type:
          type: string
          description: Type of the action
          example: wait
        duration:
          type: string
          description: >-
            Duration to wait (e.g. "500ms")


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

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

            Default: 500ms
          example: 500ms
          default: 500ms
          title: WaitDuration
      title: Touch Point Wait Action
      description: Touch point wait action configuration
      required:
        - type
        - duration
    ActionScreenshotOptions:
      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
        delay:
          type: string
          description: >-
            Delay after performing the action, before taking the final
            screenshot.


            Execution flow:

            1. Take screenshot before action

            2. Perform the action

            3. Wait for screenshotDelay (this parameter)

            4. Take screenshot after action


            Example: '500ms' means wait 500ms after the action before capturing
            the final screenshot.


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

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

            Default: 500ms

            Maximum allowed: 30s
          example: 500ms
          default: 500ms
          title: Delay
        phases:
          type: array
          description: >-
            Specify which screenshot phases to capture.


            Available options:

            - before: Screenshot before the action

            - after: Screenshot after the action

            - trace: Screenshot with operation trace


            Default captures all three phases. Can specify one or multiple in an
            array.

            If empty array is provided, no screenshots will be taken.
          default:
            - before
            - after
            - trace
          example:
            - before
            - after
          items:
            type: string
            enum:
              - before
              - after
              - trace
      title: Action Screenshot Options
      description: Action screenshot options
    ActionResultOperationTrace:
      type: object
      properties:
        uri:
          type: string
          description: URI of the screenshot with operation trace
          example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...
      title: Action Result Screenshot Operation Trace
      description: Screenshot with action operation trace
      required:
        - uri
    ActionResultScreenshotBefore:
      type: object
      properties:
        uri:
          type: string
          description: URI of the screenshot before the action
          example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...
        presignedUrl:
          type: string
          description: Presigned url of the screenshot before the action
          example: https://example.com/xxxxx/xxxxx/xxxxx
      title: Action Result Screenshot Before
      description: Screenshot taken before action execution
      required:
        - uri
    ActionResultScreenshotAfter:
      type: object
      properties:
        uri:
          type: string
          description: URI of the screenshot after the action
          example: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...
        presignedUrl:
          type: string
          description: Presigned url of the screenshot before the action
          example: https://example.com/xxxxx/xxxxx/xxxxx
      title: Action Result Screenshot After
      description: Screenshot taken after action execution
      required:
        - uri
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: >-
        Enter your API Key in the format: Bearer <token>. Get it from
        https://gbox.ai

````