Skip to main content
POST
/
boxes
/
{boxId}
/
actions
/
touch
JavaScript
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();
{
  "message": "Action executed successfully",
  "actionId": "c9bdc193-b54b-4ddb-a035-5ac0c598d32d",
  "actual": {
    "points": [
      {
        "start": {
          "x": 100,
          "y": 150
        },
        "actions": [
          {
            "type": "move",
            "x": 400,
            "y": 300,
            "duration": "200ms"
          },
          {
            "type": "wait",
            "duration": "500ms"
          }
        ]
      }
    ]
  },
  "screenshot": {
    "trace": {
      "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
    },
    "before": {
      "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
    },
    "after": {
      "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
    }
  }
}

Authorizations

Authorization
string
header
required

Enter your API Key in the format: Bearer . Get it from https://gbox.ai

Path Parameters

boxId
string
required

Box ID

Example:

"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"

Body

application/json

Multi-touch action configuration

points
Touch Point · object[]
required

Array of touch points and their actions

options
Action Common Options · object

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"]
}
}

Response

200 - application/json

Touch action result with actual parameters used

Result of touch action execution with actual parameters used

message
string
required

message

Example:

"Action executed successfully"

actionId
string
required

Unique identifier for each action. Use this ID to locate the action and report issues.

Example:

"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"

actual
Touch Action Actual Parameters · object
required

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" }
]
}
]
}
screenshot
Action Result Screenshot · object

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..."
}
}