List DNS records for an email domain
Returns the DNS records Telnyx generated for domain ownership and DKIM verification, plus MX records when inbound delivery is enabled.
GET
/
email_domains
/
{domain_id}
/
dns_records
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.emailDomains.retrieveDnsRecords('domain_id');
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_domains.retrieve_dns_records(
"domain_id",
)
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.EmailDomains.GetDnsRecords(
context.TODO(),
"domain_id",
)
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;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.emailDomains().retrieveDnsRecords("domain_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_domains.retrieve_dns_records("domain_id")
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->emailDomains->retrieveDnsRecords(
'domain_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-domains retrieve-dns-records \
--api-key 'My API Key' \
--domain-id domain_idcurl --request GET \
--url https://api.telnyx.com/v2/email_domains/{domain_id}/dns_records \
--header 'Authorization: Bearer <token>'{
"data": [
{
"id": "123e4567-e89b-12d3-a456-426614174001",
"purpose": "ownership",
"record_type": "TXT",
"host": "_telnyx-email.example.com",
"value": "telnyx-domain-verification=abc123",
"actual_value": null,
"priority": null,
"required": true,
"status": "pending"
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested email domain was not found"
}
]
}{
"errors": [
{
"code": "500",
"title": "Internal Server Error",
"detail": "An unexpected error occurred"
}
]
}Authorizations
Was this page helpful?
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.emailDomains.retrieveDnsRecords('domain_id');
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_domains.retrieve_dns_records(
"domain_id",
)
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.EmailDomains.GetDnsRecords(
context.TODO(),
"domain_id",
)
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;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.emailDomains().retrieveDnsRecords("domain_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_domains.retrieve_dns_records("domain_id")
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->emailDomains->retrieveDnsRecords(
'domain_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-domains retrieve-dns-records \
--api-key 'My API Key' \
--domain-id domain_idcurl --request GET \
--url https://api.telnyx.com/v2/email_domains/{domain_id}/dns_records \
--header 'Authorization: Bearer <token>'{
"data": [
{
"id": "123e4567-e89b-12d3-a456-426614174001",
"purpose": "ownership",
"record_type": "TXT",
"host": "_telnyx-email.example.com",
"value": "telnyx-domain-verification=abc123",
"actual_value": null,
"priority": null,
"required": true,
"status": "pending"
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested email domain was not found"
}
]
}{
"errors": [
{
"code": "500",
"title": "Internal Server Error",
"detail": "An unexpected error occurred"
}
]
}