Add a group suppression
Creates a suppression with reason: unsubscribe, source: manual,
group_id: <this group>. All other body fields are ignored; only
to is read. Idempotent (same dedupe key → 200, no new event).
POST
/
email_unsubscribe_groups
/
{id}
/
suppressions
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const EmailBlock = await client.emailUnsubscribeGroups.suppressions.create('id', {
to: 'to',
});
console.log(EmailBlock.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
email_block = client.email_unsubscribe_groups.suppressions.create(
id="id",
to="to",
)
print(email_block.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
suppression, err := client.EmailUnsubscribeGroups.Suppressions.New(
context.TODO(),
"id",
telnyx.EmailUnsubscribeGroupSuppressionNewParams{
To: "to",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", suppression.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.emailUnsubscribeGroups.suppressions.SuppressionCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
SuppressionCreateParams params = SuppressionCreateParams.builder()
.to("to")
.build();
var response = client.emailUnsubscribeGroups().suppressions().create("id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
email_block = telnyx.email_unsubscribe_groups.suppressions.create("id", to: "to")
puts(email_block)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$email_block = $client->emailUnsubscribeGroups->suppressions->create(
'id',
to: 'to',
);
var_dump($email_block);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-unsubscribe-groups:suppressions create \
--api-key 'My API Key' \
--id id \
--to tocurl --request POST \
--url https://api.telnyx.com/v2/email_unsubscribe_groups/{id}/suppressions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "user@example.com"
}
'{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"record_type": "email_block",
"domain_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"group_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"from": "string",
"to": "string",
"reason": "hard_bounce",
"source": "feedback",
"scope": "account",
"status": "active",
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z",
"expires_at": "2024-01-23T18:10:02.574Z"
}
}{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"record_type": "email_block",
"domain_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"group_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"from": "string",
"to": "string",
"reason": "hard_bounce",
"source": "feedback",
"scope": "account",
"status": "active",
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z",
"expires_at": "2024-01-23T18:10:02.574Z"
}
}{
"errors": [
{
"code": "10007",
"title": "Unauthorized",
"detail": "Missing authentication"
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested email block was not found"
}
]
}{
"errors": [
{
"code": "406",
"title": "Not Acceptable",
"detail": "Not Acceptable"
}
]
}{
"errors": [
{
"code": "10015",
"title": "Validation Failed",
"detail": "can't be blank",
"source": {
"pointer": "/data/attributes/to"
}
}
]
}Authorizations
Telnyx API key supplied as Authorization: Bearer <token>. In production, auth may be validated by the API gateway and forwarded via Telnyx auth headers.
Path Parameters
Resource UUID. Malformed UUIDs are treated as not-found (not 400).
Body
application/json
Only to is read; all other fields are ignored (reason: unsubscribe, source: manual, group_id: <group> are forced).
Response
Idempotent — already existed.
Suppression record. Schema fields hidden by the view:
account_id, bounce_category, dsn_code, meta.
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const EmailBlock = await client.emailUnsubscribeGroups.suppressions.create('id', {
to: 'to',
});
console.log(EmailBlock.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
email_block = client.email_unsubscribe_groups.suppressions.create(
id="id",
to="to",
)
print(email_block.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
suppression, err := client.EmailUnsubscribeGroups.Suppressions.New(
context.TODO(),
"id",
telnyx.EmailUnsubscribeGroupSuppressionNewParams{
To: "to",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", suppression.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.emailUnsubscribeGroups.suppressions.SuppressionCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
SuppressionCreateParams params = SuppressionCreateParams.builder()
.to("to")
.build();
var response = client.emailUnsubscribeGroups().suppressions().create("id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
email_block = telnyx.email_unsubscribe_groups.suppressions.create("id", to: "to")
puts(email_block)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$email_block = $client->emailUnsubscribeGroups->suppressions->create(
'id',
to: 'to',
);
var_dump($email_block);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-unsubscribe-groups:suppressions create \
--api-key 'My API Key' \
--id id \
--to tocurl --request POST \
--url https://api.telnyx.com/v2/email_unsubscribe_groups/{id}/suppressions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "user@example.com"
}
'{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"record_type": "email_block",
"domain_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"group_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"from": "string",
"to": "string",
"reason": "hard_bounce",
"source": "feedback",
"scope": "account",
"status": "active",
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z",
"expires_at": "2024-01-23T18:10:02.574Z"
}
}{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"record_type": "email_block",
"domain_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"group_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"from": "string",
"to": "string",
"reason": "hard_bounce",
"source": "feedback",
"scope": "account",
"status": "active",
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z",
"expires_at": "2024-01-23T18:10:02.574Z"
}
}{
"errors": [
{
"code": "10007",
"title": "Unauthorized",
"detail": "Missing authentication"
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested email block was not found"
}
]
}{
"errors": [
{
"code": "406",
"title": "Not Acceptable",
"detail": "Not Acceptable"
}
]
}{
"errors": [
{
"code": "10015",
"title": "Validation Failed",
"detail": "can't be blank",
"source": {
"pointer": "/data/attributes/to"
}
}
]
}