Featured Answer:
Box is enterprise file storage. Browser automation provides folder provisioning, permission sync, and client onboarding when API access is limited or admins use the Box UI.
Table of Contents
Introduction
Box is a leading enterprise content and file storage platform. While Box offers APIs and the Box Admin Console, browser automation provides a practical way to handle folder provisioning, permission sync, and client onboarding when API access is limited or when admins work primarily in the Box web UI.
Why Use Browser Automation for Box Admin?
- Limited API Access: Box API and admin scopes may be restricted for some teams or use cases
- Folder Provisioning: Create folder structures, apply templates, and set up shared spaces from the UI when scripting is not available
- Permission Sync: Align folder and file permissions with HR or directory data from the admin or content view
- Client Onboarding: Create client folders, invite external users, and apply policies from the Box Admin Console
- UI-Only Flows: Many admin and compliance settings are managed in the web console
- Cross-Folder and Bulk Actions: Operate across folders and users in one session
- Audit: Export sharing and access reports for compliance
Setting Up Box Admin Automation
Here's how to automate folder provisioning, permission sync, and client onboarding in Box using browser automation:
import { chromium } from 'playwright';
const response = await fetch("https://api.anchorbrowser.io/api/sessions", {
method: "POST",
headers: {
"anchor-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
'headless': false,
'proxy': { 'type': 'residential', 'country': 'US' }
}),
});
const { id } = await response.json();
const connectionString = `wss://connect.anchorbrowser.io?apiKey=YOUR_API_KEY&sessionId=${id}`;
const browser = await chromium.connectOverCDP(connectionString);
const context = browser.contexts()[0];
const ai = context.serviceWorkers()[0];
const page = context.pages()[0];
await page.goto("https://app.box.com");
await ai.evaluate(JSON.stringify({
prompt: 'Log in to Box using the provided credentials. If Admin Console is needed, go to admin.box.com or open Admin from the app. Complete SSO or MFA if required.'
}));
Use Case 1: Folder Provisioning
Create folder structures and apply templates from the Box UI:
const runFolderProvisioning = async (page, ai, criteria) => {
await ai.evaluate(JSON.stringify({
prompt: 'Navigate to the target folder or All Files. Open the location where new folders should be created.'
}));
await page.waitForLoadState('networkidle');
await ai.evaluate(JSON.stringify({
prompt: criteria.action === 'create'
? `Create folder structure: ${(criteria.folderNames || ['New Folder']).join(' > ')}. Create parent and subfolders as needed.`
: criteria.action === 'template'
? `Apply template or copy structure from ${criteria.sourceFolder || 'template folder'} to ${criteria.destinationFolder || 'destination'}.`
: 'List folders in current location: name, path, owner. Return as JSON array.'
}));
await page.waitForLoadState('networkidle');
const result = await ai.evaluate(JSON.stringify({
prompt: 'Return summary: folders created or current list. As JSON. No credentials.'
}));
return { result: typeof result === 'string' ? JSON.parse(result) : result, completedAt: new Date().toISOString() };
};
Use Case 2: Permission Sync
Sync folder and file permissions with directory or policy data:
const runPermissionSync = async (page, ai, criteria) => {
await ai.evaluate(JSON.stringify({
prompt: 'Navigate to the folder or item. Open Sharing or Manage Access (permissions).'
}));
await page.waitForLoadState('networkidle');
await ai.evaluate(JSON.stringify({
prompt: criteria.action === 'audit'
? 'List current collaborators and permission levels. Return as JSON array. No emails if sensitive.'
: criteria.action === 'update'
? `Update permissions: add or remove access for specified users/groups. Set role to ${criteria.role || 'as specified'}. Save. Do not log emails.`
: 'List sharing links and external access. Return as JSON. No credentials.'
}));
await page.waitForLoadState('networkidle');
const result = await ai.evaluate(JSON.stringify({
prompt: 'Return summary: permission changes or current access list. As JSON. No credentials.'
}));
return { result: typeof result === 'string' ? JSON.parse(result) : result, completedAt: new Date().toISOString() };
};
Use Case 3: Client Onboarding
Onboard clients: create folders, invite users, and apply policies from the Admin Console:
const runClientOnboarding = async (page, ai, criteria) => {
await ai.evaluate(JSON.stringify({
prompt: 'Navigate to Box Admin Console (admin.box.com or Admin from app). Open Users or Content/Sharing section.'
}));
await page.waitForLoadState('networkidle');
await ai.evaluate(JSON.stringify({
prompt: criteria.action === 'invite'
? 'Invite external user(s) as specified. Set folder access and role. Do not log email addresses in output.'
: criteria.action === 'folder'
? `Create client folder structure for ${criteria.clientName || 'new client'}. Set owner and sharing. Save.`
: criteria.action === 'policy'
? 'Apply or update sharing/security policy for the selected scope. Save.'
: 'List recent invites and client folders. Return as JSON. No PII.'
}));
await page.waitForLoadState('networkidle');
const result = await ai.evaluate(JSON.stringify({
prompt: 'Return summary: onboarding action or current state. As JSON. No credentials or PII.'
}));
return { result: typeof result === 'string' ? JSON.parse(result) : result, completedAt: new Date().toISOString() };
};
Exporting Sharing and Access Data
Export sharing and access reports for audit:
const exportBoxAccess = async (page, ai, scope) => {
await ai.evaluate(JSON.stringify({
prompt: scope === 'sharing'
? 'Navigate to Admin > Reports or Content. Open sharing/access report. Export or list shared items and collaborators.'
: 'Navigate to Admin. Open audit or activity report. Export or list as specified. Do not include PII in output.'
}));
await page.waitForLoadState('networkidle');
const download = await page.waitForEvent('download', { timeout: 20000 }).catch(() => null);
const result = download ? await download.path() : await ai.evaluate(JSON.stringify({ prompt: 'Return extracted report data as JSON. No PII.' }));
return result;
};
Best Practices for Box Admin Automation
- Security: Use least-privilege admin roles and SSO; never log credentials or PII; respect data classification
- Folder Provisioning: Prefer Box API or templates where available; use browser for one-off or UI-only flows; validate folder paths before bulk create
- Permission Sync: Audit before bulk permission changes; avoid exposing collaborator emails in logs
- Client Onboarding: Follow org process for external invites; use automation to reduce manual steps, not to bypass approval
- Rate Limits: Add delays between actions to avoid Box UI throttling
- Error Handling: Retry on session timeout; handle SSO and MFA gracefully
- Compliance: Align automation with your org's content and sharing policies
Handling Authentication
Box supports SSO and MFA for both app and Admin Console:
const handleBoxAuth = async (page, ai, credentials) => {
await page.goto("https://app.box.com");
await ai.evaluate(JSON.stringify({
prompt: 'Sign in with the provided credentials. If SSO is required, complete org SSO.'
}));
await ai.evaluate(JSON.stringify({
prompt: 'If MFA is required, complete verification. For Admin Console, navigate to admin.box.com if needed. Wait for UI to load.'
}));
await page.waitForLoadState('networkidle');
};
Resources
- Anchor Browser Documentation - API reference and guides
- Anchor Browser Playground - Try browser automation in your browser
Conclusion
Browser automation provides a flexible alternative to the Box API for Box Admin storage workflows. By using intelligent browser agents, you can automate folder provisioning, permission sync, and client onboarding directly from the Box web UI and Admin Console. Whether you need to create folder structures, sync permissions with directory data, or onboard clients with folders and invites, browser automation enables efficient Box admin when API access is limited or when teams work in the portal.
Start automating your Box folder provisioning, permission sync, and client onboarding today.