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

# Add Domain

> Adds a domain to a workspace and returns the 2 nameservers you need to add as NS records for it at your DNS provider. Connecting a domain takes 3 steps:

1. Add the domain with this request.
2. Add the returned `nameservers` as NS records at your DNS provider, then call `Check Domain Nameservers` until its `state` is `verified`. DNS changes can take a while to propagate.
3. Call `Start Domain Setup` to create the domain's email accounts. Setup runs in the background; `setup_complete` becomes true once it's done and the domain moves into warmup.

Returns `403` if the workspace has reached its domain limit.



## OpenAPI

````yaml /openapi-v1.yml post /api/v1/domain/
openapi: 3.1.1
info:
  title: DeliverymanAI API V1
  version: 1.0.0
  description: >-
    API documentation for version 1 of the DeliverymanAI API. These endpoints
    drive campaigns, contact lists, leads and email sequences from your own
    code.


    V1 and V2 share the same API keys, sent in the `X-Api-Key` header.
servers:
  - url: https://api.deliveryman.ai
    description: Deliveryman API Server
security: []
paths:
  /api/v1/domain/:
    post:
      tags:
        - Domains
      summary: Add Domain
      description: >-
        Adds a domain to a workspace and returns the 2 nameservers you need to
        add as NS records for it at your DNS provider. Connecting a domain takes
        3 steps:


        1. Add the domain with this request.

        2. Add the returned `nameservers` as NS records at your DNS provider,
        then call `Check Domain Nameservers` until its `state` is `verified`.
        DNS changes can take a while to propagate.

        3. Call `Start Domain Setup` to create the domain's email accounts.
        Setup runs in the background; `setup_complete` becomes true once it's
        done and the domain moves into warmup.


        Returns `403` if the workspace has reached its domain limit.
      operationId: domain_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDomainRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetDomainAPI'
          description: Domain Added
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleMessageResponse'
          description: Bad Request
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleMessageResponse'
          description: Domain Limit Reached
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleMessageResponse'
          description: Workspace Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleMessageResponse'
          description: Domain Already Connected
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleMessageResponse'
          description: Internal Server Error
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleMessageResponse'
          description: Not Available Yet
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: bash
          label: curl
          source: |-
            curl -X POST "https://api.deliveryman.ai/api/v1/domain/" \
              -H "X-Api-Key: YOUR_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "workspace_id": 12,
                "domain": "draftss.com"
              }'
components:
  schemas:
    CreateDomainRequest:
      properties:
        workspace_id:
          description: ID of the workspace to add the domain to.
          title: Workspace Id
          type: integer
        domain:
          description: >-
            Domain or subdomain to connect (ex. `example.com` or
            `mail.example.com`). A leading `http://`, `https://` or `www.` is
            removed and the value is lower-cased.
          examples:
            - example.com
          maxLength: 253
          minLength: 1
          title: Domain
          type: string
      required:
        - workspace_id
        - domain
      title: CreateDomainRequest
      type: object
    GetDomainAPI:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
          description: ID for this domain.
        workspace_id:
          type:
            - integer
            - 'null'
          readOnly: true
          description: ID of the workspace associated with this domain.
        domain:
          type: string
          readOnly: true
          description: The domain name (ex. example.com, foo.example.com).
        created_on:
          type: string
          format: date-time
          description: >-
            Datetime when the domain was created. ISO format date string in UTC
            timezone.
        deletion_started_on:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            Datetime when the domain deletion process started. ISO format date
            string in UTC timezone.
        setup_complete:
          type: boolean
          description: Flag indicating whether the domain setup is complete.
        naming_strategy:
          allOf:
            - $ref: '#/components/schemas/NamingStrategyEnum'
          description: |-
            Naming strategy used for email generation during domain setup.

            * `random` - random
            * `male` - male
            * `female` - female
            * `custom` - custom
        custom_name:
          type:
            - string
            - 'null'
          description: >-
            Custom name used in domain setup when `custom` naming strategy is
            used.
          maxLength: 500
        warmup_days_remaining:
          type: integer
          description: Number of days remaining in the domain's warmup period.
          readOnly: true
        redirect_subdomains_to:
          type:
            - string
            - 'null'
          description: The URL to which subdomains are redirected, if set.
        status:
          allOf:
            - $ref: '#/components/schemas/DomainStatusEnum'
          description: >-
            Current status of the domain. `creating` while the domain is being
            set up, `warmup` once setup is done and

            the domain is warming up, `active` once warmup is complete,
            `deleting` while it's being removed, `error`

            if setup or deletion failed, and `ns_mismatch` if the domain's
            nameserver records no longer point to us.
          readOnly: true
        warmup_active_days:
          type: integer
          maximum: 2147483647
          minimum: 0
          description: Number of days the warmup process has been active.
        current_setup_stage:
          type: integer
          maximum: 2147483647
          minimum: -2147483648
          description: >-
            Setup progress: `1` once the domain is added and waiting for
            nameserver records, `4` once email accounts are generated, and `5`
            once mail server setup has started. `setup_complete` becomes true
            when setup finishes.
        domain_usable_from:
          type: string
          format: date-time
          description: >-
            Datetime from which the domain can be used to send campaigns. ISO
            format date string in UTC timezone.
        warmup_running:
          type: boolean
          description: Whether warmup is currently running for this domain.
        is_blocked:
          type: boolean
          description: Whether this domain is blocked from being used in new campaigns.
        nameservers:
          type: array
          items:
            type: string
          description: >-
            Nameservers that must be added as NS records for this domain at your
            DNS provider.
          readOnly: true
        email_account_count:
          type: integer
          description: Number of email accounts created for this domain.
          readOnly: true
      required:
        - domain
        - email_account_count
        - id
        - nameservers
        - status
        - warmup_days_remaining
        - workspace_id
    SimpleMessageResponse:
      type: object
      properties:
        message:
          type: string
          description: Human-readable description of the result or error.
      required:
        - message
    NamingStrategyEnum:
      enum:
        - random
        - male
        - female
        - custom
      type: string
    DomainStatusEnum:
      enum:
        - creating
        - error
        - warmup
        - active
        - deleting
        - ns_mismatch
      type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        Your API key, sent as the value of the `X-Api-Key` header. In the
        dashboard, go to Integrations and open Deliveryman API Keys to create
        one.

````

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