Skip to main content
Resend Docs

Search documentation

Type to search this documentation.

On this pageOverview

Add Suppression

POST

/

suppressions

Node.js
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.suppressions.add({
  email: 'steve.wozniak@example.com',
});
PHP
$resend = Resend::client('re_xxxxxxxxx');

$resend->suppressions->add([
  'email' => 'steve.wozniak@example.com',
]);
Python
import resend

resend.api_key = "re_xxxxxxxxx"

params: resend.Suppressions.AddParams = {
  "email": "steve.wozniak@example.com",
}

resend.Suppressions.add(params)
Ruby
require "resend"

Resend.api_key = "re_xxxxxxxxx"

Resend::Suppressions.add(email: "steve.wozniak@example.com")
Go
package main

import "github.com/resend/resend-go/v4"

func main() {
	client := resend.NewClient("re_xxxxxxxxx")

	params := &resend.AddSuppressionRequest{
		Email: "steve.wozniak@example.com",
	}

	client.Suppressions.Add(params)
}
Rust
use resend_rs::types::AddSuppressionOptions;
use resend_rs::{Resend, Result};

#[tokio::main]
async fn main() -> Result<()> {
  let resend = Resend::new("re_xxxxxxxxx");

  let opts = AddSuppressionOptions::new().with_email("steve.wozniak@example.com");
  let _data = resend.suppressions.add(opts).await?;

  Ok(())
}
Java
import com.resend.Resend;
import com.resend.core.exception.ResendException;
import com.resend.services.suppressions.model.AddSuppressionOptions;

public class Main {
    public static void main(String[] args) throws ResendException {
        Resend resend = new Resend("re_xxxxxxxxx");

        AddSuppressionOptions options = AddSuppressionOptions.builder()
                .email("steve.wozniak@example.com")
                .build();

        resend.suppressions().add(options);
    }
}
.NET
using Resend;

IResend resend = ResendClient.Create( "re_xxxxxxxxx" );

var resp = await resend.SuppressionAddAsync( "steve.wozniak@example.com" );
Console.WriteLine( "Suppression Id={0}", resp.Content );
cURL
curl -X POST 'https://api.resend.com/suppressions' \
     -H 'Authorization: Bearer re_xxxxxxxxx' \
     -H 'Content-Type: application/json' \
     -d $'{
  "email": "steve.wozniak@example.com"
}'
CLI
resend suppressions add steve.wozniak@example.com
Response
{
  "object": "suppression",
  "id": "e169aa45-1ecf-4183-9955-b1499d5701d3"
}

string

required

The email address to suppress.

Node.js
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.suppressions.add({
  email: 'steve.wozniak@example.com',
});
PHP
$resend = Resend::client('re_xxxxxxxxx');

$resend->suppressions->add([
  'email' => 'steve.wozniak@example.com',
]);
Python
import resend

resend.api_key = "re_xxxxxxxxx"

params: resend.Suppressions.AddParams = {
  "email": "steve.wozniak@example.com",
}

resend.Suppressions.add(params)
Ruby
require "resend"

Resend.api_key = "re_xxxxxxxxx"

Resend::Suppressions.add(email: "steve.wozniak@example.com")
Go
package main

import "github.com/resend/resend-go/v4"

func main() {
	client := resend.NewClient("re_xxxxxxxxx")

	params := &resend.AddSuppressionRequest{
		Email: "steve.wozniak@example.com",
	}

	client.Suppressions.Add(params)
}
Rust
use resend_rs::types::AddSuppressionOptions;
use resend_rs::{Resend, Result};

#[tokio::main]
async fn main() -> Result<()> {
  let resend = Resend::new("re_xxxxxxxxx");

  let opts = AddSuppressionOptions::new().with_email("steve.wozniak@example.com");
  let _data = resend.suppressions.add(opts).await?;

  Ok(())
}
Java
import com.resend.Resend;
import com.resend.core.exception.ResendException;
import com.resend.services.suppressions.model.AddSuppressionOptions;

public class Main {
    public static void main(String[] args) throws ResendException {
        Resend resend = new Resend("re_xxxxxxxxx");

        AddSuppressionOptions options = AddSuppressionOptions.builder()
                .email("steve.wozniak@example.com")
                .build();

        resend.suppressions().add(options);
    }
}
.NET
using Resend;

IResend resend = ResendClient.Create( "re_xxxxxxxxx" );

var resp = await resend.SuppressionAddAsync( "steve.wozniak@example.com" );
Console.WriteLine( "Suppression Id={0}", resp.Content );
cURL
curl -X POST 'https://api.resend.com/suppressions' \
     -H 'Authorization: Bearer re_xxxxxxxxx' \
     -H 'Content-Type: application/json' \
     -d $'{
  "email": "steve.wozniak@example.com"
}'
CLI
resend suppressions add steve.wozniak@example.com
JSON
{
  "object": "suppression",
  "id": "e169aa45-1ecf-4183-9955-b1499d5701d3"
}

Was this page helpful?

⌘I

Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu