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

# Create new domain

> Add a new domain for email receiving. Automatically initiates verification and returns required DNS records. Subdomains inherit verification from their verified parent domain.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/inbound/openapi.documented.yml post /api/e2/domains
openapi: 3.1.0
info:
  title: Inbound Email API
  description: >+

    # Inbound API


    The Inbound API allows you to manage email infrastructure programmatically -
    domains, email addresses, webhooks, and more.


    ## Authentication


    All API requests require a Bearer token in the Authorization header:


    ```bash

    curl -H "Authorization: Bearer YOUR_API_KEY" \
      https://inbound.new/api/e2/domains
    ```


    ## Base URL


    ```

    https://inbound.new/api/e2

    ```


    ## Quick Start


    1. **Create a domain** - Register your domain with Inbound

    2. **Configure DNS** - Add the provided DNS records to your domain

    3. **Create an email address** - Set up addresses to receive emails

    4. **Create an endpoint** - Configure where emails are delivered (webhook,
    forwarding, etc.)

  version: 2.0.0
servers:
  - url: https://inbound.new
    description: Production API server
security:
  - bearerAuth: []
tags:
  - name: Webhooks
    description: Webhooks sent by Inbound to your configured endpoints when events occur.
  - name: Emails
    description: >-
      Send, list, and manage emails. Supports immediate sending, scheduling,
      replies, and retry functionality.
  - name: Mail
    description: >-
      Inbox and thread views for received emails. Filter by domain, address, or
      search.
  - name: Domains
    description: >-
      Manage domains for sending and receiving emails. Domains must be verified
      via DNS before use.
  - name: Endpoints
    description: >-
      Configure where incoming emails are delivered - webhooks, email
      forwarding, or custom handlers.
  - name: Email Addresses
    description: Create and manage email addresses on your verified domains.
  - name: Attachments
    description: Download email attachments using authenticated requests.
paths:
  /api/e2/domains:
    post:
      tags:
        - Domains
      summary: Create new domain
      description: >-
        Add a new domain for email receiving. Automatically initiates
        verification and returns required DNS records. Subdomains inherit
        verification from their verified parent domain.
      operationId: postApiE2Domains
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                domain:
                  minLength: 1
                  maxLength: 253
                  type: string
              required:
                - domain
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                domain:
                  minLength: 1
                  maxLength: 253
                  type: string
              required:
                - domain
          multipart/form-data:
            schema:
              type: object
              properties:
                domain:
                  minLength: 1
                  maxLength: 253
                  type: string
              required:
                - domain
      responses:
        '201':
          description: Response for status 201
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  domain:
                    type: string
                  status:
                    enum:
                      - pending
                      - verified
                      - failed
                    type: string
                  canReceiveEmails:
                    type: boolean
                  hasMxRecords:
                    type: boolean
                  domainProvider:
                    nullable: true
                    anyOf:
                      - type: string
                      - type: 'null'
                  providerConfidence:
                    nullable: true
                    anyOf:
                      - type: string
                      - type: 'null'
                  mailFromDomain:
                    type: string
                  mailFromDomainStatus:
                    type: string
                  dnsRecords:
                    type: array
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                        name:
                          type: string
                        value:
                          type: string
                        description:
                          type: string
                        isRequired:
                          type: boolean
                      required:
                        - type
                        - name
                        - value
                        - isRequired
                  dnsConflict:
                    type: object
                    properties:
                      hasConflict:
                        type: boolean
                      conflictType:
                        type: string
                        enum:
                          - mx
                          - cname
                          - both
                      message:
                        type: string
                      existingRecords:
                        type: array
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                            value:
                              type: string
                          required:
                            - type
                            - value
                    required:
                      - hasConflict
                      - message
                  createdAt:
                    format: date-time
                    type: string
                  updatedAt:
                    format: date-time
                    type: string
                  parentDomain:
                    type: string
                  message:
                    type: string
                required:
                  - id
                  - domain
                  - status
                  - canReceiveEmails
                  - hasMxRecords
                  - domainProvider
                  - providerConfidence
                  - dnsRecords
                  - createdAt
                  - updatedAt
        '400':
          description: Response for status 400
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                required:
                  - error
        '401':
          description: Response for status 401
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                required:
                  - error
        '403':
          description: Response for status 403
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                required:
                  - error
        '409':
          description: Response for status 409
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                required:
                  - error
        '500':
          description: Response for status 500
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                required:
                  - error
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Inbound from 'inboundemail';

            const client = new Inbound({
              apiKey: process.env['INBOUND_API_KEY'], // This is the default and can be omitted
            });

            const domain = await client.domains.create({ domain: 'x' });

            console.log(domain.id);
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Your Inbound API key. Include it in the Authorization header as: Bearer
        <your-api-key>

````