Mailboxes
Replace mailbox spam settings
Set the mailbox’s junk filter level and replace both sender lists (at most 1000 entries each). The allow list wins over the block list. Applies to new mail and reclassifies existing INBOX and Junk messages without a mailbox-specific decision.
PUT
/
api
/
e2
/
mailboxes
/
{id}
/
spam
TypeScript
import Inbound from "inboundemail";
const inbound = new Inbound();
// allow and block replace the existing lists; block: [] clears the block list.
// To add a single entry, use inbound.spam.addAllow() or inbound.spam.addBlock() instead.
const result = await inbound.spam.update("<mailboxId>", {
level: "strict",
allow: [
"@partner.example.com"
],
block: []
});curl -X PUT 'https://inbound.new/api/e2/mailboxes/<mailboxId>/spam' \
-H "Authorization: Bearer $INBOUND_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"level": "strict",
"allow": [
"@partner.example.com"
],
"block": []
}'import requests
url = "https://inbound.new/api/e2/mailboxes/{id}/spam"
payload = {
"level": "off",
"allow": ["<string>"],
"block": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({level: 'off', allow: ['<string>'], block: ['<string>']})
};
fetch('https://inbound.new/api/e2/mailboxes/{id}/spam', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://inbound.new/api/e2/mailboxes/{id}/spam",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'level' => 'off',
'allow' => [
'<string>'
],
'block' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://inbound.new/api/e2/mailboxes/{id}/spam"
payload := strings.NewReader("{\n \"level\": \"off\",\n \"allow\": [\n \"<string>\"\n ],\n \"block\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://inbound.new/api/e2/mailboxes/{id}/spam")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"level\": \"off\",\n \"allow\": [\n \"<string>\"\n ],\n \"block\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://inbound.new/api/e2/mailboxes/{id}/spam")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"level\": \"off\",\n \"allow\": [\n \"<string>\"\n ],\n \"block\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"level": "off",
"effectiveLevel": "off",
"allow": [
"<string>"
],
"block": [
"<string>"
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Your Inbound API key. Include it in the Authorization header as: Bearer
Path Parameters
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
null uses the account's level
Allowed value:
"off"Maximum array length:
1000An exact sender address (alice@example.com) or a whole domain (@example.com). Case-insensitive.
Required string length:
2 - 255Maximum array length:
1000An exact sender address (alice@example.com) or a whole domain (@example.com). Case-insensitive.
Required string length:
2 - 255Response
Response for status 200
The mailbox's junk filter level; null uses the account's level
Allowed value:
"off"Available options:
off, lenient, standard, strict Senders never marked as junk by the junk filter
Senders always marked as junk
Was this page helpful?
⌘I
TypeScript
import Inbound from "inboundemail";
const inbound = new Inbound();
// allow and block replace the existing lists; block: [] clears the block list.
// To add a single entry, use inbound.spam.addAllow() or inbound.spam.addBlock() instead.
const result = await inbound.spam.update("<mailboxId>", {
level: "strict",
allow: [
"@partner.example.com"
],
block: []
});curl -X PUT 'https://inbound.new/api/e2/mailboxes/<mailboxId>/spam' \
-H "Authorization: Bearer $INBOUND_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"level": "strict",
"allow": [
"@partner.example.com"
],
"block": []
}'import requests
url = "https://inbound.new/api/e2/mailboxes/{id}/spam"
payload = {
"level": "off",
"allow": ["<string>"],
"block": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({level: 'off', allow: ['<string>'], block: ['<string>']})
};
fetch('https://inbound.new/api/e2/mailboxes/{id}/spam', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://inbound.new/api/e2/mailboxes/{id}/spam",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'level' => 'off',
'allow' => [
'<string>'
],
'block' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://inbound.new/api/e2/mailboxes/{id}/spam"
payload := strings.NewReader("{\n \"level\": \"off\",\n \"allow\": [\n \"<string>\"\n ],\n \"block\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://inbound.new/api/e2/mailboxes/{id}/spam")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"level\": \"off\",\n \"allow\": [\n \"<string>\"\n ],\n \"block\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://inbound.new/api/e2/mailboxes/{id}/spam")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"level\": \"off\",\n \"allow\": [\n \"<string>\"\n ],\n \"block\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"level": "off",
"effectiveLevel": "off",
"allow": [
"<string>"
],
"block": [
"<string>"
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}