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

# Create domain

> Add a sending domain and return required DNS records. Does not publish DNS at your provider.

Required permission: `domains:write`.



## OpenAPI

````yaml /openapi.json post /domains
openapi: 3.1.0
info:
  title: Moonemail API
  version: 0.1.0
  description: >-
    Generated request, response and authorization contract. Covers authenticated
    product endpoints, not public discovery, dashboard assets or Stripe inbound
    webhooks. Go handlers enforce state-dependent and cross-field business
    validation.
servers:
  - url: https://api.moonemail.co
security: []
paths:
  /domains:
    post:
      tags:
        - Domains
      summary: Create domain
      description: >-
        Add a sending domain and return required DNS records. Does not publish
        DNS at your provider.


        Required permission: `domains:write`.
      operationId: create_domain
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 3
                  maxLength: 253
                region:
                  type: string
                  const: ap-southeast-2
                custom_return_path:
                  type: string
                  minLength: 1
                  maxLength: 63
                  pattern: ^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$
                open_tracking:
                  type: boolean
                click_tracking:
                  type: boolean
                tracking_subdomain:
                  type: string
                  minLength: 1
                  maxLength: 63
                  pattern: ^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$
                tls:
                  type: string
                  enum:
                    - opportunistic
                    - enforced
              required:
                - name
              additionalProperties: false
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  status:
                    type: string
                    enum:
                      - not_started
                      - pending
                      - verified
                      - failed
                      - temporary_failure
                  created_at:
                    type: string
                  region:
                    type: string
                  object:
                    type: string
                    const: domain
                  open_tracking:
                    type: boolean
                  click_tracking:
                    type: boolean
                  tracking_subdomain:
                    type:
                      - string
                      - 'null'
                  custom_return_path:
                    type: string
                  tls:
                    type: string
                    enum:
                      - opportunistic
                      - enforced
                  capabilities:
                    type: object
                    properties:
                      sending:
                        type: string
                        enum:
                          - enabled
                          - disabled
                      receiving:
                        type: string
                        enum:
                          - enabled
                          - disabled
                    required:
                      - sending
                      - receiving
                    additionalProperties: true
                  records:
                    type: array
                    items:
                      type: object
                      properties:
                        record:
                          type: string
                          enum:
                            - DKIM
                            - SPF
                            - DMARC
                            - Tracking
                        name:
                          type: string
                        type:
                          type: string
                          enum:
                            - TXT
                            - MX
                            - CNAME
                        ttl:
                          type: string
                          const: Auto
                        status:
                          type: string
                          enum:
                            - not_started
                            - pending
                            - verified
                            - failed
                            - temporary_failure
                        value:
                          type: string
                        priority:
                          type: integer
                      required:
                        - record
                        - name
                        - type
                        - ttl
                        - status
                        - value
                      additionalProperties: true
                required:
                  - id
                  - name
                  - status
                  - created_at
                  - region
                  - object
                  - open_tracking
                  - click_tracking
                  - tracking_subdomain
                  - custom_return_path
                  - tls
                  - capabilities
                  - records
                additionalProperties: true
        default:
          description: API error
          content:
            application/json:
              schema:
                type: object
                required:
                  - statusCode
                  - name
                  - message
                properties:
                  statusCode:
                    type: integer
                  name:
                    type: string
                  message:
                    type: string
      security:
        - bearerKey: []
components:
  securitySchemes:
    bearerKey:
      type: http
      scheme: bearer
      description: Moonemail API key; x-required-scope applies.

````

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