Skip to main content
PATCH
/
v2
/
dashboard
/
{dashboard_id}
Update Dashboard
const options = {
  method: 'PATCH',
  headers: {
    'x-api-key': '<x-api-key>',
    'x-organization-id': '<x-organization-id>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({widgets: [{}], layouts: {}})
};

fetch('https://api.dcycle.io/v2/dashboard/{dashboard_id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "id": "<string>",
  "project_id": "<string>",
  "widgets": [
    {}
  ],
  "layouts": {},
  "created_at": {},
  "updated_at": {}
}

Update Dashboard

Update a dashboard’s widgets and/or layouts. Only the organization that owns the project can modify its dashboards — child organizations in the hierarchy have read-only access.
Unknown fields are rejected (extra = "forbid"). Only send widgets and/or layouts in the request body.

Request

Headers

x-api-key
string
required
Your API key for authenticationExample: sk_live_1234567890abcdef
x-organization-id
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Path Parameters

dashboard_id
string
required
UUID of the dashboard to updateExample: "550e8400-e29b-41d4-a716-446655440000"

Body Parameters

widgets
array
Updated list of widget configurations. Each widget requires id, name, and config.
layouts
object
Updated responsive grid layouts by breakpoint (lg, md, sm, xs, xxs).

Response

Returns the updated dashboard object with HTTP 200.
id
string
Dashboard UUID
project_id
string
UUID of the associated project
widgets
array
Updated list of widget configurations
layouts
object
Updated responsive grid layouts
created_at
datetime
Creation timestamp (ISO 8601)
updated_at
datetime | null
Last update timestamp (ISO 8601)

Example

curl -X PATCH "https://api.dcycle.io/v2/dashboard/550e8400-e29b-41d4-a716-446655440000" \
  -H "x-api-key: ${DCYCLE_API_KEY}" \
  -H "x-organization-id: ${DCYCLE_ORG_ID}" \
  -H "Content-Type: application/json" \
  -d '{
    "widgets": [
      {
        "id": "widget-1",
        "name": "Total Emissions 2024",
        "type": "bar_chart",
        "config": {
          "metrics": [{
            "id": "m1",
            "category": "emissions",
            "filters": [],
            "aggregation": { "organizations": [{ "id": "org-uuid" }] }
          }],
          "periodicity": "monthly",
          "periods": [{ "start_date": "2024-01-01", "end_date": "2024-12-31" }],
          "unit": "tCO2e"
        }
      }
    ],
    "layouts": {
      "lg": [{ "i": "widget-1", "x": 0, "y": 0, "w": 12, "h": 6 }],
      "md": [{ "i": "widget-1", "x": 0, "y": 0, "w": 10, "h": 6 }],
      "sm": [{ "i": "widget-1", "x": 0, "y": 0, "w": 6, "h": 4 }],
      "xs": [{ "i": "widget-1", "x": 0, "y": 0, "w": 4, "h": 4 }],
      "xxs": [{ "i": "widget-1", "x": 0, "y": 0, "w": 2, "h": 4 }]
    }
  }'

Successful Response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "project_id": "a8315ef3-dd50-43f8-b7ce-d839e68d51fa",
  "widgets": [
    {
      "id": "widget-1",
      "name": "Total Emissions 2024",
      "type": "bar_chart",
      "config": { ... }
    }
  ],
  "layouts": {
    "lg": [{ "i": "widget-1", "x": 0, "y": 0, "w": 12, "h": 6 }],
    "md": [],
    "sm": [],
    "xs": [],
    "xxs": []
  },
  "created_at": "2024-11-24T10:30:00Z",
  "updated_at": "2024-12-20T09:15:00Z"
}

Common Errors

401 Unauthorized

Cause: Missing or invalid API key
{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}

403 Forbidden

Cause: The user is not a member of the organization, or your organization is not the owner of this dashboard’s project
{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
{
  "detail": "Only the owning organization can modify this dashboard."
}

404 Not Found

Cause: Dashboard does not exist
{
  "detail": "Not found."
}

422 Validation Error

Cause: Request body contains unknown fields
{
  "detail": [
    {
      "loc": ["body", "unknown_field"],
      "msg": "extra fields not permitted",
      "type": "value_error.extra"
    }
  ]
}

Get Dashboard

View the current dashboard state

Delete Dashboard

Remove a dashboard