Create an email domain
Registers a domain for email sending and optional inbound delivery. The response includes the domain configuration and current verification state.
POST
/
email_domains
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const EmailDomain = await client.emailDomains.create({
domain: 'example.com',
});
console.log(EmailDomain.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_domain = client.email_domains.create(
domain="example.com",
)
print(email_domain.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"),
)
emailDomain, err := client.EmailDomains.New(
context.TODO(),
telnyx.EmailDomainNewParams{
Domain: "example.com",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", emailDomain.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.EmailDomainCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
EmailDomainCreateParams params = EmailDomainCreateParams.builder()
.domain("example.com")
.build();
var response = client.emailDomains().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
email_domain = telnyx.email_domains.create(domain: "example.com")
puts(email_domain)<?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_domain = $client->emailDomains->create(
domain: 'example.com',
);
var_dump($email_domain);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-domains create \
--api-key 'My API Key' \
--domain example.comcurl --request POST \
--url https://api.telnyx.com/v2/email_domains \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"domain": "example.com",
"inbound_enabled": true,
"tracking": {
"open_tracking": true,
"click_tracking": true,
"unsubscribe_tracking": false
}
}
'{
"data": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"record_type": "email_domain",
"domain": "example.com",
"type": "custom",
"status": "pending",
"usable_for_sending": false,
"usable_for_inbound": false,
"verification": {
"ownership": "pending",
"spf": "missing_optional",
"dkim": "pending",
"dmarc": "missing_optional",
"mx": "not_required"
},
"dns_records": [],
"dkim": {
"selector": null,
"algorithm": null,
"key_length": null,
"active": false,
"rotated_at": null
},
"inbound": {
"enabled": false,
"catch_all": false,
"mx_required": false
},
"dmarc_policy": {
"p": "none",
"pct": 100,
"rua": "mailto:dmarc@telnyx.com"
},
"tracking": {
"open_tracking": false,
"click_tracking": false,
"unsubscribe_tracking": false
},
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-01-01T00:00:00Z",
"verified_at": null
}
}{
"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.
Body
application/json
Example:
"example.com"
Enable inbound routing for this domain
DMARC policy. Omit/null for the advisory default (v=DMARC1; p=none; rua=mailto:dmarc@telnyx.com).
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
Email domain created
Show child attributes
Show child attributes
Example:
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"record_type": "email_domain",
"domain": "example.com",
"type": "custom",
"status": "pending",
"usable_for_sending": false,
"usable_for_inbound": false,
"verification": {
"ownership": "pending",
"spf": "missing_optional",
"dkim": "pending",
"dmarc": "missing_optional",
"mx": "not_required"
},
"dns_records": [],
"dkim": {
"selector": null,
"algorithm": null,
"key_length": null,
"active": false,
"rotated_at": null
},
"inbound": {
"enabled": false,
"catch_all": false,
"mx_required": false
},
"dmarc_policy": {
"p": "none",
"pct": 100,
"rua": "mailto:dmarc@telnyx.com"
},
"tracking": {
"open_tracking": false,
"click_tracking": false,
"unsubscribe_tracking": false
},
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-01-01T00:00:00Z",
"verified_at": null
}
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 EmailDomain = await client.emailDomains.create({
domain: 'example.com',
});
console.log(EmailDomain.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_domain = client.email_domains.create(
domain="example.com",
)
print(email_domain.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"),
)
emailDomain, err := client.EmailDomains.New(
context.TODO(),
telnyx.EmailDomainNewParams{
Domain: "example.com",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", emailDomain.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.EmailDomainCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
EmailDomainCreateParams params = EmailDomainCreateParams.builder()
.domain("example.com")
.build();
var response = client.emailDomains().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
email_domain = telnyx.email_domains.create(domain: "example.com")
puts(email_domain)<?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_domain = $client->emailDomains->create(
domain: 'example.com',
);
var_dump($email_domain);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-domains create \
--api-key 'My API Key' \
--domain example.comcurl --request POST \
--url https://api.telnyx.com/v2/email_domains \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"domain": "example.com",
"inbound_enabled": true,
"tracking": {
"open_tracking": true,
"click_tracking": true,
"unsubscribe_tracking": false
}
}
'{
"data": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"record_type": "email_domain",
"domain": "example.com",
"type": "custom",
"status": "pending",
"usable_for_sending": false,
"usable_for_inbound": false,
"verification": {
"ownership": "pending",
"spf": "missing_optional",
"dkim": "pending",
"dmarc": "missing_optional",
"mx": "not_required"
},
"dns_records": [],
"dkim": {
"selector": null,
"algorithm": null,
"key_length": null,
"active": false,
"rotated_at": null
},
"inbound": {
"enabled": false,
"catch_all": false,
"mx_required": false
},
"dmarc_policy": {
"p": "none",
"pct": 100,
"rua": "mailto:dmarc@telnyx.com"
},
"tracking": {
"open_tracking": false,
"click_tracking": false,
"unsubscribe_tracking": false
},
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-01-01T00:00:00Z",
"verified_at": null
}
}{
"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"
}
]
}