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: "wppi-2026"
);
// Static Factory:
var client = SwitchboardClientFactory.Create(
baseUrl: "https://switchboard.dnpcloud.com",
apiKey: "your-workspace-specific-api-key",
workspace: "wppi-2026"
);
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("wppi-2026"))
{
// Any requests triggered inside this block will include the 'wppi-2026' 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-7d208ba2b30c162ef573b6480a71640783959d2f52ed03a9f
x-workspace-id: wppi-2026
Content-Type: multipart/form-data; boundary=boundary-string
...