Create a dashboard
curl --request POST \
--url https://clarus-api.com/api/dashboards \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "dashboards",
"attributes": {
"code": "warehouse-ops",
"name": "Warehouse Operations",
"description": "Day-to-day operational view",
"is_active": true,
"is_default": true,
"role_ids": [
1,
4
]
}
}
}
'import requests
url = "https://clarus-api.com/api/dashboards"
payload = { "data": {
"type": "dashboards",
"attributes": {
"code": "warehouse-ops",
"name": "Warehouse Operations",
"description": "Day-to-day operational view",
"is_active": True,
"is_default": True,
"role_ids": [1, 4]
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
type: 'dashboards',
attributes: {
code: 'warehouse-ops',
name: 'Warehouse Operations',
description: 'Day-to-day operational view',
is_active: true,
is_default: true,
role_ids: [1, 4]
}
}
})
};
fetch('https://clarus-api.com/api/dashboards', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": 3
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Dashboards
Create a dashboard
Create a new dashboard. Associate roles by passing role_ids inside attributes. Setting is_default: true clears the default flag from every other dashboard atomically.
POST
/
api
/
dashboards
Create a dashboard
curl --request POST \
--url https://clarus-api.com/api/dashboards \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Clarus-Subdomain: <api-key>' \
--data '
{
"data": {
"type": "dashboards",
"attributes": {
"code": "warehouse-ops",
"name": "Warehouse Operations",
"description": "Day-to-day operational view",
"is_active": true,
"is_default": true,
"role_ids": [
1,
4
]
}
}
}
'import requests
url = "https://clarus-api.com/api/dashboards"
payload = { "data": {
"type": "dashboards",
"attributes": {
"code": "warehouse-ops",
"name": "Warehouse Operations",
"description": "Day-to-day operational view",
"is_active": True,
"is_default": True,
"role_ids": [1, 4]
}
} }
headers = {
"Authorization": "Bearer <token>",
"X-Clarus-Subdomain": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'X-Clarus-Subdomain': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
type: 'dashboards',
attributes: {
code: 'warehouse-ops',
name: 'Warehouse Operations',
description: 'Day-to-day operational view',
is_active: true,
is_default: true,
role_ids: [1, 4]
}
}
})
};
fetch('https://clarus-api.com/api/dashboards', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": 3
}{
"error": "<string>"
}{
"errors": [
{
"code": 123,
"symbol": "<string>",
"details": "<string>",
"source": "<string>",
"context": {}
}
]
}Request Structure
{
"data": {
"type": "dashboards",
"attributes": {
"code": "warehouse-ops",
"name": "Warehouse Operations",
"description": "Day-to-day operational view",
"is_active": true,
"is_default": true,
"role_ids": [1, 4]
}
}
}
Key Fields
| Field | Required | Description |
|---|---|---|
code | Yes | Unique dashboard code (max 30 chars) |
name | Yes | Display name (max 50 chars) |
description | No | Optional description (max 255 chars) |
is_active | No | Whether the dashboard is visible to users (default true) |
is_default | No | When true, this dashboard becomes the default for users — the previous default is cleared atomically (default false) |
role_ids | No | Array of role IDs that can access this dashboard. Passed inside attributes (not relationships) |
Adding widgets
UsePUT /api/dashboards/{id}/widgets (setDashboardWidgetPlacements) to attach widgets to the dashboard. That endpoint replaces all placements atomically.
