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

# Add a mailbox domain

> Creates a new domain and returns the DNS records the customer must place before verification can succeed. `send_only` configures outbound sending without changing MX records. `send_receive` also configures the domain for hosted mailboxes. Provisioning touches our email platform and Amazon SES; on any failure the partial state is automatically rolled back.

Supply an `Idempotency-Key` header (any unique string, max 255 chars) to safely retry on network errors. Replays with the same key return the original response; replays with a different body return `409 idempotency_conflict`.



## OpenAPI

````yaml /openapi-app.json post /domains
openapi: 3.1.0
info:
  description: Programmatic access to your Sendmux email infrastructure.
  title: Sendmux API
  version: 1.0.0
servers:
  - description: API v1
    url: https://app.sendmux.ai/api/v1
security:
  - bearerAuth: []
paths:
  /domains:
    post:
      tags:
        - Domains
      summary: Add a mailbox domain
      description: >-
        Creates a new domain and returns the DNS records the customer must place
        before verification can succeed. `send_only` configures outbound sending
        without changing MX records. `send_receive` also configures the domain
        for hosted mailboxes. Provisioning touches our email platform and Amazon
        SES; on any failure the partial state is automatically rolled back.


        Supply an `Idempotency-Key` header (any unique string, max 255 chars) to
        safely retry on network errors. Replays with the same key return the
        original response; replays with a different body return `409
        idempotency_conflict`.
      operationId: managementCreateDomain
      parameters:
        - in: header
          name: Idempotency-Key
          required: false
          schema:
            description: >-
              Client-chosen unique key to safely retry the request. Cached for
              24h per (team, endpoint, key). Different body with same key
              returns 409 idempotency_conflict.
            example: domains-create-20260424-001
            maxLength: 255
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                domain:
                  description: >-
                    Fully qualified domain name. Must be lowercased and
                    domain-only (no scheme).
                  example: mail.acme.com
                  type: string
                mode:
                  description: Domain usage mode. Defaults to `send_receive` when omitted.
                  enum:
                    - send_only
                    - send_receive
                  example: send_only
                  type: string
              required:
                - domain
              type: object
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainItemResponse'
          description: >-
            Domain created. The response carries a `Location` header pointing at
            the canonical GET URL for the new domain.
          headers:
            Location:
              description: Canonical GET URL for the newly created domain.
              schema:
                example: /api/v1/domains/mdom_clxxxxxxxxxxxxxxxxxxxxxxxxx
                type: string
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Invalid request body
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: >-
            Domain already in use, or `Idempotency-Key` was replayed with a
            different body.
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Request body too large
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: SES tenant not yet provisioned for this team
      security:
        - bearerAuth: []
components:
  schemas:
    DomainItemResponse:
      allOf:
        - $ref: '#/components/schemas/SuccessEnvelope'
        - properties:
            data:
              $ref: '#/components/schemas/MailboxDomain'
            meta:
              $ref: '#/components/schemas/ResponseMeta'
          required:
            - data
          type: object
      unevaluatedProperties: false
    ApiError:
      additionalProperties: false
      properties:
        error:
          additionalProperties: false
          properties:
            code:
              description: Machine-readable error code
              enum:
                - invalid_parameter
                - missing_parameter
                - authentication_required
                - insufficient_permissions
                - not_found
                - conflict
                - limit_exceeded
                - idempotency_conflict
                - payload_too_large
                - validation_error
                - rate_limit_exceeded
                - service_unavailable
                - internal_error
              example: invalid_parameter
              type: string
            doc_url:
              description: Link to relevant documentation
              type: string
            errors:
              description: >-
                Accumulated per-field issues for validation errors. Only present
                on 400/422 responses.
              items:
                $ref: '#/components/schemas/ApiErrorDetail'
              type: array
            message:
              description: Human-readable error description
              type: string
            param:
              description: The parameter that caused the error
              type: string
            retryable:
              description: >-
                Whether the caller may safely retry this request. 4xx are
                typically false (except 429); 5xx are typically true.
              example: false
              type: boolean
          required:
            - code
            - message
            - retryable
          type: object
        meta:
          additionalProperties: false
          properties:
            request_id:
              example: req_clxxxxxxxxxxxxxxxxxxxxxxxxx
              type: string
          required:
            - request_id
          type: object
        ok:
          enum:
            - false
          type: boolean
      required:
        - ok
        - error
        - meta
      type: object
    SuccessEnvelope:
      properties:
        meta:
          additionalProperties: {}
          properties: {}
          type: object
        ok:
          enum:
            - true
          type: boolean
      required:
        - ok
        - meta
      type: object
    MailboxDomain:
      additionalProperties: false
      properties:
        created_at:
          description: ISO 8601 creation timestamp
          type: string
        dns_records:
          $ref: '#/components/schemas/MailboxDomainDnsRecords'
        domain:
          description: Fully qualified domain name
          example: mail.acme.com
          type: string
        id:
          description: Public ID
          example: mdom_clxxxxxxxxxxxxxxxxxxxxxxxxx
          type: string
        mailbox_count:
          description: Active mailboxes currently using this domain
          example: 14
          minimum: 0
          type: integer
        mode:
          description: >-
            `send_only` verifies outbound DNS only. `send_receive` also verifies
            MX records and can host mailboxes.
          enum:
            - send_only
            - send_receive
          example: send_receive
          type: string
        ses_dkim_status:
          description: >-
            Amazon SES DKIM status
            (pending/success/failed/temporary_failure/not_started)
          type:
            - string
            - 'null'
        ses_mail_from_status:
          description: >-
            Amazon SES MAIL FROM status
            (pending/success/failed/temporary_failure/not_started)
          type:
            - string
            - 'null'
        verification_status:
          description: Current verification state
          enum:
            - pending
            - verified
            - failed
          type: string
        verified_at:
          description: ISO 8601 timestamp of last successful verification
          type:
            - string
            - 'null'
      required:
        - id
        - domain
        - mode
        - verification_status
        - ses_dkim_status
        - ses_mail_from_status
        - verified_at
        - created_at
        - mailbox_count
        - dns_records
      type: object
    ResponseMeta:
      additionalProperties: false
      properties:
        request_id:
          example: req_clxxxxxxxxxxxxxxxxxxxxxxxxx
          type: string
      required:
        - request_id
      type: object
    ApiErrorDetail:
      additionalProperties: false
      properties:
        code:
          description: >-
            Machine-readable issue code from the validator (e.g. zod issue
            code).
          example: invalid_string
          type: string
        field:
          description: Dot-path of the offending request field.
          example: recipient.email
          type: string
        message:
          description: Human-readable issue description.
          type: string
      required:
        - field
        - code
        - message
      type: object
    MailboxDomainDnsRecords:
      additionalProperties: false
      properties:
        dkim:
          description: Three Amazon SES DKIM CNAME records
          items:
            $ref: '#/components/schemas/MailboxDomainNameValueRecord'
          type: array
        dmarc:
          allOf:
            - $ref: '#/components/schemas/MailboxDomainNameValueRecord'
            - description: DMARC enforcement record (quarantine, no reporting)
        mail_from:
          $ref: '#/components/schemas/MailboxDomainMailFromRecords'
        mx:
          description: >-
            MX records the customer must place. All point at Sendmux's inbound
            mail servers.
          items:
            $ref: '#/components/schemas/MailboxDomainMxRecord'
          type: array
        spf:
          allOf:
            - $ref: '#/components/schemas/MailboxDomainNameValueRecord'
            - description: SPF TXT record covering Amazon SES sending
        verification:
          allOf:
            - $ref: '#/components/schemas/MailboxDomainNameValueRecord'
            - description: Ownership-proof TXT record (Sendmux-specific)
      required:
        - mx
        - mail_from
        - spf
        - dmarc
        - dkim
        - verification
      type: object
    MailboxDomainNameValueRecord:
      additionalProperties: false
      description: SPF TXT record for the custom MAIL FROM subdomain
      properties:
        name:
          example: _sendmux.acme.com
          type: string
        value:
          example: sendmux-verify=team_abc123
          type: string
      required:
        - name
        - value
      type: object
    MailboxDomainMailFromRecords:
      additionalProperties: false
      description: Custom MAIL FROM records for Amazon SES bounce handling
      properties:
        mx:
          $ref: '#/components/schemas/MailboxDomainNamedMxRecord'
        spf:
          $ref: '#/components/schemas/MailboxDomainNameValueRecord'
      required:
        - mx
        - spf
      type: object
    MailboxDomainMxRecord:
      additionalProperties: false
      properties:
        priority:
          example: 10
          type: integer
        target:
          example: mail.sendmux.ai
          type: string
      required:
        - priority
        - target
      type: object
    MailboxDomainNamedMxRecord:
      additionalProperties: false
      description: MX record for Amazon SES bounce handling
      properties:
        name:
          example: bounce.acme.com
          type: string
        priority:
          example: 10
          type: integer
        target:
          example: feedback-smtp.eu-central-1.amazonses.com
          type: string
      required:
        - name
        - priority
        - target
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: API Key
      description: >-
        Sendmux API key. Use a root API key for Management API routes, or a
        mailbox credential for Mailbox API routes. Obtain keys from the
        dashboard under API Keys.
      scheme: bearer
      type: http

````