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

# Create Mailgun Domain

> Create a new Mailgun domain for the tenant.
Registers the domain with Mailgun and returns the required DNS records.



## OpenAPI

````yaml post /admin/mailgun-domain
openapi: 3.1.0
info:
  title: Decoda API
  description: External API documentation for the Decoda Health platform.
  version: '1.0'
servers: []
security: []
paths:
  /admin/mailgun-domain:
    post:
      tags:
        - provider
        - admin
        - settings
      summary: Create Mailgun Domain
      description: |-
        Create a new Mailgun domain for the tenant.
        Registers the domain with Mailgun and returns the required DNS records.
      operationId: create_mailgun_domain_admin_mailgun_domain_post
      parameters:
        - name: TENANT
          in: header
          required: true
          schema:
            type: string
            title: Tenant
          description: The tenant you are making this request on behalf of
        - name: API-KEY
          in: header
          required: true
          schema:
            type: string
            title: Api-Key
          description: Your api key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MailgunDomainCreate'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MailgunDomainDetail'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    MailgunDomainCreate:
      properties:
        domainName:
          type: string
          title: Domainname
          description: The domain name to register (e.g., mail.example.com)
      type: object
      required:
        - domainName
      title: MailgunDomainCreate
      description: Request body for creating a new Mailgun domain.
    MailgunDomainDetail:
      properties:
        id:
          type: string
          title: Id
        tenantSubDomain:
          type: string
          title: Tenantsubdomain
        domainName:
          type: string
          title: Domainname
        state:
          $ref: '#/components/schemas/MailgunDomainState'
        smtpLogin:
          anyOf:
            - type: string
            - type: 'null'
          title: Smtplogin
        dnsRecords:
          anyOf:
            - $ref: '#/components/schemas/MailgunDNSRecords'
            - type: 'null'
        isSendingVerified:
          type: boolean
          title: Issendingverified
        isReceivingVerified:
          type: boolean
          title: Isreceivingverified
        createdDate:
          type: string
          format: date-time
          title: Createddate
        updatedDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updateddate
        verifiedDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Verifieddate
      type: object
      required:
        - id
        - tenantSubDomain
        - domainName
        - state
        - isSendingVerified
        - isReceivingVerified
        - createdDate
      title: MailgunDomainDetail
      description: Full details of a Mailgun domain.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MailgunDomainState:
      type: string
      enum:
        - UNVERIFIED
        - ACTIVE
        - DISABLED
      title: MailgunDomainState
    MailgunDNSRecords:
      properties:
        sendingDnsRecords:
          items:
            $ref: '#/components/schemas/MailgunDNSRecord'
          type: array
          title: Sendingdnsrecords
        receivingDnsRecords:
          items:
            $ref: '#/components/schemas/MailgunDNSRecord'
          type: array
          title: Receivingdnsrecords
        dmarcDnsRecords:
          items:
            $ref: '#/components/schemas/MailgunDNSRecord'
          type: array
          title: Dmarcdnsrecords
      type: object
      title: MailgunDNSRecords
      description: DNS records grouped by purpose.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    MailgunDNSRecord:
      properties:
        recordType:
          type: string
          title: Recordtype
        name:
          type: string
          title: Name
        value:
          type: string
          title: Value
        priority:
          anyOf:
            - type: string
            - type: 'null'
          title: Priority
        valid:
          type: string
          enum:
            - valid
            - unknown
          title: Valid
      type: object
      required:
        - recordType
        - name
        - value
        - valid
      title: MailgunDNSRecord
      description: A single DNS record required for Mailgun domain verification.

````