Create an unsubscribe group
Creates an account-owned unsubscribe group for associating email categories with separate recipient suppression lists.
POST
/
email_unsubscribe_groups
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const UnsubscribeGroup = await client.emailUnsubscribeGroups.create({
name: 'name',
});
console.log(UnsubscribeGroup.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
)
unsubscribe_group = client.email_unsubscribe_groups.create(
name="name",
)
print(unsubscribe_group.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"),
)
emailUnsubscribeGroup, err := client.EmailUnsubscribeGroups.New(
context.TODO(),
telnyx.EmailUnsubscribeGroupNewParams{
Name: "name",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", emailUnsubscribeGroup.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.EmailUnsubscribeGroupCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
EmailUnsubscribeGroupCreateParams params = EmailUnsubscribeGroupCreateParams.builder()
.name("name")
.build();
var response = client.emailUnsubscribeGroups().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
unsubscribe_group = telnyx.email_unsubscribe_groups.create(name: "name")
puts(unsubscribe_group)<?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 {
$unsubscribe_group = $client->emailUnsubscribeGroups->create(
name: 'name',
);
var_dump($unsubscribe_group);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-unsubscribe-groups create \
--api-key 'My API Key' \
--name namecurl --request POST \
--url https://api.telnyx.com/v2/email_unsubscribe_groups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Marketing Newsletter",
"description": "Weekly product updates and promotions"
}
'{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"record_type": "email_unsubscribe_group",
"name": "string",
"description": "string",
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z"
}
}{
"errors": [
{
"code": "10007",
"title": "Unauthorized",
"detail": "Missing authentication"
}
]
}{
"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.
Response
Created.
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 UnsubscribeGroup = await client.emailUnsubscribeGroups.create({
name: 'name',
});
console.log(UnsubscribeGroup.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
)
unsubscribe_group = client.email_unsubscribe_groups.create(
name="name",
)
print(unsubscribe_group.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"),
)
emailUnsubscribeGroup, err := client.EmailUnsubscribeGroups.New(
context.TODO(),
telnyx.EmailUnsubscribeGroupNewParams{
Name: "name",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", emailUnsubscribeGroup.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.EmailUnsubscribeGroupCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
EmailUnsubscribeGroupCreateParams params = EmailUnsubscribeGroupCreateParams.builder()
.name("name")
.build();
var response = client.emailUnsubscribeGroups().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
unsubscribe_group = telnyx.email_unsubscribe_groups.create(name: "name")
puts(unsubscribe_group)<?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 {
$unsubscribe_group = $client->emailUnsubscribeGroups->create(
name: 'name',
);
var_dump($unsubscribe_group);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-unsubscribe-groups create \
--api-key 'My API Key' \
--name namecurl --request POST \
--url https://api.telnyx.com/v2/email_unsubscribe_groups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Marketing Newsletter",
"description": "Weekly product updates and promotions"
}
'{
"data": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"record_type": "email_unsubscribe_group",
"name": "string",
"description": "string",
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z"
}
}{
"errors": [
{
"code": "10007",
"title": "Unauthorized",
"detail": "Missing authentication"
}
]
}{
"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"
}
}
]
}