---
title: Update notebook content
description: Append, replace, edit, or remove notebook content, optionally within a section.
breadcrumbs: Docs > API > Update notebook content
---

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

# Update notebook content

## 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 | POST https://api.datadoghq.com/api/v2/notebooks/{notebook_id}/content     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/notebooks/{notebook_id}/content |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/notebooks/{notebook_id}/content |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/notebooks/{notebook_id}/content      |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/notebooks/{notebook_id}/content |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/notebooks/{notebook_id}/content |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/notebooks/{notebook_id}/content |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/notebooks/{notebook_id}/content      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/notebooks/{notebook_id}/content  |

### Overview

Append, replace, edit, or remove notebook content, optionally within a section.

JSON requests require `Content-Type: application/json` and supply all operation fields in the
body. Operation-related query parameters are rejected, even when they match the body. Supply one
append, replace, or remove operation, or an ordered atomic batch of 1 to 100 edit operations.
Mixed batches and multiple non-edit operations are rejected.

Markdown requests require `Content-Type: text/markdown` and an explicit `op` query parameter.
The body contains the Markdown to append or replace, or the literal `new_text` for an edit.
A remove operation requires an empty body. `old_text` and `expected_match_count` apply only to
edits. Supply `scope[type]` and `scope[id]` together. Each operation query parameter may occur
only once.

Omit the scope to target the whole notebook. An explicit `notebooks` scope must match the ID in
the URL. To replace a section, use `op=replace` with `scope[type]=notebook_sections` and the
section ID. The replacement must start with a heading, which keeps the section ID. Empty
replacements, including those containing only white space, remove the section. Section-scoped
edits must preserve a leading heading unless they remove the section entirely.
An append operation adds content after the selected section and its nested sections.
Replacing or removing a section can change the surrounding heading hierarchy. An unavailable
scope returns an error instead of targeting the whole notebook.

Whole-document replacement consumes a leading H1 as the notebook title. Whole-document edits
match the same projection, including that H1, so editing it can rename the notebook. Append and
section-scoped operations retain their headings as body content and preserve the notebook title.
Other notebook metadata is unchanged, including when frontmatter is supplied. Edit operations
match exact text in the Markdown document and treat replacement text literally.
Edit, replace, remove, and scoped append operations check for conflicting changes before writing.
Send the most recently observed `document_revision` with the request.

Every successful operation returns 200 and the full resulting notebook, including operations
that make no changes or remove the entire body. Responses negotiate JSON or Markdown
independently of the request format. 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. |

#### Query Strings

| Field                | Type    | Description                                                                                                                                                                              |
| -------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| op                   | enum    | Markdown content operation. Required for text/markdown; forbidden for JSON requests, which supply the operation in the body. Allowed enum values: `append`, `replace`, `edit`, `remove`. |
| scope[type]          | enum    | Markdown scope type. Requires scope[id]; forbidden for JSON requests. Allowed enum values: `notebooks`, `notebook_sections`.                                                             |
| scope[id]            | string  | Markdown scope ID. Requires scope[type]; forbidden for JSON requests.                                                                                                                    |
| old_text             | string  | Required nonempty exact match text for a Markdown edit. Forbidden for other operations and JSON requests.                                                                                |
| expected_match_count | integer | Positive exact match count for a Markdown edit. Defaults to 1. Forbidden for other operations and JSON requests. Default: `1`.                                                           |

#### 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

JSON operations request or single-operation Markdown body. JSON requires a body; Markdown remove
requires an empty body.

{% tabs %}
{% tab label="Model" %}
| Parent field | Field                    | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                  |
| ------------ | ------------------------ | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | Option 1                 | object    | Request containing exactly one append, replace, or remove operation.                                                                                                                                                                                                                                                                                                                         |
| Option 1     | document_revision        | uuid      | Opaque document revision UUID. Send the most recently observed value when updating the notebook.                                                                                                                                                                                                                                                                                             |
| Option 1     | operations [*required*]  | [<oneOf>] | One content operation.                                                                                                                                                                                                                                                                                                                                                                       |
| operations   | <op=append>              | object    | Append notebook body content.                                                                                                                                                                                                                                                                                                                                                                |
| <op=append>  | data [*required*]        | object    | Notebook content in Notebooks Flavored Markdown for append or replacement. Whole-document replacement consumes the leading H1 as the notebook title. Append and section replacement treat headings as body content. Other notebook metadata is unchanged, including when frontmatter is supplied.                                                                                            |
| data         | markdown [*required*]    | string    | Markdown to append or replace. For whole-document replacement, preserve the leading title H1 unless renaming the notebook. An empty replacement removes the selected body content and preserves the notebook title. Section replacements must start with a heading, which keeps the section ID. Empty section replacements, including those containing only white space, remove the section. |
| <op=append>  | op [*required*]          | enum      | Content operation type. Allowed enum values: `append`.                                                                                                                                                                                                                                                                                                                                       |
| <op=append>  | scope                    | object    | Content scope. Omit the scope to select the whole notebook. A `notebooks` scope ID must match the notebook ID in the URL. A section ID selects that section and its descendants. If the section is unavailable, the request fails instead of widening the scope.                                                                                                                             |
| scope        | id [*required*]          | string    | Stable notebook or section ID.                                                                                                                                                                                                                                                                                                                                                               |
| scope        | type [*required*]        | enum      | Supported content scope type. Allowed enum values: `notebooks`, `notebook_sections`.                                                                                                                                                                                                                                                                                                         |
| operations   | <op=replace>             | object    | Replace notebook body content.                                                                                                                                                                                                                                                                                                                                                               |
| <op=replace> | data [*required*]        | object    | Notebook content in Notebooks Flavored Markdown for append or replacement. Whole-document replacement consumes the leading H1 as the notebook title. Append and section replacement treat headings as body content. Other notebook metadata is unchanged, including when frontmatter is supplied.                                                                                            |
| data         | markdown [*required*]    | string    | Markdown to append or replace. For whole-document replacement, preserve the leading title H1 unless renaming the notebook. An empty replacement removes the selected body content and preserves the notebook title. Section replacements must start with a heading, which keeps the section ID. Empty section replacements, including those containing only white space, remove the section. |
| <op=replace> | op [*required*]          | enum      | Content operation type. Allowed enum values: `replace`.                                                                                                                                                                                                                                                                                                                                      |
| <op=replace> | scope                    | object    | Content scope. Omit the scope to select the whole notebook. A `notebooks` scope ID must match the notebook ID in the URL. A section ID selects that section and its descendants. If the section is unavailable, the request fails instead of widening the scope.                                                                                                                             |
| scope        | id [*required*]          | string    | Stable notebook or section ID.                                                                                                                                                                                                                                                                                                                                                               |
| scope        | type [*required*]        | enum      | Supported content scope type. Allowed enum values: `notebooks`, `notebook_sections`.                                                                                                                                                                                                                                                                                                         |
| operations   | <op=remove>              | object    | Remove notebook body content. Remove accepts no data and is equivalent to replacement with empty Markdown.                                                                                                                                                                                                                                                                                   |
| <op=remove>  | op [*required*]          | enum      | Content operation type. Allowed enum values: `remove`.                                                                                                                                                                                                                                                                                                                                       |
| <op=remove>  | scope                    | object    | Content scope. Omit the scope to select the whole notebook. A `notebooks` scope ID must match the notebook ID in the URL. A section ID selects that section and its descendants. If the section is unavailable, the request fails instead of widening the scope.                                                                                                                             |
| scope        | id [*required*]          | string    | Stable notebook or section ID.                                                                                                                                                                                                                                                                                                                                                               |
| scope        | type [*required*]        | enum      | Supported content scope type. Allowed enum values: `notebooks`, `notebook_sections`.                                                                                                                                                                                                                                                                                                         |
| Option 1     | reasoning                | object    | Optional Markdown explanation of the content change.                                                                                                                                                                                                                                                                                                                                         |
| reasoning    | explanation [*required*] | string    | Explanation recorded with the change.                                                                                                                                                                                                                                                                                                                                                        |
|              | Option 2                 | object    | Ordered, atomic batch of exact edits. Each edit sees earlier results; scopes are resolved again after changes. Any failure leaves the notebook unchanged. Document-size or processing limits can cause a batch to fail with 413 even when it contains fewer than 100 edits.                                                                                                                  |
| Option 2     | document_revision        | uuid      | Opaque document revision UUID. Send the most recently observed value when updating the notebook.                                                                                                                                                                                                                                                                                             |
| Option 2     | operations [*required*]  | [object]  | One to 100 exact edits. Mixed operation batches are rejected.                                                                                                                                                                                                                                                                                                                                |
| operations   | data [*required*]        | object    | Exact text replacement in the Markdown body, excluding notebook frontmatter. Matching is literal, case-sensitive, and non-overlapping, with no white space or Unicode normalization.                                                                                                                                                                                                         |
| data         | expected_match_count     | int64     | Required number of exact matches. A mismatch fails the entire request with 409. Default: `1`.                                                                                                                                                                                                                                                                                                |
| data         | new_text [*required*]    | string    | Replacement text. An empty string deletes each match.                                                                                                                                                                                                                                                                                                                                        |
| data         | old_text [*required*]    | string    | Nonempty exact text to match in the selected scope.                                                                                                                                                                                                                                                                                                                                          |
| operations   | op [*required*]          | enum      | Content operation type. Allowed enum values: `edit`.                                                                                                                                                                                                                                                                                                                                         |
| operations   | scope                    | object    | Content scope. Omit the scope to select the whole notebook. A `notebooks` scope ID must match the notebook ID in the URL. A section ID selects that section and its descendants. If the section is unavailable, the request fails instead of widening the scope.                                                                                                                             |
| scope        | id [*required*]          | string    | Stable notebook or section ID.                                                                                                                                                                                                                                                                                                                                                               |
| scope        | type [*required*]        | enum      | Supported content scope type. Allowed enum values: `notebooks`, `notebook_sections`.                                                                                                                                                                                                                                                                                                         |
| Option 2     | reasoning                | object    | Optional Markdown explanation of the content change.                                                                                                                                                                                                                                                                                                                                         |
| reasoning    | explanation [*required*] | string    | Explanation recorded with the change.                                                                                                                                                                                                                                                                                                                                                        |
{% /tab %}

{% tab label="Example" %}
```json
{
  "document_revision": "123e4567-e89b-12d3-a456-426614174456",
  "operations": [
    {
      "data": {
        "markdown": "## Setup\n\nInstall dependencies."
      },
      "op": "append",
      "scope": {
        "id": "k7m2q9x4",
        "type": "notebooks"
      }
    }
  ],
  "reasoning": {
    "explanation": "Update the setup instructions."
  }
}
```
{% /tab %}
{% /tabs %}

### Response

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

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

| Parent field             | Field                           | Type      | Description                                                                                                                                                                                                                                                               |
| ------------------------ | ------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                          | data [*required*]               | object    | Notebook resource object.                                                                                                                                                                                                                                                 |
| data                     | attributes [*required*]         | object    | Notebook attributes.                                                                                                                                                                                                                                                      |
| attributes               | created_at [*required*]         | date-time | Timestamp when the notebook was created. Read-only.                                                                                                                                                                                                                       |
| attributes               | deleted_at [*required*]         | date-time | Timestamp when the notebook was deleted, if applicable. Read-only.                                                                                                                                                                                                        |
| attributes               | document_revision [*required*]  | uuid      | Opaque document revision UUID. Send the most recently observed value when updating the notebook.                                                                                                                                                                          |
| attributes               | dropdown_templates [*required*] | [object]  | Dropdown templates configured on the notebook. Template IDs must be unique; option IDs must be unique within each template.                                                                                                                                               |
| dropdown_templates       | id [*required*]                 | string    | Dropdown template ID.                                                                                                                                                                                                                                                     |
| dropdown_templates       | name [*required*]               | string    | Dropdown template display name.                                                                                                                                                                                                                                           |
| dropdown_templates       | options [*required*]            | [object]  | Dropdown template options.                                                                                                                                                                                                                                                |
| options                  | color [*required*]              | string    | Option color.                                                                                                                                                                                                                                                             |
| options                  | id [*required*]                 | string    | Option ID.                                                                                                                                                                                                                                                                |
| options                  | label [*required*]              | string    | Option label.                                                                                                                                                                                                                                                             |
| attributes               | is_template [*required*]        | boolean   | Whether the notebook is a template.                                                                                                                                                                                                                                       |
| attributes               | markdown [*required*]           | string    | Full notebook in Notebooks Flavored Markdown, including the notebook title as a leading H1. The H1 and title attribute represent the same stored title.                                                                                                                   |
| attributes               | modified_at [*required*]        | date-time | Timestamp when the notebook was last modified. Read-only.                                                                                                                                                                                                                 |
| attributes               | notebook_type [*required*]      | enum      | Notebook category. Allowed enum values: `postmortem`, `runbook`, `investigation`, `documentation`, `report`, `workspace`, `threat_hunting`, `null`.                                                                                                                       |
| attributes               | tags [*required*]               | [string]  | Tags associated with the notebook.                                                                                                                                                                                                                                        |
| attributes               | template_variables [*required*] | [<oneOf>] | Template variables configured on the notebook.                                                                                                                                                                                                                            |
| template_variables       | Object 1                        | object    | Notebook template variable using optional default values.                                                                                                                                                                                                                 |
| Object 1                 | available_values                | [string]  | The list of values that the template variable dropdown is limited to.                                                                                                                                                                                                     |
| Object 1                 | available_values_query          | <oneOf>   | Query used to dynamically populate the list of available values for the template variable.                                                                                                                                                                                |
| available_values_query   | Object 1                        | object    | Available values query for logs, RUM, or spans data sources.                                                                                                                                                                                                              |
| Object 1                 | data_source [*required*]        | enum      | Template variable query data source. Allowed enum values: `logs`, `rum`, `spans`.                                                                                                                                                                                         |
| Object 1                 | group_by [*required*]           | [object]  | Group-by fields for the query.                                                                                                                                                                                                                                            |
| group_by                 | facet [*required*]              | string    | The facet name to group by.                                                                                                                                                                                                                                               |
| Object 1                 | search [*required*]             | object    | Search parameters for an available values query.                                                                                                                                                                                                                          |
| search                   | query [*required*]              | string    | The search query string.                                                                                                                                                                                                                                                  |
| available_values_query   | <data_source=metrics>           | object    | Available values query for the metrics data source.                                                                                                                                                                                                                       |
| <data_source=metrics>    | data_source [*required*]        | enum      | Data source for an anomaly investigation query. Allowed enum values: `metrics`.                                                                                                                                                                                           |
| <data_source=metrics>    | query [*required*]              | string    | The metrics query string.                                                                                                                                                                                                                                                 |
| Object 1                 | data_source_mappings            | object    | Mapping of data source names to template variable values.                                                                                                                                                                                                                 |
| additionalProperties     | <any-key>                       | string    | The value for the given data source.                                                                                                                                                                                                                                      |
| Object 1                 | defaults                        | [string]  | One or many default values for the template variable. Can't be combined with `default`.                                                                                                                                                                                   |
| Object 1                 | name [*required*]               | string    | The name of the variable.                                                                                                                                                                                                                                                 |
| Object 1                 | placement                       | string    | The placement of the template variable in the notebook.                                                                                                                                                                                                                   |
| Object 1                 | prefix                          | string    | The tag prefix associated with the variable. Only tags with this prefix appear in the variable dropdown.                                                                                                                                                                  |
| Object 1                 | type                            | string    | The type of the template variable.                                                                                                                                                                                                                                        |
| template_variables       | Object 2                        | object    | Notebook template variable using the legacy default value.                                                                                                                                                                                                                |
| Object 2                 | available_values                | [string]  | The list of values that the template variable dropdown is limited to.                                                                                                                                                                                                     |
| Object 2                 | available_values_query          | <oneOf>   | Query used to dynamically populate the list of available values for the template variable.                                                                                                                                                                                |
| available_values_query   | Object 1                        | object    | Available values query for logs, RUM, or spans data sources.                                                                                                                                                                                                              |
| Object 1                 | data_source [*required*]        | enum      | Template variable query data source. Allowed enum values: `logs`, `rum`, `spans`.                                                                                                                                                                                         |
| Object 1                 | group_by [*required*]           | [object]  | Group-by fields for the query.                                                                                                                                                                                                                                            |
| group_by                 | facet [*required*]              | string    | The facet name to group by.                                                                                                                                                                                                                                               |
| Object 1                 | search [*required*]             | object    | Search parameters for an available values query.                                                                                                                                                                                                                          |
| search                   | query [*required*]              | string    | The search query string.                                                                                                                                                                                                                                                  |
| available_values_query   | <data_source=metrics>           | object    | Available values query for the metrics data source.                                                                                                                                                                                                                       |
| <data_source=metrics>    | data_source [*required*]        | enum      | Data source for an anomaly investigation query. Allowed enum values: `metrics`.                                                                                                                                                                                           |
| <data_source=metrics>    | query [*required*]              | string    | The metrics query string.                                                                                                                                                                                                                                                 |
| Object 2                 | data_source_mappings            | object    | Mapping of data source names to template variable values.                                                                                                                                                                                                                 |
| additionalProperties     | <any-key>                       | string    | The value for the given data source.                                                                                                                                                                                                                                      |
| Object 2                 | default [*required*]            | string    | **DEPRECATED**: (Deprecated) The default value for the template variable on notebook load. Can't be combined with `defaults`.                                                                                                                                             |
| Object 2                 | name [*required*]               | string    | The name of the variable.                                                                                                                                                                                                                                                 |
| Object 2                 | placement                       | string    | The placement of the template variable in the notebook.                                                                                                                                                                                                                   |
| Object 2                 | prefix                          | string    | The tag prefix associated with the variable. Only tags with this prefix appear in the variable dropdown.                                                                                                                                                                  |
| Object 2                 | type                            | string    | The type of the template variable.                                                                                                                                                                                                                                        |
| attributes               | time [*required*]               | <oneOf>   | Global notebook time range. Absolute start and end values must use consistent timezone information, with start before end.                                                                                                                                                |
| time                     | Object 1                        | object    | Relative notebook time range.                                                                                                                                                                                                                                             |
| Object 1                 | live_span [*required*]          | string    | Relative time span, including custom durations.                                                                                                                                                                                                                           |
| time                     | Object 2                        | object    | Absolute notebook time range.                                                                                                                                                                                                                                             |
| Object 2                 | end [*required*]                | date-time | End time.                                                                                                                                                                                                                                                                 |
| Object 2                 | live                            | boolean   | Whether the time range should shift to end at the current time.                                                                                                                                                                                                           |
| Object 2                 | start [*required*]              | date-time | Start time.                                                                                                                                                                                                                                                               |
| time                     | Object 3                        | object    | Growing time range with a fixed start. Set live to false to pause the range.                                                                                                                                                                                              |
| Object 3                 | end [*required*]                | date-time | End time.                                                                                                                                                                                                                                                                 |
| Object 3                 | live [*required*]               | boolean   | Whether the time range should shift to end at the current time.                                                                                                                                                                                                           |
| Object 3                 | start [*required*]              | date-time | Start time.                                                                                                                                                                                                                                                               |
| 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.                                                                                                                                                                             |
| Object 4                 | end [*required*]                | date-time | End time.                                                                                                                                                                                                                                                                 |
| 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*]              | date-time | Start time.                                                                                                                                                                                                                                                               |
| Object 4                 | type [*required*]               | enum      | Calendar time range type. Allowed enum values: `daily`, `weekly`, `monthly`, `yearly`.                                                                                                                                                                                    |
| attributes               | title [*required*]              | string    | Notebook title.                                                                                                                                                                                                                                                           |
| data                     | id [*required*]                 | string    | Unique notebook ID.                                                                                                                                                                                                                                                       |
| data                     | links [*required*]              | object    | Links for a notebook resource.                                                                                                                                                                                                                                            |
| links                    | self [*required*]               | string    | API URL for the notebook.                                                                                                                                                                                                                                                 |
| data                     | meta [*required*]               | object    | Request-specific notebook metadata.                                                                                                                                                                                                                                       |
| meta                     | is_favorite [*required*]        | boolean   | Whether the notebook is favorited by the current user.                                                                                                                                                                                                                    |
| data                     | relationships [*required*]      | object    | Relationships for a notebook resource. created_by identifies its creator when available.                                                                                                                                                                                  |
| relationships            | created_by                      | object    | Relationship to user.                                                                                                                                                                                                                                                     |
| created_by               | data [*required*]               | object    | Relationship to user object.                                                                                                                                                                                                                                              |
| data                     | id [*required*]                 | string    | A unique identifier that represents the user.                                                                                                                                                                                                                             |
| data                     | type [*required*]               | enum      | Users resource type. Allowed enum values: `users`. Default: `users`.                                                                                                                                                                                                      |
| relationships            | sections [*required*]           | object    | Relationship to notebook sections. Linkage is included only when requested with include.                                                                                                                                                                                  |
| sections                 | data                            | [object]  | Related resource identities.                                                                                                                                                                                                                                              |
| data                     | id [*required*]                 | string    | Stable section ID.                                                                                                                                                                                                                                                        |
| data                     | type [*required*]               | enum      | Notebook section resource type. Allowed enum values: `notebook_sections`.                                                                                                                                                                                                 |
| sections                 | links [*required*]              | object    | Links to a related resource.                                                                                                                                                                                                                                              |
| links                    | related [*required*]            | string    | Related API URL.                                                                                                                                                                                                                                                          |
| relationships            | tasks [*required*]              | object    | Relationship to notebook tasks. Linkage is included only when requested with include.                                                                                                                                                                                     |
| tasks                    | data                            | [object]  | Related resource identities.                                                                                                                                                                                                                                              |
| data                     | id [*required*]                 | string    | Stable task ID.                                                                                                                                                                                                                                                           |
| data                     | type [*required*]               | enum      | Notebook task resource type. Allowed enum values: `notebook_tasks`.                                                                                                                                                                                                       |
| tasks                    | links [*required*]              | object    | Links to a related resource.                                                                                                                                                                                                                                              |
| links                    | related [*required*]            | string    | Related API URL.                                                                                                                                                                                                                                                          |
| relationships            | widgets [*required*]            | object    | Relationship to notebook widgets. Linkage is included only when requested with include.                                                                                                                                                                                   |
| widgets                  | data                            | [object]  | Related resource identities.                                                                                                                                                                                                                                              |
| data                     | id [*required*]                 | string    | Stable widget ID.                                                                                                                                                                                                                                                         |
| data                     | type [*required*]               | enum      | Notebook widget resource type. Allowed enum values: `notebook_widgets`.                                                                                                                                                                                                   |
| widgets                  | links [*required*]              | object    | Links to a related resource.                                                                                                                                                                                                                                              |
| links                    | related [*required*]            | string    | Related API URL.                                                                                                                                                                                                                                                          |
| data                     | type [*required*]               | enum      | Notebooks resource type. Allowed enum values: `notebooks`. Default: `notebooks`.                                                                                                                                                                                          |
|                          | included [*required*]           | [<oneOf>] | Included related resources.                                                                                                                                                                                                                                               |
| included                 | <type=users>                    | object    | A user resource included in the notebook response.                                                                                                                                                                                                                        |
| <type=users>             | attributes [*required*]         | object    | Attributes of a user resource included in the notebook response.                                                                                                                                                                                                          |
| attributes               | handle [*required*]             | string    | The handle of the user.                                                                                                                                                                                                                                                   |
| attributes               | name [*required*]               | string    | The display name of the user.                                                                                                                                                                                                                                             |
| <type=users>             | id [*required*]                 | string    | The unique identifier of the user.                                                                                                                                                                                                                                        |
| <type=users>             | type [*required*]               | enum      | Users resource type. Allowed enum values: `users`. Default: `users`.                                                                                                                                                                                                      |
| included                 | <type=notebook_sections>        | object    | A notebook section resource.                                                                                                                                                                                                                                              |
| <type=notebook_sections> | attributes [*required*]         | object    | Section attributes. Collections and included sections omit markdown unless explicitly requested. Sparse field selections can omit any attribute.                                                                                                                          |
| attributes               | document_revision               | uuid      | Opaque document revision UUID. Send the most recently observed value when updating the notebook.                                                                                                                                                                          |
| attributes               | heading                         | string    | Heading text.                                                                                                                                                                                                                                                             |
| attributes               | level                           | int64     | Heading level.                                                                                                                                                                                                                                                            |
| attributes               | markdown                        | string    | Markdown for the section, including its heading and nested sections.                                                                                                                                                                                                      |
| attributes               | path                            | [string]  | Notebook title (when nonempty), followed by ancestor headings and this section's heading.                                                                                                                                                                                 |
| attributes               | position                        | int64     | Ordering value within the document. Compare positions only within the same document revision; values can have gaps and change after edits.                                                                                                                                |
| <type=notebook_sections> | id [*required*]                 | string    | Stable section ID.                                                                                                                                                                                                                                                        |
| <type=notebook_sections> | links [*required*]              | object    | Links for a notebook resource.                                                                                                                                                                                                                                            |
| links                    | self [*required*]               | string    | API URL for the notebook.                                                                                                                                                                                                                                                 |
| <type=notebook_sections> | relationships                   | object    | Relationships for a section. Omitted when excluded by a sparse field selection.                                                                                                                                                                                           |
| relationships            | notebook                        | 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.                                                                                                                                                                                                                                                          |
| <type=notebook_sections> | type [*required*]               | enum      | Notebook section resource type. Allowed enum values: `notebook_sections`.                                                                                                                                                                                                 |
| included                 | <type=notebook_tasks>           | object    | A notebook task resource.                                                                                                                                                                                                                                                 |
| <type=notebook_tasks>    | attributes [*required*]         | object    | Task attributes.                                                                                                                                                                                                                                                          |
| attributes               | checked [*required*]            | boolean   | Whether the task is completed.                                                                                                                                                                                                                                            |
| attributes               | document_revision [*required*]  | uuid      | Opaque document revision UUID. Send the most recently observed value when updating the notebook.                                                                                                                                                                          |
| 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               | text [*required*]               | string    | Plain text of the task, without inline formatting.                                                                                                                                                                                                                        |
| <type=notebook_tasks>    | id [*required*]                 | string    | Stable task ID.                                                                                                                                                                                                                                                           |
| <type=notebook_tasks>    | links [*required*]              | object    | Links for a notebook resource.                                                                                                                                                                                                                                            |
| links                    | self [*required*]               | string    | API URL for the notebook.                                                                                                                                                                                                                                                 |
| <type=notebook_tasks>    | relationships [*required*]      | object    | Notebook and optional section relationships.                                                                                                                                                                                                                              |
| 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.                                                                                                                                                                                                                                                          |
| <type=notebook_tasks>    | type [*required*]               | enum      | Notebook task resource type. Allowed enum values: `notebook_tasks`.                                                                                                                                                                                                       |
| included                 | <type=notebook_widgets>         | object    | A notebook widget resource.                                                                                                                                                                                                                                               |
| <type=notebook_widgets>  | 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.                                                                                                                                                                                                                                                              |
| <type=notebook_widgets>  | id [*required*]                 | string    | Stable widget ID.                                                                                                                                                                                                                                                         |
| <type=notebook_widgets>  | links [*required*]              | object    | Links for a notebook resource.                                                                                                                                                                                                                                            |
| links                    | self [*required*]               | string    | API URL for the notebook.                                                                                                                                                                                                                                                 |
| <type=notebook_widgets>  | 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.                                                                                                                                                                                                                                                          |
| <type=notebook_widgets>  | 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": {
      "created_at": "2026-05-20T14:12:33Z",
      "deleted_at": null,
      "document_revision": "123e4567-e89b-12d3-a456-426614174456",
      "dropdown_templates": [
        {
          "id": "r5n2c7m9",
          "name": "Status",
          "options": [
            {
              "color": "green",
              "id": "q6h1p8v3",
              "label": "Done"
            }
          ]
        }
      ],
      "is_template": false,
      "markdown": "# Service Debugging Notes\n\n## Setup\n\nInstall dependencies.",
      "modified_at": "2026-05-20T14:15:10Z",
      "notebook_type": "investigation",
      "tags": [
        "team:backend"
      ],
      "template_variables": [
        {
          "available_values": [
            "my-host",
            "host1",
            "host2"
          ],
          "available_values_query": "undefined",
          "data_source_mappings": {
            "<any-key>": "string"
          },
          "defaults": [
            "my-host-1",
            "my-host-2"
          ],
          "name": "host1",
          "placement": "global",
          "prefix": "host",
          "type": "tag"
        }
      ],
      "time": {
        "live_span": "1h"
      },
      "title": "Service Debugging Notes"
    },
    "id": "123",
    "links": {
      "self": "/api/v2/notebooks/123"
    },
    "meta": {
      "is_favorite": false
    },
    "relationships": {
      "created_by": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "sections": {
        "data": [
          {
            "id": "k7m2q9x4",
            "type": "notebook_sections"
          }
        ],
        "links": {
          "related": "/api/v2/notebooks/123/sections"
        }
      },
      "tasks": {
        "data": [
          {
            "id": "p3v8n6r2",
            "type": "notebook_tasks"
          }
        ],
        "links": {
          "related": "/api/v2/notebooks/123/sections"
        }
      },
      "widgets": {
        "data": [
          {
            "id": "w9c4h7b5",
            "type": "notebook_widgets"
          }
        ],
        "links": {
          "related": "/api/v2/notebooks/123/sections"
        }
      }
    },
    "type": "notebooks"
  },
  "included": [
    {
      "attributes": {
        "handle": "ada.lovelace@datadoghq.com",
        "name": "Ada Lovelace"
      },
      "id": "9f3b8b7e-2df4-4d32-96f2-40d1c53f7f5f",
      "type": "users"
    }
  ],
  "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
## append

# Path parameters
export notebook_id="123"

# 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 POST "https://api.${DD_SITE}/api/v2/notebooks/${notebook_id}/content" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "operations": [
    {
      "data": {
        "markdown": "## Follow-up\n\nRecord the outcome."
      },
      "op": "append"
    }
  ]
}
EOF

## clear_body

# Path parameters
export notebook_id="123"

# 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 POST "https://api.${DD_SITE}/api/v2/notebooks/${notebook_id}/content" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "operations": [
    {
      "op": "remove"
    }
  ]
}
EOF

## edit_batch

# Path parameters
export notebook_id="123"

# 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 POST "https://api.${DD_SITE}/api/v2/notebooks/${notebook_id}/content" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "operations": [
    {
      "data": {
        "new_text": "Install the required dependencies.",
        "old_text": "Install dependencies."
      },
      "op": "edit"
    },
    {
      "data": {
        "expected_match_count": 1,
        "new_text": "project dependencies",
        "old_text": "required dependencies"
      },
      "op": "edit",
      "scope": {
        "id": "k7m2q9x4",
        "type": "notebook_sections"
      }
    }
  ]
}
EOF

## remove_section

# Path parameters
export notebook_id="123"

# 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 POST "https://api.${DD_SITE}/api/v2/notebooks/${notebook_id}/content" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "operations": [
    {
      "op": "remove",
      "scope": {
        "id": "k7m2q9x4",
        "type": "notebook_sections"
      }
    }
  ]
}
EOF

## replace

# Path parameters
export notebook_id="123"

# 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 POST "https://api.${DD_SITE}/api/v2/notebooks/${notebook_id}/content" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "operations": [
    {
      "data": {
        "markdown": "## Setup\n\nUpdated instructions."
      },
      "op": "replace"
    }
  ]
}
EOF

## scoped_append

# Path parameters
export notebook_id="123"

# 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 POST "https://api.${DD_SITE}/api/v2/notebooks/${notebook_id}/content" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "operations": [
    {
      "data": {
        "markdown": "Additional setup notes."
      },
      "op": "append",
      "scope": {
        "id": "k7m2q9x4",
        "type": "notebook_sections"
      }
    }
  ]
}
EOF
```
{% /tab %}
{% /tabs %}
