Update partially custom widget by ID
curl --request PATCH \
--url https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Done tasks per hub (top 5)",
"spec": {
"specVersion": 1,
"dataSourceId": "task",
"timeField": "doneTime",
"measures": [
{
"id": "m1",
"fn": "count"
}
],
"dimensions": [
{
"id": "d1",
"kind": "terms",
"field": "hubName",
"limit": 5
}
],
"filters": [
{
"id": "f1",
"field": "status",
"operator": "eq",
"value": "DONE"
}
]
}
}
'import requests
url = "https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id}"
payload = {
"name": "Done tasks per hub (top 5)",
"spec": {
"specVersion": 1,
"dataSourceId": "task",
"timeField": "doneTime",
"measures": [
{
"id": "m1",
"fn": "count"
}
],
"dimensions": [
{
"id": "d1",
"kind": "terms",
"field": "hubName",
"limit": 5
}
],
"filters": [
{
"id": "f1",
"field": "status",
"operator": "eq",
"value": "DONE"
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Done tasks per hub (top 5)',
spec: {
specVersion: 1,
dataSourceId: 'task',
timeField: 'doneTime',
measures: [{id: 'm1', fn: 'count'}],
dimensions: [{id: 'd1', kind: 'terms', field: 'hubName', limit: 5}],
filters: [{id: 'f1', field: 'status', operator: 'eq', value: 'DONE'}]
}
})
};
fetch('https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Done tasks per hub (top 5)',
'spec' => [
'specVersion' => 1,
'dataSourceId' => 'task',
'timeField' => 'doneTime',
'measures' => [
[
'id' => 'm1',
'fn' => 'count'
]
],
'dimensions' => [
[
'id' => 'd1',
'kind' => 'terms',
'field' => 'hubName',
'limit' => 5
]
],
'filters' => [
[
'id' => 'f1',
'field' => 'status',
'operator' => 'eq',
'value' => 'DONE'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id}"
payload := strings.NewReader("{\n \"name\": \"Done tasks per hub (top 5)\",\n \"spec\": {\n \"specVersion\": 1,\n \"dataSourceId\": \"task\",\n \"timeField\": \"doneTime\",\n \"measures\": [\n {\n \"id\": \"m1\",\n \"fn\": \"count\"\n }\n ],\n \"dimensions\": [\n {\n \"id\": \"d1\",\n \"kind\": \"terms\",\n \"field\": \"hubName\",\n \"limit\": 5\n }\n ],\n \"filters\": [\n {\n \"id\": \"f1\",\n \"field\": \"status\",\n \"operator\": \"eq\",\n \"value\": \"DONE\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Done tasks per hub (top 5)\",\n \"spec\": {\n \"specVersion\": 1,\n \"dataSourceId\": \"task\",\n \"timeField\": \"doneTime\",\n \"measures\": [\n {\n \"id\": \"m1\",\n \"fn\": \"count\"\n }\n ],\n \"dimensions\": [\n {\n \"id\": \"d1\",\n \"kind\": \"terms\",\n \"field\": \"hubName\",\n \"limit\": 5\n }\n ],\n \"filters\": [\n {\n \"id\": \"f1\",\n \"field\": \"status\",\n \"operator\": \"eq\",\n \"value\": \"DONE\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Done tasks per hub (top 5)\",\n \"spec\": {\n \"specVersion\": 1,\n \"dataSourceId\": \"task\",\n \"timeField\": \"doneTime\",\n \"measures\": [\n {\n \"id\": \"m1\",\n \"fn\": \"count\"\n }\n ],\n \"dimensions\": [\n {\n \"id\": \"d1\",\n \"kind\": \"terms\",\n \"field\": \"hubName\",\n \"limit\": 5\n }\n ],\n \"filters\": [\n {\n \"id\": \"f1\",\n \"field\": \"status\",\n \"operator\": \"eq\",\n \"value\": \"DONE\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"code": 200,
"message": "Widget has been updated successfully.",
"data": {
"_id": "66fcd2a1e4b0a7d3c1f20c01",
"organizationId": "6650c2a1f3b9e4001c7d2a10",
"schemaVersion": 1,
"name": "Done tasks per hub (top 5)",
"description": "Completed tasks per hub in the selected range.",
"category": "custom",
"viz": "bar",
"spec": {
"specVersion": 1,
"dataSourceId": "task",
"timeField": "doneTime",
"measures": [
{
"id": "m1",
"fn": "count"
}
],
"dimensions": [
{
"id": "d1",
"kind": "terms",
"field": "hubName",
"limit": 5
}
],
"filters": [
{
"id": "f1",
"field": "status",
"operator": "eq",
"value": "DONE"
}
]
},
"composite": null,
"content": null,
"defaultLayout": {
"w": 6,
"h": 6
},
"isCustom": true,
"createdBy": "[email protected]",
"updatedBy": "[email protected]",
"createdTime": "2026-10-02T03:00:00.000000Z",
"updatedTime": "2026-10-02T04:10:00.000000Z"
}
}{
"status": false,
"message": "Unknown chart type 'pie'. Allowed: bar, donut, heatmap, kpi, line, table.",
"failedCode": "dydsh-014"
}{
"status": false,
"message": "Unauthenticated.",
"failedCode": "auth-034"
}{
"status": false,
"message": "Access denied. You do not have permission for edit dashboard. Please contact your admin to request access.",
"failedCode": "sys-035"
}{
"status": false,
"code": 404,
"message": "Custom widget not found.",
"data": [],
"failedCode": "dydsh-041"
}{
"status": false,
"code": 500,
"message": "something_wrong",
"failedCode": "dydsh-045"
}Dashboard
Update partially custom widget by ID
Partially updates a custom widget of the caller’s organization. Only the fields sent are changed. Cards that already use the widget keep their own copy and do not change.
PATCH
/
dynamic-dashboard-widget
/
{id}
Update partially custom widget by ID
curl --request PATCH \
--url https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Done tasks per hub (top 5)",
"spec": {
"specVersion": 1,
"dataSourceId": "task",
"timeField": "doneTime",
"measures": [
{
"id": "m1",
"fn": "count"
}
],
"dimensions": [
{
"id": "d1",
"kind": "terms",
"field": "hubName",
"limit": 5
}
],
"filters": [
{
"id": "f1",
"field": "status",
"operator": "eq",
"value": "DONE"
}
]
}
}
'import requests
url = "https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id}"
payload = {
"name": "Done tasks per hub (top 5)",
"spec": {
"specVersion": 1,
"dataSourceId": "task",
"timeField": "doneTime",
"measures": [
{
"id": "m1",
"fn": "count"
}
],
"dimensions": [
{
"id": "d1",
"kind": "terms",
"field": "hubName",
"limit": 5
}
],
"filters": [
{
"id": "f1",
"field": "status",
"operator": "eq",
"value": "DONE"
}
]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Done tasks per hub (top 5)',
spec: {
specVersion: 1,
dataSourceId: 'task',
timeField: 'doneTime',
measures: [{id: 'm1', fn: 'count'}],
dimensions: [{id: 'd1', kind: 'terms', field: 'hubName', limit: 5}],
filters: [{id: 'f1', field: 'status', operator: 'eq', value: 'DONE'}]
}
})
};
fetch('https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Done tasks per hub (top 5)',
'spec' => [
'specVersion' => 1,
'dataSourceId' => 'task',
'timeField' => 'doneTime',
'measures' => [
[
'id' => 'm1',
'fn' => 'count'
]
],
'dimensions' => [
[
'id' => 'd1',
'kind' => 'terms',
'field' => 'hubName',
'limit' => 5
]
],
'filters' => [
[
'id' => 'f1',
'field' => 'status',
'operator' => 'eq',
'value' => 'DONE'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id}"
payload := strings.NewReader("{\n \"name\": \"Done tasks per hub (top 5)\",\n \"spec\": {\n \"specVersion\": 1,\n \"dataSourceId\": \"task\",\n \"timeField\": \"doneTime\",\n \"measures\": [\n {\n \"id\": \"m1\",\n \"fn\": \"count\"\n }\n ],\n \"dimensions\": [\n {\n \"id\": \"d1\",\n \"kind\": \"terms\",\n \"field\": \"hubName\",\n \"limit\": 5\n }\n ],\n \"filters\": [\n {\n \"id\": \"f1\",\n \"field\": \"status\",\n \"operator\": \"eq\",\n \"value\": \"DONE\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Done tasks per hub (top 5)\",\n \"spec\": {\n \"specVersion\": 1,\n \"dataSourceId\": \"task\",\n \"timeField\": \"doneTime\",\n \"measures\": [\n {\n \"id\": \"m1\",\n \"fn\": \"count\"\n }\n ],\n \"dimensions\": [\n {\n \"id\": \"d1\",\n \"kind\": \"terms\",\n \"field\": \"hubName\",\n \"limit\": 5\n }\n ],\n \"filters\": [\n {\n \"id\": \"f1\",\n \"field\": \"status\",\n \"operator\": \"eq\",\n \"value\": \"DONE\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/dynamic-dashboard-widget/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Done tasks per hub (top 5)\",\n \"spec\": {\n \"specVersion\": 1,\n \"dataSourceId\": \"task\",\n \"timeField\": \"doneTime\",\n \"measures\": [\n {\n \"id\": \"m1\",\n \"fn\": \"count\"\n }\n ],\n \"dimensions\": [\n {\n \"id\": \"d1\",\n \"kind\": \"terms\",\n \"field\": \"hubName\",\n \"limit\": 5\n }\n ],\n \"filters\": [\n {\n \"id\": \"f1\",\n \"field\": \"status\",\n \"operator\": \"eq\",\n \"value\": \"DONE\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"code": 200,
"message": "Widget has been updated successfully.",
"data": {
"_id": "66fcd2a1e4b0a7d3c1f20c01",
"organizationId": "6650c2a1f3b9e4001c7d2a10",
"schemaVersion": 1,
"name": "Done tasks per hub (top 5)",
"description": "Completed tasks per hub in the selected range.",
"category": "custom",
"viz": "bar",
"spec": {
"specVersion": 1,
"dataSourceId": "task",
"timeField": "doneTime",
"measures": [
{
"id": "m1",
"fn": "count"
}
],
"dimensions": [
{
"id": "d1",
"kind": "terms",
"field": "hubName",
"limit": 5
}
],
"filters": [
{
"id": "f1",
"field": "status",
"operator": "eq",
"value": "DONE"
}
]
},
"composite": null,
"content": null,
"defaultLayout": {
"w": 6,
"h": 6
},
"isCustom": true,
"createdBy": "[email protected]",
"updatedBy": "[email protected]",
"createdTime": "2026-10-02T03:00:00.000000Z",
"updatedTime": "2026-10-02T04:10:00.000000Z"
}
}{
"status": false,
"message": "Unknown chart type 'pie'. Allowed: bar, donut, heatmap, kpi, line, table.",
"failedCode": "dydsh-014"
}{
"status": false,
"message": "Unauthenticated.",
"failedCode": "auth-034"
}{
"status": false,
"message": "Access denied. You do not have permission for edit dashboard. Please contact your admin to request access.",
"failedCode": "sys-035"
}{
"status": false,
"code": 404,
"message": "Custom widget not found.",
"data": [],
"failedCode": "dydsh-041"
}{
"status": false,
"code": 500,
"message": "something_wrong",
"failedCode": "dydsh-045"
}Authorizations
Use a valid Bearer token to authenticate.
Path Parameters
Custom widget _id
Body
application/json
Fields to change
Literal display name, never translated
Maximum string length:
200Chart type: one of the chart types used by the built-in query widgets (currently bar, donut, heatmap, kpi, line, table)
Maximum string length:
50Query spec, validated the same way as Run analytics query. Do not send timeRange; the dashboard supplies it.
Default card size when the widget is added to a dashboard
Show child attributes
Show child attributes