Skip to main content
POST
Generate a context document

Authorizations

Authorization
string
header
required

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.

Body

application/json

Request body for POST /context-documents/generate.

All fields are optional. With no fields set, the system will:

  • Include resources from ALL connected integrations
  • Include resources from ALL users in the app (Tier 3)
  • Use the default Tier 3 structured summary prompt
  • Use Claude Opus 4.6 as the final synthesis model

The model field controls the Stage 2 (final synthesis) model. Stage 1 (per-source extraction) always uses Sonnet for cost efficiency.

sources
string[] | null

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

user_id
string | null

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

prompt
string | null

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.

Maximum string length: 10000
model
string
default:claude-opus-4-6

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_id
string
required
status
string
required
created_at
string<date-time>
required