Get the latest context document tree
Get the most recent context document tree for the authenticated app.
The sync daemon polls this endpoint to fetch updated files. Default
behaviour: serve the latest “ready” tree, where “ready” depends on
whether the app has require_review enabled:
require_review=False(default): latest COMPLETED ships immediately.require_review=True: latest PUBLISHED only — apps that gate on a curator’s approval before the daemon picks up the new tree.
?status=<value> filters to a specific status (case-insensitive).
?include_published=true returns the absolute latest tree (any status)
so the dashboard can surface an in-flight PROCESSING generation when
the user navigates away mid-gen and back. The daemon path (no
include_published) keeps strict status filtering.
Auto-trigger semantics replace the pre-Temporal lazy
BackgroundTasks path:
- If the app has no tree at all and the caller has a user_key, a
full
TreeGenerationWorkflowis dispatched withuser_id=user_keyso its in-line Phase 4 populates this user’s overrides. The endpoint still 404s on this poll; the daemon will see a PROCESSING tree on its next poll. - If the latest COMPLETED tree has no
personal_overridesentry for the caller, a lightweightPersonalDocWorkflowis dispatched against that tree to backfill just this user’s override block. The response is still served immediately with placeholder personal/*.md content — as a lightweight 304 when the caller already presents the current ETag (FT-184) — and the next poll after the backfill lands merges the generated content in (the override changes the ETag, so that poll gets a fresh 200).
Both dispatches use deterministic workflow IDs that also dedupe with
Phase 4’s child-workflow dispatch from TreeGenerationWorkflow,
so concurrent runs never race against each other.
Authorizations
API Key or JWT User Token. If using an API Key, set the X-As-User header to act as a specific user. A JWT User Token is always scoped to a specific user.