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

# Add DNS Record

> Add a DNS record to a domain bought in Migma, for example Google Workspace MX records, a site-verification TXT, or an A record pointing a subdomain at a server. Migma's email sending records are protected and managed automatically, duplicate SPF or DMARC records are refused, the root and www names are reserved for domain forwarding, and each domain is capped at 50 records. Returns 404 if the domain's DNS zone is not hosted by Migma. Requires API key with domain:write permission.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/domains/{domain}/dns-records
openapi: 3.1.0
info:
  title: Migma.ai API (v1)
  description: >-
    API for managing brands, contacts, email generation, sending, and
    integrations.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.migma.ai
    description: Production
security:
  - apiKeyAuth: []
tags:
  - name: Projects/Brands
    description: Manage projects (brands) and import from websites
  - name: Contacts
    description: Manage your contacts, segments, tags, and topics
  - name: Segments
    description: Create and manage dynamic contact segments
  - name: Tags
    description: Organize contacts with tags
  - name: Topics
    description: Manage subscription topics and preferences
  - name: Emails
    description: Generate, send, and export emails
  - name: Email Validation
    description: Validate email content for compatibility and deliverability
  - name: Email Previews
    description: Preview emails across devices and email clients
  - name: Domains
    description: Manage sending domains and verification
  - name: Webhooks
    description: Manage webhook endpoints for real-time event notifications
  - name: Events
    description: Record customer events and conversions
  - name: Integrations
    description: Third-party platform integrations
  - name: Campaigns
    description: Create, schedule, send, and manage email campaigns
  - name: Billing
    description: View your plan and credits and create billing links
  - name: Project Editing
    description: Edit project assets, logos, images, and knowledge base entries
paths:
  /v1/domains/{domain}/dns-records:
    post:
      tags:
        - Domains
      summary: Add DNS Record
      description: >-
        Add a DNS record to a domain bought in Migma, for example Google
        Workspace MX records, a site-verification TXT, or an A record pointing a
        subdomain at a server. Migma's email sending records are protected and
        managed automatically, duplicate SPF or DMARC records are refused, the
        root and www names are reserved for domain forwarding, and each domain
        is capped at 50 records. Returns 404 if the domain's DNS zone is not
        hosted by Migma. Requires API key with domain:write permission.
      operationId: AddDnsRecord
      parameters:
        - name: domain
          in: path
          description: The domain, e.g. 'acme.io'
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddDnsRecordRequest'
      responses:
        '201':
          description: DNS record created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponseDnsRecordCreated'
              example:
                success: true
                data:
                  record:
                    id: rec_abc123
                    type: TXT
                    name: '@'
                    content: google-site-verification=abc123
                    createdAt: '2026-08-20T12:00:00.000Z'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    AddDnsRecordRequest:
      type: object
      required:
        - name
        - content
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 253
          description: >-
            Record name. '@' for the root domain, a label like 'mail', or a full
            name. Root and www are reserved for domain forwarding.
        content:
          type: string
          minLength: 1
          maxLength: 2048
          description: Record value, e.g. an IP address, hostname, or TXT content
        type:
          type: string
          enum:
            - A
            - AAAA
            - CNAME
            - MX
            - TXT
            - NS
          default: TXT
          description: DNS record type
        priority:
          type: integer
          minimum: 0
          maximum: 65535
          description: Priority for MX records
    ApiResponseDnsRecordCreated:
      allOf:
        - $ref: '#/components/schemas/ApiResponse'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/DnsRecordCreatedData'
    ApiResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          nullable: true
        error:
          type: string
          nullable: true
      required:
        - success
    DnsRecordCreatedData:
      type: object
      properties:
        record:
          $ref: '#/components/schemas/CustomDnsRecord'
      required:
        - record
    ApiError:
      type: object
      properties:
        success:
          type: boolean
          default: false
        error:
          type: string
        code:
          type: string
          description: >-
            Machine-readable error code (e.g., IDEMPOTENCY_CONFLICT,
            DOMAIN_CLAIMABLE).
        data:
          type: object
          description: >-
            Additional structured context for the error, such as the affected
            domain.
          additionalProperties: true
      required:
        - success
        - error
    CustomDnsRecord:
      type: object
      properties:
        id:
          type: string
          description: Record id, used to remove the record
        type:
          type: string
          enum:
            - A
            - AAAA
            - CNAME
            - MX
            - TXT
            - NS
          description: DNS record type
        name:
          type: string
          description: >-
            Record name. '@' for the root domain, a label like 'mail', or a full
            name
        content:
          type: string
          description: Record value, e.g. an IP address, hostname, or TXT content
        priority:
          type: number
          description: Priority, set on MX records
        createdAt:
          type: string
          description: When the record was added (ISO 8601)
      required:
        - id
        - type
        - name
        - content
        - createdAt
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Forbidden:
      description: Forbidden - Missing required permissions or access denied
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where
        YOUR_API_KEY is obtained from the Migma dashboard under Settings →
        Developers → API Keys.

````