---
title: Replace Widgets on Dashboard
description: Replace Widgets on Dashboard
product: general
token_estimate: 1835
---
# Replace Widgets on Dashboard

> For AI agents: a documentation index is available at [/llms.txt](/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

## Replace Widgets on Dashboard

**PUT** `/console/v1/dashboards/{id}/widgets`

Full URL: `https://statsigapi.net/console/v1/dashboards/{id}/widgets`

Replace Widgets on Dashboard

## Authorizations

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| STATSIG-API-KEY | string | Yes | — | apiKey (header) |

## Path parameters

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| id (path) | string | Yes | — | id |

## Body (application/json)

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| widgets | oneOf[] | Yes | — | — |
| widgets.type | string | Yes | — | Allowed values: text, header, timeseries, funnel |
| widgets.title | string | Yes | — | — |
| widgets.content | string | No | — | — |
| widgets.width | integer | No | — | Constraints: min: 0, max: 12 |
| widgets.height | integer | No | — | Constraints: min: 0 |
| widgets.color | string | No | — | — |
| widgets.description | string | No | — | — |
| widgets.query | object | No | — | — |
| widgets.query.source | object | No | — | — |
| widgets.query.source.type | string | Yes | — | Allowed values: event |
| widgets.query.source.event_name | string | Yes | — | — |
| widgets.query.source.filters | object[] | No | — | — |
| widgets.query.source.filters.property | object | Yes | — | — |
| widgets.query.source.filters.property.key | string | Yes | — | — |
| widgets.query.source.filters.property.column | unknown | Yes | — | — |
| widgets.query.source.filters.operator | unknown | Yes | — | — |
| widgets.query.source.filters.values | string[] | No | [] | — |
| widgets.query.sources | object[] | No | — | — |
| widgets.query.sources.type | string | Yes | — | Allowed values: event |
| widgets.query.sources.event_name | string | Yes | — | — |
| widgets.query.sources.filters | object[] | No | — | — |
| widgets.query.sources.filters.property | object | Yes | — | — |
| widgets.query.sources.filters.property.key | string | Yes | — | — |
| widgets.query.sources.filters.property.column | unknown | Yes | — | — |
| widgets.query.sources.filters.operator | unknown | Yes | — | — |
| widgets.query.sources.filters.values | string[] | No | [] | — |
| widgets.query.aggregation | object | Yes | — | — |
| widgets.query.aggregation.type | unknown | Yes | — | — |
| widgets.query.aggregation.property | object | No | — | — |
| widgets.query.aggregation.property.key | string | Yes | — | — |
| widgets.query.aggregation.property.column | unknown | Yes | — | — |
| widgets.query.unit_type | string | No | — | — |
| widgets.query.group_bys | object[] | No | — | — |
| widgets.query.group_bys.key | string | Yes | — | — |
| widgets.query.group_bys.column | unknown | Yes | — | — |
| widgets.query.viz | object | No | — | — |
| widgets.query.viz.chart_type | unknown | Yes | — | — |
| widgets.query.steps | object[] | No | — | — |
| widgets.query.steps.event_name | string | Yes | — | — |
| widgets.query.steps.filters | object[] | No | — | — |
| widgets.query.steps.filters.property | object | Yes | — | — |
| widgets.query.steps.filters.property.key | string | Yes | — | — |
| widgets.query.steps.filters.property.column | unknown | Yes | — | — |
| widgets.query.steps.filters.operator | unknown | Yes | — | — |
| widgets.query.steps.filters.values | string[] | No | [] | — |
| widgets.query.conversion_window | object | No | — | — |
| widgets.query.conversion_window.value | integer | Yes | — | Constraints: min: 0 |
| widgets.query.conversion_window.unit | string | Yes | — | Allowed values: second, minute, hour, day |
| widgets.query.chart_type | string | No | — | Allowed values: conversion-rate, conversions |
| defaults | object | No | — | — |
| defaults.date | object | No | — | — |
| defaults.date.value | integer | Yes | — | Constraints: format: int64, min: 0 |
| defaults.date.unit | string | Yes | — | Allowed values: day, week, month |
| defaults.granularity | string | No | — | Allowed values: auto, daily, weekly, monthly |
| max_cols | integer | No | — | Constraints: format: int64, min: 0 |

## Response (application/json)

**200** — Replace dashboard widgets response

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| message | string | Yes | — | A simple string explaining the result of the operation. |
| data | object | Yes | — | — |
| data.ids | string[] | Yes | — | — |

```json
{
  "message": "Dashboard Widgets Replaced Successfully",
  "data": {
    "ids": [
      "widget_id"
    ]
  }
}
```

**404** — Not Found. The requested resource could not be found.

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| status | integer | Yes | — | Allowed values: 404 |
| message | string | Yes | — | — |

```json
{
  "status": 404,
  "message": "Not Found. The requested resource could not be found."
}
```

## Code samples

### cURL

```bash
curl -X PUT "https://statsigapi.net/console/v1/dashboards/{id}/widgets" \
  -H "Content-Type: application/json" \
  -H "STATSIG-API-KEY: YOUR_API_KEY"
```

### Python

```python
import requests

response = requests.put(
    "https://statsigapi.net/console/v1/dashboards/{id}/widgets",
    headers={
        "Content-Type": "application/json",
        "STATSIG-API-KEY": "YOUR_API_KEY"
    }
)
data = response.json()
```

### JavaScript

```javascript
const response = await fetch("https://statsigapi.net/console/v1/dashboards/{id}/widgets", {
  method: "PUT",
  headers: {
    "Content-Type": "application/json",
    "STATSIG-API-KEY": "YOUR_API_KEY"
  }
});
const data = await response.json();
```

### PHP

```php
<?php
$ch = curl_init("https://statsigapi.net/console/v1/dashboards/{id}/widgets");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "STATSIG-API-KEY: YOUR_API_KEY"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
```

### Go

```go
package main

import (
  "bytes"
  "net/http"
)

func main() {
req, _ := http.NewRequest("PUT", "https://statsigapi.net/console/v1/dashboards/{id}/widgets", nil)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("STATSIG-API-KEY", "YOUR_API_KEY")
  client := &http.Client{}
  resp, _ := client.Do(req)
  defer resp.Body.Close()
}
```

### Java

```java
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://statsigapi.net/console/v1/dashboards/{id}/widgets"))
      .method("PUT", HttpRequest.BodyPublishers.noBody())
.header("Content-Type", "application/json")
      .header("STATSIG-API-KEY", "YOUR_API_KEY")
      .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
```

### Ruby

```ruby
require "net/http"
require "json"

uri = URI("https://statsigapi.net/console/v1/dashboards/{id}/widgets")
request = Net::HTTP::Put.new(uri)
request["Content-Type"] = "application/json"
request["STATSIG-API-KEY"] = "YOUR_API_KEY"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end
```

