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

# Add new inbound domain

> Adds a new inbound domain with SMTP, webhook, or forward delivery. For forward delivery, use POST /inbound/domains/{uuid}/forward-rules to register routing rules after the domain is created and DNS is verified. Mode-specific fields are strictly enforced: smtp_servers is only allowed for delivery_type=smtp, the webhook_* fields are only allowed for delivery_type=webhook, and delivery_type=forward accepts neither. Sending fields from the wrong mode returns 400.



## OpenAPI

````yaml /openapi.json post /inbound/domains
openapi: 3.0.0
info:
  title: JetEmail API
  version: 1.0.0
  description: API documentation for JetEmail's transactional email service.
servers:
  - url: https://api.jetemail.com
    description: Production
security:
  - apiKeyAuth: []
externalDocs:
  description: Download OpenAPI Specification
  url: /openapi.json
paths:
  /inbound/domains:
    post:
      tags:
        - Inbound
      summary: Add new inbound domain
      description: >-
        Adds a new inbound domain with SMTP, webhook, or forward delivery. For
        forward delivery, use POST /inbound/domains/{uuid}/forward-rules to
        register routing rules after the domain is created and DNS is verified.
        Mode-specific fields are strictly enforced: smtp_servers is only allowed
        for delivery_type=smtp, the webhook_* fields are only allowed for
        delivery_type=webhook, and delivery_type=forward accepts neither.
        Sending fields from the wrong mode returns 400.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - domain
                - delivery_type
              properties:
                domain:
                  type: string
                  description: >-
                    Primary domain name to add (e.g., example.com, not
                    mail.example.com)
                  example: example.com
                  pattern: >-
                    ^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?.)+[a-zA-Z]{2,}$
                delivery_type:
                  type: string
                  enum:
                    - smtp
                    - webhook
                    - forward
                  description: >-
                    How emails should be delivered for this domain. For
                    "forward", inbound mail is forwarded to per-recipient
                    destinations defined via POST
                    /inbound/domains/{uuid}/forward-rules.
                smtp_servers:
                  type: array
                  description: >-
                    Only for delivery_type=smtp (required). Rejected with 400 if
                    sent with webhook or forward.
                  items:
                    oneOf:
                      - type: string
                        description: Server URL
                        example: mail.example.com:25
                      - type: object
                        properties:
                          url:
                            type: string
                            description: Server URL
                            example: mail.example.com:25
                          priority:
                            type: integer
                            description: Server priority (lower = higher priority)
                            example: 1
                          tls_enabled:
                            type: boolean
                            description: Enable TLS
                            default: false
                          timeout:
                            type: integer
                            description: Timeout in milliseconds
                            default: 30000
                        required:
                          - url
                webhook_url:
                  type: string
                  format: uri
                  description: >-
                    Only for delivery_type=webhook (required). Webhook URL to
                    receive emails. Rejected with 400 if sent with smtp or
                    forward.
                  example: https://example.com/webhook/inbound
                webhook_method:
                  type: string
                  enum:
                    - POST
                    - PUT
                  default: POST
                  description: >-
                    Only for delivery_type=webhook. HTTP method for webhook.
                    Rejected with 400 if sent with smtp or forward.
                webhook_headers:
                  type: object
                  additionalProperties:
                    type: string
                  description: >-
                    Only for delivery_type=webhook. Custom headers to send with
                    webhook requests. Rejected with 400 if sent with smtp or
                    forward.
                webhook_timeout:
                  type: integer
                  default: 30000
                  description: >-
                    Only for delivery_type=webhook. Webhook timeout in
                    milliseconds. Rejected with 400 if sent with smtp or
                    forward.
                webhook_retry_count:
                  type: integer
                  default: 3
                  description: >-
                    Only for delivery_type=webhook. Number of retry attempts for
                    failed webhook calls. Rejected with 400 if sent with smtp or
                    forward.
                webhook_auth_header:
                  type: string
                  description: >-
                    Only for delivery_type=webhook. Authorization header value
                    for webhook. Rejected with 400 if sent with smtp or forward.
            examples:
              SMTP Delivery:
                value:
                  domain: example.com
                  delivery_type: smtp
                  smtp_servers:
                    - url: mail.example.com:25
                      priority: 1
                      tls_enabled: true
              Webhook Delivery:
                value:
                  domain: example.com
                  delivery_type: webhook
                  webhook_url: https://example.com/webhook/inbound
              Forwarding Delivery:
                value:
                  domain: example.com
                  delivery_type: forward
      responses:
        '200':
          description: Domain added successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  result:
                    type: object
                    properties:
                      domain:
                        type: string
                        example: example.com
                      delivery_type:
                        type: string
                        enum:
                          - smtp
                          - webhook
                          - forward
                        example: smtp
                      status:
                        type: string
                        example: active
                      uuid:
                        type: string
                        example: 550e8400-e29b-41d4-a716-446655440000
                      webhook_secret:
                        type: string
                        description: >-
                          Only present for webhook delivery_type. Secret for
                          HMAC validation of webhook payloads.
                        example: whsec_...
                      forward_mx_verified:
                        type: integer
                        enum:
                          - 0
                          - 1
                        description: >-
                          Only present for forward delivery_type. DNS
                          verification flag for the customer's MX record. Starts
                          at 0; flipped to 1 by an external verifier once the
                          customer publishes the required record. Inbound mail
                          is rejected with 550 until all four forward_*_verified
                          flags are 1.
                        example: 0
                      forward_dkim_verified:
                        type: integer
                        enum:
                          - 0
                          - 1
                        description: >-
                          Only present for forward delivery_type. DNS
                          verification flag for the customer's DKIM CNAME.
                        example: 0
                      forward_spf_verified:
                        type: integer
                        enum:
                          - 0
                          - 1
                        description: >-
                          Only present for forward delivery_type. DNS
                          verification flag for the customer's SPF record.
                        example: 0
                      forward_dmarc_verified:
                        type: integer
                        enum:
                          - 0
                          - 1
                        description: >-
                          Only present for forward delivery_type. DNS
                          verification flag for the customer's DMARC record.
                        example: 0
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Invalid domain format
              examples:
                Invalid domain format:
                  value:
                    success: false
                    error: >-
                      Invalid primary domain format. Please provide a primary
                      domain (e.g., example.com) rather than a subdomain (e.g.,
                      mail.example.com).
                Wrong fields for delivery_type=forward:
                  summary: smtp_servers or webhook_* sent with delivery_type=forward
                  value:
                    success: false
                    error: >-
                      Fields not allowed for delivery_type=forward:
                      smtp_servers, webhook_url
                Wrong fields for delivery_type=smtp:
                  summary: webhook_* sent with delivery_type=smtp
                  value:
                    success: false
                    error: 'Fields not allowed for delivery_type=smtp: webhook_url'
                Wrong fields for delivery_type=webhook:
                  summary: smtp_servers sent with delivery_type=webhook
                  value:
                    success: false
                    error: 'Fields not allowed for delivery_type=webhook: smtp_servers'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Unauthorized
        '403':
          description: Quota exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Domain quota exceeded
                  quota:
                    type: number
                    example: 1
                  current:
                    type: number
                    example: 1
        '409':
          description: Domain already exists
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: >-
                      This domain is already configured. Please use a different
                      domain.
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Failed to create domain
components:
  securitySchemes:
    apiKeyAuth:
      type: http
      scheme: bearer
      description: API key for account management endpoints. Use your api_ prefixed token.

````