# Add dns records

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v2/dns:
    post:
      summary: Add dns records
      deprecated: false
      description: >
        Add DNS Records for a given domain.


        | Name               | Type     | Description |

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

        | `assignedDomainId` | `string` | The unique identifier for the domain
        to which DNS records are assigned. (domainId)|

        | `records`         | `array`  | A list of DNS records associated with
        the domain. |


        ### `records` Array Structure


        | Name        | Type     | Description |

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

        | `host`      | `string` | The domain or subdomain for which the DNS
        record applies. |

        | `value`     | `string` | The corresponding value of the DNS record,
        such as an IP address or another domain. |

        | `recordType` | `string` | The type of DNS record (e.g., `A`, `CNAME`,
        `MX`, `TXT`). |
      tags:
        - dns
      parameters:
        - name: x-auth-zapmail
          in: header
          description: ''
          required: true
          example: ''
          schema:
            type: string
        - name: x-workspace-key
          in: header
          description: ''
          required: false
          example: ''
          schema:
            type: string
        - name: ' x-service-provider'
          in: header
          description: ''
          required: false
          example: ''
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                assignedDomainId:
                  type: string
                records:
                  type: array
                  items:
                    type: object
                    properties:
                      host:
                        type: string
                      value:
                        type: string
                      recordType:
                        type: string
                    required:
                      - host
                      - value
                      - recordType
                    x-apidog-orders:
                      - host
                      - value
                      - recordType
              required:
                - assignedDomainId
                - records
              x-apidog-orders:
                - assignedDomainId
                - records
            example:
              assignedDomainId: f47ac10b-58cc-4372-a567-0e02b2c3d479
              records:
                - host: '@'
                  value: 203.0.113.1
                  recordType: A
                - host: blog
                  value: example.com
                  recordType: CNAME
                - host: _dmarc
                  value: v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com
                  recordType: TXT
                - host: '@'
                  value: 2001:db8::1
                  recordType: AAAA
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                status: 200
                message: Dns records added successfully
                data:
                  - id: 11111111-1111-1111-1111-111111111111
                    value: 123.123.123.123
                    host: dummy.com
                    recordType: A
                    assignedDomainId: 22222222-2222-2222-2222-222222222222
                    cdfRecordId: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                    cdfResponse:
                      id: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                      name: dummy.com.dns-records.test
                      type: A
                      content: 123.123.123.123
                    priority: null
                    createdAt: '2025-01-31T09:03:21.984Z'
                    updatedAt: '2025-01-31T09:03:21.984Z'
                    deletedAt: null
                  - id: 33333333-3333-3333-3333-333333333333
                    value: dummy-mailserver.com
                    host: mail.dummy.com
                    recordType: CNAME
                    assignedDomainId: 22222222-2222-2222-2222-222222222222
                    cdfRecordId: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                    cdfResponse:
                      id: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                      name: mail.dummy.com.dns-records.test
                      type: CNAME
                      content: dummy-mailserver.com
                    priority: null
                    createdAt: '2025-01-31T09:03:21.984Z'
                    updatedAt: '2025-01-31T09:03:21.984Z'
                    deletedAt: null
          headers: {}
          x-apidog-name: Success
        '400':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  message:
                    type: string
                  errorId:
                    type: string
                required:
                  - status
                  - message
                  - errorId
                x-apidog-orders:
                  - status
                  - message
                  - errorId
              example:
                status: 400
                message: Domain is not registered
                errorId: 8ff1a67f-dd40-4c09-9281-0f7f2910c81b
          headers: {}
          x-apidog-name: Not registered
      security: []
      x-apidog-folder: dns
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/797058/apis/api-13629231-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.zapmail.ai/api
    description: Prod Env
security: []

```
