---
title: "Create a block"
method: POST
path: "/blocks"
tags: ["Blocks"]
---

# Create a block

`POST /blocks`

## Request body

- CreateBlockBody
  - `notebookId` string, required — Notebook to create the block in.
  - `type` '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', required — Block type (e.g. "code", "sql", "markdown").
  - `content` string — Initial block content. Defaults to an empty string.
  - `metadata` object — Block-type-specific metadata.
  - `integrationId` string, uuid — Integration ID to store in SQL block metadata as sql_integration_id.
  - `position` integer — Zero-based insertion index. Omit to append at the end.
  - `includeNotebookBlockIds` boolean — When true, response includes all block IDs in the notebook.

## Response `201`

Block created

- CreateBlockResponse
  - `block` Block, required
    - `id` string, required — Opaque block identifier.
    - `notebookId` string, required — Opaque notebook identifier.
    - `type` string, required
    - `content` string, required
    - `metadata` object, nullable
    - `integrationId` string, uuid, nullable
    - `version` integer, required
    - `createdAt` string, date-time, required
    - `updatedAt` string, date-time, required
  - `notebookBlockIds` string[] — All block IDs in the notebook (only when includeNotebookBlockIds is true).

## Other responses

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

---

[API](https://skmtc.net/deepnote/apis/deepnote-public-api.md) · [All operations](https://skmtc.net/deepnote/apis/deepnote-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/deepnote/deepnote-public-api/revisions/726970fd2992/schema)
