I’m using the Notion API to add a table block but encounter a missing children error. Using a header block works. New attempts below:
auth_headers = {
'Authorization': f"Bearer {access_token}",
'Accept': 'application/json',
'Content-Type': 'application/json',
'Notion-Version': '2022-06-28'
}
payload_table = {
'children': [{
'object': 'block',
'type': 'table',
'table': {'width': 5} # Missing required 'children' field
}]
}
result = requests.patch('https://api.notion.com/v1/blocks/xyz789/children', headers=auth_headers, json=payload_table)
payload_header = {
'children': [{
'object': 'block',
'type': 'header',
'header': {'rich_text': [{'text': {'content': 'Example Header'}}]}
}]
}
success = requests.patch('https://api.notion.com/v1/blocks/xyz789/children', headers=auth_headers, json=payload_header)