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

# Add a Domain

> Add a sending domain to your account and get the DNS records to publish at your DNS provider. The domain goes through exactly the same checks as **Account Settings → Domains** in the app (format, blocked and ISP domains, subdomain depth, duplicates and your plan's domain limit), and the same DNS records are generated.

After adding the records at your DNS provider, verify the domain from **Account Settings → Domains**.

**Notes**
- The domain is case-insensitive and a leading `www.` is removed (`WWW.Example.com` is saved as `example.com`).
- Subdomains up to 3 levels below the root are allowed (`news.example.com`, `a.b.c.example.com`).
- Adding a domain can take a few seconds while its DNS is checked.



## OpenAPI

````yaml /openapi-v1.json post /domains
openapi: 3.1.0
info:
  title: Mailercloud Marketing API
  version: 1.0.0
  description: >-
    Campaigns, contacts, lists, segments, automations, and webhooks for the
    Mailercloud Marketing Platform.
servers:
  - url: https://cloudapi.mailercloud.com/v1
security:
  - apiKey: []
tags:
  - name: Campaigns
  - name: Contacts
  - name: Lists
  - name: Tags
  - name: Segments
  - name: Custom Properties
  - name: Senders
  - name: Domains
  - name: Templates
  - name: Automations
  - name: Webhooks
  - name: Webforms
  - name: Inbox Tracker
  - name: Account
paths:
  /domains:
    post:
      tags:
        - Domains
      summary: Add a Domain
      description: >-
        Add a sending domain to your account and get the DNS records to publish
        at your DNS provider. The domain goes through exactly the same checks as
        **Account Settings → Domains** in the app (format, blocked and ISP
        domains, subdomain depth, duplicates and your plan's domain limit), and
        the same DNS records are generated.


        After adding the records at your DNS provider, verify the domain from
        **Account Settings → Domains**.


        **Notes**

        - The domain is case-insensitive and a leading `www.` is removed
        (`WWW.Example.com` is saved as `example.com`).

        - Subdomains up to 3 levels below the root are allowed
        (`news.example.com`, `a.b.c.example.com`).

        - Adding a domain can take a few seconds while its DNS is checked.
      operationId: add-a-domain
      parameters:
        - name: Content-Type
          in: header
          required: true
          description: Request body type
          schema:
            type: string
            default: application/json
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - domain
              properties:
                domain:
                  type: string
                  description: >-
                    The domain or subdomain to send from.


                    Minimum: 3

                    Maximum: 100


                    Letters, digits, `-` and `.` only; a label must not start or
                    end with `-`, and the last label must start with a letter.
                  minLength: 3
                  maxLength: 100
            examples:
              Domain:
                value:
                  domain: example.com
              Subdomain:
                value:
                  domain: news.example.com
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        description: Domain ID
                      domainName:
                        type: string
                        description: The domain as saved (lowercased, without `www.`)
                      addedMainDomain:
                        type: string
                      dmarc:
                        type: string
                      domainDetails:
                        type: array
                        description: DNS records to add at your DNS provider.
                        items:
                          type: object
                          properties:
                            data:
                              type: string
                              description: >-
                                Record purpose: `track` (tracking), `dkim`,
                                `dkim2`, `img` (images), `dmarc`, `haproxyval`
                                (CAA — only when your existing CAA record would
                                block certificate issuance)
                            type:
                              type: string
                              description: '`CNAME`, `TXT` or `CAA`'
                            name:
                              type: string
                              description: Host / name of the record
                            value:
                              type: string
                              description: Value of the record
                            show:
                              type: integer
                              description: '`1` = add this record'
                            dnsStatus:
                              type: string
                              description: >-
                                `2` = a conflicting record already exists (for
                                example more than one DMARC record)
              examples:
                Example-1:
                  value:
                    message: >-
                      The record of example.com successfully added to the
                      ClouDns server, and domain created
                    data:
                      id: zjAKXb
                      domainName: example.com
                      addedMainDomain: example.com
                      domainDetails:
                        - data: track
                          type: CNAME
                          name: mc.example.com
                          value: mc3035n.mlrcloud.com
                          show: 1
                        - data: dkim
                          type: CNAME
                          name: k1._domainkey.example.com
                          value: dkim.mlrcloud.com
                          show: 1
                        - data: dkim2
                          type: CNAME
                          name: k2._domainkey.example.com
                          value: dkim2.mlrcloud.com
                          show: 1
                        - data: img
                          type: CNAME
                          name: img3035n.example.com
                          value: img3035n.mlrcloud.com
                          show: 1
                        - data: dmarc
                          type: TXT
                          name: _dmarc.example.com
                          value: >-
                            v=DMARC1; p=reject; sp=none; adkim=s; aspf=s;
                            rua=mailto:dmarc@mlrcloud.com;
                            ruf=mailto:dmarc@mlrcloud.com;
                          show: 1
        '400':
          description: Bad Request — invalid input or the domain was refused
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                        message:
                          type: string
              examples:
                Invalid domain:
                  value:
                    message: Invalid domain
                Already exists:
                  value:
                    message: Your domain example.com already exists
                Already authenticated:
                  value:
                    message: Your domain example.com already authenticated
                ISP or disposable domain:
                  value:
                    message: >-
                      Sorry! We block some major ISP domains due to their DMARC
                      policy
                Blocked domain:
                  value:
                    message: >-
                      Our anti-spam monitoring system blocked your domain. To be
                      de-listed, contact us at support@mailercloud.com.
                Contains mailercloud:
                  value:
                    message: Domain cannot contain mailercloud
                Too many subdomain levels:
                  value:
                    message: Domain addition was unsuccessful due to domain hierarchy
                Plan limit:
                  value:
                    message: >-
                      Free plan users can add only 1 domain. To add more
                      domains, please upgrade your plan.
                In use by another account:
                  value:
                    message: >-
                      The domain is already in use with another account. Please
                      contact our support team for further assistance.
                Missing body:
                  value:
                    errors:
                      - field: ''
                        message: Invalid input
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                        message:
                          type: string
              examples:
                Example-1:
                  value:
                    errors:
                      - field: ''
                        message: Authorization failed
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              examples:
                Example-1:
                  value:
                    message: Too Many Requests
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              examples:
                Example-1:
                  value:
                    message: >-
                      Sorry, we are experiencing some technical difficulties.
                      Please try after some time.
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Your Mailercloud API key (plain text, no Bearer prefix). Create keys in
        Settings → API.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.