---
title: "Generate a three-tier context document tree"
method: POST
path: "/context-documents/tree"
tags: ["Context Documents"]
---

# Generate a three-tier context document tree

`POST /context-documents/tree`

Generate a three-tier context document tree for local push delivery.

Creates company, workstream, and personal context docs from ALL ingested data
(Gmail, Slack, Drive, Jira, etc.). Returns immediately with a tree_id —
the daemon polls GET /tree/latest for the result.


No specific integration connection required — reads from synced resources
in the database.

## Request body

- TreeGenerateRequest — Request body for POST /context-documents/tree.
  - `sources` string[], nullable — Integration sources to include (e.g., ['gmail', 'slack']). Defaults to all.
  - `user_id` string, nullable — User ID for personal tier scoping. When set, personal/context.md is generated from this user's data only. Company and workstream tiers still use all data.
  - `workstream_name` string, nullable — Generate docs for this workstream only (skip auto-detection).

## Response `200`

Successful Response

- TreeGenerateResponse
  - `tree_id` string, required
  - `status` string, required
  - `created_at` string, date-time, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/hyperspell/apis/hyperspell-api.md) · [All operations](https://skmtc.net/hyperspell/apis/hyperspell-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/hyperspell/hyperspell-api/revisions/5721acd588e6/schema)
