Skip to content
undertext developers
Skip to Content
undertext developers
REST API

Seals

Seal a document, list and look up its seals, and withdraw one.

A seal is a snapshot of a document as it stood, with the record of how it was written and the numbers that come from it: where its words came from, when someone was active in the editor, how many prompts and sittings it took. Each seal has a short page at seal.undertext.sh that anyone with the link can open, unless its owners made its seals private, and a seal line people paste wherever the text goes. A seal never changes once it's made; sealing again adds a new version. See Seals.

People can also seal from the Seal button in the editor. Either way, Undertext sends seal.created to your webhook endpoints.

The seal object

AttributeTypeDescription
codestringNine capital letters and digits.
urlstringThe seal's page: your seal_url with the code in it, or, without one, https://seal.undertext.sh/ and the code. The seal line begins with it.
versioninteger1 for the document's first seal, then 2, 3 and so on.
sealed_attimestampWhen it was sealed.
sealed_bystringThe Undertext id of the person who sealed it.
documentstring or nullThe document's id, or null once the document was deleted.
methodstring or nullThe version of the method its numbers were worked out with. They never change; under a newer method, the seal page shows a labeled reassessment beside them. This and the numbers below are null once the seal is withdrawn.
linestring or nullThe seal line, ready to paste.
compositionobjectPercentages of the document by where its words came from, summing to 100: typed, shaped, ai and external.
presenceobjectshare: percent of session time with a person present. verified_share: the part vouched for by check-ins. verified: true when every sitting people wrote in was verified.
promptsintegerRounds of back-and-forth with agents.
sittingsintegerSeparate stretches of work. The seal line calls them sessions.
durationstringSession time across those sittings, as the seal line writes it, such as 11hr2min.
attested_byobjectWho vouches for the people named in it. platform: your platform's slug. key_ids: the ids of the secret keys that started its writing sessions.
withdrawn_attimestamp or nullWhen it was withdrawn, or null.
previewobject or nullFor your seal page's link-preview tags (og:title, og:description, og:image): title, description, and image_url, a 1200×630 picture of the seal with its title and address. null unless anyone may read it: a private or withdrawn seal, or one whose document is in the trash, says nothing of itself.
{
  "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_2Lq9Wd4T"] },
  "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"
  }
}

When every sitting people wrote in was verified by check-ins, the line ends (verified); when some were, it ends with the share, such as (98% verified).

Seal a document

POST /v1/documents/{document_id}/seals

Seals the document as it stands now, as a new version. A document with pending suggestions can't be sealed: a seal says what the document says, so they're accepted or rejected first.

ParameterTypeDescription
document_idstring, path, requiredThe document's id.
userstring, requiredThe Undertext id of the person sealing it. They must be one of the document's owners.
curl https://api.undertext.sh/v1/documents/doc_8Hq2Lm4R/seals \
  -H "Authorization: Bearer $UNDERTEXT_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"user": "usr_5Kq2Lm8R"}'

Returns the seal with 201. If the document reads exactly as its newest seal still up, it returns that seal with 200 instead, makes no new version and sends no seal.created, so a form submitted twice doesn't seal twice.

ErrorWhen
403 not_owneruser isn't one of the document's owners.
409 document_emptyNothing has been written in the document.
409 document_trashedThe document is in the trash.
409 open_suggestionsThe document has pending suggestions.

List a document's seals

GET /v1/documents/{document_id}/seals

Every seal made from a document, newest first, withdrawn ones included.

ParameterTypeDescription
document_idstring, path, requiredThe document's id.
limitinteger1 to 100. Default 50.
afterstringThe next cursor from the previous page.
curl https://api.undertext.sh/v1/documents/doc_8Hq2Lm4R/seals \
  -H "Authorization: Bearer $UNDERTEXT_SECRET_KEY"
{
  "data": [
    {
      "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_2Lq9Wd4T"] },
      "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"
      }
    }
  ],
  "next": null
}

Retrieve a seal

GET /v1/seals/{code}

Looks a seal up by its code, such as one a reader pasted into your product. You can only retrieve seals made on your platform; anyone can open a public seal's page at seal.undertext.sh.

ParameterTypeDescription
codestring, path, requiredThe seal's code. Case doesn't matter.
curl https://api.undertext.sh/v1/seals/66G4LF343 \
  -H "Authorization: Bearer $UNDERTEXT_SECRET_KEY"

Returns the seal, or 404 seal_not_found.

Withdraw a seal

DELETE /v1/seals/{code}

Takes a seal down. Its page then says it was withdrawn, and when, instead of showing the text. A withdrawn seal can't be brought back, and other versions of the same document stay up. Seals can be withdrawn but never changed.

ParameterTypeDescription
codestring, path, requiredThe seal's code.
curl https://api.undertext.sh/v1/seals/66G4LF343 \
  -X DELETE \
  -H "Authorization: Bearer $UNDERTEXT_SECRET_KEY"

Returns the seal with withdrawn_at set, and Undertext sends seal.withdrawn. Withdrawing a seal that's already withdrawn returns it unchanged.

While a document is in its owners' trash, its seals are down: their pages show nothing until it's restored.

Who reads seals

A document's owners choose who reads its seals, every version alike, in the editor's seal dialog (the openSeal method opens it):

  • Anyone with the link, the default. Only these seals have a link preview.
  • Private: whoever can open the document, which is its members and, while its link lets anyone in, anyone with a seal session; readers its owners list by email, or *@domain for everyone at a domain; and, if they set one, whoever has its password.

A private seal's page asks the reader for its password, or, on your seal page, for a seal session your server starts for the person signed in with you, saying which email you've verified for them. A session opens the seal for its document's members, for anyone while the document's link lets people in, and for the readers its owners listed. A private seal's page on seal.undertext.sh offers the password, and sends readers to sign in on your seal page if you've set a seal_url.

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. The owners answer in the seal dialog: letting them in adds their email to the readers. See the seal_request events.

On this page