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

# Add Domain

> Connect a sending domain and get the DNS records to publish

Guide: [Senders and domains](https://docs.minimo.it/embedded/senders-and-sending.md). Errors: [Errors and limits](https://docs.minimo.it/embedded/errors.md).


## OpenAPI

````yaml post /public/v1/domains
openapi: 3.1.0
info:
  title: API Documentation
  description: Documentation for transactional and subscribe APIs
  version: 1.0.0
servers:
  - url: https://app.minimo.it
security:
  - bearerAuth: []
paths:
  /public/v1/domains:
    servers:
      - url: https://api.minimo.it
    post:
      summary: Add domain
      description: >-
        Connects a sending domain and returns the DNS records to publish, a CSV
        of them, the DNS provider and, when the provider supports it, a
        one-click setup link. Then call Verify Domain until `status` is
        `verified`.


        A default sender is added (`info@` for `transactional`, `hello@` for
        `marketing`). It can send once the domain is verified.
      operationId: addDomain
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                domain:
                  type: string
                  description: The domain, without scheme or path.
                  example: pizzeria-mario.example
                role:
                  type: string
                  enum:
                    - transactional
                    - marketing
                  default: transactional
                  description: >-
                    `transactional` for the main domain, `marketing` for a
                    campaigns subdomain such as `news.`.
              required:
                - domain
            example:
              domain: pizzeria-mario.example
      responses:
        '201':
          description: The domain and its records
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/CreatedDomain'
              example:
                data:
                  id: 812
                  domain: pizzeria-mario.example
                  role: transactional
                  status: pending
                  readyToSend: false
                  sesStatus: pending
                  lastCheckedAt: null
                  records:
                    - type: TXT
                      host: pizzeria-mario.example
                      value: mn-…
                      status: missing
                    - type: CNAME
                      host: abc123._domainkey.pizzeria-mario.example
                      value: abc123.dkim.amazonses.com
                      status: missing
                    - type: TXT
                      host: _dmarc.pizzeria-mario.example
                      value: v=DMARC1; p=none;
                      status: missing
                    - type: MX
                      host: bounce.pizzeria-mario.example
                      value: feedback-smtp.eu-central-1.amazonses.com
                      priority: 10
                      status: missing
                  csvDownloadUrl: >-
                    https://api.minimo.it/public/v1/domains/dns-records.csv?token=…
                  dnsProvider:
                    id: cloudflare
                    name: Cloudflare
                    nameservers:
                      - ada.ns.cloudflare.com
                      - bob.ns.cloudflare.com
                  domainConnect:
                    supported: true
                    providerName: Cloudflare, Inc.
                    oneClickUrl: https://dash.cloudflare.com/…
        '400':
          description: '`INVALID_PARAMETERS`: `domain` is missing or a field is not valid.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: >-
            `INVALID_TOKEN`: missing or wrong key, or a key without the
            **Domains** permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '409':
          description: >-
            The domain is already connected, here or in another workspace, or
            `DOMAIN_LIMIT_REACHED`: your workspace has the most sending domains
            it can have.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - bearerAuth: []
      x-codeSamples:
        - label: cURL
          lang: bash
          source: |-
            curl --request POST \
              --url 'https://api.minimo.it/public/v1/domains' \
              --header 'Authorization: Bearer YOUR_MINIMO_KEY' \
              --header 'Content-Type: application/json' \
              --data '{"domain": "pizzeria-mario.example"}'
        - lang: JavaScript
          source: |-
            const res = await fetch('https://api.minimo.it/public/v1/domains', {
              method: 'POST',
              headers: {
                Authorization: 'Bearer YOUR_MINIMO_KEY',
                'Content-Type': 'application/json',
              },
              body: JSON.stringify({"domain": "pizzeria-mario.example"}),
            });
            const { data } = await res.json();
            console.log(data);
        - lang: Python
          source: |-
            import requests

            res = requests.post(
                'https://api.minimo.it/public/v1/domains',
                headers={'Authorization': 'Bearer YOUR_MINIMO_KEY'},
                json={"domain": "pizzeria-mario.example"},
            )
            print(res.status_code, res.text)
components:
  schemas:
    CreatedDomain:
      type: object
      properties:
        id:
          type: integer
          example: 812
        domain:
          type: string
          example: pizzeria-mario.example
        role:
          type: string
          enum:
            - transactional
            - marketing
          description: >-
            `transactional`: the main domain (default sender `info@`).
            `marketing`: a subdomain for campaigns such as `news.` (default
            sender `hello@`).
        status:
          type: string
          enum:
            - verified
            - pending
            - failed
          description: >-
            `verified`: the domain can send. `pending`: waiting for the DNS
            records. `failed`: the records were missing for about 72 hours: fix
            them and call Verify Domain again.
        readyToSend:
          type: boolean
          description: '`true` when emails can go out from this domain now.'
        sesStatus:
          type: string
          nullable: true
          description: Raw status from the email provider, for debugging.
          example: pending
        lastCheckedAt:
          type: string
          nullable: true
          format: date-time
          description: Last check.
        records:
          type: array
          items:
            $ref: '#/components/schemas/DnsRecord'
          description: The DNS records to publish.
        csvDownloadUrl:
          type: string
          description: >-
            Public link (no login, about 7 days) to a CSV of the records, to
            forward to whoever manages the DNS.
        dnsProvider:
          type: object
          nullable: true
          description: The DNS provider found for the domain.
          properties:
            id:
              type: string
              example: cloudflare
            name:
              type: string
              example: Cloudflare
            nameservers:
              type: array
              items:
                type: string
        domainConnect:
          type: object
          properties:
            supported:
              type: boolean
              description: Whether the provider supports one-click setup (Domain Connect).
            providerName:
              type: string
              example: Cloudflare, Inc.
            oneClickUrl:
              type: string
              description: Link the domain owner opens to add every record in one click.
          required:
            - supported
      required:
        - id
        - domain
        - role
        - status
        - readyToSend
        - sesStatus
        - lastCheckedAt
        - records
        - csvDownloadUrl
        - dnsProvider
        - domainConnect
    ApiError:
      type: object
      properties:
        status:
          type: string
          example: FAIL
        message:
          type: string
          description: The error code to test in your code.
          example: INVALID_PARAMETERS
        userMessage:
          type: string
          description: >-
            When present, a sentence that says what to fix. You can show or log
            it.
          example: Set the origins allowed to embed the widgets first.
      description: >-
        Every error has this shape. See [Errors and limits](/embedded/errors)
        for every code.
    DnsRecord:
      type: object
      properties:
        type:
          type: string
          enum:
            - TXT
            - CNAME
            - MX
        host:
          type: string
          example: abc123._domainkey.pizzeria-mario.example
        value:
          type: string
          example: abc123.dkim.amazonses.com
        priority:
          type: integer
          description: MX only.
          example: 10
        status:
          type: string
          enum:
            - verified
            - missing
            - unknown
          description: >-
            `verified`: found with the right value. `missing`: not found or a
            different value. `unknown`: not checked yet.
      required:
        - type
        - host
        - value
        - status
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: mn-API_CLIENT_ID-API_KEY

````

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