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

# Bulk provision domains

> Provision up to 1000 domains to use MailChannels Inbound.



## OpenAPI

````yaml /inbound/api-reference/openapi.yaml post /domains/batch
openapi: 3.0.3
info:
  title: Inbound API
  description: |
    Manage domains for MailChannels Inbound.

    ### Rate Limits
    This API is limited to 100 queries per second, per customer.
    Queries that exceed this rate may be rejected with the
    `503 Service Temporarily Unavailable` HTTP response.
  version: 1.3.0
servers:
  - url: https://api.mailchannels.net/inbound/v1
security:
  - APIKeyHeader: []
tags:
  - name: Domains
  - name: Lists
  - name: Recipients
  - name: Login links
  - name: Reporting
  - name: Account
paths:
  /domains/batch:
    post:
      tags:
        - Domains
      summary: Bulk provision domains
      description: Provision up to 1000 domains to use MailChannels Inbound.
      parameters:
        - name: subscriptionHandle
          description: >
            The subscription 'handle' that identifies the subscription that
            domains should be

            provisioned against.  Subscription handles can be retrieved from the
            `/subscriptions`

            endpoint.
          in: query
          required: true
          schema:
            type: string
        - name: associate-key
          description: >
            If present and set to true, the domains will be associated with the
            api-key in the header.

            This means that this api-key must be used for inbound-api actions
            involving these domains

            (for example adding safe/block list entries, etc).
          in: query
          required: false
          schema:
            type: boolean
        - name: overwrite
          description: >
            If present and set to true, the settings (domain settings,
            downstream addresses, aliases and admins)

            for any existing domains will be overwritten with the ones in the
            request, unless a section is not

            included in the request or there is problem updating a setting in
            which case the previous settings

            are carried forward.
          in: query
          required: false
          schema:
            type: boolean
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                domains:
                  type: array
                  maxItems: 1000
                  items:
                    type: object
                    required:
                      - domain
                    properties:
                      domain:
                        type: string
                        format: hostname
                        description: The domain name to be provisioned.
                      downstreamAddress:
                        description: >
                          The locations of mail servers to which messages will
                          be delivered

                          after filtering.
                        type: array
                        items:
                          $ref: '#/components/schemas/DownstreamAddress'
                      settings:
                        $ref: '#/components/schemas/DomainSettings'
                      aliases:
                        description: >
                          A list of aliases for the domain. Mail is accepted for
                          these domains and

                          routed to the downstreamAddresses defined for the
                          domain.
                        type: array
                        items:
                          type: string
                      admins:
                        description: >-
                          A list of email addresses that are the domain admins
                          for the domain.
                        type: array
                        items:
                          type: string
      responses:
        '200':
          description: >
            The request was processed successfully. This does not necessarily
            mean all the domains in

            the request were successfully provisioned.

            See the CommentedDomain definition for more information.
          content:
            application/json:
              schema:
                type: object
                required:
                  - successes
                  - errors
                properties:
                  successes:
                    type: array
                    items:
                      $ref: '#/components/schemas/CommentedDomain'
                  errors:
                    type: array
                    items:
                      $ref: '#/components/schemas/CommentedDomain'
        '400':
          description: >
            Bad Request, returned in the case that a domain name fails RFC 5891
            validation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >
            Creating the domains will exceed the number of domains allowed with
            the specified subscription, or

            you are attempting to use a subscription that is not your own.

            None of the domains have been provisioned.

            Contact sales@mailchannels.com to increase your limit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    DownstreamAddress:
      type: object
      required:
        - priority
        - weight
        - port
        - target
      properties:
        priority:
          description: >
            The priority of the dowsntream address.  Only addresses with the
            highest priority (the lowest numerical

            value) are selected.
          type: integer
          minimum: 0
        weight:
          description: >
            Downstream addresses are selected in proportion to their weights. 
            For example, if there are two

            downstream addresses, A with weight 40, and B with weight 10, then A
            is selected 80% of the time

            and B is selected 20% of the time.
          type: integer
          minimum: 0
        port:
          description: TCP port on which the downstream mail server is listening.
          type: integer
          minimum: 0
        target:
          description: >-
            The canonical hostname of the host providing the service, ending in
            a dot.
          type: string
          maxLength: 255
    DomainSettings:
      properties:
        abusePolicy:
          description: The abuse policy
          type: string
          enum:
            - block
            - flag
            - quarantine
          nullable: true
          minLength: 1
        abusePolicyOverride:
          description: If true, this abuse policy overrides the recipient abuse policy.
          nullable: true
          type: boolean
        spamHeaderName:
          description: The spam header name to use if the abuse policy is set to 'flag'.
          type: string
          nullable: true
          minLength: 1
        spamHeaderValue:
          description: The spam header value to use if the abuse policy is set to 'flag'.
          type: string
          nullable: true
          minLength: 1
    CommentedDomain:
      required:
        - domain
        - code
      properties:
        domain:
          $ref: '#/components/schemas/Domain'
        code:
          type: integer
          description: >
            * `201`: This domain was successfully created.

            * `400`: A 400 response is typically returned in the following
            case(s):
                1. The domain name was an A label that did not meet the specifications in RFC 3490

            * `409`: The domain is already provisioned, and is associated with a
            different customer.

            * `500`: There was an error provisioning the domain.
          enum:
            - 201
            - 400
            - 409
            - 500
        comment:
          type: string
          description: More information about the result of domain provisioning.
    ErrorResponse:
      required:
        - errors
      properties:
        code:
          type: integer
        message:
          type: string
        errors:
          type: array
          items:
            type: string
    Domain:
      required:
        - domain
        - subscriptionHandle
        - admins
        - aliases
        - downstreamAddresses
      properties:
        domain:
          description: The domain name.
          type: string
          format: hostname
        subscriptionHandle:
          description: >
            The subscription 'handle' that identifies the subscription that this
            domain should be

            provisioned against.  Subscription handles can be retrieved from the
            `/subscriptions`

            endpoint.
          type: string
        settings:
          $ref: '#/components/schemas/DomainSettings'
        admins:
          description: A list of email addresses that are the domain admins for the domain.
          type: array
          items:
            type: string
        downstreamAddresses:
          description: |
            The locations of mail servers to which messages will be delivered
            after filtering.
          type: array
          items:
            $ref: '#/components/schemas/DownstreamAddress'
        aliases:
          description: >
            A list of aliases for the domain. Mail is accepted for these domains
            and

            routed to the downstreamAddresses defined for the domain.
          type: array
          items:
            type: string
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````