Skip to main content
POST
/
suppression-groups
/
emails
/
suppress
curl --request POST \
  --url 'https://api.autosend.com/v1/suppression-groups/emails/suppress' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "emails": ["[email protected]", "[email protected]"],
    "groupId": "AB12C3",
    "reason": "unsubscribed",
    "isGlobal": false
  }'
import requests

response = requests.post(
    "https://api.autosend.com/v1/suppression-groups/emails/suppress",
    headers={
        "Authorization": "Bearer <token>",
        "Content-Type": "application/json",
    },
    json={
        "emails": ["[email protected]", "[email protected]"],
        "groupId": "AB12C3",
        "reason": "unsubscribed",
        "isGlobal": False,
    },
)
print(response.json())
const response = await fetch(
  "https://api.autosend.com/v1/suppression-groups/emails/suppress",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer <token>",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      emails: ["[email protected]", "[email protected]"],
      groupId: "AB12C3",
      reason: "unsubscribed",
      isGlobal: false,
    }),
  }
);
const data = await response.json();
console.log(data);
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.autosend.com/v1/suppression-groups/emails/suppress");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    "emails"   => ["[email protected]", "[email protected]"],
    "groupId"  => "AB12C3",
    "reason"   => "unsubscribed",
    "isGlobal" => false,
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer <token>",
    "Content-Type: application/json",
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
)

func main() {
    payload, _ := json.Marshal(map[string]interface{}{
        "emails":   []string{"[email protected]", "[email protected]"},
        "groupId":  "AB12C3",
        "reason":   "unsubscribed",
        "isGlobal": false,
    })

    req, _ := http.NewRequest("POST", "https://api.autosend.com/v1/suppression-groups/emails/suppress", bytes.NewBuffer(payload))
    req.Header.Set("Authorization", "Bearer <token>")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
import java.net.URI;
import java.net.http.*;

public class Main {
    public static void main(String[] args) throws Exception {
        String body = """
            {
              "emails": ["[email protected]", "[email protected]"],
              "groupId": "AB12C3",
              "reason": "unsubscribed",
              "isGlobal": false
            }
            """;

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.autosend.com/v1/suppression-groups/emails/suppress"))
            .header("Authorization", "Bearer <token>")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(body))
            .build();

        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
require "net/http"
require "uri"
require "json"

uri = URI("https://api.autosend.com/v1/suppression-groups/emails/suppress")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer <token>"
req["Content-Type"] = "application/json"
req.body = {
  emails:   ["[email protected]", "[email protected]"],
  groupId:  "AB12C3",
  reason:   "unsubscribed",
  isGlobal: false,
}.to_json

response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
puts response.body
{
  "success": true,
  "data": {
    "suppressed": 2
  }
}
curl --request POST \
  --url 'https://api.autosend.com/v1/suppression-groups/emails/suppress' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "emails": ["[email protected]", "[email protected]"],
    "groupId": "AB12C3",
    "reason": "unsubscribed",
    "isGlobal": false
  }'
import requests

response = requests.post(
    "https://api.autosend.com/v1/suppression-groups/emails/suppress",
    headers={
        "Authorization": "Bearer <token>",
        "Content-Type": "application/json",
    },
    json={
        "emails": ["[email protected]", "[email protected]"],
        "groupId": "AB12C3",
        "reason": "unsubscribed",
        "isGlobal": False,
    },
)
print(response.json())
const response = await fetch(
  "https://api.autosend.com/v1/suppression-groups/emails/suppress",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer <token>",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      emails: ["[email protected]", "[email protected]"],
      groupId: "AB12C3",
      reason: "unsubscribed",
      isGlobal: false,
    }),
  }
);
const data = await response.json();
console.log(data);
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.autosend.com/v1/suppression-groups/emails/suppress");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    "emails"   => ["[email protected]", "[email protected]"],
    "groupId"  => "AB12C3",
    "reason"   => "unsubscribed",
    "isGlobal" => false,
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer <token>",
    "Content-Type: application/json",
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io"
    "net/http"
)

func main() {
    payload, _ := json.Marshal(map[string]interface{}{
        "emails":   []string{"[email protected]", "[email protected]"},
        "groupId":  "AB12C3",
        "reason":   "unsubscribed",
        "isGlobal": false,
    })

    req, _ := http.NewRequest("POST", "https://api.autosend.com/v1/suppression-groups/emails/suppress", bytes.NewBuffer(payload))
    req.Header.Set("Authorization", "Bearer <token>")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
import java.net.URI;
import java.net.http.*;

public class Main {
    public static void main(String[] args) throws Exception {
        String body = """
            {
              "emails": ["[email protected]", "[email protected]"],
              "groupId": "AB12C3",
              "reason": "unsubscribed",
              "isGlobal": false
            }
            """;

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.autosend.com/v1/suppression-groups/emails/suppress"))
            .header("Authorization", "Bearer <token>")
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(body))
            .build();

        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
require "net/http"
require "uri"
require "json"

uri = URI("https://api.autosend.com/v1/suppression-groups/emails/suppress")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer <token>"
req["Content-Type"] = "application/json"
req.body = {
  emails:   ["[email protected]", "[email protected]"],
  groupId:  "AB12C3",
  reason:   "unsubscribed",
  isGlobal: false,
}.to_json

response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
puts response.body
{
  "success": true,
  "data": {
    "suppressed": 2
  }
}

Authorizations

Authorizations
string | header
required
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

emails
string[]
required
An array of valid email addresses to suppress. Must contain at least one address.
groupId
string
The ID of the suppression group to add the addresses to. Omit to add to the default group.
reason
string
The reason for suppression (e.g. unsubscribed, bounced, spam_complaint). Stored on each entry for reporting.
isGlobal
boolean
When true, adds the entries to the global suppression list rather than a project-specific group.

Response

Emails suppressed successfully
success
boolean
Example: true
data
object