Skip to main content
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();
{
  "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",
  "reason": "Box terminated by user",
  "type": "linux",
  "config": {
    "os": {
      "version": "ubuntu-20.04"
    },
    "workingDir": "/home/user",
    "labels": {
      "environment": "development",
      "team": "qa"
    },
    "envs": {
      "NODE_ENV": "production",
      "PATH": "/usr/bin:/bin"
    },
    "cpu": 2,
    "memory": 1024,
    "storage": 30
  }
}

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"

Response

200 - application/json

Get box

  • Linux Box
  • Android Box

Linux box instance with full configuration and status

id
string
required

Unique identifier for the box

Example:

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

status
enum<string>
required

The current status of a box instance

Available options:
pending,
running,
error,
terminated
Example:

"running"

createdAt
string<date-time>
required

Creation timestamp of the box

Example:

"2024-01-15T10:30:00.000Z"

updatedAt
string<date-time>
required

Last update timestamp of the box

Example:

"2024-01-15T10:35:00.000Z"

expiresAt
string<date-time> | null
required

Expiration timestamp of the box

Example:

"2024-01-15T10:40:00.000Z"

type
enum<string>
default:linux
required

Box type is Linux

Available options:
linux
Example:

"linux"

config
object
required

Configuration for a Linux box instance Complete configuration for Linux box instance

Example:
{
"os": { "version": "ubuntu-20.04" },
"workingDir": "/home/user",
"labels": {
"environment": "development",
"team": "qa"
},
"envs": {
"NODE_ENV": "production",
"PATH": "/usr/bin:/bin"
},
"cpu": 2,
"memory": 1024,
"storage": 30
}
reason
string | null

The reason for the current status, if any

Example:

"Box terminated by user"

I