Mail-in-a-Box DNS API

DNS operations, which include adding custom records, adding a secondary nameserver and viewing all DNS records.

Operations 15

GET /dns/secondary-nameserver Get DNS secondary nameserver #
POST /dns/secondary-nameserver Add DNS secondary nameserver #
GET /dns/zones Get DNS zones #
GET /dns/zonefile/{zone} Get DNS zonefile #
POST /dns/update Update DNS #
GET /dns/custom Get DNS custom records #
GET /dns/custom/{qname}/{rtype} Get DNS custom records #
POST /dns/custom/{qname}/{rtype} Add DNS custom record #
PUT /dns/custom/{qname}/{rtype} Update DNS custom record #
DELETE /dns/custom/{qname}/{rtype} Remove DNS custom record #
GET /dns/custom/{qname} Get DNS custom A records #
POST /dns/custom/{qname} Add DNS custom A record #
PUT /dns/custom/{qname} Update DNS custom A record #
DELETE /dns/custom/{qname} Remove DNS custom A record #
GET /dns/dump Get DNS dump #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/mail-in-a-box:mail-in-a-box-dns-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

mail-in-a-box-dns-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Mail-in-a-Box DNS API
  description: 'Mail-in-a-Box API HTTP specification.


    # Introduction

    This API is documented in **OpenAPI format**.

    (View the full HTTP specification.)


    All endpoints are relative to `https://{host}/admin` and are secured with `Basic Access` authentication. If you have multi-factor authentication enabled, authentication with a `user:password` combination will fail unless a valid OTP is supplied via the `x-auth-token` header. Authentication via a `user:user_key` pair is possible without the header being present.'
  contact:
    name: Mail-in-a-Box support
    url: https://mailinabox.email/
  license:
    name: CC0 1.0 Universal
    url: https://creativecommons.org/publicdomain/zero/1.0/legalcode
  version: 0.51.0
  x-logo:
    url: https://mailinabox.email/static/logo.png
    altText: Mail-in-a-Box logo
servers:
- url: https://{host}/admin
  variables:
    host:
      default: box.example.com
      description: The API hostname.
security:
- basicAuth: []
tags:
- name: DNS
  description: DNS operations, which include adding custom records, adding a secondary nameserver and viewing all DNS records.
paths:
  /dns/secondary-nameserver:
    get:
      tags:
      - DNS
      summary: Get DNS secondary nameserver
      description: Returns a list of nameserver hostnames.
      operationId: getDnsSecondaryNameserver
      x-codeSamples:
      - lang: curl
        source: "curl -X GET \"https://{host}/admin/dns/secondary-nameserver\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DNSSecondaryNameserverResponse'
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
    post:
      tags:
      - DNS
      summary: Add DNS secondary nameserver
      description: Adds one or more secondary nameservers.
      operationId: addDnsSecondaryNameserver
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/DNSSecondaryNameserverAddRequest'
            example:
              hostnames: ns2.hostingcompany.com, ns3.hostingcompany.com
      x-codeSamples:
      - lang: curl
        source: "curl -X POST \"https://{host}/admin/dns/secondary-nameserver\" \\\n  -d \"hostnames=<string>\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            text/html:
              schema:
                $ref: '#/components/schemas/DNSSecondaryNameserverAddResponse'
              example: 'updated DNS: example.com'
        400:
          description: Bad request
          content:
            text/html:
              schema:
                type: string
                example: Could not resolve the IP address of badhostname
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
  /dns/zones:
    get:
      tags:
      - DNS
      summary: Get DNS zones
      description: Returns an array of all managed top-level domains.
      operationId: getDnsZones
      x-codeSamples:
      - lang: curl
        source: "curl -X GET \"https://{host}/admin/dns/zones\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DNSZonesResponse'
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
  /dns/zonefile/{zone}:
    parameters:
    - in: path
      name: zone
      schema:
        $ref: '#/components/schemas/Hostname'
      required: true
      description: Hostname
    get:
      tags:
      - DNS
      summary: Get DNS zonefile
      description: Returns a DNS zone file for a hostname.
      operationId: getDnsZonefile
      x-codeSamples:
      - lang: curl
        source: "curl -X GET \"https://{host}/admin/dns/zonefile/<zone>\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DNSZonefileResponse'
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
  /dns/update:
    post:
      tags:
      - DNS
      summary: Update DNS
      description: Updates the DNS. Involves creating zone files and restarting `nsd`.
      operationId: updateDns
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/DNSUpdateRequest'
            example:
              force: 1
      x-codeSamples:
      - lang: curl
        source: "curl -X POST \"https://{host}/admin/dns/update\" \\\n  -d \"force=<integer>\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DNSUpdateResponse'
        400:
          description: Bad request
          content:
            text/html:
              schema:
                type: string
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
  /dns/custom:
    get:
      tags:
      - DNS
      summary: Get DNS custom records
      description: Returns all custom DNS records.
      operationId: getDnsCustomRecords
      x-codeSamples:
      - lang: curl
        source: "curl -X GET \"https://{host}/admin/dns/custom\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DNSCustomRecordsResponse'
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
  /dns/custom/{qname}/{rtype}:
    parameters:
    - in: path
      name: qname
      schema:
        $ref: '#/components/schemas/Hostname'
      required: true
      description: DNS record query name
    - in: path
      name: rtype
      schema:
        $ref: '#/components/schemas/DNSRecordType'
      required: true
      description: Record type
    get:
      tags:
      - DNS
      summary: Get DNS custom records
      description: Returns all custom records for the specified query name and type.
      operationId: getDnsCustomRecordsForQNameAndType
      x-codeSamples:
      - lang: curl
        source: "curl -X GET \"https://{host}/admin/dns/custom/<qname>/<rtype>\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DNSCustomRecordsResponse'
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
    post:
      tags:
      - DNS
      summary: Add DNS custom record
      description: Adds a custom DNS record for the specified query name and type.
      operationId: addDnsCustomRecord
      requestBody:
        $ref: '#/components/requestBodies/DNSCustomRecordRequest'
      x-codeSamples:
      - lang: curl
        source: "curl -X POST \"https://{host}/admin/dns/custom/<qname>/<rtype>\" \\\n  -H \"Content-Type: text/plain\" \\\n  --data-raw \"<string>\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            text/html:
              schema:
                $ref: '#/components/schemas/DNSCustomRecordUpsertResponse'
              example: 'updated DNS: example.com'
        400:
          description: Bad request
          content:
            text/html:
              schema:
                type: string
                example: '''badhostname'' does not appear to be an IPv4 or IPv6 address'
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
    put:
      tags:
      - DNS
      summary: Update DNS custom record
      description: Updates an existing DNS custom record value for the specified qname and type.
      operationId: updateDnsCustomRecord
      requestBody:
        $ref: '#/components/requestBodies/DNSCustomRecordRequest'
      x-codeSamples:
      - lang: curl
        source: "curl -x PUT \"https://{host}/admin/dns/custom/<qname>/<rtype>\" \\\n  -H \"Content-Type: text/plain\" \\\n  --data-raw \"<string>\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            text/html:
              schema:
                $ref: '#/components/schemas/DNSCustomRecordUpsertResponse'
              example: 'updated DNS: example.com'
        400:
          description: Bad request
          content:
            text/html:
              schema:
                type: string
                example: '''badhostname'' does not appear to be an IPv4 or IPv6 address'
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
    delete:
      tags:
      - DNS
      summary: Remove DNS custom record
      description: Removes a DNS custom record for the specified domain, type & value.
      operationId: removeDnsCustomRecord
      requestBody:
        $ref: '#/components/requestBodies/DNSCustomRecordRequest'
      x-codeSamples:
      - lang: curl
        source: "curl -X DELETE \"https://{host}/admin/dns/custom/<qname>/<rtype>\" \\\n  -H \"Content-Type: text/plain\" \\\n  --data-raw \"<string>\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            text/html:
              schema:
                $ref: '#/components/schemas/DNSCustomRecordRemoveResponse'
              example: 'updated DNS: example.com'
        400:
          description: Bad request
          content:
            text/html:
              schema:
                type: string
                example: badhostname is not a domain name or a subdomain of a domain name managed by this box
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
  /dns/custom/{qname}:
    parameters:
    - in: path
      name: qname
      schema:
        $ref: '#/components/schemas/Hostname'
      required: true
      description: DNS query name.
    get:
      tags:
      - DNS
      summary: Get DNS custom A records
      description: Returns all custom A records for the specified query name.
      operationId: getDnsCustomARecordsForQName
      x-codeSamples:
      - lang: curl
        source: "curl -X GET \"https://{host}/admin/dns/custom/<qname>\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DNSCustomRecordsResponse'
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
    post:
      tags:
      - DNS
      summary: Add DNS custom A record
      description: Adds a custom DNS A record for the specified query name.
      operationId: addDnsCustomARecord
      requestBody:
        $ref: '#/components/requestBodies/DNSCustomRecordRequest'
      x-codeSamples:
      - lang: curl
        source: "curl -X POST \"https://{host}/admin/dns/custom/<qname>\" \\\n  -H \"Content-Type: text/plain\" \\\n  --data-raw \"<string>\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            text/html:
              schema:
                $ref: '#/components/schemas/DNSCustomRecordUpsertResponse'
              example: 'updated DNS: example.com'
        400:
          description: Bad request
          content:
            text/html:
              schema:
                type: string
                example: '''badhostname'' does not appear to be an IPv4 or IPv6 address'
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
    put:
      tags:
      - DNS
      summary: Update DNS custom A record
      description: Updates an existing DNS custom A record value for the specified qname.
      operationId: updateDnsCustomARecord
      requestBody:
        $ref: '#/components/requestBodies/DNSCustomRecordRequest'
      x-codeSamples:
      - lang: curl
        source: "curl -x PUT \"https://{host}/admin/dns/custom/<qname>\" \\\n  -H \"Content-Type: text/plain\" \\\n  --data-raw \"<string>\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            text/html:
              schema:
                $ref: '#/components/schemas/DNSCustomRecordUpsertResponse'
              example: 'updated DNS: example.com'
        400:
          description: Bad request
          content:
            text/html:
              schema:
                type: string
                example: '''badhostname'' does not appear to be an IPv4 or IPv6 address'
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
    delete:
      tags:
      - DNS
      summary: Remove DNS custom A record
      description: Removes a DNS custom A record for the specified domain & value.
      operationId: removeDnsCustomARecord
      requestBody:
        $ref: '#/components/requestBodies/DNSCustomRecordRequest'
      x-codeSamples:
      - lang: curl
        source: "curl -X DELETE \"https://{host}/admin/dns/custom/<qname>\" \\\n  -H \"Content-Type: text/plain\" \\\n  --data-raw \"<string>\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            text/html:
              schema:
                $ref: '#/components/schemas/DNSCustomRecordRemoveResponse'
              example: 'updated DNS: example.com'
        400:
          description: Bad request
          content:
            text/html:
              schema:
                type: string
                example: badhostname is not a domain name or a subdomain of a domain name managed by this box
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
  /dns/dump:
    get:
      tags:
      - DNS
      summary: Get DNS dump
      description: Returns all DNS records.
      operationId: getDnsDump
      x-codeSamples:
      - lang: curl
        source: "curl -X GET \"https://{host}/admin/dns/dump\" \\\n  -u \"<email>:<password>\"\n"
      responses:
        200:
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DNSDumpResponse'
              example:
              - - example1.com
                - - explanation: Required. Specifies the hostname (and priority) of the machine that handles @example.com mail.
                    qname: example1.com
                    rtype: MX
                    value: 10 box.example1.com.
              - - example2.com
                - - explanation: Required. Specifies the hostname (and priority) of the machine that handles @example.com mail.
                    qname: example2.com
                    rtype: MX
                    value: 10 box.example2.com.
        403:
          description: Forbidden
          content:
            text/html:
              schema:
                type: string
components:
  schemas:
    DNSCustomRecordRemoveResponse:
      type: string
      example: 'updated DNS: example.com'
      description: Custom DNS record remove response.
    DNSDumpDomainRecords:
      type: array
      items:
        $ref: '#/components/schemas/DNSDumpDomainRecord'
      description: List of domain records.
    DNSDumpResponse:
      type: array
      items:
        $ref: '#/components/schemas/DNSDumpDomains'
      description: DNS dump response.
    DNSCustomRecordUpsertResponse:
      type: string
      example: 'updated DNS: example.com'
      description: Custom DNS record add response.
    DNSDumpDomains:
      type: array
      items:
        oneOf:
        - $ref: '#/components/schemas/Hostname'
        - $ref: '#/components/schemas/DNSDumpDomainRecords'
      description: 'A list of records per domain.


        The first item in the list is the domain and the second item is the list of records.

        '
    DNSZonefileResponse:
      type: string
    DNSUpdateResponse:
      type: string
      example: 'updated DNS: example1.com,example2.com

        '
      description: DNS update response.
    Hostname:
      type: string
      format: hostname
      example: example.com
      description: Hostname format.
    DNSZonesResponse:
      type: array
      items:
        $ref: '#/components/schemas/Hostname'
      description: DNS zones response.
    DNSSecondaryNameserverAddResponse:
      type: string
      example: 'updated DNS: example.com'
      description: Secondary nameserver/s add response.
    DNSCustomRecordsResponse:
      type: array
      items:
        $ref: '#/components/schemas/DNSCustomRecord'
      description: Custom DNS records response.
    DNSUpdateRequest:
      type: object
      required:
      - force
      properties:
        force:
          type: integer
          format: int32
          minimum: 0
          maximum: 1
          example: 1
          description: Force an update even if mailinabox detects no changes are required.
      description: DNS update request.
    DNSSecondaryNameserverResponse:
      type: object
      required:
      - hostnames
      properties:
        hostnames:
          type: array
          items:
            type: string
            example: ns1.example.com
      description: Secondary nameserver/s response.
    DNSDumpDomainRecord:
      type: object
      required:
      - explanation
      - qname
      - type
      - value
      properties:
        explanation:
          type: string
          example: Required. Specifies the hostname (and priority) of the machine that handles @example.com mail
        qname:
          $ref: '#/components/schemas/Hostname'
        rtype:
          $ref: '#/components/schemas/DNSRecordType'
        value:
          type: string
          example: 10 example.com.
      description: Domain DNS record details.
    DNSSecondaryNameserverAddRequest:
      type: object
      required:
      - hostnames
      properties:
        hostnames:
          type: string
          description: Hostnames separated with commas or spaces.
          example: ns2.hostingcompany.com, ns3.hostingcompany.com
      description: Secondary nameserver/s add request.
    DNSRecordType:
      enum:
      - A
      - AAAA
      - CAA
      - CNAME
      - TXT
      - MX
      - SRV
      - SSHFP
      - NS
      example: MX
      description: DNS record type.
    DNSCustomRecord:
      type: object
      required:
      - qname
      - rtype
      - value
      properties:
        qname:
          $ref: '#/components/schemas/Hostname'
        rtype:
          $ref: '#/components/schemas/DNSRecordType'
        value:
          type: string
          example: 10 example.com.
      description: Custom DNS record detail detail.
  requestBodies:
    DNSCustomRecordRequest:
      required: true
      content:
        text/plain:
          schema:
            type: string
            example: 1.2.3.4
            description: The value of the DNS record.
          example: 1.2.3.4
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: 'Credentials can be supplied using the `Authorization` header in

        format `Authorization: Basic {access-token}`.


        The `access-token` is comprised of the Base64 encoding of `username:password`.

        The `username` is the mail user''s email address, and `password` can either be the mail user''s

        password, or the `api_key` returned from the `login` operation.


        When using `curl`, you can supply user credentials using the `-u` or `--user` parameter.

        '
externalDocs:
  description: Find out more about Mail-in-a-box.
  url: https://mailinabox.email/