REST API
Read the user's current layout before changing its widgets. The layout endpoints handle placement, while the widget endpoints expose the individual items.
Open the API Explorer at /docs/api on your Open Mercato instance to inspect request and response schemas or try a call with an API key.
Dashboard endpoints let you hydrate the backend dashboard UI, customize layouts, and introspect widget availability per user or role.
export BASE_URL="http://localhost:3000/api"
export API_KEY="<paste your API key secret here>"
export WIDGET_ID="<dashboard item uuid>"
export ROLE_ID="<role uuid>"
export USER_ID="<user uuid>"
Mint an API key with dashboard features as described in Managing API keys before running these requests.
GET /dashboards/layoutFeature: dashboard.widgets.view
curl -X GET "$BASE_URL/dashboards/layout" \
-H "X-Api-Key: $API_KEY" \
-H "Accept: application/json"
Response (trimmed):
{
"widgets": [
{
"id": "8f221a66-08c3-4ef8-92af-dfb5eca80a2f",
"definitionId": "core.stats.summary",
"grid": { "x": 0, "y": 0, "w": 4, "h": 3 },
"config": { "range": "30d" }
}
]
}
PUT /dashboards/layoutFeature: dashboard.widgets.manage
curl -X PUT "$BASE_URL/dashboards/layout" \
-H "X-Api-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"widgets": [
{
"id": "8f221a66-08c3-4ef8-92af-dfb5eca80a2f",
"definitionId": "core.stats.summary",
"grid": { "x": 0, "y": 0, "w": 6, "h": 4 },
"config": { "range": "90d" }
}
]
}'
Response:
{ "ok": true }
GET /dashboards/layout/{itemId}Feature: dashboard.widgets.view
curl -X GET "$BASE_URL/dashboards/layout/$WIDGET_ID" \
-H "X-Api-Key: $API_KEY" \
-H "Accept: application/json"
Response:
{
"id": "8f221a66-08c3-4ef8-92af-dfb5eca80a2f",
"definitionId": "core.stats.summary",
"grid": { "x": 0, "y": 0, "w": 6, "h": 4 },
"config": { "range": "90d" }
}
DELETE /dashboards/layout/{itemId}Feature: dashboard.widgets.manage
curl -X DELETE "$BASE_URL/dashboards/layout/$WIDGET_ID" \
-H "X-Api-Key: $API_KEY" \
-H "Accept: application/json"
Response:
{ "ok": true }
GET /dashboards/roles/widgetsFeature: dashboard.widgets.view
Use this endpoint to preview which widgets a role will expose.
curl -X GET "$BASE_URL/dashboards/roles/widgets?roleId=$ROLE_ID" \
-H "X-Api-Key: $API_KEY" \
-H "Accept: application/json"
Sample response:
{
"items": [
{
"definitionId": "core.stats.summary",
"title": "Summary",
"description": "Key metrics for the tenant"
}
]
}
GET /dashboards/users/widgetsFeature: dashboard.widgets.view
curl -X GET "$BASE_URL/dashboards/users/widgets?userId=$USER_ID" \
-H "X-Api-Key: $API_KEY" \
-H "Accept: application/json"
Response mirrors the role endpoint but reflects direct user overrides. Combine both responses to build a complete widget catalog for custom dashboards.