Do one thing to many messages
POST
/api/v1/mailbox/messages/bulkApplies 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>requiredMessage ids (
INBOX:4821), 1 to 500.actionstringrequiredmark_read | mark_unread | star | unstar | move | trash | delete | labelsWhat to do to every message.
folderstring or nullFor
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/bulkcurl -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"
}'const response = await fetch('https://courier.mailyte.com/api/v1/mailbox/messages/bulk', {
method: 'POST',
headers: {
Authorization: 'Bearer MAILBOX_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"ids": [
"INBOX:4821",
"INBOX:4820"
],
"action": "move",
"folder": "Clients"
}),
});
const { data } = await response.json();import requests
response = requests.post(
"https://courier.mailyte.com/api/v1/mailbox/messages/bulk",
headers={"Authorization": "Bearer MAILBOX_TOKEN"},
json={
"ids": [
"INBOX:4821",
"INBOX:4820"
],
"action": "move",
"folder": "Clients"
},
)
data = response.json()["data"]<?php
$response = Http::withToken('MAILBOX_TOKEN')
->post('https://courier.mailyte.com/api/v1/mailbox/messages/bulk', [
'ids' => [
'INBOX:4821',
'INBOX:4820',
],
'action' => 'move',
'folder' => 'Clients',
]);
$data = $response->json('data');require "net/http"
require "json"
uri = URI("https://courier.mailyte.com/api/v1/mailbox/messages/bulk")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer MAILBOX_TOKEN"
request["Content-Type"] = "application/json"
request.body = {
"ids": [
"INBOX:4821",
"INBOX:4820"
],
"action": "move",
"folder": "Clients"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }Response
Successful Response
dataobjectresultsarray<object>idstringokbooleannew_idstring or nullThe new id after a move or trash.
error_codestring or nullmessagestring or null
succeededintegerfailedinteger
200
application/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
| 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`. |
404 | A 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.