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() {
// Create a new Android box for demonstration purposes
const boxId = (await gboxSDK.create({ type: "android" })).data.id;
// Use the 'getInfo' method to retrieve static information about the box
const boxInfo = await gboxSDK.getInfo(boxId);
// Log the box information to the console
console.log(`Box Info: ${JSON.stringify(boxInfo)}`);
// Use the 'get' method to establish a connection to the box for interactions
const box = await gboxSDK.get(boxId);
// Perform an action on the box (click at coordinates 100, 100)
await box.action.click({ x: 100, y: 100 });
console.log(`Attached Box: ${JSON.stringify(box.data.id)}`);
}
main();import os
from gbox_sdk import GboxSDK
gbox_sdk = GboxSDK(api_key=os.environ["GBOX_API_KEY"])
# Create a new Android box for demonstration purposes
box_response = gbox_sdk.create(type="android")
box_id = box_response.data.id
# Use the 'get_info' method to retrieve static information about the box
box_info = gbox_sdk.get_info(box_id)
# Log the box information to the console
print(f"Box Info: {box_info}")
# Use the 'get' method to establish a connection to the box for interactions
box = gbox_sdk.get(box_id)
# Perform an action on the box (click at coordinates 100, 100)
box.action.click(x=100, y=100)
print(f"Attached Box: {box.data.id}")curl --request GET \
--url https://gbox.ai/api/v1/boxes/{boxId} \
--header 'Authorization: Bearer <token>'{
"id": "c9bdc193-b54b-4ddb-a035-5ac0c598d32d",
"status": "running",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:35:00.000Z",
"expiresAt": "2024-01-15T10:40:00.000Z",
"type": "linux",
"config": {
"os": {
"version": "ubuntu-20.04"
},
"deviceType": "physical",
"workingDir": "/home/user",
"labels": {
"environment": "development",
"team": "qa"
},
"envs": {
"NODE_ENV": "production",
"PATH": "/usr/bin:/bin"
},
"cpu": 2,
"memory": 1024,
"storage": 30
},
"reason": "Box terminated by user"
}Box
Get box
This endpoint retrieves information about a box
GET
/
boxes
/
{boxId}
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() {
// Create a new Android box for demonstration purposes
const boxId = (await gboxSDK.create({ type: "android" })).data.id;
// Use the 'getInfo' method to retrieve static information about the box
const boxInfo = await gboxSDK.getInfo(boxId);
// Log the box information to the console
console.log(`Box Info: ${JSON.stringify(boxInfo)}`);
// Use the 'get' method to establish a connection to the box for interactions
const box = await gboxSDK.get(boxId);
// Perform an action on the box (click at coordinates 100, 100)
await box.action.click({ x: 100, y: 100 });
console.log(`Attached Box: ${JSON.stringify(box.data.id)}`);
}
main();import os
from gbox_sdk import GboxSDK
gbox_sdk = GboxSDK(api_key=os.environ["GBOX_API_KEY"])
# Create a new Android box for demonstration purposes
box_response = gbox_sdk.create(type="android")
box_id = box_response.data.id
# Use the 'get_info' method to retrieve static information about the box
box_info = gbox_sdk.get_info(box_id)
# Log the box information to the console
print(f"Box Info: {box_info}")
# Use the 'get' method to establish a connection to the box for interactions
box = gbox_sdk.get(box_id)
# Perform an action on the box (click at coordinates 100, 100)
box.action.click(x=100, y=100)
print(f"Attached Box: {box.data.id}")curl --request GET \
--url https://gbox.ai/api/v1/boxes/{boxId} \
--header 'Authorization: Bearer <token>'{
"id": "c9bdc193-b54b-4ddb-a035-5ac0c598d32d",
"status": "running",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:35:00.000Z",
"expiresAt": "2024-01-15T10:40:00.000Z",
"type": "linux",
"config": {
"os": {
"version": "ubuntu-20.04"
},
"deviceType": "physical",
"workingDir": "/home/user",
"labels": {
"environment": "development",
"team": "qa"
},
"envs": {
"NODE_ENV": "production",
"PATH": "/usr/bin:/bin"
},
"cpu": 2,
"memory": 1024,
"storage": 30
},
"reason": "Box terminated by user"
}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"
Response
200 - application/json
Get box
- Linux Box
- Android Box
Linux box instance with full configuration and status
Unique identifier for the box
Example:
"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"
The current status of a box instance
Available options:
pending, running, error, terminated Example:
"running"
Creation timestamp of the box
Example:
"2024-01-15T10:30:00.000Z"
Last update timestamp of the box
Example:
"2024-01-15T10:35:00.000Z"
Expiration timestamp of the box
Example:
"2024-01-15T10:40:00.000Z"
Box type is Linux
Available options:
linux Example:
"linux"
Configuration for a Linux box instance
Show child attributes
Show child attributes
Example:
{
"os": { "version": "ubuntu-20.04" },
"deviceType": "physical",
"workingDir": "/home/user",
"labels": {
"environment": "development",
"team": "qa"
},
"envs": {
"NODE_ENV": "production",
"PATH": "/usr/bin:/bin"
},
"cpu": 2,
"memory": 1024,
"storage": 30
}
The reason for the current status, if any
Example:
"Box terminated by user"
Was this page helpful?