Skip to main content
POST
/
boxes
/
{boxId}
/
actions
/
scroll
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" });

  // Scroll action (advanced) - with coordinates
  await box.action.scroll({
    x: 400,
    y: 300,
    scrollX: 0,
    scrollY: -100
  });

  // Scroll action (simple) - with direction
  await box.action.scroll({
    direction: "up",
    duration: "500ms",
    distance: "medium"
  });
}

main();
{
  "message": "Action executed successfully",
  "actionId": "c9bdc193-b54b-4ddb-a035-5ac0c598d32d",
  "actual": {
    "x": 400,
    "y": 300,
    "scrollX": 0,
    "scrollY": -100
  },
  "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
  • Scroll Advanced
  • Scroll Simple

Advanced scroll action configuration. The scroll will be performed from the specified coordinates with the given scroll amounts. Use positive scrollY to scroll content downward (reveal content below), negative scrollY to scroll content upward (reveal content above). Use positive scrollX to scroll content rightward (reveal content on the right), negative scrollX to scroll content leftward (reveal content on the left).

scrollX
number
required

Horizontal scroll amount. Positive values scroll content rightward (reveals content on the right), negative values scroll content leftward (reveals content on the left).

Example:

0

scrollY
number
required

Vertical scroll amount. Positive values scroll content downward (reveals content below), negative values scroll content upward (reveals content above).

Example:

-100

x
number
required

X coordinate of the scroll position

Example:

400

y
number
required

Y coordinate of the scroll position

Example:

300

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

Scroll action result with actual parameters used

Result of scroll 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
Scroll Action Actual Parameters · object
required

Actual parameters used when executing the scroll action

Example:
{
"x": 400,
"y": 300,
"scrollX": 0,
"scrollY": -100
}
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..."
}
}