Workspaces are the core organisational unit in AnythingLLM. Each workspace holds its own set of embedded documents, LLM settings, chat history, and threads. The API lets you manage every aspect of a workspace programmatically — from initial creation and document embedding to running chat conversations and performing direct vector similarity searches. All requests must include a valid Bearer token in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Mintplex-Labs/anything-llm/llms.txt
Use this file to discover all available pages before exploring further.
Authorization header.
All API endpoints are prefixed with
/api. For a self-hosted instance the full
base URL is typically http://localhost:3001/api/v1/....POST /v1/workspace/new
Create a new workspace. Returns the created workspace object on success.Body Parameters
Display name for the new workspace.
Minimum vector-similarity score (0–1) that a document chunk must reach before it is included in a response context. Defaults to
0.25.LLM temperature override for this workspace (0–1). Leave
null to use the system default.Number of previous chat turns to include in the LLM context window. Default
20.Custom system prompt applied to every conversation in this workspace.
Custom message returned when the workspace has no relevant context to answer a query-mode question.
Default chat mode:
"chat" (uses general LLM knowledge + documents) or "query" (documents only).Maximum number of document chunks to retrieve per query. Default
4.Response Fields
"Workspace created" on success.GET /v1/workspaces
Return a list of all workspaces on the instance.Response Fields
Array of workspace objects. Each object contains the same fields as the create response plus a
threads array.GET /v1/workspace/{slug}
Retrieve a single workspace by its unique slug, including embedded documents and threads.Path Parameters
Unique URL slug of the workspace (e.g.
product-docs).Response Fields
Single-element array containing the full workspace object with
documents and threads arrays.POST /v1/workspace/{slug}/update
Update one or more settings on an existing workspace. Only the fields you include will be changed.Path Parameters
Unique slug of the workspace to update.
Body Parameters
New display name.
Updated temperature (0–1).
Number of history turns to retain.
Updated system prompt.
Response Fields
Updated workspace object including all current settings and embedded documents.
Error string if the update failed, otherwise
null.DELETE /v1/workspace/{slug}
Permanently delete a workspace and all its embedded document associations. This does not delete the source documents from the library.Path Parameters
Unique slug of the workspace to delete.
GET /v1/workspace/{slug}/chats
Return the full chat history for a workspace, optionally filtered by an external session identifier.Path Parameters
Unique slug of the workspace.
Query Parameters
Filter results to a specific external session ID passed during chat requests.
Maximum number of messages to return. Default
100.Sort order:
"asc" or "desc". Defaults to ascending.Response Fields
POST /v1/workspace/{slug}/update-embeddings
Add or remove documents from a workspace. Document paths are relative to the top-leveldocuments storage directory (i.e. omit the leading documents/ prefix).
Path Parameters
Unique slug of the workspace.
Body Parameters
Array of document path strings to embed into the workspace. Example:
["custom-documents/my-pdf.pdf-hash.json"].Array of document path strings to remove from the workspace embeddings.
Response Fields
Updated workspace object with the new
documents array reflecting the changes.null on success or an error description.POST /v1/workspace/{slug}/update-pin
Toggle the pinned state of a specific document inside a workspace. Pinned documents are always injected into the LLM context regardless of vector search results.Path Parameters
Unique slug of the workspace.
Body Parameters
The document path as stored in the workspace (e.g.
custom-documents/my-pdf.pdf-hash.json).true to pin the document, false to unpin it.Response Fields
"Pin status updated successfully" on success.POST /v1/workspace/{slug}/chat
Send a message to a workspace and receive a complete (non-streaming) response. Supportschat, query, and automatic modes, as well as inline image and document attachments.
Path Parameters
Unique slug of the workspace to chat with.
Body Parameters
The user’s message or question.
Conversation mode:
"chat"— uses LLM general knowledge plus embedded documents with rolling history."query"— only answers from embedded documents; ignores chat history."automatic"— uses tool-calling when the LLM provider supports it, without needing to invoke@agent. Defaults to"chat".
An arbitrary external identifier used to partition chat history. Useful for multi-tenant deployments where you want per-user history.
Set to
true to clear the existing chat history for this session before sending. Default false.Response Fields
Unique ID of the chat exchange.
"textResponse" on success or "abort" on failure.The LLM’s response text.
Array of source document chunks used to generate the answer. Each item contains a
title (document filename) and a chunk (the relevant text snippet).Always
true for non-streaming responses.null on success, or a description of the failure.POST /v1/workspace/{slug}/stream-chat
Send a message and receive the response as a Server-Sent Events (SSE) stream. Each event is a JSON object with atextResponseChunk type. The final event carries "close": true and the full sources array.
Path Parameters
Unique slug of the workspace to chat with.
Body Parameters
Identical toPOST /v1/workspace/{slug}/chat — message, mode, sessionId, attachments, and reset.
Response
The responseContent-Type is text/event-stream. Each data: line contains a JSON object:
Shared ID for all chunks in this response.
"textResponseChunk" for content or "abort" on error.Text fragment for this chunk.
Populated only in the final chunk (
close: true). Each item contains a title and chunk field.true signals the end of the stream.Error string or
null.POST /v1/workspace/{slug}/vector-search
Perform a raw vector similarity search against the workspace’s embedded documents without invoking the LLM. Returns the most similar document chunks along with their distance scores.Path Parameters
Unique slug of the workspace to search.
Body Parameters
The natural-language query string to embed and search with.
Number of results to return. Default
4.Minimum similarity score (0–1) a chunk must have to appear in results.
Response Fields
Workspace Thread Endpoints
Threads are isolated conversation contexts inside a workspace. They share the workspace’s documents and settings but maintain independent chat histories.POST /v1/workspace/{slug}/thread/new
Create a new thread inside a workspace.Path Parameters
Unique slug of the parent workspace.
Body Parameters
Display name for the thread. Auto-generated if omitted.
Custom slug for the thread. Auto-generated if omitted.
Associate the thread with a specific user ID (multi-user mode).
Response Fields
null on success or an error description.POST /v1/workspace/{slug}/thread/{threadSlug}/update
Update the display name of an existing thread.Path Parameters
Workspace slug.
Thread slug to update.
Body Parameters
New display name for the thread.
Response Fields
Updated thread object with
id, name, slug, user_id, and workspace_id.null on success or an error description.DELETE /v1/workspace/{slug}/thread/{threadSlug}
Permanently delete a thread and its chat history.Path Parameters
Workspace slug.
Thread slug to delete.
GET /v1/workspace/{slug}/thread/{threadSlug}/chats
Retrieve the full message history for a specific thread.Path Parameters
Workspace slug.
Thread slug.
Response Fields
Array of
{role, content, sentAt, sources} message objects — same schema as workspace-level chats.POST /v1/workspace/{slug}/thread/{threadSlug}/chat
Send a non-streaming message to a workspace thread.Path Parameters
Workspace slug.
Thread slug.
Body Parameters
The user message.
"chat" or "query". Default "chat".Associate this message with a user ID.
Inline file attachments — same structure as workspace chat.
Clear thread history before this message. Default
false.POST /v1/workspace/{slug}/thread/{threadSlug}/stream-chat
Send a streaming SSE message to a workspace thread. Response format and parameters are identical to the workspace-levelstream-chat endpoint.
Path Parameters
Workspace slug.
Thread slug.