Box
UI Action
Run Code
Command
File System
Browser
UI Action
Extract data
Extract data from the UI interface using a JSON schema.
POST
/
boxes
/
{boxId}
/
actions
/
extract
JavaScript
Copy
Ask AI
import GboxSDK from "gbox-sdk";
import { z } from "zod";
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" });
// Extract with JSON Schema
console.info(
await box.action.extract({
instruction: "extract the app count from the home page",
schema: {
type: "object",
properties: {
count: { type: "number" }
},
required: ["count"]
}
})
);
// Define Zod schema
const extractSchema = z.object({
text: z.string(),
isClickable: z.boolean().optional()
});
// Extract with Zod Schema
console.info(
await box.action.extract({
instruction: "extract the text from the login button",
schema: extractSchema
})
);
}
main();
Copy
Ask AI
{
"data": "test@example.com"
}
Authorizations
Enter your API Key in the format: Bearer <token>. Get it from https://gbox.ai
Path Parameters
Box ID
Example:
"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"
Body
application/json
Action to extract data from the UI interface
Response
200 - application/json
Result of extract action execution
Was this page helpful?
JavaScript
Copy
Ask AI
import GboxSDK from "gbox-sdk";
import { z } from "zod";
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" });
// Extract with JSON Schema
console.info(
await box.action.extract({
instruction: "extract the app count from the home page",
schema: {
type: "object",
properties: {
count: { type: "number" }
},
required: ["count"]
}
})
);
// Define Zod schema
const extractSchema = z.object({
text: z.string(),
isClickable: z.boolean().optional()
});
// Extract with Zod Schema
console.info(
await box.action.extract({
instruction: "extract the text from the login button",
schema: extractSchema
})
);
}
main();
Copy
Ask AI
{
"data": "test@example.com"
}
Assistant
Responses are generated using AI and may contain mistakes.