Bulk add suppressions
Add up to 1,000 suppression entries in one wemail API call. Duplicates are skipped, invalid rows are reported per index, and the send-gate applies immediately.
Migrating a list or syncing another system? Send up to 1,000 entries per call instead of one request per address. Bulk adds keep the idempotent semantics of the single endpoint — an entry that already exists counts as added, never as an error — and invalid rows are skipped and reported per-index while the rest of the batch proceeds.
POST /v3/suppressions/{type}/bulk
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
entries | array | Required | 1–1,000 items of { email, reason?, override_unsubscribes? }. Addresses are lowercased; override_unsubscribes applies to allowlist entries only. |
Responses
| Status | Description |
|---|---|
200 | { added, skipped: [{ index, email, reason }] } — skip reasons are invalid_syntax and duplicate_in_batch, with 0-based indexes into your entries array. |
400 | Validation error (empty or >1,000 entries). |
429 | Rate limit exceeded (10 bulk calls/minute). |
Code examples
cURL
curl -X POST https://api.wemail.io/v3/suppressions/bounces/bulk \
-H "Authorization: Bearer afn_live_…" \
-H "Content-Type: application/json" \
-d '{ "entries": [ { "email": "bounce@example.com", "reason": "Hard bounce at previous ESP" }, { "email": "optout@example.com" } ] }'Node.js
import { WemailClient } from "@wemailio/sdk";
const wemail = new WemailClient(process.env.WEMAIL_API_KEY);
const res = await wemail.suppressions.bulkCreateSuppressions({
type: "bounces",
bulkCreateSuppressionsRequest: {
entries: [
{ email: "bounce@example.com", reason: "Hard bounce at previous ESP" },
{ email: "optout@example.com" },
],
},
});
console.log(res.added, res.skipped);Python
import os
from wemail import WemailClient, BulkCreateSuppressionsRequest
wemail = WemailClient(api_key=os.environ["WEMAIL_API_KEY"])
res = wemail.suppressions.bulk_create_suppressions(
"bounces",
BulkCreateSuppressionsRequest.from_dict({"entries": [
{"email": "bounce@example.com", "reason": "Hard bounce at previous ESP"},
{"email": "optout@example.com"},
]}),
)
print(res.added, res.skipped)PHP
<?php
$wemail = new \Wemail\WemailClient(getenv('WEMAIL_API_KEY'));
$res = $wemail->suppressions()->bulkCreateSuppressions('bounces',
new \Wemail\Sdk\Model\BulkCreateSuppressionsRequest(['entries' => [
['email' => 'bounce@example.com', 'reason' => 'Hard bounce at previous ESP'],
['email' => 'optout@example.com'],
]])
);
echo $res->getAdded();Ruby
wemail = Wemail::Client.new(api_key: ENV["WEMAIL_API_KEY"])
res = wemail.suppressions.bulk_create_suppressions("bounces",
Wemail::BulkCreateSuppressionsRequest.new(entries: [
{ email: "bounce@example.com", reason: "Hard bounce at previous ESP" },
{ email: "optout@example.com" }
]))
puts res.addedGo
client, _ := wemail.NewClient(os.Getenv("WEMAIL_API_KEY"))
// Generated layer (client.API.*): pass the key in the context.
ctx := context.WithValue(context.Background(), wemail.ContextAccessToken, os.Getenv("WEMAIL_API_KEY"))
res, _, err := client.API.SuppressionsAPI.BulkCreateSuppressions(ctx, "bounces").
BulkCreateSuppressionsRequest(wemail.BulkCreateSuppressionsRequest{
Entries: []wemail.BulkCreateSuppressionsRequestEntriesInner{
{Email: "bounce@example.com", Reason: wemail.PtrString("Hard bounce at previous ESP")},
{Email: "optout@example.com"},
},
}).Execute()
fmt.Println(res.Added, len(res.Skipped))Java
WemailClient wemail = new WemailClient(System.getenv("WEMAIL_API_KEY"));
BulkSuppressionResult res = wemail.suppressions().bulkCreateSuppressions("bounces",
new BulkCreateSuppressionsRequest().entries(List.of(
new BulkCreateSuppressionsRequestEntriesInner().email("bounce@example.com").reason("Hard bounce at previous ESP"),
new BulkCreateSuppressionsRequestEntriesInner().email("optout@example.com"))));
System.out.println(res.getAdded());.NET
var wemail = new WemailClient(Environment.GetEnvironmentVariable("WEMAIL_API_KEY"));
var res = await wemail.Suppressions.BulkCreateSuppressionsAsync("bounces",
new BulkCreateSuppressionsRequest(new List<BulkCreateSuppressionsRequestEntriesInner> {
new BulkCreateSuppressionsRequestEntriesInner("bounce@example.com", "Hard bounce at previous ESP"),
new BulkCreateSuppressionsRequestEntriesInner("optout@example.com"),
}));
Console.WriteLine(res.Added);