Skip to Content
Docs
API

REST API Reference

This page lists every endpoint in DocsGPTโ€™s Swagger document, generated from the current code, on one page. REST API Endpoints has a page for each endpoint instead, from the same document, with request examples and a playground that sends the request to your own instance. Your own instance serves the document for the version you run at /swagger.json, and a Swagger UI for it at /api/docs (see Swagger UI and the OpenAPI document). A few routes are not in the document; the API overview lists them and where they are covered.

How to read an entry:

  • Authentication is the same for every endpoint: a session token or a personal access token in Authorization: Bearer <token>, or none when AUTH_TYPE is unset. The chat and search endpoints also take an agent API key in the body. See Choose a credential.
  • Token scope is the personal access token scope the endpoint needs; any one of the listed scopes is enough, and a write scope includes the matching read scope. Not available to personal access tokens means a token is refused whatever its scopes; call it from a signed-in session.
  • Parameters and JSON body show what the code declares. Some endpoints read more fields than they declare, and the document does not describe response bodies; the guides linked from the API overview cover the common ones in detail.

Answer

Answer related operations.

POST/api/agent_starters

Return the agent's starters.

List the starters (suggested first questions) of the agent an API key belongs to. Returns {"starters": [...]}, empty when the agent has none. Returns: ``{"starters": [...]}`` with 200; 400 when ``api_key`` is missing and 401 when it belongs to no agent.

Token scope: chat:run

JSON body (AgentStartersModel):

FieldTypeRequiredDescription
api_keystringyesThe agent's API key.

POST/api/answer

Provide a response based on the question and retriever.

Token scope: chat:run

JSON body (AnswerModel):

FieldTypeRequiredDescription
active_docsstringnoActive documents.
active_foldersarray of stringnoAgentless chats only: the caller's own source folders to search as a whole, every source filed in them (subfolders included), unioned with active_docs. Ignored when an agent answers.
agent_idstringnoAgent ID.
api_keystringnoAPI key.
capabilitiesarray of stringnoWhat this client can render. 'forms': the assistant may ask clarifying questions (ask_user), which pause the turn on an awaiting_answer tool call carrying `message` and `questions`; resume it with tool_actions [{call_id, answer}] or [{call_id, skipped: true}]. Optional and not enforced: unknown values are ignored, and without 'forms' the assistant never asks and answers as usual.
chunksintegernoNumber of chunks. Default: 6.
conversation_idstringnoExisting conversation ID (loads history)
historyarray of stringnoConversation history (only for new conversations)
isNoneDocbooleannoFlag indicating if no document is used.
model_idstringnoModel ID to use for this request.
passthroughobjectnoDynamic parameters to inject into prompt template.
prompt_idstringnoPrompt ID. Default: "default".
questionstringyesQuestion to be asked.
retrieverstringnoRetriever type.
save_conversationbooleannoDeprecated, no effect: conversations always persist. Use `visibility` to control sidebar listing.
visibilitystringno'listed' shows the conversation in the owner's sidebar; any other value (or omitting it) persists it hidden. Default: "hidden".

POST/api/search

Search for relevant documents based on query.

Token scope: chat:run

JSON body (SearchModel):

FieldTypeRequiredDescription
api_keystringyesAPI key for authentication.
chunksintegernoNumber of results to return. Default: 5.
questionstringyesSearch query.

POST/stream

Stream a response based on the question and retriever.

Token scope: chat:run

JSON body (StreamModel):

FieldTypeRequiredDescription
active_docsstringnoActive documents.
active_foldersarray of stringnoAgentless chats only: the caller's own source folders to search as a whole, every source filed in them (subfolders included), unioned with active_docs. Ignored when an agent answers.
agent_idstringnoAgent ID.
api_keystringnoAPI key.
attachmentsarray of stringnoList of attachment IDs.
capabilitiesarray of stringnoWhat this client can render. 'forms': the assistant may ask clarifying questions (ask_user), which pause the turn on an awaiting_answer tool call carrying `message` and `questions`; resume it with tool_actions [{call_id, answer}] or [{call_id, skipped: true}]. Optional and not enforced: unknown values are ignored, and without 'forms' the assistant never asks and answers as usual.
chunksintegernoNumber of chunks. Default: 6.
conversation_idstringnoExisting conversation ID (loads history)
historyarray of stringnoConversation history (only for new conversations)
indexintegernoIndex of the query to update.
isNoneDocbooleannoFlag indicating if no document is used.
model_idstringnoModel ID to use for this request.
passthroughobjectnoDynamic parameters to inject into prompt template.
prompt_idstringnoPrompt ID. Default: "default".
questionstringyesQuestion to be asked.
retrieverstringnoRetriever type.
save_conversationbooleannoDeprecated, no effect: conversations always persist. Use `visibility` to control sidebar listing.
visibilitystringno'listed' shows the conversation in the owner's sidebar; any other value (or omitting it) persists it hidden. Default: "hidden".

Activity

What runs now and what is planned.

GET/api/activity/history

Return one page of the caller's finished runs.

The caller's finished runs of every kind, newest first: scheduled, webhook and workflow runs, background jobs, and monitor wakes, with one status vocabulary. Returns: A Flask response with ``runs`` and ``has_more``, or 400 for an unknown ``kind`` or ``status``.

Not available to personal access tokens

ParameterInTypeRequiredDescription
kindquerystringnoOne of schedule, webhook, workflow, job, monitor; all when left out.
statusquerystringnoOne of success, failed, timeout, skipped, cancelled (failed includes timed out); all when left out.
qquerystringnoText matched against the run, agent and conversation names.
daysquerystringnoHow far back to look (default 30, at most 90).
limitquerystringnoRows per page (default 50, at most 200).
offsetquerystringnoRows to skip.

GET/api/activity/now

Return the caller's Now snapshot.

What runs for the caller now (chat answers, background jobs, scheduled, webhook and workflow runs, ingests), what waits for them (tool approvals, schedules paused after failures), what runs in the next 24 hours, and the 24-hour counts. Returns: A Flask response with ``running``, ``needs_you``, ``up_next``, ``approval_conversations``, ``failed_conversations`` and ``stats``.

Not available to personal access tokens

GET/api/activity/planned

Return the caller's calendar window.

The caller's calendar for a window: planned schedule runs (from cron or run_at), past and in-flight runs with their status, coming knowledge syncs (one event per frequency each time it fires, kind sync), and monitors as date ranges. The window may span at most 62 days. A frequent schedule with more events than one schedule may list is summed up per day in tz: one event per day and routine state, with count and until. Returns: A Flask response with ``from``, ``to``, ``events`` (schedule and sync events, by ``kind``), ``monitors`` and ``truncated``, or 400 for a bad window or time zone.

Not available to personal access tokens

ParameterInTypeRequiredDescription
fromquerystringyesWindow start, ISO 8601.
toquerystringyesWindow end (exclusive), ISO 8601.
tzquerystringnoThe viewer's IANA time zone, which days are split in (default UTC).

POST/api/messages/{message_id}/cancel

Ask a running answer to stop.

Stop the caller's chat answer that is still being written. The stream ends as if its client had disconnected and keeps what it wrote. Answers 202 once the request is stored; the stream sees it within a few seconds, or when a long tool call returns. Args: message_id: The answer's message id. Returns: 202 when the stop was requested, 404 when the caller has no such message, 409 when it is not running (finished, or paused for a tool approval), 503 without Redis.

Not available to personal access tokens

ParameterInTypeRequiredDescription
message_idpathstringyes

Analytics

Analytics and reporting operations.

GET/api/analytics/topic_folders

The folders of an agent's sources, largest first: one per documentation section, described by up to five page titles. They fill the agent's topic question after its own topics; the settings list them so the owner can hide or edit them. Needs edit access to the agent.

Token scope: agents:read

ParameterInTypeRequiredDescription
agent_idquerystringnoAgent id.

GET/api/analytics/topics

Every topic an agent's conversations are labelled with, sorted by name, each with the Logs 'label' filter that selects it: topic:<name> for a topic that doesn't overlap (its own topics and source folders), tag:<id> for one that can. Needs the agent's logs; an agent the caller can't see gives an empty list.

Token scope: analytics:read

ParameterInTypeRequiredDescription
agent_idquerystringnoAgent id.

POST/api/get_conversation_insights

Insights from the decision model's labels: per label and option the expected count and its rate with a 95% interval widened by the label's calibration error, each label's tier, the same per time bucket, label coverage and the language mix. answer_status rates are over requests (not over greetings). 'available' is the operator switch (DECISION_ANALYTICS_ENABLED with the model available); 'enabled' is that and the agent's own analytics switch. The sweep labels only the last 'backfill_days' (from 'labelling_from'), so coverage splits unlabelled answers into 'unlabelled_recent_turns' (still to be labelled) and 'unlabelled_older_turns' (never labelled without a backfill). For an agent, 'one_pick' lists the options of its topic question (empty when it asks none) and 'overlapping' its topics that can overlap; each one's totals are under 'tag:<id>'. Topics ('topic_effective') are reported for an agent only: each agent has its own list. 'series' is in 'bucket_unit': the filter's own unit while its buckets average 10 analyzed answers, else the next coarser one (minute to hour, hour to day, day to week). A week is named by its first day in the window and carries its last as 'bucket_end'. 'previous' holds answer_status, reaction and sentiment totals over the period of the same length just before the window.

Token scope: analytics:read

JSON body (GetConversationInsightsModel):

FieldTypeRequiredDescription
api_key_idstringnoAgent id.
filter_optionstringnoFilter option for analytics. One of: last_hour, last_24_hour, last_7_days, last_15_days, last_30_days. Default: "last_30_days".

POST/api/get_docs_gaps

Docs gaps: answers that fell short because the docs do not cover the question, as expected counts (sums of the decision model's probabilities) per group, with the group's rate over its answers and a 95% interval, the window just before for the trend, and up to five example questions (gaps at even odds or better). Groups with under half an expected gap are left out; key null means no source was retrieved. previous_labelled counts the labelled answers in the window before, so a group with no earlier gaps can be told from a window that was never labelled; by page, each row's source names the source most of its answers retrieved the page from (null if unknown).

Token scope: analytics:read

JSON body (GetDocsGapsModel):

FieldTypeRequiredDescription
api_key_idstringnoAgent id.
filter_optionstringnoFilter option for analytics. One of: last_hour, last_24_hour, last_7_days, last_15_days, last_30_days. Default: "last_30_days".
group_bystringnoGroup by the effective topic, or by the source or page of the turn's first retrieved chunk. One of: topic, source, page. Default: "page".
limitintegernoMost groups returned (1-50) Default: 25.

POST/api/get_feedback_analytics

Get feedback analytics data.

Token scope: analytics:read

JSON body (GetFeedbackAnalyticsModel):

FieldTypeRequiredDescription
api_key_idstringnoAPI Key ID.
filter_optionstringnoFilter option for analytics. One of: last_hour, last_24_hour, last_7_days, last_15_days, last_30_days. Default: "last_30_days".

POST/api/get_message_analytics

Get message analytics based on filter option.

Token scope: analytics:read

JSON body (GetMessageAnalyticsModel):

FieldTypeRequiredDescription
api_key_idstringnoAPI Key ID.
filter_optionstringnoFilter option for analytics. One of: last_hour, last_24_hour, last_7_days, last_15_days, last_30_days. Default: "last_30_days".

POST/api/get_schedule_analytics

Get scheduled agent run outcomes over time.

Token scope: analytics:read

JSON body (GetScheduleAnalyticsModel):

FieldTypeRequiredDescription
api_key_idstringnoAPI Key ID.
filter_optionstringnoFilter option for analytics. One of: last_hour, last_24_hour, last_7_days, last_15_days, last_30_days. Default: "last_30_days".

POST/api/get_token_analytics

Get token analytics data.

Token scope: analytics:read

JSON body (GetTokenAnalyticsModel):

FieldTypeRequiredDescription
api_key_idstringnoAPI Key ID.
filter_optionstringnoFilter option for analytics. One of: last_hour, last_24_hour, last_7_days, last_15_days, last_30_days. Default: "last_30_days".
group_bystringnoSecond grouping dimension for the series. One of: none, model, agent, source. Default: "none".
include_side_channelbooleannoInclude non-user-initiated token usage (title generation, compression, RAG condensing, fallback) Default: true.

POST/api/get_tool_analytics

Get tool call analytics from the tool execution journal.

Token scope: analytics:read

JSON body (GetToolAnalyticsModel):

FieldTypeRequiredDescription
api_key_idstringnoAPI Key ID.
filter_optionstringnoFilter option for analytics. One of: last_hour, last_24_hour, last_7_days, last_15_days, last_30_days. Default: "last_30_days".

POST/api/get_user_logs

Get user activity logs with pagination. Merges chat answers (user_logs), request errors (stack_logs) and scheduled agent runs (schedule_runs) into one timeline. Runs are ordered by their start time; ones still going (answers, scheduled, workflow and webhook runs) carry running: true until their finished row replaces them. Finished chat rows carry 'labels', the analytics label keys at ANALYTICS_FILTER_MIN_PROBABILITY or better, and 'tag_names' names the tags on the page.

Token scope: analytics:read

JSON body (GetUserLogsModel):

FieldTypeRequiredDescription
api_key_idstringnoAPI Key ID.
conversation_idstringnoOnly rows of this conversation (chat turns and scheduled runs)
date_fromstringnoRows at or after this ISO 8601 moment.
date_tostringnoRows before this ISO 8601 moment.
event_typestringnoFilter by event source. One of: chat, schedule, webhook, workflow, system, search, graph.
feedbackstringnoOnly chat turns rated this way. One of: like, dislike.
labelstringnoOnly chat turns the decision model labelled this way at ANALYTICS_FILTER_MIN_PROBABILITY or better: one of docs_gap, not_answered, negative_reaction, negative_sentiment, frustrated, asks_human, tag:<id> (a topic of the turn's conversation that can overlap) or topic:<name> (the turn's own topic)
levelstringnoFilter by log level. One of: info, error, warning.
pageintegernoPage number for pagination. Default: 1.
page_sizeintegernoNumber of logs per page. Default: 10.
passthroughobjectnoOnly chat turns whose passthrough values match every given key, compared as text, e.g. {"user_id": "42"}.
searchstringnoSubstring filter on the summary.

GET/api/traces

Stored execution traces (span timelines) for one Logs row. Pass exactly one of message_id, request_id, activity_id, workflow_run_id or id; api_key_id scopes to an agent you own.

Token scope: analytics:read

ParameterInTypeRequiredDescription
message_idquerystringnoAssistant message id.
request_idquerystringnoRequest id (chat turn, scheduled run)
activity_idquerystringnoAgent activity id (webhook and system rows)
workflow_run_idquerystringnoWorkflow run id.
idquerystringnoTrace id.
api_key_idquerystringnoAgent id to scope to.

Artifacts

Artifact operations.

GET/api/artifacts

List artifacts for a conversation, workflow run, or the caller. The caller's own list is per workspace (the X-DocsGPT-Workspace header; Personal without it).

Token scope: artifacts:read

GET/api/artifacts/{artifact_id}

Get an artifact's metadata, version list, and current spec.

Token scope: artifacts:read

ParameterInTypeRequiredDescription
artifact_idpathstringyes

DELETE/api/artifacts/{artifact_id}

Delete an artifact and all its versions (owner only)

Not available to personal access tokens

ParameterInTypeRequiredDescription
artifact_idpathstringyes

POST/api/artifacts/{artifact_id}/restore

Restore a prior version by appending it as the new current version.

Not available to personal access tokens

ParameterInTypeRequiredDescription
artifact_idpathstringyes

GET/api/artifacts/{artifact_id}/versions/{version}

Get a single artifact version's metadata and spec.

Token scope: artifacts:read

ParameterInTypeRequiredDescription
artifact_idpathstringyes
versionpathintegeryes

Attachments

File attachments and media operations.

GET/api/images/{agent_id}/{capability}

Serve an agent image using an opaque capability URL.

Not available to personal access tokens

ParameterInTypeRequiredDescription
agent_idpathstringyes
capabilitypathstringyes

POST/api/store_attachment

Stores one or multiple attachments without vectorization or training. Supports user or API key authentication.

Token scope: chat:run

JSON body (AttachmentModel):

FieldTypeRequiredDescription
api_keystringnoAPI key (optional)
fileobjectyesFile(s) to upload.

POST/api/stt

Transcribe an uploaded audio file.

Not available to personal access tokens

JSON body (SpeechToTextModel):

FieldTypeRequiredDescription
fileobjectyesAudio file.
languagestringnoOptional transcription language hint.

POST/api/stt/live/chunk

Transcribe a chunk for a live speech-to-text session.

Not available to personal access tokens

JSON body (LiveSpeechToTextChunkModel):

FieldTypeRequiredDescription
chunk_indexintegeryesSequential chunk index.
fileobjectyesAudio chunk.
is_silencebooleannoWhether the latest capture window was mostly silence.
session_idstringyesLive transcription session ID.

POST/api/stt/live/finish

Finish a live speech-to-text session.

Not available to personal access tokens

POST/api/stt/live/start

Start a live speech-to-text session.

Not available to personal access tokens

POST/api/tts

Synthesize audio speech from text.

Not available to personal access tokens

JSON body (TextToSpeechModel):

FieldTypeRequiredDescription
textstringyesText to be synthesized as audio.

Background jobs

Background jobs of tool calls.

GET/api/background_jobs

List the caller's background jobs of one conversation, newest first (no result bodies).

Token scope: conversations:read

ParameterInTypeRequiredDescription
conversation_idquerystringyesThe conversation whose jobs to list.

GET/api/background_jobs/{job_id}

One background job: its state, progress and, once finished, a result preview.

Token scope: conversations:read

ParameterInTypeRequiredDescription
job_idpathstringyes

POST/api/background_jobs/{job_id}/cancel

Ask a running background job to stop. It ends as cancelled once its work really stops; a step already under way may still complete.

Token scope: conversations:write

ParameterInTypeRequiredDescription
job_idpathstringyes

Conversations

Conversation management operations.

GET/api/delete_all_conversations

Deletes all of the caller's conversations in the current workspace (the workspace header; Personal without it). A team's needs current membership (404 otherwise).

Token scope: conversations:write

POST/api/delete_conversation

Deletes a conversation by ID.

Token scope: conversations:write

ParameterInTypeRequiredDescription
idquerystringnoThe ID of the conversation to delete.

POST/api/feedback

Submit feedback for a conversation.

Token scope: conversations:write

JSON body (FeedbackModel):

FieldTypeRequiredDescription
answerstringnoThe AI answer.
api_keystringnoOptional API key.
conversation_idstringyesid of the particular conversation.
feedbackstringyesUser feedback.
questionstringnoThe user question.
question_indexintegeryesThe question number in that particular conversation.

GET/api/get_conversations

Retrieve the user's sidebar conversations (visibility = listed) in the workspace the X-DocsGPT-Workspace header names (Personal without it), newest first, ordered by ``date`` DESC then ``id`` DESC. Each item carries ``date`` (ISO-8601) and ``workspace`` ({kind, team_id}). To page older conversations, pass the last item's ``date`` and ``id`` as ``before`` and ``before_id``. Invalid params are ignored. A team the caller is not in answers 404 workspace_not_found.

Token scope: conversations:read

ParameterInTypeRequiredDescription
limitquerystringnoMaximum number of results (default 30, clamped to 1-100)
beforequerystringnoKeyset cursor: ISO-8601 ``date`` of the last item seen (needs before_id)
before_idquerystringnoKeyset cursor: ``id`` of the last item seen (needs before)

GET/api/get_single_conversation

Retrieve a single conversation by ID.

Token scope: conversations:read

ParameterInTypeRequiredDescription
idquerystringnoThe conversation ID.

GET/api/messages/{message_id}/tail

Current state of one conversation_messages row, scoped to the authenticated user. Used to reconnect to an in-flight stream after a refresh.

Token scope: chat:run or conversations:read

ParameterInTypeRequiredDescription
message_idpathstringyesMessage UUID.

GET/api/search_conversations

Search the authenticated user's conversations by name or message content (case-insensitive substring match). Mirrors the visibility and workspace filter and response shape of /get_conversations, and additionally returns ``match_field`` (``name``, ``prompt`` or ``response``) and ``match_snippet`` (a short excerpt of the matched text centered on the query) for each result.

Token scope: conversations:read

ParameterInTypeRequiredDescription
qquerystringnoSearch term (required)
limitquerystringnoMaximum number of results to return (default 30, max 100)

POST/api/update_conversation_name

Updates the name of a conversation.

Token scope: conversations:write

JSON body (UpdateConversationModel):

FieldTypeRequiredDescription
idstringyesConversation ID.
namestringyesNew name of the conversation.

Folders

Folders for agents, knowledge, tools and prompts.

GET/api/folders

The folder tree of the workspace the request names (header X-DocsGPT-Workspace, default Personal), oldest first: {folders: [Folder], workspace}. In a team it is the team's one tree, the same for every member. counts, item_count and folder_count count direct children; used_by names the agents reading a folder's sources live. 404 workspace_not_found for a team the caller isn't in.

Token scope: agents:read or prompts:read or sources:read or tools:read

ParameterInTypeRequiredDescription
typequerystringnoagent, source, tool or prompt (optional): the kind item_count counts.

POST/api/folders

Create a folder in the workspace the request names: {name, parent_id?} (type is ignored). Names are trimmed, 1-80 characters, unique among siblings ignoring case across kinds (409 folder_name_taken); folders nest 3 levels deep (400 folder_too_deep). In a team it needs the Editor role (403 workspace_role_required). Answers 201 with the Folder.

Token scope: agents:write or prompts:write or sources:write or tools:write

JSON body (CreateFolderRequest):

FieldTypeRequiredDescription
namestringyesFolder name.
parent_idstringnoParent folder id.
typestringnoIgnored: a folder holds every kind.

POST/api/folders/items

File items into a folder: {type, folder_id, ids}; folder_id null takes them out of the tree of the workspace the request names. A team's folder holds only the team's own items and needs the Editor role (403 workspace_role_required); a personal folder holds the caller's own items and personal items shared with them. 409 team_item_not_fileable (a team's item into a personal folder) or item_not_in_team (anything else into a team's folder), with ids; nothing is filed then. Answers {success, moved: [ids], skipped: [ids the caller can't see]}.

Token scope: agents:write or prompts:write or sources:write or tools:write

JSON body (FileFolderItemsRequest):

FieldTypeRequiredDescription
folder_idstringnoTarget folder id, or null to unfile.
idsarray of stringyesIds of items of that kind.
typestringyesagent, source, tool or prompt.

PUT/api/folders/{folder_id}

Rename or move a folder within its tree: {name?, parent_id?}; parent_id null moves it to the top level. The folder's own tree decides (a team's folder needs the Editor role there). Errors: 404 folder_not_found, 403 workspace_role_required, 400 folder_cycle / folder_too_deep, 409 folder_name_taken.

Token scope: agents:write or prompts:write or sources:write or tools:write

ParameterInTypeRequiredDescription
folder_idpathstringyes

JSON body (UpdateFolderRequest):

FieldTypeRequiredDescription
namestringnoNew name.
parent_idstringnoNew parent folder id, or null.

DELETE/api/folders/{folder_id}

Delete a folder. Its folders and items move to its parent (the top level and unfiled when it had none); a child folder whose name is taken there gets a " (n)" suffix; agents reading it live lose it. A team's folder needs the Editor role there. Answers {success, moved_items, moved_folders, renamed: [{id, from, to}]}.

Token scope: agents:write or prompts:write or sources:write or tools:write

ParameterInTypeRequiredDescription
folder_idpathstringyes

Drafter

Draft with DocsGPT.

GET/api/drafter/agent_gaps

Report an agent's gap summary.

An agent's gap summary from Insights for Draft with DocsGPT's improve screen: expected gaps per topic and gap type over the last 30 days, the most first, read from the decision model's labels (no model call). Returns {"available", "reason", "conversations", "needed", "days", "rows": [{"topic", "gap_type", "expected", "turns", "previous"}]}: at most 10 rows, each with at least half an expected gap, counts rounded as Insights shows them; topic is null for an agent without a topic question, previous null until the period before has labelled answers. reason is disabled (the drafter is off), off_on_this_instance, agent_off (Insights is off for the agent) or not_enough (fewer than needed analysed conversations; conversations counts them), else null. Needs edit access to the agent.

Not available to personal access tokens

ParameterInTypeRequiredDescription
agent_idquerystringnoAgent id.

GET/api/drafter/config

Report whether the drafter is on for the caller, and its model.

Whether Draft with DocsGPT is offered to the caller, and the model it runs on (the task model). Returns {"enabled", "model": {"id", "display_name"} | null, "reason": "disabled" | "no_model" | null}.

Not available to personal access tokens

POST/api/drafter/stream

Stream one draft turn.

Run one draft turn and stream it as server-sent events (data: <json>). Events: turn (first, {"id"}: the id POST /api/drafter/turns/<id>/cancel stops, the request's turn_id when it sent a valid one; absent when the server can't stop turns), status, read (what a read tool showed the model, {"kind": "questions", "items"}), message, questions, proposal, error, and end (always last). Refusals (disabled, no_model, rate_limited, quota, bad_request) arrive as an error event in a 200 stream; a bad_request carries reason: history (the conversation is refused: start a new one), too_long (the prompt is over the read cap, with limit), empty (the message is empty once cleaned) or invalid. Nothing is saved.

Not available to personal access tokens

JSON body (DrafterStreamModel):

FieldTypeRequiredDescription
contextobjectnoThe recipe's screen state: the agent form's current values (agent), the prompt being written or improved (prompt), or {agent_id} (topics)
messagesarray of objectyesThe conversation so far, oldest first: {role: user | assistant, content}. An assistant message is the JSON of an earlier questions or proposal event. Ends with a user message.
recipestringyesWhat is drafted: agent (the agent form), prompt (a prompt), topics (Insights topics)
turn_idstringnoThe id the client picks for this turn (32 lowercase hex characters), so it can stop the turn before the turn event arrives. Optional: without one, or with one that isn't a turn id, the server picks it.

GET/api/drafter/topics/status

Report whether topic suggestions are available for an agent.

Whether Draft with DocsGPT suggests Insights topics for an agent from its conversations: Insights sorts them (on this server and for the agent) and it had enough in the last 30 days. Returns {"available", "conversations", "needed", "reason"}; reason is disabled (the drafter is off), off_on_this_instance or turned_off_for_this_agent (Insights is off), with conversations 0 and uncounted, else null. Needs edit access to the agent: the suggestions read its users' questions.

Not available to personal access tokens

ParameterInTypeRequiredDescription
agent_idquerystringnoAgent id.

POST/api/drafter/turns/{turn_id}/cancel

Ask a running draft turn to stop.

Stop the caller's draft turn: it makes no further model calls and its stream ends with end. The id is the turn_id the stream request sent, or the stream's first event (turn). A stop that arrives before the turn has started stops it as soon as it does. The stop is kept under the caller's name, so it never reaches another user's turn. Answers 202 once the request is stored, whether or not the caller has such a turn. Args: turn_id: The id the stream request sent, or the one its ``turn`` event carried. Returns: 202 when the stop was stored, 404 for a malformed id, 503 without Redis.

Not available to personal access tokens

ParameterInTypeRequiredDescription
turn_idpathstringyes

Current user

Current user identity and roles.

GET/api/user/me

Return ``{user_id, roles, email?, name?, picture?}`` for the caller.

Any valid personal access token

GET/api/user/preferences

Return the chat prompt and the task model fields the caller may read.

The caller's preferences: {success, chat_prompt_id, chat_prompt_set, task_model_id, task_model_unavailable, task_model_error, instance_task_model_id}. chat_prompt_id is default when none was set or the stored prompt was deleted or is no longer shared with the caller. chat_prompt_set is true once a chat prompt was ever stored, default included, even when it now reads as default. task_model_id is the model the caller's DocsGPT jobs run on, null when they picked none or can no longer use it; task_model_unavailable is true when a choice is stored that can no longer run (a disabled or deleted model): the instance's runs meanwhile, the stored one again if it comes back, until a PUT with task_model_id null clears it. task_model_error is {model_id, code, at} when the task model that runs now failed its last draft because its provider refused the key (code model_auth, at ISO 8601), else null; a draft that works on it, or a PUT of task_model_id, clears it. instance_task_model_id is the one that runs without a usable choice, null when no model can. A token gets the chat prompt fields with prompts:read (never when restricted to specific prompts) and the task model fields with models:read. A token reads only the parts its scopes cover: the chat prompt with ``prompts:read`` and no prompt allowlist (the stored id can't be proven inside one), the task model with ``models:read``. Returns: Response: The preferences the caller may read.

Token scope: models:read or prompts:read

PUT/api/user/preferences

Store ``chat_prompt_id`` and/or ``task_model_id`` after checking the caller may use them.

Set the prompt the caller's chats use, the model their DocsGPT jobs run on, or both; send at least one. Answers {success} with chat_prompt_id and applied when a chat prompt was sent, and task_model_id when one was. With only_if_unset and a chat prompt already stored, the chat prompt is not written, applied is false and chat_prompt_id is the stored one as GET reads it. 400 for a chat_prompt_id that is neither a preset nor a prompt id, a non-boolean only_if_unset, or a task_model_id the caller can't use (code invalid_model), in which case nothing is written; 403 for only_if_unset from a token restricted to specific prompts, or a token without prompts:write (chat_prompt_id) or models:write (task_model_id); 404 when the caller can't read the prompt; 500 when the read or write fails. Returns: Response: ``{success}`` plus, for a sent chat prompt, ``chat_prompt_id`` and ``applied`` (false only when ``only_if_unset`` found a stored chat prompt, whose readable value ``chat_prompt_id`` then carries), and for a sent task model, ``task_model_id`` as stored (``None``: the instance's applies).

Token scope: models:write or prompts:write

JSON body (UserPreferencesModel):

FieldTypeRequiredDescription
chat_prompt_idstringnoThe prompt chats use: default, creative, strict, or the id of a prompt the caller can read.
only_if_unsetbooleannoStore it only when no chat prompt was ever stored (moving a browser's old choice); otherwise the stored one is kept and returned. Refused to a token restricted to specific prompts.
task_model_idstringnoThe model the caller's DocsGPT jobs run on (drafting, graph extraction, monitor judging): a model the caller can use, their own custom models included; null uses the instance's. A token needs models:write to send it.

GET/api/user/quota

Return the caller's limited buckets, the near-limit notice, the parts of their use, and what stopped.

``buckets``: ``{bucket, tokens, cost, resets_at}`` each. ``notice``: see :func:`quota_notice`. ``parts``: see :func:`quota_parts`, only when a limit is set. ``paused``: see :func:`stopped_for_allowance`, only when ``notice.level`` is ``reached``. Each of the three is null otherwise, and null too when it can't be worked out: the buckets still answer. For a personal access token, ``paused.published`` keeps only the agents it may read.

Any valid personal access token

MCP apps

MCP Apps: interactive tool views in chat.

POST/api/mcp_apps/call

Run a tool an MCP App view calls. Only tools visible to the app; a tool that needs approval answers 409 needs_approval until the call is sent approved.

Not available to personal access tokens

JSON body (McpAppCallModel):

FieldTypeRequiredDescription
approvedbooleannoThe user approved this call, for a tool that needs approval.
argumentsobjectnoIts arguments.
namestringyesThe tool the view calls.
tool_idstringyesThe MCP tool row the view belongs to.

POST/api/mcp_apps/resource

Read an MCP App view's HTML and its declared CSP and permissions.

Not available to personal access tokens

JSON body (McpAppResourceModel):

FieldTypeRequiredDescription
tool_idstringyesThe MCP tool row the call ran on.
uristringyesThe view's ui:// resource.

POST/api/mcp_apps/result

Read back the tool result an MCP App view was handed live, for a reopened conversation. The caller needs the access that reloading the conversation needs.

Not available to personal access tokens

JSON body (McpAppResultModel):

FieldTypeRequiredDescription
call_idstringyesThe call that drew the view.
message_idstringyesThe message the call belongs to.

GET/api/mcp_apps/sandbox

The sandbox page an MCP App view runs in, served with a CSP built from the view's declared domains. Only on the sandbox origin (MCP_APPS_SANDBOX_URL), never one of the app's.

Not available to personal access tokens

ParameterInTypeRequiredDescription
cspquerystringnoThe view's _meta.ui.csp, as JSON.

Models

Available models.

GET/api/models

Get list of available models with their capabilities.

When the request is authenticated, the response includes the user's own BYOM registrations alongside the built-in catalog. In a team workspace it lists the team's enabled models instead (``source: "team"``, without ``base_url``) and never the person's: saving one on a team item is refused, so a team's pickers never offer one.

Token scope: chat:run or models:read

GET/api/user/models

List the current user's BYOM custom models; with owner=team, the models of the team the workspace header names (any member)

Token scope: models:read

ParameterInTypeRequiredDescription
ownerquerystringnopersonal (default) or team.

POST/api/user/models

Register a new BYOM custom model. owner=team adds it for the team the workspace header names (Admins, in the app only); without it the model is the caller's own, whatever the header.

Token scope: models:write

POST/api/user/models/test

Test an arbitrary BYOM payload (display_name / model id / base_url / api_key) without saving. Used by the UI's 'Test connection' button so the user can validate before they Save. Uses the selected API protocol with the same SSRF guard and 5s timeout as the by-id variant.

Token scope: models:write

GET/api/user/models/{model_id}

Get one BYOM custom model: the caller's own, or a team's they are in.

Token scope: models:read

ParameterInTypeRequiredDescription
model_idpathstringyes

PATCH/api/user/models/{model_id}

Update a BYOM custom model (partial)

Token scope: models:write

ParameterInTypeRequiredDescription
model_idpathstringyes

DELETE/api/user/models/{model_id}

Delete a BYOM custom model. On a team's model (Admins, in the app only) the answer also has usage: the team's agents and workflows that named it; agents fall back to the default model, workflow steps set to it stop.

Token scope: models:write

ParameterInTypeRequiredDescription
model_idpathstringyes

POST/api/user/models/{model_id}/copy

Copy the caller's own custom model into a team where they are an Admin or the Owner (body: team_id). The team's copy has its key re-sealed for the team and names the caller as the one who added it; the caller's model is left as it was. 409 model_already_in_team when the team already has a model with the same base URL and upstream model id. In the app only.

Token scope: models:write

ParameterInTypeRequiredDescription
model_idpathstringyes

POST/api/user/models/{model_id}/test

Test a saved BYOM record. Defaults to the stored base_url / upstream_model_id / encrypted api_key, but any of those can be overridden via the request body so the UI can test in-flight edits before saving. Used by the 'Test connection' button in edit mode.

Token scope: models:write

ParameterInTypeRequiredDescription
model_idpathstringyes

GET/api/user/models/{model_id}/usage

Answer which of the owner's agents and workflows use the model, so a delete confirm can name them.

The owner's agents and workflows that name a custom model. If it is deleted, agents fall back to the default model and workflow steps set to it stop: {usage: {agents: [{id, name}], workflows: [{id, name}]}}. Anyone who may see the model: every member for a team's model, only its owner for a person's own. Args: model_id: The model's id. Returns: 200 ``{success, usage}``; 404 ``model_not_found`` to anyone who may not see the model.

Token scope: models:read

ParameterInTypeRequiredDescription
model_idpathstringyes

Notifications

Presence, Web Push subscriptions and unread conversations.

POST/api/conversations/{conversation_id}/read

Clear the conversation's unread mark (the user opened it). Idempotent.

Not available to personal access tokens

ParameterInTypeRequiredDescription
conversation_idpathstringyes

POST/api/presence

Report what one tab shows: sent when its visibility or route changes and every ~20 s while visible. A report counts for 45 s; `closing: true` forgets the tab at once. A user is not notified about a conversation a visible tab of theirs shows.

Not available to personal access tokens

JSON body (PresenceReport):

FieldTypeRequiredDescription
closingbooleannoThe tab is closing; forget it.
conversation_idstringnoThe conversation the tab shows, or null.
tab_idstringyesThe tab's own random id (1-64 of A-Z a-z 0-9 _ . : -)
visiblebooleanyesWhether the tab is visible.

GET/api/push/public_key

Whether Web Push is configured, and the VAPID public key browsers subscribe with (`applicationServerKey`, raw base64url).

Not available to personal access tokens

POST/api/push/subscriptions

Save this browser's Web Push subscription (the browser's `PushSubscription` JSON) for the caller. The endpoint must be https on a known push service. Saving a known endpoint moves it to the caller. 503 when Web Push is not configured.

Not available to personal access tokens

JSON body (PushSubscription):

FieldTypeRequiredDescription
endpointstringyesThe push service URL (https, a known push service)
expirationTimeobjectnoIgnored.
keysobjectyes{p256dh, auth}, base64url, as the browser gives them.

DELETE/api/push/subscriptions

Forget this browser's Web Push subscription: `{endpoint}` in the body, or `?endpoint=`.

Not available to personal access tokens

ParameterInTypeRequiredDescription
endpointquerystringnoThe subscription's endpoint, when not in the body.

JSON body (PushUnsubscribe):

FieldTypeRequiredDescription
endpointstringyes

Agents

Agent management operations.

POST/api/adopt_agent

Adopt a template agent into the current workspace: a copy the caller owns, or in a team (Editor and up) one the team owns. A team's copy keeps only the team's own items and gets a key only when an Admin adopts it.

Token scope: agents:write

ParameterInTypeRequiredDescription
idquerystringnoAgent ID.

GET/api/agent_webhook

Generate webhook URL for the agent.

Token scope: agents:keys

ParameterInTypeRequiredDescription
idquerystringnoID of the agent.

POST/api/agents/{agent_id}/outside_access/take_over

Become the person who pays for a team agent's outside access (its API key, public link and webhook). Needs the Admin role in the team; not available on a personal agent, whose owner pays. Returns {success, outside_access, changed}; changed is false when the caller already pays. Refusals: 404 agent_not_found, 403 workspace_role_required, 409 take_over_team_only, 409 no_outside_access.

Not available to personal access tokens

ParameterInTypeRequiredDescription
agent_idpathstringyes

POST/api/create_agent

Create a new agent. JSON or multipart (multipart for an image). 201 {id, key, image, workflow_id (workflow agents)}. A workflow agent may send workflow_graph to create its workflow in the same request; a graph that fails validation is 400 {success: false, message, error, errors}.

Token scope: agents:write

JSON body (CreateAgentModel):

FieldTypeRequiredDescription
agent_typestringnoType of the agent (classic, react, workflow). Defaults to 'classic' for backwards compatibility.
allow_system_prompt_overridebooleannoAllow API callers to override the system prompt via the v1 endpoint.
chunksintegernoChunks count.
default_model_idstringnoDefault model ID for this agent.
descriptionstringyesDescription of the agent.
folder_idstringnoOne of the caller's agent folders to file the agent in (the caller's own filing)
foldersarray of stringnoSource folders the agent reads live: every source their owner files in them, subfolders included. A folder is attached by its owner only (403 folder_not_accessible); ones already on the agent stay. Must be a list (a JSON string in a multipart form)
imageobjectnoImage file upload.
json_schemaobjectnoJSON schema for enforcing structured output format.
limited_request_modebooleannoWhether the agent is in limited request mode.
limited_token_modebooleannoWhether the agent is in limited token mode.
modelsarray of stringnoList of available model IDs for this agent.
namestringyesName of the agent.
prompt_idstringnoPrompt id, or a preset: default, creative or strict.
request_limitintegernoRequest limit for the agent in limited mode.
retrieverstringnoRetriever ID.
sourcestringnoSource ID (legacy single source)
sourcesarray of stringnoList of source identifiers for multiple sources.
startersarray of stringnoUp to 4 questions a new chat with the agent offers, each at most 200 characters; trimmed, blanks and case-insensitive duplicates dropped. Multipart sends a JSON string.
statusstringyesStatus of the agent (draft or published)
token_limitintegernoToken limit for the agent in limited mode.
toolsarray of stringnoList of tool identifiers.
workflowstringnoWorkflow ID for workflow-type agents.
workflow_graphobjectnoWorkflow agents only, instead of workflow: the graph saved with the agent in the same transaction, {nodes, edges, retry_defaults?} (a JSON string in a multipart form). A draft only its builder runs is checked for shape only; a published agent, one a key, webhook, schedule or public link runs, or one sharing its workflow with such an agent gets the full validation. Needs workflows:write for a token.

DELETE/api/delete_agent

Delete an agent by ID.

Token scope: agents:write

ParameterInTypeRequiredDescription
idquerystringnoID of the agent.

GET/api/export_agent

Export an agent as YAML.

Token scope: agents:read

ParameterInTypeRequiredDescription
idquerystringnoAgent ID.

GET/api/get_agent

Get agent by ID.

Token scope: agents:read

ParameterInTypeRequiredDescription
idquerystringnoAgent ID.

GET/api/get_agents

Retrieve the agents of the current workspace (X-DocsGPT-Workspace: personal or a team id). Personal: the caller's own plus those shared with their teams; a team: the team's agents, each with the caller's role, then those other teams share with it (origin team_shared, shared_from {team_id, name}, the receiver's actions). Every row carries workspace, team_role, origin and created_by.

Token scope: agents:read

POST/api/import_agent

Import an agent from YAML into the request's workspace (X-DocsGPT-Workspace): create a draft, or update the workspace's agent matched by id or slug. A team needs the editor role; the agent and what the import creates are the team's. resolution.folders is keyed by a folder entry's key, its path_key, or its name when no other folder entry shares it.

Token scope: agents:write

POST/api/import_agent/plan

Dry-run an agent YAML import into the request's workspace (X-DocsGPT-Workspace) and return the resolution plan. A team needs the editor role. Knowledge-folder entries carry key, path, path_key and target_path; a team's plan marks a custom model or a personal-only tool unavailable with a reason.

Token scope: agents:write

POST/api/pin_agent

Pin or unpin an agent.

Token scope: agents:write

ParameterInTypeRequiredDescription
idquerystringnoID of the agent.

GET/api/pinned_agents

Get the caller's pinned agents in the current workspace: a pin shows in the workspace its agent lives in (a team's agents in that team and in each team it is shared with, every other agent in Personal)

Token scope: agents:read

POST/api/regenerate_agent_key/{agent_id}

Rotate an agent's API key. The previous key is invalidated immediately and a fresh key is returned once. Historical logging and usage records are re-pointed to the new key so analytics stay intact. Owner only.

Token scope: agents:keys

ParameterInTypeRequiredDescription
agent_idpathstringyesID of the agent.

DELETE/api/remove_shared_agent

Remove a shared agent from the current user's shared list.

Token scope: agents:write

ParameterInTypeRequiredDescription
idquerystringnoID of the shared agent.

PUT/api/share_agent

Share or unshare an agent.

Token scope: agents:write

JSON body (ShareAgentModel):

FieldTypeRequiredDescription
idstringyesID of the agent.
sharedbooleanyesShare or unshare the agent.
usernamestringnoName of the user.

GET/api/shared_agent

Get a shared agent by token or ID.

Not available to personal access tokens

ParameterInTypeRequiredDescription
tokenquerystringnoShared token of the agent.

GET/api/shared_agents

Get shared agents explicitly shared with the user.

Token scope: agents:read

GET/api/template_agents

Get template/premade agents.

Token scope: agents:read

PUT/api/update_agent/{agent_id}

Update an existing agent. JSON or multipart (multipart for an image). 200 {success, id, message, image, key (when first published), workflow_id (workflow agents)}. A workflow agent may send workflow_graph to write its next graph version in the same transaction (or create its workflow); confirm_sponsor covers the agent's and the graph's resources. Publishing a draft without a graph validates the stored one.

Token scope: agents:write

ParameterInTypeRequiredDescription
agent_idpathstringyes

JSON body (UpdateAgentModel):

FieldTypeRequiredDescription
agent_typestringnoType of the agent (classic, react, workflow). Defaults to 'classic' for backwards compatibility.
allow_system_prompt_overridebooleannoAllow API callers to override the system prompt via the v1 endpoint.
chunksintegernoChunks count.
default_model_idstringnoDefault model ID for this agent.
descriptionstringyesNew description of the agent.
folder_idstringnoOne of the caller's agent folders to file the agent in (the caller's own filing)
foldersarray of stringnoSource folders the agent reads live: every source their owner files in them, subfolders included. A folder is attached by its owner only (403 folder_not_accessible); ones already on the agent stay. Must be a list (a JSON string in a multipart form)
imageobjectnoImage file upload.
json_schemaobjectnoJSON schema for enforcing structured output format.
limited_request_modebooleannoWhether the agent is in limited request mode.
limited_token_modebooleannoWhether the agent is in limited token mode.
modelsarray of stringnoList of available model IDs for this agent.
namestringyesNew name of the agent.
prompt_idstringnoPrompt id, or a preset: default, creative or strict.
request_limitintegernoRequest limit for the agent in limited mode.
retrieverstringnoRetriever ID.
sourcestringnoSource ID (legacy single source)
sourcesarray of stringnoList of source identifiers for multiple sources.
startersarray of stringnoUp to 4 questions a new chat with the agent offers, each at most 200 characters; trimmed, blanks and case-insensitive duplicates dropped. Multipart sends a JSON string.
statusstringyesStatus of the agent (draft or published)
token_limitintegernoToken limit for the agent in limited mode.
toolsarray of stringnoList of tool identifiers.
workflowstringnoWorkflow ID for workflow-type agents.
workflow_graphobjectnoWorkflow agents only, instead of workflow: the graph saved with the agent in the same transaction, {nodes, edges, retry_defaults?} (a JSON string in a multipart form). A draft only its builder runs is checked for shape only; a published agent, one a key, webhook, schedule or public link runs, or one sharing its workflow with such an agent gets the full validation. Needs workflows:write for a token.

GET/api/webhooks/agents/{webhook_token}

Webhook listener for agent events (GET). Uses URL query parameters as payload to trigger processing. Honors an optional ``Idempotency-Key`` header: a repeat request with the same key within 24h returns the original cached response and does not re-enqueue the task.

Not available to personal access tokens

ParameterInTypeRequiredDescription
webhook_tokenpathstringyes

POST/api/webhooks/agents/{webhook_token}

Webhook listener for agent events (POST). Expects JSON payload, which is used to trigger processing. Honors an optional ``Idempotency-Key`` header: a repeat request with the same key within 24h returns the original cached response and does not re-enqueue the task.

Not available to personal access tokens

ParameterInTypeRequiredDescription
webhook_tokenpathstringyes

Agent folders

Agent folder management (aliases of /api/folders?type=agent)

GET/api/agents/folders/

The workspace's folder tree, as GET /api/folders?type=agent.

Token scope: agents:read

POST/api/agents/folders/

Create a folder in the workspace's tree, as POST /api/folders.

Token scope: agents:write

JSON body (CreateFolder):

FieldTypeRequiredDescription
namestringyesFolder name.
parent_idstringnoParent folder ID.

POST/api/agents/folders/bulk_move

File several agents into a folder (null takes them out of the workspace's tree)

Token scope: agents:write

JSON body (BulkMoveAgents):

FieldTypeRequiredDescription
agent_idsarray of stringyesList of agent IDs.
folder_idstringnoTarget folder ID.

POST/api/agents/folders/move_agent

File an agent into a folder, or take it out of the workspace's tree (as POST /api/folders/items)

Token scope: agents:write

JSON body (MoveAgent):

FieldTypeRequiredDescription
agent_idstringyesAgent ID to move.
folder_idstringnoTarget folder ID (null to remove from folder)

GET/api/agents/folders/{folder_id}

A folder with the agents filed in it and its subfolders.

Token scope: agents:read

ParameterInTypeRequiredDescription
folder_idpathstringyes

PUT/api/agents/folders/{folder_id}

Rename or move a folder, as PUT /api/folders/<id>.

Token scope: agents:write

ParameterInTypeRequiredDescription
folder_idpathstringyes

DELETE/api/agents/folders/{folder_id}

Delete a folder; its folders and items move to its parent.

Token scope: agents:write

ParameterInTypeRequiredDescription
folder_idpathstringyes

Guardrails

Agent guardrail configuration and audit.

GET/api/agents/defaults

The guardrails a new agent starts with (set by an admin under Admin > Defaults), for prefilling the new-agent form: `{guardrails: {...}}`, the built-in defaults when none are set.

Token scope: agents:read

GET/api/guardrails/catalog

List available guardrail checks and their capabilities.

Token scope: agents:read

GET/api/guardrails/events

List guardrail decisions recorded for an agent.

Token scope: agents:read

ParameterInTypeRequiredDescription
agent_idquerystringnoAgent ID.
limitquerystringnoMax rows (default 100)
offsetquerystringnoRow offset.
daysquerystringnoTrailing window in days, clamped to 1-365 (optional; invalid values are ignored)
checkquerystringnoExact check name (optional)
outcomequerystringnoOne of block, redact, flag, not_evaluated (optional; unknown values are ignored)

GET/api/guardrails/summary

Aggregate guardrail activity for the caller.

Token scope: agents:read

ParameterInTypeRequiredDescription
daysquerystringnoTrailing window in days (default 30)
agent_idquerystringnoScope the aggregate to one agent (optional)

Triggers

Public webhook trigger links of monitors.

GET/api/triggers/{token}

A GET call, taken only by a link created with methods ["POST", "GET"]: the query parameters are the delivery (a dotted key nests). A HEAD, a prefetch (Purpose / Sec-Purpose: prefetch) or a known link-preview or crawler User-Agent gets 200 {ignored} and changes nothing. 202 when accepted, 405 for a POST-only link, 404 for an unknown, expired, revoked or used-up one, 429 when rate limited.

Not available to personal access tokens

ParameterInTypeRequiredDescription
tokenpathstringyesThe link's token.

POST/api/triggers/{token}

Deliver an event to a monitor's webhook trigger link. Public: the token is the credential. Accepts JSON, form or text up to TRIGGER_MAX_PAYLOAD_BYTES. Signed links verify Standard Webhooks (webhook-id/webhook-timestamp/webhook-signature, 5 minute tolerance), GitHub X-Hub-Signature-256, X-Signature: sha256=<hex>, Stripe-Signature (t=..,v1=.., 5 minute tolerance), Slack X-Slack-Signature with X-Slack-Request-Timestamp (5 minute tolerance; a url_verification challenge is answered with 200 {challenge}), a static token header (X-Webhook-Token unless the link names another) or Authorization: Bearer. Deduplicated on Idempotency-Key, webhook-id, X-GitHub-Delivery or the Stripe/Slack event id, else the body hash. 202 when accepted; 404 for an unknown, expired, revoked or used-up link; 401 for a bad signature; 413 for a large body; 429 past TRIGGER_RATE_PER_MINUTE.

Not available to personal access tokens

ParameterInTypeRequiredDescription
tokenpathstringyesThe link's token.

Approvals

Public human approval links of monitors.

GET/api/approvals/{token}

What an approval link asks: its title, question, details, options and whether it was decided. Public (the token is the credential); reading it changes nothing.

Not available to personal access tokens

ParameterInTypeRequiredDescription
tokenpathstringyesThe link's token.

POST/api/approvals/{token}

Decide an approval link: {decision, comment?}, where decision is one of its options. The first decision wins and resumes the conversation that asked; later ones get 409. 404 for an unknown, expired or revoked link, 400 for an option it doesn't offer, 429 when rate limited.

Not available to personal access tokens

ParameterInTypeRequiredDescription
tokenpathstringyesThe link's token.

Monitors

The caller's monitors (Settings > Monitors)

GET/api/monitors

The caller's monitors, newest first: what each watches, its interval, last check, wakes left, expiry and links (never tokens or secrets).

Token scope: conversations:read

ParameterInTypeRequiredDescription
conversation_idquerystringnoOnly this conversation's monitors.
statusquerystringnolive (active and paused) or all (the default).

GET/api/monitors/{monitor_id}

One of the caller's monitors.

Token scope: conversations:read

ParameterInTypeRequiredDescription
monitor_idpathstringyes

GET/api/monitors/{monitor_id}/secret

The signing secret of one of the caller's webhook monitors, so the owner can configure the sender. Only the owner's session may read it (never an access token); the model only ever sees its reference. Rate limited, audited, never cached or logged. 404 when the monitor has no live signed link, or its secret was never set.

Not available to personal access tokens

ParameterInTypeRequiredDescription
monitor_idpathstringyes

PUT/api/monitors/{monitor_id}/secret

Set the signing secret of one of the caller's webhook monitors: {secret}. For Stripe and Slack, which create their own signing secret, this is how the link gets it; for any other signed scheme it replaces the generated one. Only the owner's session may set it (never an access token). Rate limited, audited without the value, never logged. 400 for a value that can't be this scheme's secret, 404 when the monitor has no live signed link.

Not available to personal access tokens

ParameterInTypeRequiredDescription
monitor_idpathstringyes

PUT/api/monitors/{monitor_id}/secret/exposure

Show (or stop showing) one of the caller's webhook monitors' raw signing secret to the assistant: {exposed: true|false}. Shown, monitor_list gives the assistant the value, which then goes to the model provider. Only the owner's session may change it (never an access token, never the assistant). Rate limited and audited. 404 when the monitor has no live signed link with a secret.

Not available to personal access tokens

ParameterInTypeRequiredDescription
monitor_idpathstringyes

POST/api/monitors/{monitor_id}/{action}

Pause, resume or cancel one of the caller's monitors. Cancelling revokes its links and any approval its source was given; resuming a polled monitor checks it again right away. 409 when the monitor is not in a state the action applies to.

Token scope: conversations:write

ParameterInTypeRequiredDescription
monitor_idpathstringyes
actionpathstringyespause, resume or cancel.

Prompts

Prompt management operations.

POST/api/check_prompt

Check a prompt's text without a model: blanks left in, lines DocsGPT already adds to a persona, and a template that doesn't parse, runs tool variables, or lacks the Boundaries section or citation rules. Each check is a code the client words; works with the drafter off.

Token scope: prompts:read

JSON body (CheckPromptModel):

FieldTypeRequiredDescription
contentstringyesThe prompt's text as the editor holds it, at most 100,000 characters.

POST/api/create_prompt

Create a new prompt in the workspace the request names (header X-DocsGPT-Workspace, default Personal); in a team it needs the Editor role and the team owns it.

Token scope: prompts:write

JSON body (CreatePromptModel):

FieldTypeRequiredDescription
contentstringyesContent of the prompt.
folder_idstringnoA folder of the workspace's tree to file the new prompt in.
namestringyesName of the prompt.

POST/api/delete_prompt

Delete a prompt by ID.

Token scope: prompts:write

JSON body (DeletePromptModel):

FieldTypeRequiredDescription
idstringyesPrompt ID to delete.

GET/api/get_prompts

Get the prompts of the workspace the request names (header X-DocsGPT-Workspace, default Personal), after the built-in presets: in a team, the team's prompts with the caller's team role, then those other teams share with it (origin team_shared, shared_from {team_id, name}, the receiver's actions); in Personal, the caller's own and those shared with them, never a team's. Each row carries workspace, created_by {user_id, label}, access, allowed_actions, team_role, origin and its filing in the workspace's folder tree (folder_id, folder_path [{id, name}] from the top-level folder down; presets have none)

Token scope: prompts:read

GET/api/get_single_prompt

Get a single prompt by ID.

Token scope: prompts:read

ParameterInTypeRequiredDescription
idquerystringnoID of the prompt.

POST/api/update_prompt

Update an existing prompt.

Token scope: prompts:write

JSON body (UpdatePromptModel):

FieldTypeRequiredDescription
contentstringyesNew content of the prompt.
expected_updated_atstringnoThe prompt's updated_at as last read or saved; the save is refused (409) when someone saved it since.
folder_idstringnoFile the prompt in this folder of its workspace's tree; null takes it out.
idstringyesPrompt ID to update.
namestringyesNew name of the prompt.

Schedules

Agent schedule management.

GET/api/agents/{agent_id}/schedules

List schedules for an agent (recurring + one-time).

Token scope: schedules:read

ParameterInTypeRequiredDescription
agent_idpathstringyes

POST/api/agents/{agent_id}/schedules

Create a schedule (recurring or one-time) for an agent.

Token scope: schedules:write

ParameterInTypeRequiredDescription
agent_idpathstringyes

JSON body (ScheduleCreate):

FieldTypeRequiredDescription
cronstringnoRequired when trigger_type == 'recurring'.
end_atstringnoISO 8601.
instructionstringyes
model_idstringno
namestringno
run_atstringnoISO 8601 โ€” required when trigger_type == 'once'.
timezonestringno
token_budgetintegerno
tool_allowlistarray of stringno
trigger_typestringno'recurring' (default) or 'once'.

GET/api/agents/{agent_id}/schedules/stats

Return run count, failures, tokens and latest failure for an agent.

Run stats for an agent's schedules over a recent window. Args: agent_id: Agent id from the URL. Returns: A Flask response with ``days``, ``runs``, ``failed``, ``tokens`` and ``latest_failure`` (or an error envelope).

Token scope: schedules:read

ParameterInTypeRequiredDescription
agent_idpathstringyes
daysquerystringnoWindow in days (default 30, clamped to 1..365)

GET/api/schedules

Return the workspace's schedules with agent and origin-chat names.

List the schedules of the current workspace (X-DocsGPT-Workspace). Personal: the caller's own across every personal agent, agentless ones created in chat, and those of teammates' agents they manage through a team (team: true). A team: the schedules on the team's agents, every member's for an Editor and up, the caller's own for a Viewer. Each row names who pays for it (paid_by). Monitors are not included. Returns: A Flask response with ``workspace`` (``{kind, team_id, role}``) and ``schedules``: schedule rows plus ``agent_name``, ``agent_image`` (a signed URL, never a storage path), ``origin_conversation_name``, ``team`` (someone else's schedule the caller manages through a team) and ``paid_by``.

Token scope: schedules:read

GET/api/schedules/{schedule_id}

Get schedule by id.

Token scope: schedules:read

ParameterInTypeRequiredDescription
schedule_idpathstringyes

PUT/api/schedules/{schedule_id}

Edit a schedule's editable fields.

Token scope: schedules:write

ParameterInTypeRequiredDescription
schedule_idpathstringyes

PATCH/api/schedules/{schedule_id}

Pause / resume a schedule.

Token scope: schedules:write

ParameterInTypeRequiredDescription
schedule_idpathstringyes

DELETE/api/schedules/{schedule_id}

Cancel / delete a schedule.

Token scope: schedules:write

ParameterInTypeRequiredDescription
schedule_idpathstringyes

POST/api/schedules/{schedule_id}/run

Run a schedule immediately (trigger_source='manual').

Token scope: schedules:write

ParameterInTypeRequiredDescription
schedule_idpathstringyes

GET/api/schedules/{schedule_id}/runs

Paginated run log for a schedule.

Token scope: schedules:read

ParameterInTypeRequiredDescription
schedule_idpathstringyes
limitquerystringnoPage size (default 50)
offsetquerystringnoPage offset.

GET/api/schedules/{schedule_id}/runs/{run_id}

Full output / error for a single run.

Token scope: schedules:read

ParameterInTypeRequiredDescription
schedule_idpathstringyes
run_idpathstringyes

POST/api/schedules/{schedule_id}/take_over

Take over a schedule on a team agent.

Make the caller the payer of a schedule on a team agent: it runs under them from now on (its failure count reset, the chat it was set from no longer linked). Editors and up of the team; a personal agent's schedule can't be taken over. Returns the schedule in the list's shape and whether anything changed. Not available to access tokens. Args: schedule_id: Schedule id from the URL. Returns: 200 ``{success, schedule, changed}``; ``changed`` is false when the caller already paid for it. Refusals carry ``{success: false, error, message}``: 401; 404 ``schedule_not_found``; 403 ``workspace_role_required``; 409 ``take_over_team_only`` or ``schedule_finished`` (completed or cancelled); 429 ``max_schedules``.

Not available to personal access tokens

ParameterInTypeRequiredDescription
schedule_idpathstringyes

Sharing

Conversation sharing operations.

POST/api/share

Share a conversation.

Not available to personal access tokens

JSON body (ShareConversationModel):

FieldTypeRequiredDescription
chunksintegernoChunks count (optional)
conversation_idstringyesConversation ID.
prompt_idstringnoPrompt ID (optional)
userstringnoUser ID (optional)

GET/api/shared_conversation/{identifier}

Get publicly shared conversations by identifier.

Not available to personal access tokens

ParameterInTypeRequiredDescription
identifierpathstringyes

Sources

Source document management operations.

POST/api/add_chunk

Adds a new chunk to the document. 409 (code source_busy) while a sync or page change on the source runs.

Token scope: sources:write

JSON body (AddChunkModel):

FieldTypeRequiredDescription
idstringyesDocument ID.
metadataobjectnoMetadata associated with the chunk.
textstringyesText of the chunk.

GET/api/combine

Redirects /api/combine to /api/sources for backward compatibility.

Not available to personal access tokens

DELETE/api/delete_chunk

Deletes a specific chunk from the document. 409 (code source_busy) while a sync or page change on the source runs.

Token scope: sources:write

ParameterInTypeRequiredDescription
idquerystringnoThe document ID.
chunk_idquerystringnoThe ID of the chunk to delete.

GET/api/delete_old

Deletes a source: its index, stored files and row. 409 (code source_busy) while a sync or page change on the source runs; nothing is deleted.

Token scope: sources:write

ParameterInTypeRequiredDescription
source_idquerystringnoThe source ID to delete.

GET/api/directory_structure

Get the directory structure for a document.

Token scope: sources:read

ParameterInTypeRequiredDescription
idquerystringnoThe document ID.

GET/api/get_chunks

Retrieves chunks from a document, optionally filtered by file path and search term.

Token scope: sources:read

ParameterInTypeRequiredDescription
idquerystringnoThe document ID.
pagequerystringnoPage number for pagination.
per_pagequerystringnoNumber of chunks per page.
pathquerystringnoOptional: Filter chunks by relative file path.
searchquerystringnoOptional: Search term to filter chunks by title or content.
injectionquerystringnoOptional: `flagged` keeps the chunks whose cached prompt-injection score is suspected or high (marked safe ones included)

POST/api/manage_source_files

Add files, remove files, remove directories, or replace the whole file set (sync) of an existing source. The source is then re-ingested: only added, removed and edited files are re-embedded.

Token scope: sources:write

JSON body (ManageSourceFilesModel):

FieldTypeRequiredDescription
directory_pathstringnoDirectory path to remove (for remove_directory operation)
fileobjectnoFiles to add (for add operation) or the new file set (for sync)
file_pathsarray of stringnoFile paths to remove (for remove operation)
manifestobjectnoFor sync_manifest, as a file part: JSON {"version": 1, "files": [{"path": "guide/intro.md", "sha256": "<64 lowercase hex>"}]} listing the whole file set. The reply names the paths the source lacks (status 'needs_files'); only those are uploaded, each file part named after its sha256.
operationstringyesOperation: 'add', 'remove', 'remove_directory', 'sync' (the uploaded files and ZIPs become the source's whole file set; files not in the upload are removed), or 'sync_manifest' (the same, uploading only the files the source lacks)
parent_dirstringnoParent directory path relative to source root.
source_idstringyesSource ID to modify.

POST/api/manage_sync

Manage sync frequency for sources.

Token scope: sources:write

JSON body (ManageSyncModel):

FieldTypeRequiredDescription
source_idstringyesSource ID.
sync_frequencystringyesSync frequency (never, daily, weekly, monthly)

POST/api/remote

Uploads remote source for vectorization. Honors an optional ``Idempotency-Key`` header: a repeat request with the same key within 24h returns the original cached response without re-enqueuing.

Token scope: sources:write

JSON body (RemoteUploadModel):

FieldTypeRequiredDescription
datastringyesJSON loader config. For source=website: {entries: [{url, mode: page|site, max_pages, path_prefix, include_subdomains, discovery: auto|sitemap|links, sitemap_url}], skip: [url or https://host/path/*], keep_links}.
folder_idstringnoOne of the caller's source folders to file the new source in.
namestringyesJob name.
repo_urlstringnoGitHub repository URL.
sourcestringyesSource of the data.
sync_frequencystringnoHow often to re-fetch: never (default), daily, weekly or monthly.
userstringyesUser ID.

GET/api/sources

Provide JSON file with combined available indexes.

Token scope: sources:read

GET/api/sources/defaults

The retrieval settings a new source starts with (set by an admin under Admin > Defaults), for prefilling create forms: `{retrieval: {...}}`, the built-in defaults when none are set.

Token scope: sources:read

POST/api/sources/from_attachments

Creates a Knowledge source from chat attachments the caller already uploaded. The stored originals are copied into a new source and ingested like an upload (a zip contributes its files); the files together may not exceed the upload request limit (413). Returns the source id and the ingest task id; progress arrives as ``source.ingest.*`` events for that source id. Honors an optional ``Idempotency-Key`` header: a repeat request with the same key within 24h returns the first request's source and task ids without copying the files or queueing a second ingest.

Token scope: sources:write

JSON body (SourceFromAttachmentsModel):

FieldTypeRequiredDescription
attachment_idsarray of stringyesIds of the caller's chat attachments, in the order to list them.
namestringnoName of the new source; defaults to the first file's name and a count.

GET/api/sources/paginated

Get sources with pagination, sorting and filtering. Each row carries ``used_by`` (the agents using it) and the caller's filing (``folder_id``, ``folder_path`` [{id, name}] from the top-level folder down) and ``sync_paused`` ({reason, since} while a team source's scheduled sync is skipped for want of a payer; {reason, until, left_team, connection_id} while the team connection it reads through is paused; else null), and ``filesFailed`` (how many files a connector source's last sync could not read; its next sync retries them). ``kind_counts`` counts every kind with the search and usage filters applied; ``usage_counts`` counts all/in_use/unused with the search and kind filters applied. Both follow ``origin``; ``origin_counts`` counts own/shared with the search, kind and usage filters applied. With ``folder``, the counts and ``subtree_total`` cover the folder's whole subtree, while ``total``/``totalPages`` describe the listed rows.

Token scope: sources:read

ParameterInTypeRequiredDescription
pagequerystringnoPage number, from 1.
rowsquerystringnoRows per page.
sortquerystringnodate (default), name, tokens, type, created_at or updated_at.
orderquerystringnoasc or desc (default)
searchquerystringnoSubstring of the name, case-insensitive.
kindquerystringnoall (default), files, websites, synced, wikis, or shared (sources a team shares with the caller, of any kind)
usagequerystringnoall (default), in_use (some agent uses it) or unused.
originquerystringnoall (default), own (the workspace's own sources) or shared (in Personal, sources a team shares with the caller; in a team, sources other teams share with it)
folderquerystringnoroot, or one of the caller's source folders: counts cover that folder and every folder under it (root: everything). Omitted: no folder scoping.
directquerystringnotrue lists only the sources filed directly in ``folder`` (root: the unfiled ones); false (default) lists its whole subtree.

POST/api/sources/reingest

Re-run ingestion for a source โ€” e.g. to recover a stalled embed flagged by the reconciler, or to apply a chunking change. A source with no stored files (Website, crawler, connector) is synced from its stored config instead; either way the answer is ``{success, task_id}`` and the task's source.ingest events carry that task_id. A connector source can be refused with a 409: code connection_missing when its connection was removed, reconnect_needed when the owner must sign it in again, connection_paused (with paused_for) when a team's account it reads through is paused. Honours an Idempotency-Key header: a repeat with the same key runs nothing new, and a rebuild's repeat answers with the first request's task_id.

Token scope: sources:write

JSON body (ReingestSourceModel):

FieldTypeRequiredDescription
source_idstringyesSource ID.

POST/api/sources/wiki

Create an LLM-editable wiki source. No ingestion task is enqueued; pages are authored via the WikiTool. An optional initial_content seeds /index.md and triggers its per-page re-embed.

Token scope: sources:write

JSON body (CreateWikiModel):

FieldTypeRequiredDescription
folder_idstringnoOne of the caller's source folders (the team's in a team) to file the wiki in.
initial_contentstringnoOptional markdown seed for /index.md.
namestringyesWiki source name.

GET/api/sources/{source_id}/chunk

Return the cited chunk and its source.

The chunk behind a citation, found by its content key, else by its excerpt, with what the reader needs about its source. 404 when the caller cannot see the source, or with reason chunk_missing when neither finds the chunk (the source was edited); 501 with reason unsupported when the vector store cannot look chunks up. Args: source_id: The source the citation names. Returns: Response: ``{"success", "chunk", "source", "page_path"}``, or an error with ``reason`` ``chunk_missing`` (404) or ``unsupported`` (501) the reader tells apart from a source out of reach.

Token scope: sources:read

ParameterInTypeRequiredDescription
source_idpathstringyes
chunk_keyquerystringnoThe citation's ``chunk_key``: the MD5 of the chunk text.
excerptquerystringnoOptional: the start of the cited passage, searched when the key misses.

PATCH/api/sources/{source_id}/config

Edit a source's behavior config. Retrieval-time fields take effect live; chunking changes require an explicit re-ingest (surfaced as requires_reingest). A section the body leaves out (chunking, retrieval, graph) keeps its saved value, so a body with only `retrieval` saves just that.

Token scope: sources:write

ParameterInTypeRequiredDescription
source_idpathstringyes

JSON body (SourceConfigModel):

FieldTypeRequiredDescription
chunkingobjectnoIngest-time chunking config.
kindstringnoBehavior selector (e.g. classic)
retrievalobjectnoQuery-time retrieval config.

GET/api/sources/{source_id}/graph

Bounded knowledge-graph overview for a graphrag source: top nodes by degree and the edges among them (read access: owner or shared). Returns empty lists when no graph has been built yet.

Token scope: sources:read

ParameterInTypeRequiredDescription
source_idpathstringyes

GET/api/sources/{source_id}/graph/node/{node_id}

A graph node's description and its linked chunks (read access: owner or shared).

Token scope: sources:read

ParameterInTypeRequiredDescription
source_idpathstringyes
node_idpathstringyes

GET/api/sources/{source_id}/graph/nodes

List one page of a source's graph nodes with type facets.

Paged, searchable list of a graphrag source's nodes, highest degree first, plus type facets over all its nodes (read access: owner or shared). Query params: q (name substring), type (type key), page (1-based), per_page (1-100, default 25). Args: source_id: The source id from the URL. Returns: Response: ``{success, nodes, total, page, per_page, types}``, or 401/404/400 on missing auth, no read access or a failure. ``page`` is clamped to ``1..GRAPH_NODE_LIST_MAX_PAGE`` and ``per_page`` to ``1..GRAPH_NODE_LIST_MAX_LIMIT``. A graph store that is not configured or has no tables yet reads as an empty page, like the overview; any other store query failure is a 400, never an empty 200.

Token scope: sources:read

ParameterInTypeRequiredDescription
source_idpathstringyes

POST/api/sources/{source_id}/graphrag/enable

Enable GraphRAG on a source: flips its config to graphrag mode and enqueues graph extraction over its embedded chunks. Requires VECTOR_STORE=pgvector and GRAPHRAG_ENABLED. Write access required (owner/editor). The config kind cannot be set to graphrag via the config PATCH endpoint.

Token scope: sources:write

ParameterInTypeRequiredDescription
source_idpathstringyes

POST/api/sources/{source_id}/injection_review

Add a chunk text's hash to the source's owner allowlist, or remove it.

Mark a flagged chunk safe from prompt-injection screening for agents using this source, or undo that. Needs chunk-edit access. Keyed by the chunk text, so editing the chunk drops the mark. At most 1000 chunks per source. Returns `{success, content_hash, allowed, count}`. Args: source_id: The source. Returns: Response: ``{"success", "content_hash", "allowed", "count"}``, a 400 for a bad body or a full allowlist, or the access error.

Token scope: sources:write

ParameterInTypeRequiredDescription
source_idpathstringyes

JSON body (InjectionReviewModel):

FieldTypeRequiredDescription
content_hashstringyesThe chunk's `injection.content_hash` (sha256 of its text)
decisionstringyes`allow` marks the chunk safe from prompt-injection screening; `clear` undoes it. One of: allow, clear.

POST/api/sources/{source_id}/search

Run the real retrieval pipeline against one source and return the ranked chunks it produces, optionally under an ad-hoc retrieval config. Read-only: nothing is saved.

Token scope: chat:run

ParameterInTypeRequiredDescription
source_idpathstringyes

JSON body (SourceSearchModel):

FieldTypeRequiredDescription
comparebooleannoAlso return `candidates`: every chunk the stages received, in retriever order, with its relevance and whether it was kept.
querystringyesThe query to retrieve for.
retrievalobjectnoAd-hoc retrieval config to test with. Omit to use the source's saved config. Never persisted.

POST/api/sources/{source_id}/wiki/convert

Convert an ingested source into a wiki. A blank source is enabled inline; a source with files runs a conversion task (poll its status for the per-file summary). Write access required (owner/editor).

Token scope: sources:write

ParameterInTypeRequiredDescription
source_idpathstringyes

GET/api/sources/{source_id}/wiki/page

Fetch a single wiki page's content fresh from storage.

Token scope: sources:read

ParameterInTypeRequiredDescription
source_idpathstringyes
pathquerystringnoPage path (e.g. /index.md)

PUT/api/sources/{source_id}/wiki/page

Create or overwrite a wiki page (human edit). Write access required; a stale expected_version returns 409.

Token scope: sources:write

ParameterInTypeRequiredDescription
source_idpathstringyes

JSON body (WikiPageEditModel):

FieldTypeRequiredDescription
contentstringyesMarkdown content.
expected_versionintegernoOptimistic-lock version from the last read.
pathstringyesPage path.

GET/api/sources/{source_id}/wiki/pages

List a wiki source's pages (read access: owner or shared).

Token scope: sources:read

ParameterInTypeRequiredDescription
source_idpathstringyes

GET/api/sources/{source_id}/wiki/settings

A wiki's settings. Anyone who can see the wiki may read them; returns allow_outside_edits plus the caller's access.

Token scope: sources:read

ParameterInTypeRequiredDescription
source_idpathstringyes

PUT/api/sources/{source_id}/wiki/settings

Change a wiki's settings (owner only, manage_settings). Body: {"allow_outside_edits": bool}: whether runs from an agent's API key or widget may edit the wiki.

Not available to personal access tokens

ParameterInTypeRequiredDescription
source_idpathstringyes

GET/api/sources/{source_id}/workspace

Return where a source the caller can read lives.

The workspace a source lives in (``{kind, team_id}``), so a link to it opened from another workspace can go there first. A source another team shares with the caller's team lives in that receiving team. 404 when the caller cannot see the source. Args: source_id: The source's id. Returns: Response: ``{"success", "workspace"}``, or 404 for a source the caller can't read (missing, someone else's, or a team they left).

Token scope: sources:read

ParameterInTypeRequiredDescription
source_idpathstringyes

POST/api/sync_source

Trigger an immediate sync for a source.

Token scope: sources:write

JSON body (SyncSourceModel):

FieldTypeRequiredDescription
source_idstringyesSource ID.

GET/api/task_status

Get celery job status.

Token scope: chat:run or sources:read or sources:write

JSON body (TaskStatusModel):

FieldTypeRequiredDescription
task_idstringyesTask ID.

PUT/api/update_chunk

Updates an existing chunk in the document. 409 (code source_busy) while a sync or page change on the source runs.

Token scope: sources:write

JSON body (UpdateChunkModel):

FieldTypeRequiredDescription
chunk_idstringyesChunk ID to update.
idstringyesDocument ID.
metadataobjectnoUpdated metadata associated with the chunk.
textstringnoNew text of the chunk.

POST/api/upload

Uploads a file to be vectorized and indexed. Honors an optional ``Idempotency-Key`` header: a repeat request with the same key within 24h returns the original cached response without re-enqueuing.

Token scope: sources:write

JSON body (UploadModel):

FieldTypeRequiredDescription
fileobjectyesFile(s) to upload.
folder_idstringnoOne of the caller's source folders to file the new source in.
namestringyesJob name.
userstringyesUser ID.

GET/api/website

A Website source's config, sync schedule and last ingest report. entry_paths lists the tree paths of the pages a mode: page entry lists (by its address, or one that redirected to the page); the other pages were found by a site's crawl.

Token scope: sources:read

ParameterInTypeRequiredDescription
idquerystringnoSource ID.

POST/api/website

Save a Website source's entries, skips, link setting and sync schedule. Applies at the next sync. An address the save adds is checked as in /api/website/pages: one that isn't a web address (user:password@ credentials, a malformed host, a control character) is a 400 with code invalid_address, as is a new skip rule with a control character; a new path with one is a 400 with code invalid_config. What the source already stores is saved as it is.

Token scope: sources:write

JSON body (WebsiteSettingsModel):

FieldTypeRequiredDescription
entriesarray of objectyesWhat the source fetches: {url, mode: page|site, max_pages, path_prefix, include_subdomains, discovery: auto|sitemap|links, sitemap_url}.
keep_linksbooleannoKeep the URL of links inside sentences in page text; left out, the stored setting is kept.
skiparray of stringnoPages (url) or sections (https://host/path/*) to leave out; left out, the stored list is kept, and [] clears it.
source_idstringyesSource ID.
sync_frequencystringnonever, daily, weekly or monthly.

POST/api/website/pages

Add pages or sites to a Website source; they stay in every sync. Pages are fetched and appended now (mode append). A site rebuilds the source like a sync (mode sync), and so does a page whose host makes a single-host source span several hosts (every page moves under a host folder), or any add on a vector store that can't change single chunks. Only what the source doesn't list yet is added and fetched: a page it lists under any spelling, or a site with the same address and settings; when that leaves nothing, a 400 with code already_listed and nothing is queued. Refused with code page_limit when the source would hold more than WEB_MAX_PAGES pages; a 500 with code queue_failed when the entries were saved but the task couldn't be queued (the next sync fetches them).

Token scope: sources:write

JSON body (AddWebsitePagesModel):

FieldTypeRequiredDescription
entriesarray of objectyesPages or sites to add (as in /api/website)
source_idstringyesSource ID.

POST/api/website/refresh

Re-fetch one page of a Website source now; if it can't be fetched, its content is kept. A page found by a site's crawl that now leads outside the site's scope or to a skipped address is removed, as the next sync would drop it (the task's failed event carries reason out_of_scope). A 500 with code queue_failed when the task couldn't be queued.

Token scope: sources:write

JSON body (RefreshWebsitePageModel):

FieldTypeRequiredDescription
file_pathstringyesTree path of the page.
source_idstringyesSource ID.
urlstringnoThe page's address, as its tree leaf shows it; when given, the page is found by it wherever a sync moved it.

POST/api/website/remove

Remove pages or a folder from a Website source. The config changes now: a page added by address leaves the list; one found by a site's crawl (or a whole folder) is skipped in later syncs. Their chunks and tree entries go in a background task (task_id), after any running sync; a 500 with code queue_failed when the config was saved but the task couldn't be queued. A page an older url, crawler or sitemap source stored without its address is matched by the address on its chunks; when none is found it is still removed, by its path, and the config is left as it is.

Token scope: sources:write

JSON body (RemoveWebsitePagesModel):

FieldTypeRequiredDescription
directory_pathstringnoTree path of a folder to remove.
file_pathsarray of stringnoTree paths of pages to remove, up to 1000.
source_idstringyesSource ID.

Teams

Team management and resource sharing.

GET/api/admin/teams

Global-admin oversight: every team with member counts, or a picker search.

With no query args every team is returned. Any of these switches to a bounded search (same row shape): q: Case-insensitive substring of the team name or slug. without_quota: ``1`` keeps only teams with no team ``all``-bucket quota policy. limit: The most rows to return, clamped to 1-100 (default 20).

Not available to personal access tokens

GET/api/resource_settings

A resource's sharing switches.

Anyone with access may read them. Query: ``resource_type``, ``resource_id``. Returns ``settings`` as ``[{key, value, default}]`` in display order, plus the caller's ``access`` and ``allowed_actions``.

Token scope: teams:read

PUT/api/resource_settings

Change a resource's sharing switches.

Needs ``manage_settings`` (owner). Body: ``{"resource_type", "resource_id", "settings": {key: bool}}``. An unknown key or a non-boolean value is a 400. Returns the GET shape.

Not available to personal access tokens

GET/api/resource_shares

List the teams a resource is shared with.

Needs ``share`` on it. Powers the share dialog (current shares + unshare), so only someone who may change the sharing can enumerate it: 404 when the resource isn't visible, 403 when the caller's role can't share. A personal agent adds ``uses_team_items`` (``[{team_id, name, items}]``, the teams' items it uses, which keep its shares to people who reach them). A team's own item has no per-person shares: whoever reaches it gets where its access comes from and its shares with other teams instead (:func:`_team_item_shares`).

Token scope: teams:read

GET/api/teams

List the teams the caller belongs to, each annotated with their role.

Token scope: teams:read

POST/api/teams

Create a team (self-serve)

The creator becomes its first team_admin.

Not available to personal access tokens

GET/api/teams/{team_id}

Team detail with members and the caller's role.

Requires membership.

Token scope: teams:read

ParameterInTypeRequiredDescription
team_idpathstringyes

PUT/api/teams/{team_id}

Update team name/description.

Requires team_admin.

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes

DELETE/api/teams/{team_id}

Delete the team.

Owner-only (a global admin overrides).

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes

GET/api/teams/{team_id}/chats/export

Every chat of the team workspace as NDJSON: a header line, then one line per conversation.

404 while ``TEAM_CHAT_EXPORT_ENABLED`` is off, as if the route were absent. The team's Owner and Admins only (403 ``workspace_role_required`` below Admin, 404 outside the team). The ``team.chats_exported`` audit row is written before the first byte; 503 ``audit_unavailable`` and no file when it can't be.

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes

GET/api/teams/{team_id}/grants

List resources shared with this team.

Requires membership. Each row carries the resource's name, owner and people labels (email when on file, else null), ``caller`` โ€” the caller's own live access fields on that resource (null if none) โ€” and ``origin`` (``personal_shared`` on a member's personal item). A Viewer or Editor sees whole-team grants and grants aimed at them; an Admin, the Owner, or someone with ``share`` on the resource, sees every grant. ``paused_reason`` is ``owner_left`` on a grant whose item's owner is no longer in the team (it gives no access until they are re-added), else null. Items other teams share with this team follow, every member seeing them, with ``origin`` ``team_shared``, ``shared_from``, ``paused_reason`` ``team_locked`` and ``can_revoke`` (see ``outside.incoming_share_rows``). The envelope gives the caller's ``role`` (``owner|admin|editor|viewer``) and ``team_role`` in today's names.

Token scope: teams:read

ParameterInTypeRequiredDescription
team_idpathstringyes

POST/api/teams/{team_id}/grants

Share a resource with this team, or change an existing grant's level.

A person's item needs ``share`` on it (the owner, or an editor when the owner turned on ``editors_can_share``) and membership of the team. The grant records the real owner as ``owner_id`` and the caller as ``granted_by``. A personal agent that uses a team's items goes only to people who reach them (409 ``uses_team_items``). A team's item goes to the whole team at Viewer level, from someone its outside policy lets share (``share_outside``) who is in this team too (``outside.share_team_item``): 201 with ``share``, 200 when this team has it already.

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes

DELETE/api/teams/{team_id}/grants

Unshare a resource from this team.

Allowed with ``share`` on the resource โ€” no membership needed, so an owner who left the team can still pull their resource back โ€” or for a team_admin of this team. ``target_user_id`` picks one member's grant (absent โ†’ the whole-team grant). Identifiers come from query params (some proxies strip DELETE bodies), with a JSON-body fallback. A team's item shared with this team is stopped from either side (``outside.revoke_team_item``): in the owning team by whoever may take its items outside and by its Admins and Owner (locked too), in this team by its Admins and Owner.

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes

GET/api/teams/{team_id}/members

List members.

Requires membership. Optional query args: ``q`` (case-insensitive substring over email and user id), ``page`` (1-based) and ``page_size`` (1..100; paginates only when given). ``total`` is the row count after the ``q`` filter. For the team's Owner and Admins each row also has ``pays_for`` (``{schedules, outside_access}``): the running schedules the member set on the team's agents and the team agents whose outside access they pay for, which pause when they leave or lose the role; and ``custom_models``: how many of the team's custom models they added, whose keys stay in use after they leave.

Token scope: teams:read

ParameterInTypeRequiredDescription
team_idpathstringyes

POST/api/teams/{team_id}/members

Add a member by email (preferred) or raw user_id.

Requires an Admin or the Owner. Body: ``email`` or ``user_id``, and ``role``: ``viewer`` (the default), ``editor`` or ``admin`` (``team_member`` / ``team_admin`` still work). The member must be a person who has signed in: anyone else, a team principal included, is 404. Re-adding an existing member sets their role, under the same owner and last-admin guard as the role change.

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes

PUT/api/teams/{team_id}/members/{member_id}

Change a member's role.

Requires an Admin or the Owner. Body: ``role``: ``viewer``, ``editor`` or ``admin`` (``team_member`` / ``team_admin`` still work). ``owner`` is 400: only the ownership transfer changes the Owner. The owner can't be demoted and the last admin can't step down (``change_membership``).

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes
member_idpathstringyes

DELETE/api/teams/{team_id}/members/{member_id}

Remove a member.

team_admin removes anyone; a member may remove self (leave). Guards the last admin.

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes
member_idpathstringyes

GET/api/teams/{team_id}/outside

What the team takes outside: its items shared with other teams, and its agents with outside access.

Every member reads it (404 to anyone else): ``outside_policy``, ``can_set_outside_policy``, ``shares`` (see :func:`outside_share_rows`; ``can_revoke`` per the reader) and ``published`` (``{agent_id, name, outside_access}``, the agent page's block, read-only here).

Token scope: teams:read

ParameterInTypeRequiredDescription
team_idpathstringyes

PUT/api/teams/{team_id}/outside_policy

Change who may take the team's items outside: ``admins``, ``editors`` or ``locked``.

Admins and the Owner while it isn't locked; once locked only the Owner (403 ``policy_owner_only`` for an Admin), and an instance admin gets no way in (404 outside the team; ownership is transferred instead). The team row is locked for the change. A change is audited as ``team.outside_policy_changed``; the same policy again answers ``changed: false``.

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes

POST/api/teams/{team_id}/transfer_owner

Transfer team ownership.

Owner-only (global admin overrides). The new owner must already be a member; they are promoted to team_admin.

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes

GET/api/teams/{team_id}/usage

What the team workspace spent this period (``?period=previous`` for the one before)

The team's Owner and Admins only: 403 ``workspace_role_required`` below Admin, 404 outside the team. Lists hold at most 200 rows, by cost then tokens. See :func:`team_usage_body` for the shape.

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes

Tools

Tool management operations.

GET/api/artifact/{artifact_id}

Get artifact data by artifact ID. Returns all todos for the tool when fetching a todo artifact.

Not available to personal access tokens

ParameterInTypeRequiredDescription
artifact_idpathstringyes

GET/api/available_tools

Get the tools the caller can add in the current workspace. A team workspace leaves out what a team can't hold (connected services and the paired-device tool). The response echoes ``workspace`` ({kind, team_id, role}).

Token scope: tools:read

POST/api/create_tool

Create a new tool.

Token scope: tools:write

JSON body (CreateToolModel):

FieldTypeRequiredDescription
configobjectyesConfiguration of the tool.
customNamestringnoCustom name for the tool.
descriptionstringyesTool description.
displayNamestringyesDisplay name for the tool.
folder_idstringnoA folder of the workspace's tree to file the new tool in.
namestringyesName of the tool.
statusbooleanyesStatus of the tool.

POST/api/delete_tool

Delete a tool by ID.

Token scope: tools:write

JSON body (DeleteToolModel):

FieldTypeRequiredDescription
idstringyesTool ID.

GET/api/get_tools

Get the tools of the workspace the request names (header X-DocsGPT-Workspace, default Personal): in a team, the team's tools with the caller's team role, then those other teams share with it (origin team_shared, shared_from {team_id, name}, the receiver's actions); in Personal, the caller's own and those shared with them, never a team's. Each row carries workspace, created_by {user_id, label}, access, allowed_actions, team_role, origin and its filing in the workspace's folder tree (folder_id, folder_path [{id, name}] from the top-level folder down; built-in tools have none); the response echoes workspace {kind, team_id, role}.

Token scope: tools:read

GET/api/mcp_server/auth_status

Batch check auth status for all MCP tools. Lightweight DB-only check โ€” no network calls to MCP servers.

Not available to personal access tokens

GET/api/mcp_server/callback

Handle OAuth callback by providing the authorization code and state.

Not available to personal access tokens

JSON body (MCPServerCallbackModel):

FieldTypeRequiredDescription
codestringyesAuthorization code.
errorstringnoError message (if any)
statestringyesState parameter.

POST/api/mcp_server/oauth_cancel

Cancel an MCP OAuth sign-in the caller started, so the worker stops waiting for its callback.

Token scope: tools:write

JSON body (MCPOAuthCancelModel):

FieldTypeRequiredDescription
task_idstringyesOAuth task to cancel.

POST/api/mcp_server/save

Create or update MCP server with automatic tool discovery. While Admin > Guardrails warns on tool descriptions, each discovered action is scored for prompt injection and stored with `injection: {p, scorer}`; the response's `injection` is `{flagged: [names], unscored: [names]}` (null while the warnings are off). Nothing is deactivated. The response's `connection_id` is the connection the server runs on. With owner=team, the tool is the team's, on the team connection the caller's finished sign-in wrote; signing in again updates that tool.

Token scope: tools:write

JSON body (MCPServerSaveModel):

FieldTypeRequiredDescription
configobjectyesMCP server configuration.
connection_idstringnoWith owner=team: the team's connection that was reconnected.
displayNamestringyesDisplay name for the MCP server.
folder_idstringnoFolder to file the server in: the workspace's tree for a new server, the tool's own tree for an existing one; null unfiles an existing server.
idstringnoTool ID for updates (optional)
ownerstringnoteam: save a sign-in server on the team's connection the caller just signed in to (config.oauth_task_id from /mcp_server/test with owner=team; Admins)
statusbooleannoTool status. Default: true.

POST/api/mcp_server/test

Test MCP server connection with provided configuration. With owner=team on a sign-in server (Admins of the header's team), always starts a fresh sign-in for the team: {requires_oauth, task_id}; 409 account_already_connected {connection_id} when the team is already signed in to that server (reconnect it with connection_id instead).

Token scope: tools:write

JSON body (MCPServerTestModel):

FieldTypeRequiredDescription
configobjectyesMCP server configuration to test.
connection_idstringnoWith owner=team: the team's connection to this server to reconnect.
idstringnoStored tool to test with (empty secrets reuse its stored ones)
ownerstringnoteam: sign in to a new sign-in server for the team the workspace header names (Admins); the sign-in's events, cancel and status are the caller's.

POST/api/parse_spec

Parse an API specification (OpenAPI 3.x or Swagger 2.0) and return actions.

Token scope: tools:write

POST/api/tools/member

Add a team tool that runs on each person's own account for a service (member mode). Editor and up in the team the workspace header names. No secret is stored: each run uses the caller's own connection. An MCP service's actions are read with the creator's own connection (409 connect_personal_first without one). 409 member_mode_not_allowed when an admin makes every tool of that service run on its owner's account. A custom sign-in MCP server (connector_key custom_mcp with server_url) is read with the creator's own sign-in to that server.

Token scope: tools:write

JSON body (CreateMemberToolModel):

FieldTypeRequiredDescription
connector_keystringyesThe service each person signs in to (a catalog key)
displayNamestringnoFor custom_mcp: the tool's name.
folder_idstringnoA folder of the team's tree to file the new tool in.
permissionsobjectnoPer-action permission overrides: {action: always|ask|off}.
server_urlstringnoFor custom_mcp: the sign-in MCP server each person signs in to (a preset's server counts as that preset)
statusbooleannoSwitch it into the creator's own chats (default true)
transport_typestringnoFor custom_mcp: auto (default), http or sse.

POST/api/update_tool

Update a tool's names, actions, config or chat switch.

Update a tool by ID The tool type (``name``) never changes. ``actions`` are checked against the stored ones like ``/api/update_tool_actions``: nothing is added and fixed values are the owner's. A connection-backed MCP server is moved only through ``/api/mcp_server/save``. Returns: ``{"success": true}``, or 400 / 403 / 404 with a message.

Token scope: tools:write

JSON body (UpdateToolModel):

FieldTypeRequiredDescription
actionsarray of objectnoActions the tool can perform.
configobjectnoConfiguration of the tool.
customNamestringnoCustom name for the tool.
descriptionstringnoTool description.
displayNamestringnoDisplay name for the tool.
folder_idstringnoFile the tool in this folder of its workspace's tree; null takes it out.
idstringyesTool ID.
namestringnoName of the tool.
statusbooleannoStatus of the tool.

POST/api/update_tool_actions

Update the actions of a tool.

Token scope: tools:write

JSON body (UpdateToolActionsModel):

FieldTypeRequiredDescription
actionsarray of objectyesActions the tool can perform.
idstringyesTool ID.

POST/api/update_tool_config

Replace a tool's config, keeping stored secrets the client left out.

Update the configuration of a tool A connection-backed tool's new key goes to its connection (the owner's to change) and its server cannot be moved here; an api_tool's fixed values are the owner's. Returns: ``{"success": true}``, or 400 / 403 / 404 with a message.

Token scope: tools:write

JSON body (UpdateToolConfigModel):

FieldTypeRequiredDescription
configobjectyesConfiguration of the tool.
idstringyesTool ID.

POST/api/update_tool_status

Update the status of a tool.

Token scope: tools:write

JSON body (UpdateToolStatusModel):

FieldTypeRequiredDescription
idstringyesTool ID.
statusbooleanyesStatus of the tool.

Workflows

POST/api/workflows

Create a new workflow with nodes and edges.

Token scope: workflows:write

GET/api/workflows/{workflow_id}

Get workflow details with nodes and edges.

Token scope: workflows:read

ParameterInTypeRequiredDescription
workflow_idpathstringyes

PUT/api/workflows/{workflow_id}

Update workflow and replace nodes/edges.

Token scope: workflows:write

ParameterInTypeRequiredDescription
workflow_idpathstringyes

DELETE/api/workflows/{workflow_id}

Delete workflow and its graph.

Token scope: workflows:write

ParameterInTypeRequiredDescription
workflow_idpathstringyes

Workflow runs

Workflow run results.

GET/api/workflow_runs

List the workflow runs you started, newest first.

Token scope: runs:read

ParameterInTypeRequiredDescription
agent_idquerystringnoOnly runs of this agent.
sincequerystringnoOnly runs started at or after this ISO 8601 moment.
statusquerystringnoOnly runs in this status: pending, running, completed or failed.
limitquerystringnoMost runs to return, 1 to 100 (default 20)

GET/api/workflow_runs/{run_id}

One workflow run you started: status and timing, plus its steps, final state and produced files on request.

Token scope: runs:read

ParameterInTypeRequiredDescription
run_idpathstringyes
includequerystringnoComma-separated extras: steps, state, artifacts.
state_keyquerystringnoReturn only this key of the final state, in full.

GET/api/workflow_runs/{run_id}/steps/{step_index}

One step of a workflow run you started, with its full output and state changes: what a summarized workflow_step stream event (its step_index) left out.

Token scope: runs:read

ParameterInTypeRequiredDescription
run_idpathstringyes
step_indexpathintegeryes

Workspaces

Workspaces and moving items between them.

POST/api/workspace_moves

Apply a planned move in one transaction. Answers 409 move_plan_changed with the fresh plan when the fingerprint no longer matches, 409 move_would_borrow naming the agents with outside access that would use a moved item (and counting those the caller can't open), 403 move_needs_admin when a moving agent has outside access and the caller isn't a team Admin, and 409 credentials_unreadable naming a tool whose saved secret can't be re-sealed.

Not available to personal access tokens

JSON body (WorkspaceMove):

FieldTypeRequiredDescription
fingerprintstringnoThe plan's fingerprint (apply only)
itemsobjectyes[{type: agent|source|tool|prompt|folder, id}].
toobjectyes{workspace: "personal" | team id, folder_id?}.

POST/api/workspace_moves/plan

Plan a move to a team (the person who owns the items, Editor or above there) or out of one to the caller's Personal (an Admin): what comes along, what can't, who gains or loses access, and the fingerprint to apply it with. Changes nothing.

Not available to personal access tokens

JSON body (WorkspaceMove):

FieldTypeRequiredDescription
fingerprintstringnoThe plan's fingerprint (apply only)
itemsobjectyes[{type: agent|source|tool|prompt|folder, id}].
toobjectyes{workspace: "personal" | team id, folder_id?}.

GET/api/workspaces

Personal and every team the caller is in, with the caller's role in each.

Token scope: teams:read

Connectors

Connector operations.

GET/api/connectors/auth

Get connector OAuth authorization URL. owner=team connects the account for the team the workspace header names (Admins); without it the connection is the caller's own, whatever the header. connection_id signs a connection in again (its owner's, or a team's for its Admins; another Admin than whoever connected it replaces the account with theirs).

Not available to personal access tokens

ParameterInTypeRequiredDescription
providerquerystringnoConnector provider (e.g., google_drive)
ownerquerystringnopersonal (default) or team.
connection_idquerystringnoThe connection to sign in again.

POST/api/connectors/auth/complete

Finish a connector sign-in: the app's callback page posts the provider's code and state. Only whoever started it finishes it; a sign-in for a team needs them still its Admin (403 connection_admin_required, the sign-in is used up) and goes to the team the sign-in named, never the request's workspace. A replacing sign-in into an account the team already has: 409 account_already_connected with connection_id.

Not available to personal access tokens

JSON body (ConnectorAuthCompleteModel):

FieldTypeRequiredDescription
codestringyesThe provider's authorization code.
statestringyesThe state the provider echoed.

GET/api/connectors/callback

Forward the provider's answer to the app page that finishes the sign-in.

OAuth redirect URI for external connectors; forwards to the app's callback page.

Not available to personal access tokens

GET/api/connectors/callback-status

Return HTML page with connector authentication status.

Return HTML page with connector authentication status.

Not available to personal access tokens

POST/api/connectors/disconnect

Disconnect a connector session.

Not available to personal access tokens

JSON body (ConnectorDisconnectModel):

FieldTypeRequiredDescription
providerstringyes
session_tokenstringno

POST/api/connectors/files

List files from a connector provider (supports pagination and search)

Not available to personal access tokens

JSON body (ConnectorFilesModel):

FieldTypeRequiredDescription
connection_idstringno
folder_idstringno
limitintegerno
page_tokenstringno
providerstringyes
search_querystringno
session_tokenstringnoLegacy; use connection_id.

POST/api/connectors/sync

Sync connector source to check for modifications. A 409 with code connection_missing when the source has no connection (it was removed) and none is named, as for a team editor, who can't name one; code reconnect_needed when a team editor's sync finds the source's connection signed out; code connection_paused (with paused_for) for a team's source whose team account is paused. A team's source is synced by its Editors and up, through the team's connection, and bills the caller.

Not available to personal access tokens

JSON body (ConnectorSyncModel):

FieldTypeRequiredDescription
connection_idstringnoConnection to sync with; defaults to the source's own (ignored for team editors, whose sync always uses the source's own connection)
session_tokenstringnoLegacy; use connection_id.
source_idstringyesSource ID to sync.

POST/api/connectors/validate-session

Validate a connection and return the account and a short-lived access token.

Not available to personal access tokens

JSON body (ConnectorValidateSessionModel):

FieldTypeRequiredDescription
connection_idstringno
providerstringyes
session_tokenstringnoLegacy; use connection_id.

Connections

Connectors and connections.

GET/api/connections

The caller's connections with status and linked resource counts; with owner=team, the connections of the team the workspace header names (any member). Each says who owns it, who connected it, why it is paused and what the caller may do (allowed_actions, can_pick).

Not available to personal access tokens

ParameterInTypeRequiredDescription
ownerquerystringnopersonal (default) or team.

POST/api/connections

Create a connection from pasted credentials: {connector_key, credentials, label?, owner?}. Same credentials reuse the same connection. owner=team connects it for the team the workspace header names (Admins); without it the connection is the caller's own, whatever the header.

Not available to personal access tokens

PUT/api/connections/tools/{tool_id}/credential-mode

Whose account a shared connection-backed tool uses: {mode: owner | member}. Owner only; refused when an admin forces a mode for the connector.

Not available to personal access tokens

ParameterInTypeRequiredDescription
tool_idpathstringyes

GET/api/connections/{connection_id}

One connection with the sources it syncs and the tools it provides.

Not available to personal access tokens

ParameterInTypeRequiredDescription
connection_idpathstringyes

PATCH/api/connections/{connection_id}

Name an account: {name}. An empty name clears it. Owner, or a team's Admins.

Not available to personal access tokens

ParameterInTypeRequiredDescription
connection_idpathstringyes

DELETE/api/connections/{connection_id}

Remove a connection: {sources: keep | delete, tools: delete | keep}. Kept sources keep their content and stop syncing. Owner, or a team's Admins.

Not available to personal access tokens

ParameterInTypeRequiredDescription
connection_idpathstringyes

POST/api/connections/{connection_id}/disconnect

Delete a connection's stored credentials; its sources and tools stay. Owner, or a team's Admins.

Not available to personal access tokens

ParameterInTypeRequiredDescription
connection_idpathstringyes

GET/api/connections/{connection_id}/linear

Linear: the teams and projects the connection can see, for the sync picker. Read through Linear's MCP server with the connection's sign-in.

Not available to personal access tokens

ParameterInTypeRequiredDescription
connection_idpathstringyes

POST/api/connections/{connection_id}/picker-token

A short-lived access token for a browser-side file picker; never a refresh token. Owner only; on a team's connection only the Admin who connected it (403 connection_picker_owner_only), and 409 connection_paused while the account is paused.

Not available to personal access tokens

ParameterInTypeRequiredDescription
connection_idpathstringyes

POST/api/connections/{connection_id}/reconnect

OAuth: returns an authorization URL for the same account. API key: accepts {credentials} and replaces the stored ones. On a team's connection (Admins), an Admin other than whoever connected it (or any Admin while it is paused) reconnects with their own account: replace is true, a key must fill every required field and nothing of the old one is kept, the connection keeps its id, sources and tools, and they become who connected it (409 account_already_connected with connection_id when the team already has that account).

Not available to personal access tokens

ParameterInTypeRequiredDescription
connection_idpathstringyes

POST/api/connections/{connection_id}/refresh-tools

MCP: re-scan the server's actions and return what was added and removed.

Not available to personal access tokens

ParameterInTypeRequiredDescription
connection_idpathstringyes

GET/api/connections/{connection_id}/repositories

GitHub: the repositories the connection can read, for the sync picker. install_url is where a GitHub App sign-in chooses more repositories.

Not available to personal access tokens

ParameterInTypeRequiredDescription
connection_idpathstringyes

POST/api/connections/{connection_id}/setup

Apply the connect wizard's choices: {create_tools, allow_writes?, tool_permissions?, sync?: {items, frequency, name?, config?, folder_id?}}. allow_writes points GitHub's tool at its write endpoint. config is the synced source's retrieval settings, validated like an upload's; folder_id files the new source in one of the owner's source folders (404 folder_not_found). Honours an Idempotency-Key header for the sync. On a team's connection: Admins; the sync only by the Admin who connected it (403 connection_picker_owner_only); 409 connection_paused while the account is paused. The source and tools are the team's.

Not available to personal access tokens

ParameterInTypeRequiredDescription
connection_idpathstringyes

PUT/api/connections/{connection_id}/tools/{tool_id}/parameters

Fix or release an action's parameters: {action, parameters: {name: value | null}}. A value is sent on every call and hidden from the model; null lets the model decide. Owner, or a team's Admins.

Not available to personal access tokens

ParameterInTypeRequiredDescription
connection_idpathstringyes
tool_idpathstringyes

PUT/api/connections/{connection_id}/tools/{tool_id}/permissions

Set per-action permissions: {permissions: {action: always | ask | off}}.

Not available to personal access tokens

ParameterInTypeRequiredDescription
connection_idpathstringyes
tool_idpathstringyes

PUT/api/connections/{connection_id}/writes

GitHub: let agents make changes through this connection, or only read: {allow}. Re-reads the tool's actions from the matching endpoint. Owner, or a team's Admins.

Not available to personal access tokens

ParameterInTypeRequiredDescription
connection_idpathstringyes

GET/api/connectors/catalog

Every connector with its availability and the caller's connection summary; with owner=team, the summary of the connections of the team the workspace header names (any member)

Not available to personal access tokens

ParameterInTypeRequiredDescription
ownerquerystringnopersonal (default) or team.

Admin

Admin-only management endpoints.

GET/api/admin/activity

Merged audit feed, newest first, with filters and a total.

Not available to personal access tokens

GET/api/admin/activity/events

Distinct ``(event, category)`` pairs this instance has recorded.

The filter UI offers these instead of a free-text box, so an operator never has to guess that denied logins are ``oidc_login_denied``.

Not available to personal access tokens

GET/api/admin/activity/export

Stream the filtered feed as CSV or NDJSON.

Streamed, not buffered: a compliance export of a busy instance should not be built in memory first. Capped at ``_EXPORT_MAX_ROWS``, and the ``X-Export-Max-Rows`` header reports the cap that was in effect so a truncated export is not mistaken for a complete one.

Not available to personal access tokens

GET/api/admin/admins

List all admins with earliest grant time + grant sources.

Not available to personal access tokens

GET/api/admin/audit

Global auth-events feed, newest first.

Filter by event/user/since.

Not available to personal access tokens

GET/api/admin/connectors

Every connector with its policy, setup state and connection count.

Not available to personal access tokens

PUT/api/admin/connectors

Update policies: {policies: {key: {enabled?, credential_mode?, allow_writes?}}, allow_custom_mcp?}.

Not available to personal access tokens

GET/api/admin/decisions

The decision model as this API process sees it.

Not available to personal access tokens

GET/api/admin/defaults/agents

The guardrails new agents start with, and what the injection model costs on this server.

Not available to personal access tokens

PUT/api/admin/defaults/agents

Store the body's `guardrails` object as the default for new agents; existing agents keep their own.

Not available to personal access tokens

GET/api/admin/defaults/models

The instance task model, what runs when it is unset (TASK_MODEL_ID or the default), the built-ins.

`task_model_id` is null when none is stored or the stored one can't run; `task_model_unavailable` is then true for the latter, and a PUT with null clears it. `task_model_error` is {model_id, code, at} when the model that runs for members without a choice failed a draft because its provider refused the key (code model_auth), else null; a draft that works on it, or any PUT, clears it.

Not available to personal access tokens

PUT/api/admin/defaults/models

Store the body's `task_model_id` (a built-in model id, or null to clear) as the instance task model.

Not available to personal access tokens

GET/api/admin/defaults/sources

The default retrieval settings for new sources, and what relevance costs on this server.

Not available to personal access tokens

PUT/api/admin/defaults/sources

Store the body's `retrieval` object as the default for new sources; existing sources keep their own.

Not available to personal access tokens

GET/api/admin/devices/audit

Global remote-device command audit feed.

Filter by decision/user/since.

Not available to personal access tokens

GET/api/admin/guardrails

The floor every agent follows, whether MCP tool descriptions are scored, and the injection model's cost.

Not available to personal access tokens

PUT/api/admin/guardrails

Store the body's `floor` (an agent guardrails object, or null for none) and/or `mcp_description_warnings`.

Not available to personal access tokens

GET/api/admin/overview

Top-line KPIs for the dashboard home.

Not available to personal access tokens

GET/api/admin/quotas

Every stored policy, grouped by layer, plus the models cost limits cannot see.

Query args (all optional; without them every row is returned): teams_q: Case-insensitive substring of the team name or slug. users_q: Case-insensitive substring of the user's subject id or email. teams_page / users_page: 1-based page of that list; only a list whose page arg is given is paginated. page_size: Teams or users per page, clamped to 1-100 (default 20); a page carries every bucket row of each of them. ``teams_total`` and ``users_total`` count the teams and users after filtering and before paging. Rows keep the repository order (subject, then bucket).

Not available to personal access tokens

PUT/api/admin/quotas/instance

Set the instance default for one bucket.

Not available to personal access tokens

DELETE/api/admin/quotas/instance

Remove the instance default for ``?bucket=``, or for every bucket.

Not available to personal access tokens

GET/api/admin/quotas/teams/{team_id}

The per-member allowance of one team.

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes

PUT/api/admin/quotas/teams/{team_id}

Set the allowance each member of the team gets.

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes

DELETE/api/admin/quotas/teams/{team_id}

Remove the team's allowance for ``?bucket=``, or for every bucket.

Not available to personal access tokens

ParameterInTypeRequiredDescription
team_idpathstringyes

GET/api/admin/quotas/users/{user_id}

A user's overrides and the limits and usage they resolve to.

409 for a team or the system.

Not available to personal access tokens

ParameterInTypeRequiredDescription
user_idpathstringyes

PUT/api/admin/quotas/users/{user_id}

Set one user's override, which beats team allowances and the default.

409 for a team or the system.

Not available to personal access tokens

ParameterInTypeRequiredDescription
user_idpathstringyes

DELETE/api/admin/quotas/users/{user_id}

Remove the user's override for ``?bucket=``, or for every bucket.

Not available to personal access tokens

ParameterInTypeRequiredDescription
user_idpathstringyes

GET/api/admin/usage

Global usage: time-bucketed series, totals, spend, latency, top users.

Every bucket carries both tokens and USD cost. Quota policies have always been settable in dollars; until now nothing showed the spend they were capping.

Not available to personal access tokens

GET/api/admin/users

List users, paginated, most-recently-seen first.

Each row carries ``last_seen`` (max auth-event time) and the stored ``email`` (null when none is on file); ``?user_id=`` matches either. Admin status is intentionally not joined here; the dashboard cross-references GET /api/admin/admins for badges.

Not available to personal access tokens

GET/api/admin/users/{user_id}

Per-user drill-down: profile, roles, recent auth events, counts.

A team principal is shown, not hidden, labelled with its team, so the counts of what the team owns stay reachable.

Not available to personal access tokens

ParameterInTypeRequiredDescription
user_idpathstringyes

PATCH/api/admin/users/{user_id}

Activate/deactivate a user.

Deactivation also revokes live sessions.

Not available to personal access tokens

ParameterInTypeRequiredDescription
user_idpathstringyes

POST/api/admin/users/{user_id}/revoke-sessions

Force-logout: revoke the user's live OIDC sessions (best-effort)

409 for a team or the system.

Not available to personal access tokens

ParameterInTypeRequiredDescription
user_idpathstringyes

POST/api/admin/users/{user_id}/role

Grant the admin role to ``user_id`` (manual source)

Idempotent. 409 for a team or the system.

Not available to personal access tokens

ParameterInTypeRequiredDescription
user_idpathstringyes

DELETE/api/admin/users/{user_id}/role

Revoke the manual admin grant.

Refuses to remove the last admin.

Not available to personal access tokens

ParameterInTypeRequiredDescription
user_idpathstringyes

GET/api/admin/users/{user_id}/usage

One user's spend: daily series plus a split by model and by flow.

Not available to personal access tokens

ParameterInTypeRequiredDescription
user_idpathstringyes

Personal access tokens

Personal access tokens.

DELETE/api/admin/tokens/{token_id}

Revoke any user's token.

Not available to personal access tokens

ParameterInTypeRequiredDescription
token_idpathstringyes

GET/api/admin/users/{user_id}/tokens

List a user's tokens, revoked ones included.

A team principal has none, so it is not found.

Not available to personal access tokens

ParameterInTypeRequiredDescription
user_idpathstringyes

GET/api/user/tokens

List the caller's tokens with the scope catalog and the server's token policy.

Not available to personal access tokens

POST/api/user/tokens

Create a token.

The plaintext ``token`` is returned here and never again.

Not available to personal access tokens

DELETE/api/user/tokens/{token_id}

Revoke one of the caller's tokens.

Takes effect on the next request.

Not available to personal access tokens

ParameterInTypeRequiredDescription
token_idpathstringyes

POST/api/user/tokens/{token_id}/regenerate

Issue a new secret for a token and reset its expiry.

Name, scopes and restrictions stay; the old secret stops working at once. ``expires_in_days`` is optional and defaults to the lifetime the token was last issued with. An expired token can be renewed this way; a revoked one cannot. The plaintext ``token`` is returned here and never again.

Not available to personal access tokens

ParameterInTypeRequiredDescription
token_idpathstringyes

POST/api/user/tokens/{token_id}/tool

Create an API tool that lets agents work in this account with the token.

The body carries the token's plaintext ``token``, which only the caller holds (it was just shown to them), and ``base_url``, where the API is reached. The tool gets an action for each endpoint the token may call (see ``docsgpt.api.pat.agent_tool``), with the token sealed as their ``Authorization`` header. Deletes, and asking another agent, start switched off; the response names them in ``inactive``.

Not available to personal access tokens

ParameterInTypeRequiredDescription
token_idpathstringyes
Edit this page on GitHub

Last updated on