updateBlock

abstract suspend fun updateBlock(id: UuidString, block: Block): Block

Updates the content of an existing block.

Note:

  • You cannot change a block's type (e.g., from paragraph to to-do), only its content. This method will throw an exception if a block of a different type is provided.

  • This method does not retrieve or update children blocks. Blocks that can have children will have their Block.children property set to an empty list, while blocks that cannot have children will have it set to null.

Return

The updated Block object

Parameters

id

The unique identifier of the block to update

block

The updated block content (must be the same type as the original block)

See also

Throws

NotionApiException

if the block doesn't exist, the block type doesn't match, or the API request fails