> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List DNS records for an email domain



## OpenAPI

````yaml /openapi/generated/email/domains.yml get /email_domains/{domain_id}/dns_records
openapi: 3.1.0
info:
  contact:
    email: support@telnyx.com
  description: API for managing email domains, DNS records, verification, and webhooks.
  title: Telnyx Email Domains API
  version: 2.0.0
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /email_domains/{domain_id}/dns_records:
    get:
      tags:
        - Email Domain DNS Records
      summary: List DNS records for an email domain
      operationId: listEmailDomainDnsRecords
      parameters:
        - $ref: '#/components/parameters/EmailDomainDomainId'
      responses:
        '200':
          description: DNS records for the email domain
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DNSRecordListResponse'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            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);
        - lang: Python
          source: |-
            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)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.EmailDomains.GetDnsRecords(\n\t\tcontext.TODO(),\n\t\t\"domain_id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n"
        - lang: Java
          source: |-
            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");
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            response = telnyx.email_domains.retrieve_dns_records("domain_id")

            puts(response)
        - lang: PHP
          source: >-
            <?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();
            }
        - lang: CLI
          source: |-
            telnyx email-domains retrieve-dns-records \
              --api-key 'My API Key' \
              --domain-id domain_id
components:
  parameters:
    EmailDomainDomainId:
      name: domain_id
      in: path
      required: true
      description: Email domain UUID
      schema:
        type: string
        format: uuid
  schemas:
    DNSRecordListResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/DNSRecord'
    DNSRecord:
      type: object
      required:
        - id
        - purpose
        - record_type
        - host
        - value
        - required
        - status
      properties:
        id:
          type: string
          format: uuid
        purpose:
          type: string
          enum:
            - ownership
            - spf
            - dkim
            - dmarc
            - mx
        record_type:
          type: string
          enum:
            - TXT
            - MX
        host:
          type: string
        value:
          type: string
        actual_value:
          type:
            - string
            - 'null'
        priority:
          type:
            - integer
            - 'null'
        required:
          type: boolean
        status:
          type: string
          enum:
            - pending
            - verified
            - failed
            - not_required
      example:
        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
    DomainsErrorResponse:
      type: object
      required:
        - errors
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/email_Error'
    email_Error:
      type: object
      required:
        - code
        - title
        - detail
      properties:
        code:
          type: string
          enum:
            - '10001'
            - '10015'
            - '500'
            - '10007'
            - '10008'
            - '10020'
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              type: string
  responses:
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DomainsErrorResponse'
          example:
            errors:
              - code: '10001'
                title: Not Found
                detail: The requested email domain was not found
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DomainsErrorResponse'
          example:
            errors:
              - code: '500'
                title: Internal Server Error
                detail: An unexpected error occurred
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````