---
title: "Generate Document Content"
method: POST
path: "/api/me/documents/{document_id}/generate"
---

# Generate Document Content

`POST /api/me/documents/{document_id}/generate`

## Request

- Base URL: `https://api.meet-align.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.meet-align.com/api/me/documents/{document_id}/generate`
- Auth: none declared

The "Align" panel's AI-draft actions — a real LLM call (same
OpenRouter context model @align's grounded Q&A uses), not a canned
response.

Two distinct modes, split on whether the request references the
document's own existing text (`useExisting`, e.g. "Summarize this" /
"Write an introduction" / "Improve this content"):
- `useExisting` on a non-blank document: generates ONLY the new
  content the request asks for and APPENDS it (`generate_document_addition`
  + `append_document_content`) — this used to run the exact same
  from-scratch generation as the branch below and save that over the
  whole document, silently destroying whatever the user had already
  written the moment any "summarize"/"improve" style action ran.
- Otherwise (a blank/new document, or a from-scratch request):
  generates a whole new document and saves it in full — there's
  nothing existing to lose.
Either way this bumps current_version and records a version snapshot
like a manual save would, so a bad generation is still one click
away from Version history — but that's a safety net now, not the
only thing standing between a user and a wiped document.

Also feeds in whatever the Context panel has attached — the panel's
actual promise ("Add context so Align can help you better"), not
just a list of links. Always on, not opt-in: an attached item with
nothing feeding into generation would make the panel decorative.

## Path parameters

- `document_id` string, required

## Request body

- object

## Response `200`

Successful Response

- object

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/meet-align/apis/hudl-api.md) · [All operations](https://skmtc.dev/meet-align/apis/hudl-api/llms.txt) · [OpenAPI document](https://skmtc.dev/meet-align/apis/hudl-api/revisions/3f4c53c5b564?raw)
