# Update dashboard custom code

Replace the custom code configuration for a dashboard.

Source: https://statusdashboard.com/docs/api/status-dashboards/dashboards/custom-code/update

`PUT /app/dashboards/{id}/custom-code`

Replaces the custom CSS, JavaScript, header HTML, and footer HTML for a dashboard. This is a full replacement. Requires the **Custom Code** feature entitlement.

Pass empty strings to clear individual fields. When all fields are empty strings, the `customCode` attribute is removed from the dashboard.

***

## Path parameters
| Parameter | Description                |
| --------- | -------------------------- |
| `id`      | The UUID of the dashboard. |

***

## Request
See [API Basics](/docs/api) for required headers.

### Request body
| Field        | Type   | Description                                                                                                              |
| ------------ | ------ | ------------------------------------------------------------------------------------------------------------------------ |
| `css`        | string | Raw CSS injected into a `<style>` tag on the status dashboard. Maximum 50,000 characters. Pass an empty string to clear. |
| `js`         | string | Raw JavaScript executed on the status dashboard. Maximum 50,000 characters. Pass an empty string to clear.               |
| `headerHtml` | string | Raw HTML injected above the status banner. Maximum 50,000 characters. Pass an empty string to clear.                     |
| `footerHtml` | string | Raw HTML injected below the event history section. Maximum 50,000 characters. Pass an empty string to clear.             |

***

## Sample request
```bash
curl -X PUT https://api.statusdashboard.com/app/dashboards/a1b2c3d4-e5f6-7890-abcd-ef1234567890/custom-code \
  -H "Authorization: Bearer bcf847abf5c6:def456" \
  -H "Content-Type: application/json" \
  -d '{
    "css": "body { font-family: Inter, sans-serif; }",
    "js": "console.log('\''Status dashboard loaded'\'');",
    "headerHtml": "",
    "footerHtml": ""
  }'
```

## Sample response
**Status: `200 OK`**

```json
{
  "css": "body { font-family: Inter, sans-serif; }",
  "js": "console.log('Status dashboard loaded');",
  "headerHtml": "",
  "footerHtml": ""
}
```

***

## Error responses
| Status | When                                                                 |
| ------ | -------------------------------------------------------------------- |
| `400`  | Validation failure — field exceeds maximum length.                   |
| `403`  | Insufficient permissions, or the Custom Code feature is not enabled. |
| `404`  | Dashboard not found or does not belong to the caller's organization. |
