Skip to Content
Fluxmail

POST /api/v1/accounts/{accountId}/folders/{folderId}/move

Move a folder under another folder, or to the top level of the account. The folder keeps its own name, its messages and its subfolders. Send either `parent` or `topLevel: true`, not both. The destination can't be the folder itself, one of its subfolders, or the trash, and it can't already hold a folder with the same name. In Gmail, where the folder is a label, the labels nested under it move with it. System folders such as Inbox, Sent and Trash can't be moved, and neither can a folder the account settings use as one. Use the folder ID in the response afterwards: in an IMAP mailbox the folder and its subfolders always get new IDs. Message IDs normally stay the same. If one stops working, list the folder again.

Move a folder under another folder, or to the top level of the account. The folder keeps its own name, its messages and its subfolders. Send either parent or topLevel: true, not both. The destination can't be the folder itself, one of its subfolders, or the trash, and it can't already hold a folder with the same name. In Gmail, where the folder is a label, the labels nested under it move with it. System folders such as Inbox, Sent and Trash can't be moved, and neither can a folder the account settings use as one. Use the folder ID in the response afterwards: in an IMAP mailbox the folder and its subfolders always get new IDs. Message IDs normally stay the same. If one stops working, list the folder again.

Authentication

Pass a Fluxmail member session or API key as a bearer token. API keys apply their mailbox scope and permissions to the request.

Request

curl 'http://localhost:8977/api/v1/accounts/acct_123/folders/Receipts/move' \
  -X POST \
  -H "Authorization: Bearer $FLUXMAIL_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{}'

Parameters

NameLocationRequiredTypeDetails
accountIdpathYesstringMinimum length: 1.
folderIdpathYesstringFolder ID from the folder list, or the folder name. URL-encode it, since folder IDs can contain a slash. Minimum length: 1.

Request body

Content type: application/json

{
  "type": "object",
  "properties": {
    "parent": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "description": "ID or name of the folder to move it under. Leave out when topLevel is true."
    },
    "topLevel": {
      "type": "boolean",
      "description": "Set to true to move the folder to the top level of the account. Leave out when parent is given."
    }
  },
  "additionalProperties": false
}

Responses

StatusDescriptionContent type
200The folder as it is listed now, and as it was listed beforeapplication/json
400Invalid requestapplication/json
401Authentication requiredapplication/json
403Permission or plan deniedapplication/json
404Resource not foundapplication/json
409Request conflictapplication/json
422Unsupported capabilityapplication/json
429Provider rate limitapplication/json
500Internal errorapplication/json
503Provider unavailableapplication/json

200 response

{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "folder": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "name"
          ],
          "additionalProperties": false
        },
        "previous": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "id",
            "name"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "folder",
        "previous"
      ],
      "additionalProperties": false
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "data"
  ],
  "additionalProperties": false
}

Last updated