v38

latestOpenAPI 3.1.0raw.githubusercontent.com2026-06-1793196344.2 KB
Context Documents

Generate a context document

Generate an LLM-synthesized context document from the app's synced data.

This endpoint is async — it creates a ContextDocument record with status PROCESSING, emits an Inngest event, and returns immediately. The actual synthesis (which can take 1-15 minutes depending on data volume) happens in the background via the generate_context_document Inngest function.

The pipeline automatically chooses single-pass or multi-pass mode based on the total number of resources. See tasks/context_documents.py for the full pipeline architecture.

post/context-documents/generate

Request body

sourcesstring[] nullable

Integration sources to include (e.g., ['gmail', 'slack']). Defaults to all connected integrations.

user_idstring nullable

Scope to a specific user's data (Tier 1). Defaults to all users in the app (Tier 3).

promptstring nullable

Custom prompt template. Replaces the default Tier 3 structured summary prompt. The formatted resource data is passed as the user message regardless of the prompt.

modelstring

LLM model for final synthesis. This controls the Stage 2 model in multi-pass mode, or the single model in single-pass mode. Stage 1 extraction always uses Sonnet.

Response

Successful Response

document_idstring required
statusstring required
created_atstring date-time required