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" });
// Press single key
await box.action.pressKey({
keys: ["Enter"]
});
// Press key combination
await box.action.pressKey({
keys: ["Control", "c"]
});
}
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")
# Press single key
box.action.press_key(keys=["Enter"])
# Press key combination
box.action.press_key(keys=["Control", "c"])
if __name__ == "__main__":
main()curl --request POST \
--url https://gbox.ai/api/v1/boxes/{boxId}/actions/press-key \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"keys": [
"enter"
]
}
'{
"message": "Action executed successfully",
"actionId": "c9bdc193-b54b-4ddb-a035-5ac0c598d32d",
"screenshot": {
"trace": {
"uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
},
"before": {
"uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
},
"after": {
"uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
}
}
}Press key
Simulates pressing a specific key by triggering the complete keyboard key event chain (keydown, keypress, keyup). Use this to activate keyboard key event listeners such as shortcuts or form submissions.
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" });
// Press single key
await box.action.pressKey({
keys: ["Enter"]
});
// Press key combination
await box.action.pressKey({
keys: ["Control", "c"]
});
}
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")
# Press single key
box.action.press_key(keys=["Enter"])
# Press key combination
box.action.press_key(keys=["Control", "c"])
if __name__ == "__main__":
main()curl --request POST \
--url https://gbox.ai/api/v1/boxes/{boxId}/actions/press-key \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"keys": [
"enter"
]
}
'{
"message": "Action executed successfully",
"actionId": "c9bdc193-b54b-4ddb-a035-5ac0c598d32d",
"screenshot": {
"trace": {
"uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
},
"before": {
"uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
},
"after": {
"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
"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"
Body
Press keyboard key action configuration
This is an array of keyboard keys to press. Supports cross-platform compatibility.
a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, control, alt, shift, meta, win, cmd, option, arrowUp, arrowDown, arrowLeft, arrowRight, home, end, pageUp, pageDown, enter, space, tab, escape, backspace, delete, insert, capsLock, numLock, scrollLock, pause, printScreen, ;, =, ,, -, ., /, `, [, \, ], ', numpad0, numpad1, numpad2, numpad3, numpad4, numpad5, numpad6, numpad7, numpad8, numpad9, numpadAdd, numpadSubtract, numpadMultiply, numpadDivide, numpadDecimal, numpadEnter, numpadEqual, volumeUp, volumeDown, volumeMute, mediaPlayPause, mediaStop, mediaNextTrack, mediaPreviousTrack ["control", "c"]
Whether to press keys as combination (simultaneously) or sequentially. When true, all keys are pressed together as a shortcut (e.g., Ctrl+C). When false, keys are pressed one by one in sequence.
true
Action options. When options.screenshot is provided, ALL deprecated screenshot fields (outputFormat, presignedExpiresIn, screenshotDelay, screenshotRange, includeScreenshot) will be completely ignored.
Show child attributes
Show child attributes
{
"screenshot": {
"outputFormat": "base64",
"presignedExpiresIn": "30m",
"delay": "500ms",
"phases": ["before", "after"]
}
}
Response
Result of an UI action execution with optional screenshots
message
"Action executed successfully"
Unique identifier for each action. Use this ID to locate the action and report issues.
"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"
Optional screenshot data. Only present when screenshots are requested via options.screenshot.phases or deprecated fields
Show child attributes
Show child attributes
{
"trace": {
"uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
},
"before": {
"uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
},
"after": {
"uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
}
}
Was this page helpful?