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();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()curl --request POST \
--url https://gbox.ai/api/v1/boxes/{boxId}/actions/screenshot \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
}UI Action
Take screenshot
Captures a screenshot of the current box screen
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();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()curl --request POST \
--url https://gbox.ai/api/v1/boxes/{boxId}/actions/screenshot \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
}Authorizations
Enter your API Key in the format: Bearer . Get it from https://gbox.ai
Path Parameters
Box ID
Example:
"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"
Body
application/json
Screenshot capture action configuration
Type of the URI. default is base64.
Available options:
base64, storageKey Example:
"base64"
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"
Whether to save the screenshot to the device screenshot album
Example:
false
Scroll capture parameters
Show child attributes
Show child attributes
Example:
{ "maxHeight": 4000, "scrollBack": true }
clip of the screenshot
Show child attributes
Show child attributes
Example:
{
"x": 100,
"y": 50,
"width": 800,
"height": 600
}
Was this page helpful?