Clear Notion Page
curl --request POST \
--url https://api.mark2notion.com/api/clear-page \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"notionToken": "<string>",
"pageId": "<string>"
}
'import requests
url = "https://api.mark2notion.com/api/clear-page"
payload = {
"notionToken": "<string>",
"pageId": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({notionToken: '<string>', pageId: '<string>'})
};
fetch('https://api.mark2notion.com/api/clear-page', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mark2notion.com/api/clear-page",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'notionToken' => '<string>',
'pageId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mark2notion.com/api/clear-page"
payload := strings.NewReader("{\n \"notionToken\": \"<string>\",\n \"pageId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mark2notion.com/api/clear-page")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"notionToken\": \"<string>\",\n \"pageId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mark2notion.com/api/clear-page")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"notionToken\": \"<string>\",\n \"pageId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "<string>",
"data": {
"blocksDeleted": 123,
"retryCount": 123
}
}API Reference
Clear Notion Page
Archive all top-level blocks from a Notion page
POST
/
api
/
clear-page
Clear Notion Page
curl --request POST \
--url https://api.mark2notion.com/api/clear-page \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--data '
{
"notionToken": "<string>",
"pageId": "<string>"
}
'import requests
url = "https://api.mark2notion.com/api/clear-page"
payload = {
"notionToken": "<string>",
"pageId": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({notionToken: '<string>', pageId: '<string>'})
};
fetch('https://api.mark2notion.com/api/clear-page', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mark2notion.com/api/clear-page",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'notionToken' => '<string>',
'pageId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mark2notion.com/api/clear-page"
payload := strings.NewReader("{\n \"notionToken\": \"<string>\",\n \"pageId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mark2notion.com/api/clear-page")
.header("x-api-key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"notionToken\": \"<string>\",\n \"pageId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mark2notion.com/api/clear-page")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"notionToken\": \"<string>\",\n \"pageId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "<string>",
"data": {
"blocksDeleted": 123,
"retryCount": 123
}
}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
- 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
string
required
Your Mark2Notion API key
string
Your Notion integration token. Optional when your workspace is connected via OAuth in the dashboard. Pass this if you prefer to authenticate with a manual integration token instead. See Using a Manual Notion Token.
string
required
The URL or page ID of the Notion page to clear. Pass the full
notion.so page URL or just the page ID — both are accepted.Response
string
Will be “success” for successful requests
object
Examples
curl -X POST "https://api.mark2notion.com/api/clear-page" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"pageId": "https://notion.so/Your-Page-Title-a1b2c3d4e5f67890abcdef1234567890"
}'
const response = 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({
pageId: 'https://notion.so/Your-Page-Title-a1b2c3d4e5f67890abcdef1234567890'
})
});
const data = await response.json();
console.log(`Cleared ${data.data.blocksDeleted} blocks`);
import requests
response = requests.post(
'https://api.mark2notion.com/api/clear-page',
headers={
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
},
json={
'pageId': 'https://notion.so/Your-Page-Title-a1b2c3d4e5f67890abcdef1234567890'
}
)
data = response.json()
print(f"Cleared {data['data']['blocksDeleted']} blocks")
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
payload := map[string]string{
"pageId": "https://notion.so/Your-Page-Title-a1b2c3d4e5f67890abcdef1234567890",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest(
"POST",
"https://api.mark2notion.com/api/clear-page",
bytes.NewBuffer(jsonData),
)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
data := result["data"].(map[string]interface{})
fmt.Printf("Cleared %.0f blocks\n", data["blocksDeleted"])
}
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({
pageId: 'https://notion.so/Your-Page-Title-abc123'
})
});
// 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.',
pageId: 'https://notion.so/Your-Page-Title-abc123'
})
});
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={
'pageId': 'https://notion.so/Your-Report-Page-abc123'
}
)
# 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,
'pageId': 'https://notion.so/Your-Report-Page-abc123'
}
)
Error Handling
The endpoint follows standard error responses. See the Errors page for details.Common Errors
| Status | Meaning |
|---|---|
400 | Missing or invalid pageId parameter |
401 | Invalid Notion token or no access to the specified page |
403 | Invalid API key |
404 | Page does not exist or has been deleted |
429 | Too many requests. Automatic retry logic is built in, but very high volumes may still hit limits |
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 Acceptedwith “in_progress” status - Once completed, subsequent clear requests are processed normally
- Each request is tracked based on API key, page ID, and Notion token
Performance
- 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/appendwith 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-keywith your API key - Body: JSON with
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:
pageId(URL or page ID)