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

# Create Domain

> Creates and provisions a sending domain. Provisioning may be asynchronous while email infrastructure is being prepared.



## OpenAPI

````yaml /openapi.json post /domains
openapi: 3.1.0
info:
  title: Dugble API
  description: >-
    Programmatic access to Dugble email, SMS, sending infrastructure, contacts,
    audiences, suppressions, and broadcasts. Authenticate with a team token sent
    as a Bearer token.
  version: 1.0.0
  contact:
    name: Dugble Support
    email: support@dugble.com
servers:
  - url: https://api.dugble.com
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Email
    description: Send and manage transactional emails.
  - name: SMS
    description: Send and manage SMS messages.
  - name: Domains
    description: Manage and verify sending domains.
  - name: Templates
    description: Create, version, publish, preview, and test reusable email templates.
  - name: Sender IDs
    description: Manage SMS sender IDs.
  - name: Contacts
    description: Manage contacts and their audience memberships.
  - name: Contact Properties
    description: Manage typed custom property definitions used by contacts.
  - name: Topics
    description: Manage contact subscription topics.
  - name: Segments
    description: Manage audience segments.
  - name: Suppressions
    description: Manage suppressed email recipients.
  - name: Broadcasts
    description: Create, schedule, and analyze email broadcasts.
paths:
  /domains:
    post:
      tags:
        - Domains
      summary: Create Domain
      description: >-
        Creates and provisions a sending domain. Provisioning may be
        asynchronous while email infrastructure is being prepared.
      operationId: createDomain
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DomainCreateRequest'
            example:
              name: mail.example.com
              region: us-east-1
              tls: opportunistic
      responses:
        '201':
          description: Domain created and provisioned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DomainEnvelope'
        '202':
          description: Domain accepted while infrastructure provisioning completes.
          headers:
            Retry-After:
              description: Suggested delay before checking again.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProvisioningEnvelope'
        default:
          $ref: '#/components/responses/Error'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: Optional idempotency key for mutation requests. Maximum 256 characters.
      schema:
        type: string
        maxLength: 256
  schemas:
    DomainCreateRequest:
      type: object
      required:
        - name
        - region
      properties:
        name:
          type: string
          maxLength: 253
        region:
          type: string
          enum:
            - us-east-1
            - eu-north-1
        tls:
          type: string
          enum:
            - opportunistic
            - enforced
          default: opportunistic
      additionalProperties: false
    DomainEnvelope:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          $ref: '#/components/schemas/SenderDomain'
    ProvisioningEnvelope:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          $ref: '#/components/schemas/ProvisioningResponse'
    SenderDomain:
      type: object
      properties:
        id:
          type: string
          format: uuid
        team_id:
          type: string
          format: uuid
        name:
          type: string
        provider:
          type: string
        provider_account:
          type: string
        region:
          type: string
          enum:
            - us-east-1
            - eu-north-1
        provider_external_id:
          type: string
        status:
          type: string
          enum:
            - not_started
            - pending
            - verified
            - partially_verified
            - partially_failed
            - failed
            - temporary_failure
            - disabled
        provider_status:
          type: string
        records:
          type: array
          items:
            $ref: '#/components/schemas/VerificationRecord'
        tls:
          type: string
          enum:
            - opportunistic
            - enforced
        failure_reason:
          type: string
        health_status:
          type: string
          enum:
            - unknown
            - healthy
            - degraded
        consecutive_health_failures:
          type: integer
          format: int32
        last_checked_at:
          type: string
          format: date-time
        last_health_checked_at:
          type: string
          format: date-time
        last_health_failure_at:
          type: string
          format: date-time
        verified_at:
          type: string
          format: date-time
        disabled_at:
          type: string
          format: date-time
        created_by:
          type: string
          format: uuid
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ProvisioningResponse:
      type: object
      required:
        - status
        - message
        - retry_after_seconds
      properties:
        status:
          type: string
          enum:
            - provisioning
        message:
          type: string
        retry_after_seconds:
          type: integer
    ErrorEnvelope:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - BAD_REQUEST
                - UNAUTHORIZED
                - FORBIDDEN
                - STEP_UP_REQUIRED
                - NOT_FOUND
                - CONFLICT
                - PAYMENT_REQUIRED
                - PAYLOAD_TOO_LARGE
                - UNPROCESSABLE_ENTITY
                - TOO_MANY_REQUESTS
                - INTERNAL_ERROR
                - SERVICE_UNAVAILABLE
            message:
              type: string
    VerificationRecord:
      type: object
      required:
        - record
        - name
        - value
        - type
        - status
        - ttl
      properties:
        record:
          type: string
          enum:
            - DKIM
            - SPF
        name:
          type: string
        value:
          type: string
        type:
          type: string
          enum:
            - TXT
            - MX
        status:
          type: string
          enum:
            - pending
            - verified
            - failed
        ttl:
          type: string
        priority:
          type: integer
  responses:
    Error:
      description: >-
        The request failed. See the HTTP status and structured error code for
        the category.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Team token
      description: >-
        Pass a Dugble team token in the Authorization header as Bearer <token>.
        Team token secrets use the dgb_team_ prefix.

````