POST
/
boxes
/
{boxId}
/
actions
/
recording
/
rewind
/
extract
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",
    config: {
      deviceType: "physical",
    },
  });

  await box.action.recording.rewind.enable();

  // Perform some operations...

  console.info("tapping chrome app...");

  await box.action.tap({ target: "chrome app" });

  // sleep 3 seconds
  console.info("sleeping 3 seconds...");

  await new Promise((resolve) => setTimeout(resolve, 3000));

  console.info("pressing home button...");

  await box.action.pressButton({ buttons: ["home"] });

  console.info("extracting recording...");

  // Extract the last 5 seconds of the recording
  const result = await box.action.recording.rewind.extract({
    duration: "5s",
  });

  console.log(`recording download url: ${result.presignedUrl}`);
}

main();
{
  "storageKey": "storage://gbox/recording/1234567890",
  "presignedUrl": "https://gbox.ai/api/v1/boxes/1234567890/recording/1234567890"
}

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"

Body

application/json

Configuration for rewinding and extracting clips from continuous screen recording

duration
string
default:30s

How far back in time to rewind for extracting recorded video. This specifies the duration to go back from the current moment (e.g., '30s' rewinds 30 seconds to get recent recorded activity). Default is 30s, max is 5m.

Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: "500ms", "30s", "5m", "1h" Maximum allowed: 5m

Example:

"10s"

Response

200 - application/json

Result of extracting the recording rewind

storageKey
string
required

Storage key of the recording. Before the box is deleted, you can use this storageKey with the endpoint box/:boxId/storage/presigned-url to get a downloadable URL for the recording.

Example:

"storage://gbox/recording/1234567890"

presignedUrl
string
required

Presigned URL of the recording. This is a temporary downloadable URL with an expiration time for accessing the recording file.

Example:

"https://gbox.ai/api/v1/boxes/1234567890/recording/1234567890"