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.
Personal access token scope: agents:read or prompts:read or sources:read or tools:read.
bearerAuthorizationBearer <token>A session token or a personal access token. Leave it empty when the instance runs without authentication (AUTH_TYPE unset).
type?stringagent, source, tool or prompt (optional): the kind item_count counts
Success
curl -X GET 'http://localhost:7091/api/folders'Delete a folder DELETE
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}]}. [Personal access token](/API/personal-access-tokens) scope: `agents:write` or `prompts:write` or `sources:write` or `tools:write`.
POST /api/folders/items POST
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]}. [Personal access token](/API/personal-access-tokens) scope: `agents:write` or `prompts:write` or `sources:write` or `tools:write`.