Using Workspaces
Switchboard supports logical partitioning via Workspaces. Workspaces allow developers to segment data and storage isolation cleanly—ideal for one-off internal events, trade shows, live demos, staging/testing environments, or regional activations.
What is Isolated?
When targeting a specific workspace, Switchboard isolates the following components:
- Data Storage: Captures, filters, and history records are partitioned so each workspace only accesses its own data.
- Asset Storage: Uploaded files and generated output images are kept in separate workspace folders.
- Authentication: Access is secured via workspace-specific API keys, preventing cross-workspace access.
Configuring the Client SDK
To associate client operations with a workspace, provide the workspace identifier during initialization. This automatically registers request interceptors that inject the required headers.
Method 1: Factory / DI Registration
Pass the workspace name during creation to tie all client requests to that workspace:
using Switchboard.Client;
using Switchboard.Client.DependencyInjection;
// Dependency Injection:
builder.Services.AddSwitchboardClient(
baseUrl: "https://switchboard.dnpcloud.com",
apiKey: "your-workspace-specific-api-key",
workspace: "sandbox"
);
// Static Factory:
var client = SwitchboardClientFactory.Create(
baseUrl: "https://switchboard.dnpcloud.com",
apiKey: "your-workspace-specific-api-key",
workspace: "sandbox"
);
Method 2: Dynamic Ambient Context
If you are managing multiple workspaces dynamically within your application flow, use WorkspaceContext to set the workspace for the current asynchronous thread execution scope:
using Switchboard.Client;
// Temporary scope override:
using (WorkspaceContext.Begin("sandbox"))
{
// Any requests triggered inside this block will include the 'sandbox' workspace header
var capture = await client.UploadAsync("filter-id", stream, 1024, 1024);
}
Direct HTTP Integration
If you integrate directly with the REST API using custom HTTP libraries, you must supply two headers in every request:
x-api-key: The unique API key authorized for the workspace.x-workspace-id: The target workspace identifier.
POST /captures HTTP/1.1
Host: switchboard.dnpcloud.com
x-api-key: lwk-8d308ba2b30c162ef573b6480a71640783959d2f52ed03a9f
x-workspace-id: sandbox
Content-Type: multipart/form-data; boundary=boundary-string
...
Workspaces in Switchboard Labs
In Switchboard Labs, workspaces separate prompt authoring and experimentation (sandbox) from production operations (live).
sandboxWorkspace:- Default workspace for filter authoring, prompt tuning, and batch test uploads.
- Allows full creation, update, and deletion of filters and grounding assets.
liveWorkspace:- Production environment where filters are read-only to prevent unintended changes to live photo booths or kiosk pipelines.
- Publishing Filters to Live:
- When prompt tuning and asset tests in
sandboxare complete, users with theoperatorrole (or higher) can publish the filter to production: - Select Publish in the Labs UI or trigger
POST /api/filters/{id}/publish. - The filter definition and assets are copied into the
liveworkspace scope and ready for client traffic.
- When prompt tuning and asset tests in