Skip to content

Daily

Archive empty and duplicate Notion pages

Your database stays clean, and you get an email listing what was archived so you can restore anything from the trash.

Runs
Daily
Apps
Notion
AI
Not needed
Access
read+write

Send this to your assistant

Create a ClickRuntime automation: every night at 11pm, archive pages in my Notion Links database that are empty or have the same URL as an older page, then email me a list of what was archived.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

Notion databases collect junk. A person clicks New and leaves without typing, an import runs twice, a form integration creates the same contact on each retry. After a year, a CRM database has 200 untitled pages and 80 duplicate companies, filters return confusing results, and a count of customers is wrong. Cleaning it takes a tedious afternoon that nobody schedules, so the clutter grows and trust in the data falls.

Every night ClickRuntime goes through the database's pages, identifies empty ones that have no blocks and no filled properties, finds duplicates by a key property such as email or title, archives them, and emails an audit log of what was archived. Archived pages are not deleted outright, so a mistake can be reversed in Notion.

Anyone who keeps a CRM, a contact list or an inventory in Notion benefits from regular tidying.

What you get out of it

  • Counts and views become reliable

    With duplicates gone, the number of customers is the real number. Reports and rollups built on the database stop being quietly wrong. Reports and rollups built on the database stop being quietly wrong, and filters return what you expect.

  • Cleanup stops being a project

    The nightly run removes clutter before it builds up. Nobody has to schedule a half-day to tidy the database before an important review. Nobody has to schedule a half day to tidy the database before an important review or client demo.

  • Nothing is lost permanently

    Pages are archived and can be restored from Notion's trash if a decision was wrong. That safety makes it reasonable to run the cleanup unattended. That safety makes it reasonable to run the cleanup unattended every night without worry.

  • A log tells you exactly what changed

    The email lists each archived page and the reason, empty or duplicate. If someone asks where a record went, the audit log answers it. If someone asks where a record went, the audit log gives the answer in seconds.

  • Imports can be rerun safely

    A double import or an integration retry no longer permanently doubles your records. Duplicates are caught the next night, which removes fear from bulk loads. That removes the fear from bulk loads and re-syncs, since duplicates are caught the next night.

How it works

What happens, step by step

  1. Every day ClickRuntime goes through every page in your Notion database.

  2. It finds pages that are empty and pages that duplicate another entry with the same link.

  3. Those pages are archived in Notion, not deleted, so you can restore them.

  4. You get an email listing each archived page and why.

Before it runs live

  • Connect Notion and share the database you want it to use

What you get

RunsDaily
Archive empty and duplicate Notion pagestoday, 9:00Succeeded
Email · Archived 3 Notion pages(untitled): empty Acme pricing teardown: duplicate of https://acme.example/blog/pricing

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Notion steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
archive_empty_and_duplicate_database_pages.pyexample
from clickruntime import on_trigger, credentials, http, notify

NOTION = "https://api.notion.com/v1"

def headers():
    return {"Authorization": f"Bearer {credentials.secret('NOTION_TOKEN')}", "Notion-Version": "2022-06-28"}

def query(db, body=None):
    resp = http.post(f"{NOTION}/databases/{db}/query", headers=headers(), json=body or {})
    resp.raise_for_status()
    return resp.json()["results"]

def title(page, prop="Name"):
    return "".join(t["plain_text"] for t in page["properties"][prop]["title"])

LINKS = "links-database-id"

@on_trigger
def run(event):
    pages = query(LINKS, {"sorts": [{"timestamp": "created_time", "direction": "ascending"}], "page_size": 100})
    seen, archived = set(), []
    for page in pages:
        name, url = title(page), page["properties"]["URL"]["url"]
        if not name and not url:
            reason = "empty"
        elif url and url in seen:
            reason = f"duplicate of {url}"
        else:
            seen.add(url)
            continue
        http.patch(f"{NOTION}/pages/{page['id']}", headers=headers(), json={"archived": True}).raise_for_status()
        archived.append(f"{name or '(untitled)'}: {reason}")
    if archived:
        notify.email_me(f"Archived {len(archived)} Notion pages", "\n".join(archived))
    return {"archived": len(archived)}

FAQ

Common questions

How are duplicates identified?
By a key property you choose, such as email for contacts or name for companies. Pages sharing the same value are treated as duplicates, and the oldest one is kept while the others are archived.
Will it archive pages that are only partly filled in?
No. Only pages with no content and no filled properties count as empty, apart from the default title. A page with a single note or any property value is left alone. Archiving applies only to pages that match the empty rule exactly.
Can I preview what it would archive?
Yes. A first run can email the list without archiving anything, so you can check the rules against real data. Once you are satisfied, switch on archiving, and keep the email as a record. Reviewing the first email is a good habit.
What permissions does it need?
read+write. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (daily). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Archive empty and duplicate Notion pages” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.