Create an analysis from a content selection

Requires `analyses:run`. **Selection → analysis → comments.** Name the content (`selection.collectionId`, `selection.postIds`, or `selection.posts` filters — the same filters as `GET /posts`, plus `tag`), optionally narrow the comments with dashboard `filters` and/or an AI `search`, and get back one analysis resource. - **Snapshot** (no AI `search`, ≤ 100 posts): computed inline from stored comment scores. Responds `201` with `status: ready`. `search.mode: keyword` is folded into `filters.keywords` and still returns a `201` snapshot. - **Job** (`search` with `mode: ai` — the default — or more than 100 posts): responds `202` with `status: queued` and a `Location` header. Poll `GET /analyses/{analysisId}` until `status` is `ready` or `failed`, honoring `Retry-After` / `meta.pollAfterMs`. Either way, a sample of comments behind the analysis is `GET /analyses/{analysisId}/comments`. Analyses expire after 7 days. Paths: the `Location` header is a path on the host (`/analyst/v1/analyses/{analysisId}`); `comments.path` in payloads is relative to the API base URL (`/analyses/{analysisId}/comments`). Do not prepend `/analyst/v1` to `comments.path` a second time. Selections are capped at 1,000 posts (`selectionTruncated: true` when more matched). Never rescores posts or changes the workspace. Rate class `analysis_create` (10 / minute, 100 / day per key), or `analysis_search` (2 / minute, 10 / day) when `search.mode` is `ai`. Recreate rollups on one refresh a day, not every run.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

OR
X-Api-Keystring
API Key authentication via header

Request

This endpoint expects an object.
selectionobjectRequired

Which content the analysis covers. Provide exactly one of postIds or posts; collectionId may stand alone or be combined with posts filters to narrow within the collection. Resolves to at most 1,000 posts (newest first).

filtersobjectOptional

Comment-level narrowing — the same controls as the dashboard analysis view. Everything is optional; when present, only comments matching all active filters count toward the analysis and are returned from GET /analyses/{analysisId}/comments. Hidden comments are always excluded.

searchobjectOptional

Search inside the selected comments. mode: ai (default) runs the dashboard’s semantic search and always creates a job (202). mode: keyword is deterministic — it is folded into filters.keywords and stays synchronous.

includelist of enumsOptional
Optional extras computed with the analysis.
Allowed values:

Response headers

LocationstringOptional

Host path of the analysis, e.g. /analyst/v1/analyses/an_…

Response

Analysis computed inline (status: ready)

dataobjectOptional

An analysis created with POST /analyses. scope, content, and commentAnalysis are null until status is ready. content is creator-side (what was posted); commentAnalysis is audience-side (how the matched comments landed). A sample of comments behind the analysis lives at comments.path.

metaobjectOptional

Errors

400
Bad Request Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error