API: Manage Folders

Create, update, and delete email folders programmatically

Create Folder

POST /api/settings/folders

{
  "name": "Projects",
  "parentId": null
}

Response:

{
  "ok": true,
  "data": {
    "id": "folder_123",
    "name": "Projects",
    "parentId": null,
    "createdAt": "2024-01-15T10:00:00Z"
  }
}
Update Folder

PATCH /api/settings/folders/[id]

{
  "name": "Work Projects"
}
Delete Folder

DELETE /api/settings/folders/[id]

Deletes the folder and optionally moves its contents to another folder.

List Folders

GET /api/settings/folders

{
  "ok": true,
  "data": [
    {
      "id": "folder_123",
      "name": "Projects",
      "parentId": null,
      "messageCount": 42
    },
    {
      "id": "folder_456",
      "name": "Archive",
      "parentId": null,
      "messageCount": 150
    }
  ]
}
Error Codes
  • 400 - Invalid folder name or structure
  • 401 - Unauthorized
  • 404 - Folder not found
  • 409 - Folder name already exists