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

# Verify Domain

> Verify a domain's DNS records (DKIM and CNAME) with SparkPost. This triggers a verification check and returns the current status of DNS records.

Triggers DNS verification for a sending domain. Lettr checks that the required CNAME and DKIM records are correctly configured. Call this after adding DNS records to your domain.


## OpenAPI

````yaml POST /domains/{domain}/verify
openapi: 3.1.0
info:
  title: Lettr API
  version: 1.0.0
  description: >-
    Lettr Email API - Send transactional emails with tracking, attachments, and
    personalization.
  contact:
    name: Lettr Support
    url: https://lettr.com
  license:
    name: Proprietary
    url: https://lettr.com/terms
servers:
  - url: https://app.lettr.com/api
    description: Production
security: []
tags:
  - name: Emails
    description: Email sending operations
  - name: Templates
    description: Email template management operations
  - name: Domains
    description: Domain management operations
  - name: Webhooks
    description: Webhook management operations
  - name: Audience
    description: 'Audience management: lists, contacts, topics, properties, and segments'
  - name: Campaigns
    description: >-
      Campaign operations: listing, stats, engagement events, and
      dispatch/scheduling
paths:
  /domains/{domain}/verify:
    post:
      tags:
        - Domains
      summary: Verify Domain
      description: >-
        Verify a domain's DNS records (DKIM and CNAME) with SparkPost. This
        triggers a verification check and returns the current status of DNS
        records.
      operationId: verifyDomain
      parameters:
        - name: domain
          in: path
          required: true
          description: The domain name to verify
          schema:
            type: string
            example: example.com
      responses:
        '200':
          description: Domain verification completed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VerifyDomainResponse'
              examples:
                valid:
                  summary: All DNS records valid
                  value:
                    message: Domain verification completed.
                    data:
                      domain: example.com
                      dkim_status: valid
                      cname_status: valid
                      dmarc_status: valid
                      spf_status: unverified
                      ownership_verified: 'true'
                      is_primary_domain: false
                unverified:
                  summary: DNS records not configured
                  value:
                    message: Domain verification completed.
                    data:
                      domain: example.com
                      dkim_status: invalid
                      cname_status: invalid
                      dmarc_status: missing
                      spf_status: unverified
                      ownership_verified: null
                      is_primary_domain: false
                      dns:
                        dkim_record: null
                        cname_record: null
                        dkim_error: >-
                          DNS DKIM query error: dns lookup failed for
                          scph0226._domainkey.example.com: no TXT records found
                        cname_error: 'DNS CNAME query error: No CNAME records retrieved'
                        dmarc_record: null
                        dmarc_error: >-
                          No DMARC record found for example.com or its parent
                          domain.
                        spf_record: null
                        spf_error: null
                      dmarc:
                        is_valid: false
                        status: missing
                        found_at_domain: null
                        record: null
                        policy: null
                        subdomain_policy: null
                        error: >-
                          No DMARC record found for example.com or its parent
                          domain.
                        covered_by_parent_policy: false
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '404':
          description: Domain not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Domain not found.
                error_code: not_found
        '422':
          description: Validation error - Invalid domain format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
              example:
                message: Validation failed.
                error_code: validation_error
                errors:
                  domain:
                    - >-
                      The domain must be a valid domain name (e.g.,
                      example.com).
        '500':
          description: Server error - Failed to verify domain
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Failed to verify domain. Please try again later.
                error_code: send_error
      security:
        - bearerAuth: []
components:
  schemas:
    VerifyDomainResponse:
      type: object
      description: Response containing domain verification results
      required:
        - message
        - data
      properties:
        message:
          type: string
          description: Human-readable response message
          example: Domain verification completed.
        data:
          $ref: '#/components/schemas/DomainVerificationView'
    ErrorResponse:
      type: object
      required:
        - message
        - error_code
      description: Error response for non-validation errors (400, 409, 500, 502).
      properties:
        message:
          type: string
          description: Human-readable error message
          example: The sender domain could not be determined from the email address.
        error_code:
          $ref: '#/components/schemas/ErrorCode'
    ValidationErrorResponse:
      type: object
      required:
        - message
        - error_code
        - errors
      properties:
        message:
          type: string
          description: Human-readable error message
          example: Validation failed.
        error_code:
          type: string
          description: Error code (always `validation_error` for 422 responses)
          const: validation_error
          example: validation_error
        errors:
          type: object
          description: Field-specific validation errors
          additionalProperties:
            type: array
            items:
              type: string
          example:
            from:
              - The sender email address is required.
            to:
              - At least one recipient email address is required.
    DomainVerificationView:
      type: object
      description: Domain verification status and DNS details
      required:
        - domain
        - dkim_status
        - cname_status
        - dmarc_status
        - spf_status
        - is_primary_domain
      properties:
        domain:
          type: string
          description: The domain name
          example: example.com
        dkim_status:
          type: string
          description: DKIM verification status
          enum:
            - valid
            - unverified
            - invalid
          example: valid
        cname_status:
          type: string
          description: >-
            CNAME verification status. `not_applicable` is returned for primary
            (apex) sending domains, which require SPF instead of CNAME
            delegation.
          enum:
            - valid
            - unverified
            - invalid
            - not_applicable
          example: valid
        dmarc_status:
          type: string
          description: DMARC verification status.
          enum:
            - valid
            - invalid
            - missing
            - unverified
          example: valid
        spf_status:
          type: string
          description: SPF verification status.
          enum:
            - valid
            - invalid
            - missing
            - unverified
          example: valid
        is_primary_domain:
          type: boolean
          description: >-
            True when this is a root/apex sending domain (not a subdomain).
            Primary domains require SPF instead of CNAME delegation.
          example: false
        ownership_verified:
          type:
            - string
            - 'null'
          description: Whether domain ownership has been verified
          example: 'true'
        dns:
          $ref: '#/components/schemas/DomainDnsVerificationView'
        dmarc:
          $ref: '#/components/schemas/DmarcValidationResult'
        spf:
          $ref: '#/components/schemas/SpfValidationResult'
    UnauthorizedResponse:
      type: object
      required:
        - message
      description: Error response for authentication failures (401).
      properties:
        message:
          type: string
          description: Human-readable error message
          example: API key is required.
    ErrorCode:
      type: string
      description: >-
        Error codes returned by the API.


        | Code | HTTP Status | Description |

        |------|-------------|-------------|

        | `validation_error` | 422 | Request validation failed. Check the
        `errors` object for field-specific messages. |

        | `invalid_domain` | 400 | The sender domain could not be determined
        from the email address. |

        | `unconfigured_domain` | 400 | The sender domain is not configured or
        approved for sending. |

        | `send_error` | 400, 500 | General error during email send preparation
        or domain registration. |

        | `retrieval_error` | 400, 500 | Failed to retrieve resources (e.g.,
        sandbox key without associated user, upstream error). |

        | `transmission_failed` | 502 | Email transmission to the upstream
        provider failed. |

        | `resource_already_exists` | 409 | The resource (e.g., domain) already
        exists. |

        | `not_found` | 404 | The specified resource was not found. |

        | `template_not_found` | 404 | The specified template, project, or
        template version was not found. |

        | `insufficient_scope` | 403 | The API key does not have the required
        scope for this endpoint. |

        | `schedule_cancellation_failed` | 409, 500 | Could not cancel the
        scheduled transmission (already sent or upstream error). |

        | `quota_exceeded` | 429 | Monthly sending quota exceeded. Upgrade your
        plan to continue sending. |

        | `daily_quota_exceeded` | 429 | Daily sending quota exceeded. Try again
        tomorrow. |

        | `campaign_not_sendable` | 422 | The campaign cannot be sent in its
        current state (not a draft, or missing subject/sender/content). |

        | `campaign_not_scheduled` | 422 | The campaign is not scheduled, so it
        cannot be unscheduled. |
      enum:
        - validation_error
        - invalid_domain
        - unconfigured_domain
        - send_error
        - retrieval_error
        - transmission_failed
        - resource_already_exists
        - not_found
        - template_not_found
        - insufficient_scope
        - schedule_cancellation_failed
        - quota_exceeded
        - daily_quota_exceeded
        - campaign_not_sendable
        - campaign_not_scheduled
      example: invalid_domain
    DomainDnsVerificationView:
      type: object
      description: DNS verification error details
      properties:
        dkim_record:
          type:
            - string
            - 'null'
          description: Found DKIM record value
          example: null
        cname_record:
          type:
            - string
            - 'null'
          description: Found CNAME record value
          example: null
        dkim_error:
          type:
            - string
            - 'null'
          description: DKIM verification error message
          example: DKIM record not found
        cname_error:
          type:
            - string
            - 'null'
          description: CNAME verification error message
          example: CNAME record not found
        dmarc_record:
          type:
            - string
            - 'null'
          description: Found DMARC record value.
          example: null
        dmarc_error:
          type:
            - string
            - 'null'
          description: DMARC verification error message.
          example: No DMARC record found for example.com or its parent domain.
        spf_record:
          type:
            - string
            - 'null'
          description: Found SPF record value.
          example: null
        spf_error:
          type:
            - string
            - 'null'
          description: SPF verification error message.
          example: null
    DmarcValidationResult:
      type: object
      description: DMARC validation result details.
      required:
        - is_valid
        - status
        - found_at_domain
        - record
        - policy
        - subdomain_policy
        - error
        - covered_by_parent_policy
      properties:
        is_valid:
          type: boolean
          description: Whether a valid DMARC record was found.
          example: false
        status:
          type: string
          description: DMARC validation status.
          enum:
            - valid
            - invalid
            - missing
            - unverified
          example: missing
        found_at_domain:
          type:
            - string
            - 'null'
          description: >-
            Domain where the DMARC record was located (may be a parent domain
            for subdomains).
          example: null
        record:
          type:
            - string
            - 'null'
          description: Raw DMARC record value.
          example: null
        policy:
          type:
            - string
            - 'null'
          description: DMARC policy tag (`p=`).
          enum:
            - none
            - quarantine
            - reject
            - null
          example: null
        subdomain_policy:
          type:
            - string
            - 'null'
          description: DMARC subdomain policy tag (`sp=`), if present.
          enum:
            - none
            - quarantine
            - reject
            - null
          example: null
        error:
          type:
            - string
            - 'null'
          description: Validation error message, if any.
          example: No DMARC record found for example.com or its parent domain.
        covered_by_parent_policy:
          type: boolean
          description: >-
            Whether this domain is covered by the parent domain's subdomain
            policy.
          example: false
    SpfValidationResult:
      type: object
      description: SPF validation result details.
      required:
        - is_valid
        - status
        - record
        - error
        - includes_sparkpost
      properties:
        is_valid:
          type: boolean
          description: Whether a valid SPF record was found that authorises SparkPost.
          example: false
        status:
          type: string
          description: SPF validation status.
          enum:
            - valid
            - invalid
            - missing
            - unverified
          example: unverified
        record:
          type:
            - string
            - 'null'
          description: Raw SPF record value.
          example: null
        error:
          type:
            - string
            - 'null'
          description: Validation error message, if any.
          example: null
        includes_sparkpost:
          type: boolean
          description: Whether the SPF record authorises `_spf.sparkpostmail.com`.
          example: false
  responses:
    UnauthorizedError:
      description: Unauthorized - Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthorizedResponse'
          examples:
            missing_key:
              summary: Missing API key
              value:
                message: API key is required.
            invalid_key:
              summary: Invalid API key
              value:
                message: Invalid API key.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key for authentication

````