Deepnote research: our notes on building agents
Get started
All endpoint groups

Deepnote Public API v2

Blocks API

Notebook blocks (code, SQL, markdown, etc.).

Base URL

https://api.deepnote.com/v2

Create a block

post/blocks

Request body

required
application/jsonCreateBlockBody
notebookIdrequiredstring

Notebook to create the block in.

typerequired"code" | "sql" | "markdown" | "notebook-function" | "input-text" | "input-textarea" | "input-select" | "input-date" | "input-date-range" | "input-slider" | "input-file" | "input-checkbox" | "text-cell-h1" | "text-cell-h2" | "text-cell-h3" | "text-cell-p" | "text-cell-bullet" | "text-cell-todo" | "text-cell-callout" | "visualization" | "pivot-table" | "image" | "button" | "separator" | "big-number" | "agent"

Block type (e.g. "code", "sql", "markdown").

contentstring

Initial block content. Defaults to an empty string.

metadataobject

Block-type-specific metadata.

integrationIdstring:uuid

Integration ID to store in SQL block metadata as sql_integration_id.

positioninteger

Zero-based insertion index. Omit to append at the end.

includeNotebookBlockIdsboolean

When true, response includes all block IDs in the notebook.

Responses

▸201Block created
application/jsonCreateBlockResponse
blockrequiredBlock
notebookBlockIdsstring[]

All block IDs in the notebook (only when includeNotebookBlockIds is true).

▸400Validation error
application/jsonErrorResponse
messagerequiredstring
▸401Unauthorized
application/jsonErrorResponse
messagerequiredstring
▸403Insufficient permissions
application/jsonErrorResponse
messagerequiredstring
▸404Notebook not found, or integration does not exist in workspace
application/jsonErrorResponse
messagerequiredstring
▸409Project is suspended, or block type conflicts with requested integration
application/jsonErrorResponse
messagerequiredstring
▸429Rate limit exceeded
application/jsonErrorResponse
messagerequiredstring

Get a block

get/blocks/{blockId}

Parameters

blockIdpathrequiredstring

Opaque block identifier.

includeOutputsquery"true" | "false"

Also return the block's outputs in the live editor, from its last run there. Detached runs and sessions don't change them; get their outputs with `GET /runs/{runId}`. Scheduled runs do, unless their schedule has output syncing turned off. Defaults to `false`.

fullOutputsquery"true" | "false"

Return the outputs as stored. By default, outputs longer than 16384 characters as JSON get a notice in their place, with `outputHead` and `outputTail` showing how they start and end. When a block runs, its printed output (stdout and stderr) keeps only the last 1000 lines or 600000 characters, whichever is shorter, and is marked `"truncated": true`. The dropped text isn't stored, so this option can't return it. Defaults to `false`. Applies only with `includeOutputs=true`.

Responses

▸200Block details
application/jsonGetBlockResponse
blockrequiredBlockWithOutputs
▸400Validation error
application/jsonErrorResponse
messagerequiredstring
▸401Unauthorized
application/jsonErrorResponse
messagerequiredstring
▸403Insufficient permissions
application/jsonErrorResponse
messagerequiredstring
▸404Block not found
application/jsonErrorResponse
messagerequiredstring
▸409Project is suspended
application/jsonErrorResponse
messagerequiredstring
▸429Rate limit exceeded
application/jsonErrorResponse
messagerequiredstring

Update a block

patch/blocks/{blockId}

Parameters

blockIdpathrequiredstring

Opaque block identifier.

Request body

required
application/jsonobject
contentstring

Updated block content.

integrationIdstring:uuid

Integration ID to store in sql block metadata as sql_integration_id.

Responses

▸200Block updated
application/jsonUpdateBlockResponse
blockrequiredobject
▸400Bad request
application/jsonErrorResponse
messagerequiredstring
▸401Unauthorized
application/jsonErrorResponse
messagerequiredstring
▸403Insufficient permissions to update the block
application/jsonErrorResponse
messagerequiredstring
▸404Block not found, or integration does not exist in workspace
application/jsonErrorResponse
messagerequiredstring
▸409Project is suspended, or block type conflicts with requested update
application/jsonErrorResponse
messagerequiredstring
▸429Rate limit exceeded
application/jsonErrorResponse
messagerequiredstring

Delete a block

delete/blocks/{blockId}

Parameters

blockIdpathrequiredstring

Opaque block identifier.

Responses

▸204Block deleted
▸400Validation error
application/jsonErrorResponse
messagerequiredstring
▸401Unauthorized
application/jsonErrorResponse
messagerequiredstring
▸403Insufficient permissions
application/jsonErrorResponse
messagerequiredstring
▸404Block not found
application/jsonErrorResponse
messagerequiredstring
▸409Project is suspended
application/jsonErrorResponse
messagerequiredstring
▸429Rate limit exceeded
application/jsonErrorResponse
messagerequiredstring