---
title: Update a notebook widget
description: Update the widget definition or notebook-owned graph_size, time, or split_by.
breadcrumbs: Docs > API > Update a notebook widget
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Update a notebook widget

## v2 (latest)

{% alert level="warning" %}
**Note**: This endpoint is in preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help.md).
{% /alert %}

| Datadog site      | API endpoint                                                                           |
| ----------------- | -------------------------------------------------------------------------------------- |
| app.datadoghq.com | PATCH https://api.datadoghq.com/api/v2/notebooks/{notebook_id}/widgets/{widget_id}     |
| us3.datadoghq.com | PATCH https://api.us3.datadoghq.com/api/v2/notebooks/{notebook_id}/widgets/{widget_id} |
| us5.datadoghq.com | PATCH https://api.us5.datadoghq.com/api/v2/notebooks/{notebook_id}/widgets/{widget_id} |
| app.datadoghq.eu  | PATCH https://api.datadoghq.eu/api/v2/notebooks/{notebook_id}/widgets/{widget_id}      |
| ap1.datadoghq.com | PATCH https://api.ap1.datadoghq.com/api/v2/notebooks/{notebook_id}/widgets/{widget_id} |
| ap2.datadoghq.com | PATCH https://api.ap2.datadoghq.com/api/v2/notebooks/{notebook_id}/widgets/{widget_id} |
| uk1.datadoghq.com | PATCH https://api.uk1.datadoghq.com/api/v2/notebooks/{notebook_id}/widgets/{widget_id} |
| app.ddog-gov.com  | PATCH https://api.ddog-gov.com/api/v2/notebooks/{notebook_id}/widgets/{widget_id}      |
| us2.ddog-gov.com  | PATCH https://api.us2.ddog-gov.com/api/v2/notebooks/{notebook_id}/widgets/{widget_id}  |

### Overview

Update the widget definition or notebook-owned graph_size, time, or split_by. Supply at least one
writable field. Definitions are replaced as a whole; title belongs in definition.title. Null
clears graph_size, time, or split_by. Request and response bodies must be JSON. Returns the
updated widget.

Widgets accept and return JSON only; text/markdown is rejected. Resource requests accept
application/json or application/vnd.api+json; JSON responses and all errors use
application/vnd.api+json.

This endpoint requires the `notebooks_write` permission.

### Arguments

#### Path Parameters

| Field                    | Type    | Description                                        |
| ------------------------ | ------- | -------------------------------------------------- |
| notebook_id [*required*] | integer | Unique notebook ID.                                |
| widget_id [*required*]   | string  | Stable widget ID returned by the widgets endpoint. |

#### Header Parameters

| Field  | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ------ | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Prefer | string | Use `handling=lenient` to preserve recoverable invalid widget definitions as placeholders when recovery is enabled. The default is strict. Invalid metadata, envelopes, IDs, and size limits still fail. `Preference-Applied: handling=lenient` confirms when the preference was honored. JSON responses report invalid widgets in `meta.warnings`. Full-notebook Markdown responses include `warnings` in YAML frontmatter. Warnings can also describe previously saved invalid widgets; they do not necessarily mean the current request used lenient handling. |

### Request

#### Body Data (required)

Resource update request.

{% tabs %}
{% tab label="Model" %}
| Parent field      | Field                                  | Type     | Description                                                                                                                                                                                                                                                               |
| ----------------- | -------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                   | data [*required*]                      | object   | Widget update data. The ID must match the URL.                                                                                                                                                                                                                            |
| data              | attributes [*required*]                | <oneOf>  | Writable widget attributes. At least one writable attribute is required; omitted fields are unchanged.                                                                                                                                                                    |
| attributes        | Object 1                               | object   | Writable attributes with definition supplied.                                                                                                                                                                                                                             |
| Object 1          | definition [*required*]                | object   | Notebook widget definition. The type selects the widget-specific schema; title is stored here. Supports notebook widgets, including analysis widgets and invalid_widget placeholders. Markdown and rich-text definitions cannot be submitted through the widget endpoint. |
| definition        | original_definition                    | object   | Original definition preserved by an invalid_widget placeholder.                                                                                                                                                                                                           |
| definition        | title                                  | string   | Optional widget title. Omit it from a replacement definition to clear the title.                                                                                                                                                                                          |
| definition        | type [*required*]                      | string   | Notebook widget type.                                                                                                                                                                                                                                                     |
| definition        | validation_errors                      | [object] | Nonempty diagnostics required for an invalid_widget placeholder.                                                                                                                                                                                                          |
| validation_errors | code [*required*]                      | string   | Machine-readable diagnostic code.                                                                                                                                                                                                                                         |
| validation_errors | location [*required*]                  | object   | Location of a diagnostic in its documented representation.                                                                                                                                                                                                                |
| location          | pointer [*required*]                   | string   | JSON Pointer to the affected field.                                                                                                                                                                                                                                       |
| validation_errors | message [*required*]                   | string   | Description of the validation failure.                                                                                                                                                                                                                                    |
| Object 1          | document_revision                      | uuid     | Opaque document revision UUID. Send the most recently observed value when updating the notebook.                                                                                                                                                                          |
| Object 1          | graph_size                             | enum     | Widget graph size. Null clears the local size. Allowed enum values: `xs`, `s`, `m`, `l`, `xl`, `null`.                                                                                                                                                                    |
| Object 1          | split_by                               | object   | Widget split configuration. Null clears the configuration.                                                                                                                                                                                                                |
| split_by          | keys [*required*]                      | [string] | Split keys.                                                                                                                                                                                                                                                               |
| split_by          | tags [*required*]                      | [string] | Split tags.                                                                                                                                                                                                                                                               |
| Object 1          | time                                   | <oneOf>  | Widget time for writes. Use one supported time shape with an optional completeness preference, only the preference, or null to clear local time.                                                                                                                          |
| time              | Object 1                               | object   | Relative notebook time range.                                                                                                                                                                                                                                             |
| Object 1          | hide_incomplete_cost_data              | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| Object 1          | live_span [*required*]                 | string   | Relative time span, including custom durations.                                                                                                                                                                                                                           |
| time              | Object 2                               | object   | Absolute notebook time range. Both absolute bounds must include a timezone or both omit it, with start before end.                                                                                                                                                        |
| Object 2          | end [*required*]                       | string   | End time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                    |
| Object 2          | hide_incomplete_cost_data              | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| Object 2          | live                                   | boolean  | Whether the time range should shift to end at the current time.                                                                                                                                                                                                           |
| Object 2          | start [*required*]                     | string   | Start time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                  |
| time              | Object 3                               | object   | Growing time range with a fixed start. Set live to false to pause the range. Both absolute bounds must include a timezone or both omit it, with start before end.                                                                                                         |
| Object 3          | end [*required*]                       | string   | End time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                    |
| Object 3          | hide_incomplete_cost_data              | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| Object 3          | live [*required*]                      | boolean  | Whether the time range should shift to end at the current time.                                                                                                                                                                                                           |
| Object 3          | start [*required*]                     | string   | Start time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                  |
| Object 3          | type [*required*]                      | enum     | Growing time range type. Allowed enum values: `growing`.                                                                                                                                                                                                                  |
| time              | Object 4                               | object   | Calendar-aligned time range. Start and end provide the resolved range, with start before end. Both absolute bounds must include a timezone or both omit it, with start before end.                                                                                        |
| Object 4          | end [*required*]                       | string   | End time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                    |
| Object 4          | hide_incomplete_cost_data              | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| Object 4          | live [*required*]                      | boolean  | Whether the time range should shift to end at the current time.                                                                                                                                                                                                           |
| Object 4          | offset [*required*]                    | int64    | Number of calendar periods before the current period.                                                                                                                                                                                                                     |
| Object 4          | start [*required*]                     | string   | Start time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                  |
| Object 4          | type [*required*]                      | enum     | Calendar time range type. Allowed enum values: `daily`, `weekly`, `monthly`, `yearly`.                                                                                                                                                                                    |
| time              | Object 5                               | object   | Cloud Cost completeness preference without a local time range. Null clears local time.                                                                                                                                                                                    |
| Object 5          | hide_incomplete_cost_data [*required*] | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| attributes        | Object 2                               | object   | Writable attributes with graph_size supplied.                                                                                                                                                                                                                             |
| Object 2          | document_revision                      | uuid     | Opaque document revision UUID. Send the most recently observed value when updating the notebook.                                                                                                                                                                          |
| Object 2          | graph_size [*required*]                | enum     | Widget graph size. Null clears the local size. Allowed enum values: `xs`, `s`, `m`, `l`, `xl`, `null`.                                                                                                                                                                    |
| Object 2          | split_by                               | object   | Widget split configuration. Null clears the configuration.                                                                                                                                                                                                                |
| split_by          | keys [*required*]                      | [string] | Split keys.                                                                                                                                                                                                                                                               |
| split_by          | tags [*required*]                      | [string] | Split tags.                                                                                                                                                                                                                                                               |
| Object 2          | time                                   | <oneOf>  | Widget time for writes. Use one supported time shape with an optional completeness preference, only the preference, or null to clear local time.                                                                                                                          |
| time              | Object 1                               | object   | Relative notebook time range.                                                                                                                                                                                                                                             |
| Object 1          | hide_incomplete_cost_data              | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| Object 1          | live_span [*required*]                 | string   | Relative time span, including custom durations.                                                                                                                                                                                                                           |
| time              | Object 2                               | object   | Absolute notebook time range. Both absolute bounds must include a timezone or both omit it, with start before end.                                                                                                                                                        |
| Object 2          | end [*required*]                       | string   | End time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                    |
| Object 2          | hide_incomplete_cost_data              | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| Object 2          | live                                   | boolean  | Whether the time range should shift to end at the current time.                                                                                                                                                                                                           |
| Object 2          | start [*required*]                     | string   | Start time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                  |
| time              | Object 3                               | object   | Growing time range with a fixed start. Set live to false to pause the range. Both absolute bounds must include a timezone or both omit it, with start before end.                                                                                                         |
| Object 3          | end [*required*]                       | string   | End time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                    |
| Object 3          | hide_incomplete_cost_data              | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| Object 3          | live [*required*]                      | boolean  | Whether the time range should shift to end at the current time.                                                                                                                                                                                                           |
| Object 3          | start [*required*]                     | string   | Start time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                  |
| Object 3          | type [*required*]                      | enum     | Growing time range type. Allowed enum values: `growing`.                                                                                                                                                                                                                  |
| time              | Object 4                               | object   | Calendar-aligned time range. Start and end provide the resolved range, with start before end. Both absolute bounds must include a timezone or both omit it, with start before end.                                                                                        |
| Object 4          | end [*required*]                       | string   | End time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                    |
| Object 4          | hide_incomplete_cost_data              | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| Object 4          | live [*required*]                      | boolean  | Whether the time range should shift to end at the current time.                                                                                                                                                                                                           |
| Object 4          | offset [*required*]                    | int64    | Number of calendar periods before the current period.                                                                                                                                                                                                                     |
| Object 4          | start [*required*]                     | string   | Start time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                  |
| Object 4          | type [*required*]                      | enum     | Calendar time range type. Allowed enum values: `daily`, `weekly`, `monthly`, `yearly`.                                                                                                                                                                                    |
| time              | Object 5                               | object   | Cloud Cost completeness preference without a local time range. Null clears local time.                                                                                                                                                                                    |
| Object 5          | hide_incomplete_cost_data [*required*] | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| attributes        | Object 3                               | object   | Writable attributes with time supplied.                                                                                                                                                                                                                                   |
| Object 3          | document_revision                      | uuid     | Opaque document revision UUID. Send the most recently observed value when updating the notebook.                                                                                                                                                                          |
| Object 3          | split_by                               | object   | Widget split configuration. Null clears the configuration.                                                                                                                                                                                                                |
| split_by          | keys [*required*]                      | [string] | Split keys.                                                                                                                                                                                                                                                               |
| split_by          | tags [*required*]                      | [string] | Split tags.                                                                                                                                                                                                                                                               |
| Object 3          | time [*required*]                      | <oneOf>  | Widget time for writes. Use one supported time shape with an optional completeness preference, only the preference, or null to clear local time.                                                                                                                          |
| time              | Object 1                               | object   | Relative notebook time range.                                                                                                                                                                                                                                             |
| Object 1          | hide_incomplete_cost_data              | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| Object 1          | live_span [*required*]                 | string   | Relative time span, including custom durations.                                                                                                                                                                                                                           |
| time              | Object 2                               | object   | Absolute notebook time range. Both absolute bounds must include a timezone or both omit it, with start before end.                                                                                                                                                        |
| Object 2          | end [*required*]                       | string   | End time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                    |
| Object 2          | hide_incomplete_cost_data              | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| Object 2          | live                                   | boolean  | Whether the time range should shift to end at the current time.                                                                                                                                                                                                           |
| Object 2          | start [*required*]                     | string   | Start time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                  |
| time              | Object 3                               | object   | Growing time range with a fixed start. Set live to false to pause the range. Both absolute bounds must include a timezone or both omit it, with start before end.                                                                                                         |
| Object 3          | end [*required*]                       | string   | End time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                    |
| Object 3          | hide_incomplete_cost_data              | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| Object 3          | live [*required*]                      | boolean  | Whether the time range should shift to end at the current time.                                                                                                                                                                                                           |
| Object 3          | start [*required*]                     | string   | Start time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                  |
| Object 3          | type [*required*]                      | enum     | Growing time range type. Allowed enum values: `growing`.                                                                                                                                                                                                                  |
| time              | Object 4                               | object   | Calendar-aligned time range. Start and end provide the resolved range, with start before end. Both absolute bounds must include a timezone or both omit it, with start before end.                                                                                        |
| Object 4          | end [*required*]                       | string   | End time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                    |
| Object 4          | hide_incomplete_cost_data              | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| Object 4          | live [*required*]                      | boolean  | Whether the time range should shift to end at the current time.                                                                                                                                                                                                           |
| Object 4          | offset [*required*]                    | int64    | Number of calendar periods before the current period.                                                                                                                                                                                                                     |
| Object 4          | start [*required*]                     | string   | Start time as an ISO 8601 timestamp. The timezone may be omitted if both bounds omit it.                                                                                                                                                                                  |
| Object 4          | type [*required*]                      | enum     | Calendar time range type. Allowed enum values: `daily`, `weekly`, `monthly`, `yearly`.                                                                                                                                                                                    |
| time              | Object 5                               | object   | Cloud Cost completeness preference without a local time range. Null clears local time.                                                                                                                                                                                    |
| Object 5          | hide_incomplete_cost_data [*required*] | boolean  | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| attributes        | Object 4                               | object   | Writable attributes with split_by supplied.                                                                                                                                                                                                                               |
| Object 4          | document_revision                      | uuid     | Opaque document revision UUID. Send the most recently observed value when updating the notebook.                                                                                                                                                                          |
| Object 4          | split_by [*required*]                  | object   | Widget split configuration. Null clears the configuration.                                                                                                                                                                                                                |
| split_by          | keys [*required*]                      | [string] | Split keys.                                                                                                                                                                                                                                                               |
| split_by          | tags [*required*]                      | [string] | Split tags.                                                                                                                                                                                                                                                               |
| data              | id [*required*]                        | string   | Stable widget ID.                                                                                                                                                                                                                                                         |
| data              | type [*required*]                      | enum     | Notebook widget resource type. Allowed enum values: `notebook_widgets`.                                                                                                                                                                                                   |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "definition": {
        "original_definition": {},
        "title": "CPU usage",
        "type": "timeseries",
        "validation_errors": [
          {
            "code": "invalid_widget",
            "location": {
              "pointer": "/data/attributes/definition/requests"
            },
            "message": "The requests field must be an array."
          }
        ]
      },
      "document_revision": "123e4567-e89b-12d3-a456-426614174456",
      "graph_size": "xs",
      "split_by": {
        "keys": [
          "service"
        ],
        "tags": [
          "env:prod"
        ]
      },
      "time": {
        "hide_incomplete_cost_data": true,
        "live_span": "1h"
      }
    },
    "id": "w9c4h7b5",
    "type": "notebook_widgets"
  }
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
Response containing a widget.

| Parent field      | Field                          | Type      | Description                                                                                                                                                                                                                                                               |
| ----------------- | ------------------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                   | data [*required*]              | object    | A notebook widget resource.                                                                                                                                                                                                                                               |
| data              | attributes [*required*]        | object    | Widget attributes. The title is in definition.title; split_by is omitted when empty.                                                                                                                                                                                      |
| attributes        | definition [*required*]        | object    | Notebook widget definition. The type selects the widget-specific schema; title is stored here. Supports notebook widgets, including analysis widgets and invalid_widget placeholders. Markdown and rich-text definitions cannot be submitted through the widget endpoint. |
| definition        | original_definition            | object    | Original definition preserved by an invalid_widget placeholder.                                                                                                                                                                                                           |
| definition        | title                          | string    | Optional widget title. Omit it from a replacement definition to clear the title.                                                                                                                                                                                          |
| definition        | type [*required*]              | string    | Notebook widget type.                                                                                                                                                                                                                                                     |
| definition        | validation_errors              | [object]  | Nonempty diagnostics required for an invalid_widget placeholder.                                                                                                                                                                                                          |
| validation_errors | code [*required*]              | string    | Machine-readable diagnostic code.                                                                                                                                                                                                                                         |
| validation_errors | location [*required*]          | object    | Location of a diagnostic in its documented representation.                                                                                                                                                                                                                |
| location          | pointer [*required*]           | string    | JSON Pointer to the affected field.                                                                                                                                                                                                                                       |
| validation_errors | message [*required*]           | string    | Description of the validation failure.                                                                                                                                                                                                                                    |
| attributes        | document_revision [*required*] | uuid      | Opaque document revision UUID. Send the most recently observed value when updating the notebook.                                                                                                                                                                          |
| attributes        | graph_size [*required*]        | enum      | Widget graph size. Null clears the local size. Allowed enum values: `xs`, `s`, `m`, `l`, `xl`, `null`.                                                                                                                                                                    |
| attributes        | position [*required*]          | int64     | Ordering value within the document. Compare positions only within the same document revision; values can have gaps and change after edits.                                                                                                                                |
| attributes        | split_by                       | object    | Widget split configuration. Null clears the configuration.                                                                                                                                                                                                                |
| split_by          | keys [*required*]              | [string]  | Split keys.                                                                                                                                                                                                                                                               |
| split_by          | tags [*required*]              | [string]  | Split tags.                                                                                                                                                                                                                                                               |
| attributes        | time [*required*]              | object    | Widget-local time. Null uses notebook time. Accepts the same relative, absolute, growing, and calendar shapes as notebook time, optionally with hide_incomplete_cost_data, or that preference alone.                                                                      |
| time              | end                            | date-time | End time.                                                                                                                                                                                                                                                                 |
| time              | hide_incomplete_cost_data      | boolean   | Whether to hide incomplete Cloud Cost data.                                                                                                                                                                                                                               |
| time              | live                           | boolean   | Whether the time range should shift to end at the current time.                                                                                                                                                                                                           |
| time              | live_span                      | string    | Relative time span.                                                                                                                                                                                                                                                       |
| time              | offset                         | int64     | Calendar offset.                                                                                                                                                                                                                                                          |
| time              | start                          | date-time | Start time.                                                                                                                                                                                                                                                               |
| time              | type                           | enum      | Growing or calendar time type. Allowed enum values: `growing`, `daily`, `weekly`, `monthly`, `yearly`.                                                                                                                                                                    |
| attributes        | widget_type [*required*]       | string    | Widget type.                                                                                                                                                                                                                                                              |
| data              | id [*required*]                | string    | Stable widget ID.                                                                                                                                                                                                                                                         |
| data              | links [*required*]             | object    | Links for a notebook resource.                                                                                                                                                                                                                                            |
| links             | self [*required*]              | string    | API URL for the notebook.                                                                                                                                                                                                                                                 |
| data              | relationships [*required*]     | object    | Notebook, optional section, and available widget export relationships. Analysis widgets may include a csv link; supported graph widgets without split groups may include a snapshot link.                                                                                 |
| relationships     | csv                            | object    | Link to start a widget CSV export or image snapshot.                                                                                                                                                                                                                      |
| csv               | links [*required*]             | object    | Links to a related resource.                                                                                                                                                                                                                                              |
| links             | related [*required*]           | string    | Related API URL.                                                                                                                                                                                                                                                          |
| relationships     | notebook [*required*]          | object    | Relationship to the containing notebook.                                                                                                                                                                                                                                  |
| notebook          | data [*required*]              | object    | Stable notebook resource identity.                                                                                                                                                                                                                                        |
| data              | id [*required*]                | string    | Notebook ID.                                                                                                                                                                                                                                                              |
| data              | type [*required*]              | enum      | Notebooks resource type. Allowed enum values: `notebooks`. Default: `notebooks`.                                                                                                                                                                                          |
| notebook          | links [*required*]             | object    | Links to a related resource.                                                                                                                                                                                                                                              |
| links             | related [*required*]           | string    | Related API URL.                                                                                                                                                                                                                                                          |
| relationships     | section                        | object    | Relationship to the containing section, when one exists.                                                                                                                                                                                                                  |
| section           | data [*required*]              | object    | Stable section identity.                                                                                                                                                                                                                                                  |
| data              | id [*required*]                | string    | Stable section ID.                                                                                                                                                                                                                                                        |
| data              | type [*required*]              | enum      | Notebook section resource type. Allowed enum values: `notebook_sections`.                                                                                                                                                                                                 |
| section           | links [*required*]             | object    | Links to a related resource.                                                                                                                                                                                                                                              |
| links             | related [*required*]           | string    | Related API URL.                                                                                                                                                                                                                                                          |
| relationships     | snapshot                       | object    | Link to start a widget CSV export or image snapshot.                                                                                                                                                                                                                      |
| snapshot          | links [*required*]             | object    | Links to a related resource.                                                                                                                                                                                                                                              |
| links             | related [*required*]           | string    | Related API URL.                                                                                                                                                                                                                                                          |
| data              | type [*required*]              | enum      | Notebook widget resource type. Allowed enum values: `notebook_widgets`.                                                                                                                                                                                                   |
|                   | meta                           | object    | Response metadata. Warnings can appear on reads as well as writes and are omitted when no invalid widgets are present.                                                                                                                                                    |
| meta              | warnings                       | [object]  | Diagnostics describing persisted widget placeholders.                                                                                                                                                                                                                     |
| warnings          | code [*required*]              | string    | Warning code.                                                                                                                                                                                                                                                             |
| warnings          | location                       | object    | Location of a diagnostic in its documented representation.                                                                                                                                                                                                                |
| location          | pointer [*required*]           | string    | JSON Pointer to the affected field.                                                                                                                                                                                                                                       |
| warnings          | message [*required*]           | string    | Warning description.                                                                                                                                                                                                                                                      |
| warnings          | meta                           | object    | Context for a widget diagnostic inside Markdown.                                                                                                                                                                                                                          |
| meta              | definition                     | object    | Notebook widget definition. The type selects the widget-specific schema; title is stored here. Supports notebook widgets, including analysis widgets and invalid_widget placeholders. Markdown and rich-text definitions cannot be submitted through the widget endpoint. |
| definition        | original_definition            | object    | Original definition preserved by an invalid_widget placeholder.                                                                                                                                                                                                           |
| definition        | title                          | string    | Optional widget title. Omit it from a replacement definition to clear the title.                                                                                                                                                                                          |
| definition        | type [*required*]              | string    | Notebook widget type.                                                                                                                                                                                                                                                     |
| definition        | validation_errors              | [object]  | Nonempty diagnostics required for an invalid_widget placeholder.                                                                                                                                                                                                          |
| validation_errors | code [*required*]              | string    | Machine-readable diagnostic code.                                                                                                                                                                                                                                         |
| validation_errors | location [*required*]          | object    | Location of a diagnostic in its documented representation.                                                                                                                                                                                                                |
| location          | pointer [*required*]           | string    | JSON Pointer to the affected field.                                                                                                                                                                                                                                       |
| validation_errors | message [*required*]           | string    | Description of the validation failure.                                                                                                                                                                                                                                    |
| meta              | validation_errors              | [object]  | Diagnostics relative to the unwrapped widget attributes.                                                                                                                                                                                                                  |
| validation_errors | code [*required*]              | string    | Machine-readable diagnostic code.                                                                                                                                                                                                                                         |
| validation_errors | location [*required*]          | object    | Location of a diagnostic in its documented representation.                                                                                                                                                                                                                |
| location          | pointer [*required*]           | string    | JSON Pointer to the affected field.                                                                                                                                                                                                                                       |
| validation_errors | message [*required*]           | string    | Description of the validation failure.                                                                                                                                                                                                                                    |
| meta              | widget_id                      | string    | ID of the affected widget.                                                                                                                                                                                                                                                |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "definition": {
        "original_definition": {},
        "title": "CPU usage",
        "type": "timeseries",
        "validation_errors": [
          {
            "code": "invalid_widget",
            "location": {
              "pointer": "/data/attributes/definition/requests"
            },
            "message": "The requests field must be an array."
          }
        ]
      },
      "document_revision": "123e4567-e89b-12d3-a456-426614174456",
      "graph_size": "xs",
      "position": 33,
      "split_by": {
        "keys": [
          "service"
        ],
        "tags": [
          "env:prod"
        ]
      },
      "time": {
        "end": "2026-05-20T14:00:00Z",
        "hide_incomplete_cost_data": true,
        "live": false,
        "live_span": "1h",
        "offset": 0,
        "start": "2026-05-20T13:00:00Z",
        "type": "growing"
      },
      "widget_type": "timeseries"
    },
    "id": "w9c4h7b5",
    "links": {
      "self": "/api/v2/notebooks/123"
    },
    "relationships": {
      "csv": {
        "links": {
          "related": "/api/v2/notebooks/123/sections"
        }
      },
      "notebook": {
        "data": {
          "id": "123",
          "type": "notebooks"
        },
        "links": {
          "related": "/api/v2/notebooks/123/sections"
        }
      },
      "section": {
        "data": {
          "id": "k7m2q9x4",
          "type": "notebook_sections"
        },
        "links": {
          "related": "/api/v2/notebooks/123/sections"
        }
      },
      "snapshot": {
        "links": {
          "related": "/api/v2/notebooks/123/sections"
        }
      }
    },
    "type": "notebook_widgets"
  },
  "meta": {
    "warnings": [
      {
        "code": "invalid_widget",
        "location": {
          "pointer": "/data/attributes/definition/requests"
        },
        "message": "The widget definition is invalid.",
        "meta": {
          "definition": {
            "original_definition": {},
            "title": "CPU usage",
            "type": "timeseries",
            "validation_errors": [
              {
                "code": "invalid_widget",
                "location": {
                  "pointer": "/data/attributes/definition/requests"
                },
                "message": "The requests field must be an array."
              }
            ]
          },
          "validation_errors": [
            {
              "code": "invalid_widget",
              "location": {
                "pointer": "/data/attributes/definition/requests"
              },
              "message": "The requests field must be an array."
            }
          ],
          "widget_id": "w9c4h7b5"
        }
      }
    ]
  }
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Forbidden

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="404" %}
Not Found

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="406" %}
Not Acceptable

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="409" %}
Conflict: an exact match count did not match, a requested scope disappeared, concurrent changes
prevented a guarded write, or the notebook uses unsupported legacy storage.

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="413" %}
Request, document, or edit batch exceeds a supported size, content-block, or rendering budget.

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="415" %}
Unsupported Media Type

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="422" %}
Invalid notebook attributes, unsupported or mismatched scope, invalid Markdown, or invalid widget
definition.

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Path parameters
export notebook_id="123"
export widget_id="w9c4h7b5"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/notebooks/${notebook_id}/widgets/${widget_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "graph_size": "l"
    },
    "id": "w9c4h7b5",
    "type": "notebook_widgets"
  }
}
EOF
```
{% /tab %}
{% /tabs %}
