Skip to main content
POST
Create an Extract chat
Opens an Extract thread. You can attach documents or a batch at create time. Creating the row is free; the first user message is the chat charge.

Authorizations

Authorization
string
header
required

Organisation API key from Settings → API / /api/keys/. The secret is shown once. Send Authorization: Bearer sk-abacus-…. One active key per organisation. Ingest (/api/v2/ingest/*) refuses API keys — that surface is Auth0-only with ingest:read / ingest:write scopes.

Body

application/json

Body for POST /api/v2/chats/.

All fields optional — the minimal create is an empty body, which mints a fresh extract-workspace chat with a default title.

Fields: workflow_type: Extract workflow slug. Validated against the Extract whitelist in the view (lazy import of documents.chat_views.ALLOWED_EXTRACT_WORKFLOWS to avoid pulling that heavy module into the serializer at import time). Unknown / non-Extract values (e.g. document-intelligence or a retired presentation-builder slug) are rejected with 400 — the chat surface is Extract-only. Defaults to extract-workspace when omitted. title: Optional chat title. When omitted the helper assigns the default "New Chat — <date>". batch_ids: Batches to pre-attach as LLM context. Each must be visible to the caller via _visible_batch_qs — an invisible batch rolls the whole create back (403, no orphan chat). attachment_ids: Existing documents to LINK into the new chat (Decision 8). Each must be visible via authz.policy.can_view_chat_attachment — an invisible doc rolls the whole create back (403).

workflow_type
string

Extract workflow slug (extract-workspace / extract-batch-analysis / extract-excel-assist). Defaults to 'extract-workspace'. Non-Extract values are rejected with 400.

Required string length: 1 - 50
title
string

Optional chat title; defaults to an auto-generated 'New Chat — '.

Required string length: 1 - 255
batch_ids
integer[]

Batch PKs to pre-attach as LLM context (must be visible to the caller).

Required range: x >= 1
attachment_ids
integer[]

Existing document PKs to LINK into the new chat (must be visible to the caller).

Required range: x >= 1

Response

Response shape for a single chat (list item AND detail).

A plain Serializer (not ModelSerializer) because the *_count fields are queryset annotations, not model fields — the view layers them on via :func:deckmonkey.api_v2.chats.views._annotated_chat_qs (one query, no per-row N+1). DRF reads each field as an attribute off the model instance, so the annotations surface transparently alongside the real columns.

Fields: id / thread_id / title / workflow_type / created_at / updated_at / is_active: straight off the Chat row. message_count: ChatMessage rows in the thread. batch_count: attached batches (ChatBatchAttachment join rows). attachment_count: documents uploaded directly into this chat (ChatAttachment rows whose chat is this chat). linked_count: documents linked in from another chat (ChatAttachmentLink rows) — Decision 8 LINK semantics.

id
integer
required
read-only
thread_id
string
required
read-only
title
string
required
read-only
workflow_type
string | null
required
read-only
created_at
string<date-time>
required
read-only
updated_at
string<date-time>
required
read-only
is_active
boolean
required
read-only
message_count
integer
required
read-only
batch_count
integer
required
read-only
attachment_count
integer
required
read-only
linked_count
integer
required
read-only