Overview
The clear-page endpoint archives all top-level content blocks from a Notion page, effectively clearing it. This is useful for:
- Resetting a page before adding new content
- Cleaning up test or temporary pages
- Automating page content replacement workflows
Important Notes:
- Uses Notion’s archive functionality (blocks can be recovered from trash)
- Only deletes top-level blocks; child blocks are automatically archived with their parents
- Does NOT delete the page itself, only its content
- Preserves page properties and title
Request
Your Notion integration token (from notion.so/my-integrations)
The ID of the Notion page to clear
Response
Will be “success” for successful requests
Total number of top-level blocks that were archived
Number of retry attempts due to rate limiting or transient errors
Examples
curl -X POST "https://api.mark2notion.com/api/clear-page" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"notionToken": "secret_NOTION_INTEGRATION_TOKEN",
"pageId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}'
Response Example
{
"status": "success",
"data": {
"blocksDeleted": 42,
"retryCount": 0
}
}
Common Use Cases
Clear and Replace Page Content
Combine with the /append endpoint to replace page content:
// 1. Clear existing content
await fetch('https://api.mark2notion.com/api/clear-page', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
notionToken: 'secret_NOTION_INTEGRATION_TOKEN',
pageId: 'your-page-id'
})
});
// 2. Add new content
await fetch('https://api.mark2notion.com/api/append', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
markdown: '# Fresh Content\n\nThis replaces everything.',
notionToken: 'secret_NOTION_INTEGRATION_TOKEN',
pageId: 'your-page-id'
})
});
Automated Report Generation
Clear and regenerate daily reports:
import requests
from datetime import datetime
# Clear yesterday's report
requests.post(
'https://api.mark2notion.com/api/clear-page',
headers={'x-api-key': 'YOUR_API_KEY'},
json={
'notionToken': 'secret_TOKEN',
'pageId': 'report-page-id'
}
)
# Generate today's report
report_markdown = f"# Daily Report - {datetime.now().strftime('%Y-%m-%d')}\n\n..."
requests.post(
'https://api.mark2notion.com/api/append',
headers={'x-api-key': 'YOUR_API_KEY'},
json={
'markdown': report_markdown,
'notionToken': 'secret_TOKEN',
'pageId': 'report-page-id'
}
)
Error Handling
The endpoint follows standard error responses. See the Errors page for details.
Common Errors
Missing or invalid notionToken or pageId parameters
Invalid Notion token or no access to the specified page
Page does not exist or has been deleted
Too many requests. The endpoint includes automatic retry logic, but you may still hit limits with very high request volumes.
Usage & Pricing
Each successful clear-page request counts as 1 API usage regardless of how many blocks are deleted.
- Empty pages (0 blocks): Still counts as 1 usage
- Pages with many blocks: Still counts as 1 usage
- Failed requests: Do not count towards usage
Pro Tip: Since clearing a page costs 1 credit regardless of size, it’s efficient for pages with lots of content. Use this when you need a clean slate!
Idempotency
The clear-page endpoint implements idempotency to prevent duplicate operations:
- Concurrent identical requests return
202 Accepted with “in_progress” status
- Once completed, subsequent clear requests are processed normally
- Each request is tracked based on API key, page ID, and Notion token
- Average response time: 2-5 seconds for typical pages
- Large pages (100+ blocks): Up to 10-15 seconds
- The endpoint processes blocks sequentially with built-in rate limit handling
- Automatic retries ensure reliability even during Notion API throttling
Integration Examples
n8n Workflow
Create a workflow node that clears a page before updating:
- HTTP Request node →
POST /api/clear-page
- Wait 2 seconds (optional, for safety)
- HTTP Request node →
POST /api/append with new content
Make (Integromat)
Add a “Clear Page” action:
- HTTP module → Make a request
- Method: POST
- URL:
https://api.mark2notion.com/api/clear-page
- Headers:
x-api-key with your API key
- Body: JSON with
notionToken and pageId
Zapier
Use the Webhooks by Zapier action:
- Choose “POST” method
- URL:
https://api.mark2notion.com/api/clear-page
- Add header:
x-api-key
- Payload Type: JSON
- Add data:
notionToken and pageId