Do one thing to many messages

POST/api/v1/mailbox/messages/bulk
Requires amailbox token— it acts as one mailbox holder, not as the organization.

Applies one action to up to 500 messages: mark_read, mark_unread, star, unstar, move (needs folder), trash, delete (only messages already in Trash) or labels (needs add or remove). Each message succeeds or fails on its own; results says which, in the order you sent them, with new_id for messages that moved.

Errors

Status When
401 No token, or the session expired or was signed out. Sign in again with POST /mailbox-auth/login.
403 The account has a temporary password: until POST /security/password succeeds, every other call answers this with error_code: password_change_required.
422 move needs a folder, labels needs add or remove, or more than 500 ids.
404 A message or the target folder was not found.

Request body

  • idsarray<string>required

    Message ids (INBOX:4821), 1 to 500.

  • actionstringrequiredmark_read | mark_unread | star | unstar | move | trash | delete | labels

    What to do to every message.

  • folderstring or null

    For move: the folder to move them to.

  • addarray<string>

    For labels: labels to add, up to 20.

  • removearray<string>

    For labels: labels to remove, up to 20.

Request

POST/api/v1/mailbox/messages/bulk
curl -X POST 'https://courier.mailyte.com/api/v1/mailbox/messages/bulk' \
  -H 'Authorization: Bearer MAILBOX_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "ids": [
      "INBOX:4821",
      "INBOX:4820"
    ],
    "action": "move",
    "folder": "Clients"
  }'

Response

Successful Response

  • dataobject
    • resultsarray<object>
      • idstring
      • okboolean
      • new_idstring or null

        The new id after a move or trash.

      • error_codestring or null
      • messagestring or null
    • succeededinteger
    • failedinteger
200application/json
{
  "type": "success",
  "msg": "2 of 2 messages moved",
  "data": {
    "results": [
      {
        "id": "INBOX:4821",
        "ok": true,
        "new_id": "Clients:89"
      },
      {
        "id": "INBOX:4820",
        "ok": true,
        "new_id": "Clients:90"
      }
    ],
    "succeeded": 2,
    "failed": 0
  }
}

Returned inside the standard envelope.

Errors

StatusWhen
401No token, or the session expired or was signed out. Sign in again with `POST /mailbox-auth/login`.
403The account has a temporary password: until `POST /security/password` succeeds, every other call answers this with `error_code: password_change_required`.
404A message or the target folder was not found.
422`move needs a folder`, `labels needs add or remove`, or more than 500 ids.

Every status, with what causes it and what to do, is on the error reference.