Add sender filter entries to an inbox
Adds entries to either the allowlist or blocklist. The operation is an idempotent set union: entries already present remain unchanged.
POST
/
email_inboxes
/
{inbox_id}
/
filters
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.emailInboxes.filters.add('inbox_id', {
entries: 'entries',
type: 'allowlist',
});
console.log(response.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
)
response = client.email_inboxes.filters.add(
inbox_id="inbox_id",
entries="entries",
type="allowlist",
)
print(response.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"),
)
response, err := client.EmailInboxes.Filters.Add(
context.TODO(),
"inbox_id",
telnyx.EmailInboxeFilterAddParams{
Entries: "entries",
Type: "allowlist",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.emailInboxes.filters.FilterAddParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
FilterAddParams params = FilterAddParams.builder()
.entries("entries")
.type(FilterAddParams.Type.ALLOWLIST)
.build();
var response = client.emailInboxes().filters().add("inbox_id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_inboxes.filters.add("inbox_id", entries: "entries", type: :allowlist)
puts(response)<?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 {
$response = $client->emailInboxes->filters->add(
'inbox_id',
entries: 'entries',
type: 'allowlist',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-inboxes:filters add \
--api-key 'My API Key' \
--inbox-id inbox_id \
--type allowlist \
--entries entriescurl --request POST \
--url https://api.telnyx.com/v2/email_inboxes/{inbox_id}/filters \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "blocklist",
"entries": [
"@spam.example"
]
}
'{
"data": {
"record_type": "email_inbox_filters",
"allowlist": [
"trusted@example.com",
"@partner.example"
],
"blocklist": [
"@spam.example"
]
}
}{
"errors": [
{
"code": "10006",
"title": "Not authorized",
"detail": "Invalid API key",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10006"
}
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested resource was not found"
}
]
}{
"errors": [
{
"code": "10015",
"title": "Validation Failed",
"detail": "subject can't be blank",
"source": {
"pointer": "/data/attributes/subject"
}
}
]
}{
"errors": [
{
"code": "10016",
"title": "Service Unavailable",
"detail": "The email domain service is temporarily unavailable. Please try again later."
}
]
}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
Email inbox UUID.
Body
application/json
Response
The inbox's current sender allowlist and blocklist.
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 response = await client.emailInboxes.filters.add('inbox_id', {
entries: 'entries',
type: 'allowlist',
});
console.log(response.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
)
response = client.email_inboxes.filters.add(
inbox_id="inbox_id",
entries="entries",
type="allowlist",
)
print(response.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"),
)
response, err := client.EmailInboxes.Filters.Add(
context.TODO(),
"inbox_id",
telnyx.EmailInboxeFilterAddParams{
Entries: "entries",
Type: "allowlist",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.emailInboxes.filters.FilterAddParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
FilterAddParams params = FilterAddParams.builder()
.entries("entries")
.type(FilterAddParams.Type.ALLOWLIST)
.build();
var response = client.emailInboxes().filters().add("inbox_id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_inboxes.filters.add("inbox_id", entries: "entries", type: :allowlist)
puts(response)<?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 {
$response = $client->emailInboxes->filters->add(
'inbox_id',
entries: 'entries',
type: 'allowlist',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-inboxes:filters add \
--api-key 'My API Key' \
--inbox-id inbox_id \
--type allowlist \
--entries entriescurl --request POST \
--url https://api.telnyx.com/v2/email_inboxes/{inbox_id}/filters \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "blocklist",
"entries": [
"@spam.example"
]
}
'{
"data": {
"record_type": "email_inbox_filters",
"allowlist": [
"trusted@example.com",
"@partner.example"
],
"blocklist": [
"@spam.example"
]
}
}{
"errors": [
{
"code": "10006",
"title": "Not authorized",
"detail": "Invalid API key",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10006"
}
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested resource was not found"
}
]
}{
"errors": [
{
"code": "10015",
"title": "Validation Failed",
"detail": "subject can't be blank",
"source": {
"pointer": "/data/attributes/subject"
}
}
]
}{
"errors": [
{
"code": "10016",
"title": "Service Unavailable",
"detail": "The email domain service is temporarily unavailable. Please try again later."
}
]
}