Save the dashboard layout, the theme, or both.
PUT
/api/dashboard/layout
const url = 'https://api.tradr.cloud/api/dashboard/layout';const options = { method: 'PUT', headers: {'Content-Type': 'application/json'}, body: '{"theme":"light","widgets":[{"config":"example","h":1,"id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","type":"stats-summary","w":1,"x":1,"y":1}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.tradr.cloud/api/dashboard/layout \ --header 'Content-Type: application/json' \ --data '{ "theme": "light", "widgets": [ { "config": "example", "h": 1, "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "type": "stats-summary", "w": 1, "x": 1, "y": 1 } ] }'Authed. Send widgets, theme, or both — a body with neither is a 400. widgets replaces the whole layout; it is not a patch. Placements are validated as a set: at most one widget of each type, no two overlapping, none extending past the 12-column grid, and none below its type’s minimum size. When theme is sent the response also sets the tradr_theme cookie so the next page load paints without a flash.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
theme
string
widgets
Array<object>
One widget on the dashboard grid. The grid is 12 columns wide and rows are a fixed height, so x/w are columns and y/h are rows.
object
config
Optional per-widget settings. Serialises to at most 2048 bytes.
h
required
integer
id
required
string format: uuid
type
required
string
w
required
X + w must not exceed 12.
integer
x
required
integer
y
required
integer
Responses
Section titled “Responses”The saved layout.
Validation error
PAYLOAD_TOO_LARGE — the request body exceeds the limit.