//native
/**
* Update Block
* Update an existing block's content. `content` is keyed by the block's type and replaces the fields you give, e.g. {"paragraph": {"rich_text": [{"text": {"content": "New text"}}]}} or {"to_do": {"checked": true}}. The block type can't be changed.
*/
export async function main(
auth: RT.Notion,
block_id: string,
content: { [key: string]: any }
) {
const response = await fetch(`https://api.notion.com/v1/blocks/${block_id}`, {
method: "PATCH",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
"Notion-Version": "2026-03-11",
},
body: JSON.stringify(content),
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 4 hours ago