How to Summarise Notion Pages with Claude Code

Summarise Notion pages inside a Claude Code agent pipeline using EnConvert Distill. Get a clean summary in one API call without chunking or prompt engineering

Get API key

If you are building a Claude Code agent that reads Notion pages, you need condensed, usable content — not raw exports. Notion pages carry navigation chrome, breadcrumb trails, inline comments, and sidebar metadata that inflate token usage and dilute the signal your agent actually needs. A custom summarisation prompt works until you need it to generalise across pages with different structures and lengths, at which point it becomes another layer to maintain. EnConvert’s Distill endpoint takes a Notion URL and returns a clean, concise summary ready to pass into a Claude Code agent as context or store in a memory layer.

Example

python
import os

import anthropic
import httpx

NOTION_URL = os.environ["NOTION_URL"]  # a publicly shared Notion page URL

# Step 1: Extract the Notion page content via Distill
distill_response = httpx.post(
    "https://api.enconvert.com/v2/distill",
    headers={
        "X-API-Key": os.environ["ENCONVERT_API_KEY"],
        "Content-Type": "application/json",
    },
    json={
        "urls": [NOTION_URL],
        "schema": {
            "summary": (
                "a thorough summary of the page, including every decision "
                "recorded on it"
            ),
        },
    },
    timeout=60,
)
distill_response.raise_for_status()

item = distill_response.json()["results"][0]
if item.get("error") or not item.get("data"):
    raise RuntimeError(f"Distill failed for {NOTION_URL}: {item.get('error')}")
summary = item["data"]["summary"]

# Step 2: Pass the summary into Claude as context
client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])

message = client.messages.create(
    model="claude-opus-4-6",
    max_tokens=1024,
    system="You are a technical assistant. Use the provided page summary as context when answering questions.",
    messages=[
        {
            "role": "user",
            "content": (
                "Here is a summary of the relevant Notion page:\n\n"
                f"{summary}\n\n"
                "Based on this, what are the key decisions recorded?"
            ),
        }
    ],
)

print(message.content[0].text)

What you get back

Distill returns the core content condensed into clean paragraphs or structured points, with navigation elements, breadcrumb trails, inline comments, and sidebar blocks stripped before the response is returned. Passing a raw Notion export into an agent context instead produces bloated token usage, irrelevant formatting markup, inconsistent structure across pages, and a higher probability of the agent reasoning over navigation text rather than actual content.

Get free API key — 500 ops per month, no card required.