GET
/
boxes
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 boxes = await gboxSDK.list();

  boxes.operators.forEach((operator) => {
    console.log(operator.data.id);
  });

  const boxInfo = await gboxSDK.listBoxInfo();

  boxInfo.data.forEach((operator) => {
    console.log(operator.id);
  });
}

main();
{
  "total": 100,
  "page": 1,
  "pageSize": 10,
  "data": [
    {
      "id": "c9bdc193-b54b-4ddb-a035-5ac0c598d32d",
      "type": "linux",
      "status": "running",
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-01-15T10:35:00.000Z",
      "expiresAt": "2024-01-15T10:40:00.000Z",
      "config": {
        "os": {
          "version": "ubuntu-20.04"
        },
        "workingDir": "/home/user",
        "labels": {
          "environment": "development"
        },
        "envs": {
          "NODE_ENV": "production"
        },
        "cpu": 2,
        "memory": 1024,
        "storage": 30
      }
    },
    {
      "id": "f7e8a2c1-9d4e-4b3a-8c6f-1e5d7a9b2c4e",
      "type": "android",
      "status": "pending",
      "createdAt": "2024-01-15T10:32:00.000Z",
      "updatedAt": "2024-01-15T10:32:00.000Z",
      "expiresAt": "2024-01-15T10:47:00.000Z",
      "config": {
        "os": {
          "version": "12"
        },
        "deviceType": "virtual",
        "workingDir": "/data/local/tmp",
        "labels": {
          "app": "mobile-testing"
        },
        "envs": {
          "ANDROID_HOME": "/opt/android-sdk"
        },
        "cpu": 2,
        "memory": 2048,
        "storage": 20
      }
    }
  ]
}

Authorizations

Authorization
string
header
required

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

Query Parameters

page
integer
default:1

Page number

Example:

1

pageSize
integer
default:10

Page size

Example:

10

status
enum<string>[]

Filter boxes by their current status (pending, running, stopped, error, terminated, all). Must be an array of statuses. Use 'all' to get boxes with any status.

Example:
["running"]
type
enum<string>[]

Filter boxes by their type (linux, android, all). Must be an array of types. Use 'all' to get boxes of any type.

Example:
["linux"]
labels
object

Filter boxes by their labels. Labels are key-value pairs that help identify and categorize boxes. Use this to filter boxes that match specific label criteria. For example, you can filter by project, environment, team, or any custom labels you've added to your boxes.

deviceType
string

Filter boxes by their device type (virtual, physical)

Example:

"virtual"

Response

200 - application/json

List box

Response containing paginated list of box instances