FrameworkJavaScript
BlockData: the per-block payload
The structure of each block in the blocks array.
TypeScript
// Individual block structure
interface OutputBlockData {
id?: string; // Unique identifier (auto-generated)
type: string; // Tool name (e.g., "paragraph", "header")
data: object; // Tool-specific data
tunes?: { [name: string]: BlockTuneData }; // Optional block tunes/metadata
parent?: string; // Id of the parent block (flat-with-references nesting)
content?: string[]; // Ids of child blocks (flat-with-references nesting)
indent?: number; // Nesting/indent level
lastEditedAt?: number; // Timestamp (ms since epoch) of the last edit to this block
lastEditedBy?: string; // Id of the user who last edited this block (from user.id config)
}
// Example blocks:
const paragraphBlock: OutputBlockData = {
id: "p6QK0Xz1Ab",
type: "paragraph",
data: { "text": "Hello, world!" }
};
const headerBlock: OutputBlockData = {
id: "hM3lTn9RdC",
type: "header",
data: { "text": "Chapter 1", "level": 1 }
};
// Each list item is its own block — the list tool saves a single item,
// not an items[] array
const listItemBlock: OutputBlockData = {
id: "wY7bV2sQ8e",
type: "list",
data: {
"text": "Item 1",
"style": "unordered"
}
};BlockData
| Property | Description | |
|---|---|---|
id | string (optional) | The structure of each block in the blocks array. |
type | string | The structure of each block in the blocks array. |
data | object | The structure of each block in the blocks array. |
tunes | { [name: string]: BlockTuneData } | The structure of each block in the blocks array. |
parent | string (optional) | The structure of each block in the blocks array. |
content | string[] (optional) | The structure of each block in the blocks array. |
indent | number (optional) | The structure of each block in the blocks array. |
lastEditedAt | number (optional) | The structure of each block in the blocks array. |
lastEditedBy | string (optional) | The structure of each block in the blocks array. |