Seal and verify
Seal a document from the editor or your server, show the seal line in your app and seals on your own site, and know what a reader sees when they open one.
Sealing takes a snapshot of a document as it stands, together with the record of how it was written, and gives it a short link: on your own site once you show seals there, and at seal.undertext.sh until then. The text can then go anywhere, such as an email, a submission form or a pull request, and the link goes with it. Anyone who opens the link sees the sealed text, where its words came from, and when someone was active in the editor, unless its owners made its seals private.
By the end of this guide, your users can seal from the editor or from your own button, your app knows about every seal, your site shows them, and you know what readers will see.
Seal from the editor
The editor has a Seal button (your own button can open it with editor.openSeal()). Anyone who can open the document sees its seals there, with their links and who reads them, and its editors the readers listed. Its owners also seal there on confirmation, choose who reads the document's seals, answer people asking to read them, and withdraw versions. You don't need to build anything for this, but your app should hear about it:
editor.on("seal", ({ code, url, line }) => {
sealList.add({ code, url, line });
});The same seal also arrives as a seal.created webhook, which is the one to rely on for anything you store: the page may be closed before the event reaches it. See Send notifications.
Seal from your server
To seal from your own button, or as part of your own flow such as submitting an assignment, call the API with the user who is sealing. They must be one of the document's members who edit it, or an owner, and it can't be sealed while it has pending suggestions.
app.post("/assignments/:id/submit", requireSignIn, async (req, res) => {
const assignment = await db.assignments.find(req.params.id);
const seal = await undertext.seals.create(assignment.documentId, { user: req.user.undertextUserId });
await db.submissions.insert({ assignment: assignment.id, seal: seal.code, at: seal.sealed_at });
res.json({ url: seal.url, line: seal.line });
});The seal comes back with everything a reader will see:
{
"code": "66G4LF343",
"url": "https://seal.undertext.sh/66G4LF343",
"document": "doc_8Hq2Lm4R",
"version": 1,
"sealed_at": "2026-10-30T16:31:04Z",
"sealed_by": "usr_5Kq2Lm8R",
"method": "v0.2",
"line": "seal.undertext.sh/66G4LF343 · 96% typed/shaped · 2% AI · 2% external · 101 prompts · 9 sessions, 11hr2min (98% verified)",
"composition": { "typed": 86, "shaped": 10, "ai": 2, "external": 2 },
"presence": { "share": 99, "verified_share": 98, "verified": false },
"prompts": 101,
"sittings": 9,
"duration": "11hr2min",
"attested_by": { "platform": "acme", "key_ids": ["key_2wLx7Hq"] },
"withdrawn_at": null,
"preview": {
"title": "On the Analytical Engine",
"description": "96% typed/shaped · 2% AI · 2% external · 101 prompts · 9 sessions, 11hr2min (98% verified). Sealed with Undertext, written in Acme Notes (acme.com, verified).",
"image_url": "https://seal.undertext.sh/api/seals/66G4LF343/preview.png"
}
}Sealing a document that reads exactly as its newest seal still up returns that seal, with 200 rather than 201, so a form submitted twice doesn't seal twice.
Before sealing
To show where a document stands before anyone seals it, such as on a submit screen, read its live provenance. It uses the same method a seal would, but nothing is kept:
const reading = await undertext.documents.provenance("doc_8Hq2Lm4R");
reading.composition; // { typed: 85.8, shaped: 10.2, ai: 2.3, external: 1.7 }
reading.presence; // { share: 99, verified_share: 98, verified: false }The editor's own seal, in the corner, shows the same reading as people write.
Show the seal line
The seal line is one string meant to travel with the text: the link, then the shares. Show it with a copy button wherever your users finish their work.
seal.undertext.sh/66G4LF343 · 96% typed/shaped · 2% AI · 2% external · 101 prompts · 9 sessions, 11hr2min (98% verified)When check-ins vouched for every sitting, the line ends (verified); when they vouched for some, it says how much, such as (98% verified). Show seal.line as it comes: don't rebuild it from the numbers, since rounding and wording are part of the method.
Public seal links unfurl in chat apps and social sites with an image of the seal and its numbers.
Show seals on your site
Until you show seals yourself, a seal's link is its page on seal.undertext.sh. To show them at your own address instead, such as https://acme.com/seals/66G4LF343:
-
Set your seal URL, with
{code}where the code goes, in the console or from your server. Every seal'surland seal line name it from then on, those made before too.await undertext.platform.update({ seal_url: "https://acme.com/seals/{code}" }); -
Serve a page there, with a public seal's link-preview tags from its
preview, so its link unfurls as it would onseal.undertext.sh:seals.ts app.get("/seals/:code", async (req, res) => { const seal = await undertext.seals.retrieve(req.params.code).catch(() => null); if (!seal) return res.status(404).send(notFound()); // <title>, og:title, og:description and og:image, from seal.preview when it isn't null, // escaped as any text people wrote: the title is theirs. res.send(sealPage(seal.code, seal.preview)); }); -
Show the seal in it with
mountSeal. Undertext draws the text, the seal and its breakdown in a frame of its own, as it does the editor, so what readers see is what Undertext recorded, whatever your page does around it.seal-page.ts import { mountSeal } from "@undertext/embed"; const seal = mountSeal(document.getElementById("seal"), { code, getToken: async () => { const response = await fetch("/undertext/seal-session", { method: "POST" }); return response.ok ? (await response.json()).token : null; }, onSignIn: () => location.assign(`/sign-in?next=${encodeURIComponent(location.pathname)}`), }); seal.on("ready", ({ title }) => (document.title = title ?? "Acme Notes"));
Add embed.undertext.sh to your page's frame-src if it has a Content Security Policy, and make sure its origin is one of your embed origins. seal.undertext.sh/<code> keeps showing each public seal as Undertext's own page, where anyone can check what yours shows.
Seal again
A seal never changes. People can keep editing after sealing, and seal again whenever they like: each seal gets its own code and link, and its version counts up for that document. List them all with:
const seals = await undertext.seals.list("doc_8Hq2Lm4R");Withdraw a seal
Whoever sealed a version can withdraw it in the seal dialog, and an owner can withdraw any, for example one shared by mistake. Your server can withdraw any. Its link then says it was withdrawn, instead of showing the text. A seal can't be edited, only withdrawn.
await undertext.seals.withdraw("66G4LF343");Deleting a document withdraws all its seals. You hear about each through seal.withdrawn. While a document is in its owners' trash, its seals are down, and come back when it's restored.
Private seals
In the seal dialog, its owners choose who reads a document's seals, every version alike: anyone with the link, or private: whoever can open the document, the readers they name by email (or *@domain for everyone at a domain), and whoever has a password, if they set one.
A private seal's page offers the password. On your own seal page, your server also vouches for the person signed in with you, with a seal session carrying the email you've verified for them, which getToken above asks for:
app.post("/undertext/seal-session", requireSignIn, async (req, res) => {
const user = req.user;
const { token } = await undertext.sessions.create({
user: await undertextUserId(user),
purpose: "seal",
email: user.emailVerified ? user.email : null,
});
res.json({ token });
});Undertext lets them in if they can open the document or their email is on the list. While the document's link lets anyone in, that's anyone you start a seal session for, as a seal's page can't tell who has the document's link. Pass the email only if you've verified it. Someone signed out, or signed in with an email it isn't shared with, sees a way to sign in that calls your onSignIn. On seal.undertext.sh, a private seal offers its password, and sends readers to sign in on your seal page.
Someone signed in whose email you vouched for, and whom it doesn't let in, can ask its owners to let them read it, with a message, right on the seal's page. The owners answer in the seal dialog. Undertext sends seal_request.created with the owners to tell, then seal_request.accepted or seal_request.declined; tell the owners on the first, and the person asking on accepted, with the seal's link.
What a reader sees
-
The sealed text, exactly as it stood, so a reader can compare it with what they were sent.
-
The seal. The outer ring is the whole document by where its words came from: typed by people, AI text people shaped, AI text kept as written, and external (pasted or imported). The inner ring is presence, in electric blue where check-ins vouched for it.
-
The breakdown. Prompts and agent work, who did what, the sittings on a timeline, which signals were on, and the date and method the seal was made under. Below it, who sealed it and when.
-
Who vouches for what. The page names your platform as where it was written, which vouches for who wrote it. Undertext vouches for how the text was written, because it recorded that itself. Your platform vouches for who the people are, because it signs them in. Check-ins are shown apart, as the part neither of you could produce.
Each seal records the method version it was made under (v0.2 above). When Undertext's method improves, existing seals keep their numbers; the page adds the reading under the newer method beside them, labelled as such, and never rewrites a seal.
Each seal keeps the ids of the secret keys that started its writing sessions (attested_by.key_ids), so a seal written with a key you later find leaked can be traced to it. See Go live.
Next
- Seals: what each number means.
- Trust model: what a seal proves, and what it doesn't.
- Seals in the API reference.