Overview
The Dashboard Management API lets you programmatically control workspaces and dashboards. Common use cases include:
- Building a custom sidebar listing available dashboards
- Dynamically creating dashboards when users enable features (e.g. “Enable revenue charts”)
- Cloning template dashboards for new tenants
- Bulk-adding or removing charts from dashboards
Authentication
All Dashboard Management endpoints accept a tenant JWT in the Authorization header. This is the same JWT you receive from the Register Tenant endpoint.
Authorization: Bearer <tenant_jwt>
Alternatively, you can authenticate with an Upsolve API key for server-to-server calls:
Authorization: Bearer up_admin_************
Tenant JWT authentication is recommended for frontend SDK integrations. API
key authentication is recommended for backend automations.
List all workspaces, then list dashboards within a workspace to build your own navigation UI.
Step 1: List Workspaces
curl -X GET "https://api.upsolve.ai/v1/api/dashboard/list-workspaces" \
-H "Authorization: Bearer up_admin_************"
Step 2: List Dashboards in a Workspace
curl -X GET "https://api.upsolve.ai/v1/api/dashboard/list-workspace-dashboards?workspaceId=<workspace_id>" \
-H "Authorization: Bearer <tenant_jwt>"
Response:
{
"dashboards": [
{
"id": "abc-123",
"name": "Revenue Overview",
"tenantId": null,
"createdAt": "2024-01-15T..."
},
{
"id": "def-456",
"name": "My Custom View",
"tenantId": "tenant-789",
"createdAt": "2024-02-01T..."
}
]
}
Step 3: Load a Specific Dashboard in the SDK
Use the selectedDashboardId prop to open a specific dashboard tab:
import { UpsolveWorkspace } from "@upsolve-labs/sdk";
function DashboardView({ selectedDashId }) {
return (
<UpsolveWorkspace
workspaceId="<workspace_id>"
tenantJWT={tenantJwt}
selectedDashboardId={selectedDashId}
hideTabs={true} // Hide default tabs, use your own sidebar
/>
);
}
Or with UpsolveDashboard:
import { UpsolveDashboard } from "@upsolve-labs/sdk";
<UpsolveDashboard
dashboardId="<any_dashboard_in_workspace>"
tenantJWT={tenantJwt}
selectedDashboardId={selectedDashId}
hideTabs={true}
/>;
Workflow 2: Create a Dashboard and Add Charts
Create a new empty dashboard, then populate it with charts from your chart library.
Step 1: Create an Empty Dashboard
curl -X POST "https://api.upsolve.ai/v1/api/dashboard/create" \
-H "Authorization: Bearer <tenant_jwt>" \
-H "Content-Type: application/json" \
-d '{ "workspaceId": "<workspace_id>", "name": "My New Dashboard" }'
Step 2: Add Charts
curl -X POST "https://api.upsolve.ai/v1/api/dashboard/add-charts" \
-H "Authorization: Bearer <tenant_jwt>" \
-H "Content-Type: application/json" \
-d '{
"targetDashboardId": "<new_dashboard_id>",
"charts": [
{ "chartId": "<revenue_chart_id>" },
{ "chartId": "<cost_chart_id>" },
{ "chartId": "<profit_chart_id>" }
]
}'
Charts are deep-copied into the target dashboard, so changes to the originals won’t affect the copy.
Workflow 3: Clone a Dashboard
Clone an existing dashboard (with all its charts) into the same or a different workspace.
curl -X POST "https://api.upsolve.ai/v1/api/dashboard/clone" \
-H "Authorization: Bearer <tenant_jwt>" \
-H "Content-Type: application/json" \
-d '{
"sourceDashboardId": "<template_dashboard_id>",
"targetWorkspaceId": "<target_workspace_id>",
"name": "Sales Dashboard for ACME Corp"
}'
Workflow 4: Merge Charts Between Dashboards
Append all charts from one dashboard to another. This is useful for enabling feature bundles (e.g., “Enable revenue charts” adds all revenue-related charts).
curl -X POST "https://api.upsolve.ai/v1/api/dashboard/append-charts-from" \
-H "Authorization: Bearer <tenant_jwt>" \
-H "Content-Type: application/json" \
-d '{
"sourceDashboardId": "<revenue_template_dashboard_id>",
"targetDashboardId": "<users_dashboard_id>"
}'
Workflow 5: Remove Charts from a Dashboard
Remove specific charts that are no longer needed:
curl -X POST "https://api.upsolve.ai/v1/api/dashboard/remove-charts" \
-H "Authorization: Bearer <tenant_jwt>" \
-H "Content-Type: application/json" \
-d '{
"dashboardId": "<dashboard_id>",
"chartIds": ["<chart_id_1>", "<chart_id_2>"]
}'
The chart records are preserved in the chart library. Only the dashboard layout is updated.
API Reference
| Endpoint | Description |
|---|
| List Workspaces | List all workspaces in your organization |
| List Workspace Dashboards | List dashboards in a workspace |
| Create Dashboard | Create a new empty dashboard |
| Clone Dashboard | Deep-copy a dashboard with all charts |
| Add Charts | Add charts to a dashboard |
| Remove Charts | Remove charts from a dashboard |
| Append Charts | Copy all charts from one dashboard to another |