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

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

}

main();
{
"uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
}

Authorizations

Authorization
string
header
required

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

Path Parameters

boxId
string
required

Box ID

Example:

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

Body

application/json

Screenshot capture action configuration

outputFormat
enum<string>
default:base64

Type of the URI. default is base64.

Available options:
base64,
storageKey
Example:

"base64"

presignedExpiresIn
string
default:30m

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"

saveToAlbum
boolean
default:false

Whether to save the screenshot to the device screenshot album

Example:

false

scrollCapture
object

Scroll capture parameters

Example:
{ "maxHeight": 4000, "scrollBack": true }
clip
object

clip of the screenshot Clipping region for screenshot capture

Example:
{
"x": 100,
"y": 50,
"width": 800,
"height": 600
}

Response

200 - application/json

Result of screenshot capture action

uri
string
required

URL of the screenshot

Example:

"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."

presignedUrl
string

Presigned url of the screenshot

Example:

"https://example.com/xxxxx/xxxxx/xxxxx"

I