# Folders

## Get User Personal Folder

> Get the user's personal folder if it exists.

```json
{"openapi":"3.1.0","info":{"title":"StackAI API","version":"0.1.0"},"servers":[{"url":"https://api.stack-ai.com","description":"StackAI API Server"}],"security":[{"OAuth2PasswordBearer":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}}}},"schemas":{"Folder":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"name":{"type":"string","maxLength":128,"title":"Name","description":"The name of the folder, it is used like a path"},"access":{"items":{"type":"string"},"type":"array","title":"Access","description":"DEPRECATED. A list containing emails and group ids that have access to the folder","deprecated":true},"user_id_access_list":{"items":{"type":"string","format":"uuid"},"type":"array","title":"User Id Access List","description":"A list containing user ids that have access to the folder","default":[]},"group_id_access_list":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Group Id Access List","description":"A list containing group ids that have access to the folder","default":[]},"personal_folder_owner_id":{"anyOf":[{"type":"string","format":"uuid","description":"The id of the user that owns this folder as their unique personal folder"},{"type":"null"}],"title":"Personal Folder Owner Id"}},"type":"object","required":["name","access"],"title":"Folder"}}},"paths":{"/folders/me":{"get":{"tags":["folders"],"summary":"Get User Personal Folder","description":"Get the user's personal folder if it exists.","operationId":"get_user_personal_folder_folders_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Folder"},{"type":"null"}],"title":"Response Get User Personal Folder Folders Me Get"}}}}}}}}}
```

## GET /folders/{folder\_id}

> Get Folder

```json
{"openapi":"3.1.0","info":{"title":"StackAI API","version":"0.1.0"},"servers":[{"url":"https://api.stack-ai.com","description":"StackAI API Server"}],"security":[{"OAuth2PasswordBearer":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}}}},"schemas":{"Folder":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"name":{"type":"string","maxLength":128,"title":"Name","description":"The name of the folder, it is used like a path"},"access":{"items":{"type":"string"},"type":"array","title":"Access","description":"DEPRECATED. A list containing emails and group ids that have access to the folder","deprecated":true},"user_id_access_list":{"items":{"type":"string","format":"uuid"},"type":"array","title":"User Id Access List","description":"A list containing user ids that have access to the folder","default":[]},"group_id_access_list":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Group Id Access List","description":"A list containing group ids that have access to the folder","default":[]},"personal_folder_owner_id":{"anyOf":[{"type":"string","format":"uuid","description":"The id of the user that owns this folder as their unique personal folder"},{"type":"null"}],"title":"Personal Folder Owner Id"}},"type":"object","required":["name","access"],"title":"Folder"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/folders/{folder_id}":{"get":{"tags":["folders"],"summary":"Get Folder","operationId":"get_folder_folders__folder_id__get","parameters":[{"name":"folder_id","in":"path","required":true,"schema":{"type":"string","title":"Folder Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Folder"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Delete Folder

> Delete a folder in the current organization.

```json
{"openapi":"3.1.0","info":{"title":"StackAI API","version":"0.1.0"},"servers":[{"url":"https://api.stack-ai.com","description":"StackAI API Server"}],"security":[{"OAuth2PasswordBearer":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}}}},"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/folders/{folder_id}":{"delete":{"tags":["folders"],"summary":"Delete Folder","description":"Delete a folder in the current organization.","operationId":"delete_folder_folders__folder_id__delete","parameters":[{"name":"folder_id","in":"path","required":true,"schema":{"type":"string","title":"Folder Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Patch Folder

> Update a folder in the current organization.

```json
{"openapi":"3.1.0","info":{"title":"StackAI API","version":"0.1.0"},"servers":[{"url":"https://api.stack-ai.com","description":"StackAI API Server"}],"security":[{"OAuth2PasswordBearer":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}}}},"schemas":{"FolderUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":128,"description":"The name of the folder, it is used like a path"},{"type":"null"}],"title":"Name"},"access":{"anyOf":[{"items":{"type":"string"},"type":"array","description":"DEPRECATED. A list containing emails and group ids that have access to the folder","deprecated":true},{"type":"null"}],"title":"Access"},"user_id_access_list":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array","description":"A list containing user ids that have access to the folder"},{"type":"null"}],"title":"User Id Access List"},"group_id_access_list":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array","description":"A list containing group ids that have access to the folder"},{"type":"null"}],"title":"Group Id Access List"}},"type":"object","title":"FolderUpdate"},"Folder":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"name":{"type":"string","maxLength":128,"title":"Name","description":"The name of the folder, it is used like a path"},"access":{"items":{"type":"string"},"type":"array","title":"Access","description":"DEPRECATED. A list containing emails and group ids that have access to the folder","deprecated":true},"user_id_access_list":{"items":{"type":"string","format":"uuid"},"type":"array","title":"User Id Access List","description":"A list containing user ids that have access to the folder","default":[]},"group_id_access_list":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Group Id Access List","description":"A list containing group ids that have access to the folder","default":[]},"personal_folder_owner_id":{"anyOf":[{"type":"string","format":"uuid","description":"The id of the user that owns this folder as their unique personal folder"},{"type":"null"}],"title":"Personal Folder Owner Id"}},"type":"object","required":["name","access"],"title":"Folder"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/folders/{folder_id}":{"patch":{"tags":["folders"],"summary":"Patch Folder","description":"Update a folder in the current organization.","operationId":"patch_folder_folders__folder_id__patch","parameters":[{"name":"folder_id","in":"path","required":true,"schema":{"type":"string","title":"Folder Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FolderUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Folder"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Query Folders

> Get all folders for the current user organization.\
> \
> Args:\
> &#x20;   offset (int): The offset of the folders to return as a number of rows. Defaults to 0.\
> &#x20;   limit (int): The limit of the folders to return as a number of rows. Defaults to 100.\
> &#x20;   query (str): The search query to filter folders by name. If provided, only folders whose names contain the query\
> &#x20;       string will be returned.

```json
{"openapi":"3.1.0","info":{"title":"StackAI API","version":"0.1.0"},"servers":[{"url":"https://api.stack-ai.com","description":"StackAI API Server"}],"security":[{"OAuth2PasswordBearer":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}}}},"schemas":{"FolderQuery":{"properties":{"offset":{"type":"integer","title":"Offset","default":0},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit","default":100},"query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query"},"include_public_folders":{"type":"boolean","title":"Include Public Folders","default":true},"include_private_folders":{"type":"boolean","title":"Include Private Folders","default":true},"include_personal_folders":{"type":"boolean","title":"Include Personal Folders","default":false},"include_empty_folders":{"type":"boolean","title":"Include Empty Folders","default":false}},"type":"object","title":"FolderQuery","description":"Query parameters for folder retrieval.\n\nArgs:\n    offset (int): The offset of the folders to return as a number of rows. Defaults to 0.\n    limit (int): The limit of the folders to return as a number of rows. Defaults to 100.\n    query (str): The search query to filter folders by name. If provided, only folders whose names contain the query\n        string will be returned.\n    include_public_folders (bool): Whether to include public folders in the results. Defaults to True.\n    include_personal_folders (bool): Whether to include personal folders in the results. Defaults to False.\n    include_empty_folders (bool): Whether to include empty folders in the results. Defaults to False."},"Folder":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"name":{"type":"string","maxLength":128,"title":"Name","description":"The name of the folder, it is used like a path"},"access":{"items":{"type":"string"},"type":"array","title":"Access","description":"DEPRECATED. A list containing emails and group ids that have access to the folder","deprecated":true},"user_id_access_list":{"items":{"type":"string","format":"uuid"},"type":"array","title":"User Id Access List","description":"A list containing user ids that have access to the folder","default":[]},"group_id_access_list":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Group Id Access List","description":"A list containing group ids that have access to the folder","default":[]},"personal_folder_owner_id":{"anyOf":[{"type":"string","format":"uuid","description":"The id of the user that owns this folder as their unique personal folder"},{"type":"null"}],"title":"Personal Folder Owner Id"}},"type":"object","required":["name","access"],"title":"Folder"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/folders":{"post":{"tags":["folders"],"summary":"Query Folders","description":"Get all folders for the current user organization.\n\nArgs:\n    offset (int): The offset of the folders to return as a number of rows. Defaults to 0.\n    limit (int): The limit of the folders to return as a number of rows. Defaults to 100.\n    query (str): The search query to filter folders by name. If provided, only folders whose names contain the query\n        string will be returned.","operationId":"query_folders_folders_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FolderQuery"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Folder"},"type":"array","title":"Response Query Folders Folders Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Create Folder

> Create a new folder in the current organization.

```json
{"openapi":"3.1.0","info":{"title":"StackAI API","version":"0.1.0"},"servers":[{"url":"https://api.stack-ai.com","description":"StackAI API Server"}],"security":[{"OAuth2PasswordBearer":[]}],"components":{"securitySchemes":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}}}},"schemas":{"CreateFolderRequest":{"properties":{"name":{"type":"string","title":"Name"},"access":{"items":{"type":"string"},"type":"array","title":"Access","description":"DEPRECATED field, kept for backward compatibility","deprecated":true},"user_id_access_list":{"items":{"type":"string","format":"uuid"},"type":"array","title":"User Id Access List","description":"User ids of users who have access to the folder"},"group_id_access_list":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Group Id Access List","description":"Group ids of users who have access to the folder"}},"type":"object","required":["name"],"title":"CreateFolderRequest"},"Folder":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"name":{"type":"string","maxLength":128,"title":"Name","description":"The name of the folder, it is used like a path"},"access":{"items":{"type":"string"},"type":"array","title":"Access","description":"DEPRECATED. A list containing emails and group ids that have access to the folder","deprecated":true},"user_id_access_list":{"items":{"type":"string","format":"uuid"},"type":"array","title":"User Id Access List","description":"A list containing user ids that have access to the folder","default":[]},"group_id_access_list":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Group Id Access List","description":"A list containing group ids that have access to the folder","default":[]},"personal_folder_owner_id":{"anyOf":[{"type":"string","format":"uuid","description":"The id of the user that owns this folder as their unique personal folder"},{"type":"null"}],"title":"Personal Folder Owner Id"}},"type":"object","required":["name","access"],"title":"Folder"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/folders":{"put":{"tags":["folders"],"summary":"Create Folder","description":"Create a new folder in the current organization.","operationId":"create_folder_folders_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFolderRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Folder"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```
