Deepnote Public API v2
Blocks API
Notebook blocks (code, SQL, markdown, etc.).
Base URL
https://api.deepnote.com/v2Create a block
/blocksRequest body
CreateBlockBodynotebookIdrequiredstringNotebook 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").
contentstringInitial block content. Defaults to an empty string.
metadataobjectBlock-type-specific metadata.
integrationIdstring:uuidIntegration ID to store in SQL block metadata as sql_integration_id.
positionintegerZero-based insertion index. Omit to append at the end.
includeNotebookBlockIdsbooleanWhen true, response includes all block IDs in the notebook.
Responses
▸201Block created
CreateBlockResponseblockrequiredBlocknotebookBlockIdsstring[]All block IDs in the notebook (only when includeNotebookBlockIds is true).
▸400Validation error
ErrorResponsemessagerequiredstring▸401Unauthorized
ErrorResponsemessagerequiredstring▸403Insufficient permissions
ErrorResponsemessagerequiredstring▸404Notebook not found, or integration does not exist in workspace
ErrorResponsemessagerequiredstring▸409Project is suspended, or block type conflicts with requested integration
ErrorResponsemessagerequiredstring▸429Rate limit exceeded
ErrorResponsemessagerequiredstringGet a block
/blocks/{blockId}Parameters
blockIdpathrequiredstringOpaque 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
GetBlockResponseblockrequiredBlockWithOutputs▸400Validation error
ErrorResponsemessagerequiredstring▸401Unauthorized
ErrorResponsemessagerequiredstring▸403Insufficient permissions
ErrorResponsemessagerequiredstring▸404Block not found
ErrorResponsemessagerequiredstring▸409Project is suspended
ErrorResponsemessagerequiredstring▸429Rate limit exceeded
ErrorResponsemessagerequiredstringUpdate a block
/blocks/{blockId}Parameters
blockIdpathrequiredstringOpaque block identifier.
Request body
objectcontentstringUpdated block content.
integrationIdstring:uuidIntegration ID to store in sql block metadata as sql_integration_id.
Responses
▸200Block updated
UpdateBlockResponseblockrequiredobject▸400Bad request
ErrorResponsemessagerequiredstring▸401Unauthorized
ErrorResponsemessagerequiredstring▸403Insufficient permissions to update the block
ErrorResponsemessagerequiredstring▸404Block not found, or integration does not exist in workspace
ErrorResponsemessagerequiredstring▸409Project is suspended, or block type conflicts with requested update
ErrorResponsemessagerequiredstring▸429Rate limit exceeded
ErrorResponsemessagerequiredstringDelete a block
/blocks/{blockId}Parameters
blockIdpathrequiredstringOpaque block identifier.
Responses
▸204Block deleted
▸400Validation error
ErrorResponsemessagerequiredstring▸401Unauthorized
ErrorResponsemessagerequiredstring▸403Insufficient permissions
ErrorResponsemessagerequiredstring▸404Block not found
ErrorResponsemessagerequiredstring▸409Project is suspended
ErrorResponsemessagerequiredstring▸429Rate limit exceeded
ErrorResponsemessagerequiredstring