Create a webhook for an email domain
Creates a webhook endpoint subscribed to a specific allowlist of event types. Both email.* events (published by email-api) and email_domain.* events (published by this service) flow through the same webhooks.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const EmailWebhook = await client.emailDomains.webhooks.create('domain_id', {
events: [],
url: 'url',
});
console.log(EmailWebhook.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_webhook = client.email_domains.webhooks.create(
domain_id="domain_id",
events=[],
url="url",
)
print(email_webhook.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"),
)
webhook, err := client.EmailDomains.Webhooks.New(
context.TODO(),
"domain_id",
telnyx.EmailDomainWebhookNewParams{
Events: "events",
URL: "url",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", webhook.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.emailDomains.webhooks.WebhookCreateParams;
import java.util.List;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
WebhookCreateParams params = WebhookCreateParams.builder()
.events(List.of())
.url("url")
.build();
var response = client.emailDomains().webhooks().create("domain_id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
email_webhook = telnyx.email_domains.webhooks.create("domain_id", events: [], url: "url")
puts(email_webhook)<?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_webhook = $client->emailDomains->webhooks->create(
'domain_id',
events: [],
url: 'url',
);
var_dump($email_webhook);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-domains:webhooks create \
--api-key 'My API Key' \
--domain-id domain_id \
--url url \
--events email.scheduledcurl --request POST \
--url https://api.telnyx.com/v2/email_domains/{domain_id}/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/webhooks/email",
"events": [
"email.sent",
"email.delivered",
"email.bounced"
]
}
'{
"data": {
"id": "123e4567-e89b-12d3-a456-426614174003",
"record_type": "email_webhook",
"url": "https://example.com/webhooks/email",
"events": [
"email.sent",
"email.delivered",
"email.bounced"
],
"domain_id": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2026-06-18T12:00:00Z",
"updated_at": "2026-06-18T12:00:00Z"
}
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested email domain was not found"
}
]
}{
"errors": [
{
"code": "10015",
"title": "Validation Failed",
"detail": "domain is invalid",
"source": {
"pointer": "/data/attributes/domain"
}
}
]
}{
"errors": [
{
"code": "500",
"title": "Internal Server Error",
"detail": "An unexpected error occurred"
}
]
}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 domain UUID
Body
HTTPS endpoint to deliver subscribed events to.
At least one event type is required.
1Event types accepted by domain webhook subscriptions. Allowlists match the legacy event_type, not canonical_event_type. Of the 22 accepted types, email.sending is stored but intentionally not published. Cancellation, daily-limit failures, and system failures publish after commit when a matching domain webhook is configured.
email.scheduled, email.sandbox, email.queued, email.sending, email.sent, email.delivered, email.deferred, email.bounced, email.failed, email.complained, email.opened, email.clicked, email.unsubscribed, email.received, email.cancelled, email.daily_limit_exceeded, email_domain.created, email_domain.verified, email_domain.degraded, email_domain.suspended, email_domain.deleted, email_domain.dkim_rotated Response
Email webhook created
Show child attributes
Show child attributes
{
"id": "123e4567-e89b-12d3-a456-426614174003",
"record_type": "email_webhook",
"url": "https://example.com/webhooks/email",
"events": [
"email.sent",
"email.delivered",
"email.bounced"
],
"domain_id": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2026-06-18T12:00:00Z",
"updated_at": "2026-06-18T12:00:00Z"
}
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const EmailWebhook = await client.emailDomains.webhooks.create('domain_id', {
events: [],
url: 'url',
});
console.log(EmailWebhook.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_webhook = client.email_domains.webhooks.create(
domain_id="domain_id",
events=[],
url="url",
)
print(email_webhook.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"),
)
webhook, err := client.EmailDomains.Webhooks.New(
context.TODO(),
"domain_id",
telnyx.EmailDomainWebhookNewParams{
Events: "events",
URL: "url",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", webhook.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.emailDomains.webhooks.WebhookCreateParams;
import java.util.List;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
WebhookCreateParams params = WebhookCreateParams.builder()
.events(List.of())
.url("url")
.build();
var response = client.emailDomains().webhooks().create("domain_id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
email_webhook = telnyx.email_domains.webhooks.create("domain_id", events: [], url: "url")
puts(email_webhook)<?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_webhook = $client->emailDomains->webhooks->create(
'domain_id',
events: [],
url: 'url',
);
var_dump($email_webhook);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-domains:webhooks create \
--api-key 'My API Key' \
--domain-id domain_id \
--url url \
--events email.scheduledcurl --request POST \
--url https://api.telnyx.com/v2/email_domains/{domain_id}/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/webhooks/email",
"events": [
"email.sent",
"email.delivered",
"email.bounced"
]
}
'{
"data": {
"id": "123e4567-e89b-12d3-a456-426614174003",
"record_type": "email_webhook",
"url": "https://example.com/webhooks/email",
"events": [
"email.sent",
"email.delivered",
"email.bounced"
],
"domain_id": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2026-06-18T12:00:00Z",
"updated_at": "2026-06-18T12:00:00Z"
}
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested email domain was not found"
}
]
}{
"errors": [
{
"code": "10015",
"title": "Validation Failed",
"detail": "domain is invalid",
"source": {
"pointer": "/data/attributes/domain"
}
}
]
}{
"errors": [
{
"code": "500",
"title": "Internal Server Error",
"detail": "An unexpected error occurred"
}
]
}