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

# Save DNS Records

> Saves or updates the DNS records for the domain.



## OpenAPI

````yaml api-reference/openapi.json post /domains/{domain}/dns
openapi: 3.1.0
info:
  title: Domains Reseller API
  description: >-
    Domain name management API for resellers. Manage domains, renewals, billing,
    and other domain-related operations.
  version: 2.4.1
servers:
  - url: https://vicem.com/modules/addons/DomainsReseller/api/index.php
    description: Production server
security: []
paths:
  /domains/{domain}/dns:
    post:
      tags:
        - DNS
      summary: Save DNS Records
      description: Saves or updates the DNS records for the domain.
      operationId: saveDns
      parameters:
        - $ref: '#/components/parameters/UsernameHeader'
        - $ref: '#/components/parameters/TokenHeader'
        - name: domain
          in: path
          required: true
          description: Domain name (e.g. example.com)
          schema:
            type: string
            example: example.com
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - domain
                - dnsrecords
              properties:
                domain:
                  type: string
                  description: Domain name
                  example: example.com
                dnsrecords:
                  type: array
                  description: Array of DNS records to save
                  items:
                    $ref: '#/components/schemas/DnsRecord'
      responses:
        '200':
          description: Success - Registrar result
          content:
            application/json:
              schema:
                type: object
        '400':
          description: Parameter validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Authentication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Domain not found in reseller account
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  parameters:
    UsernameHeader:
      name: username
      in: header
      required: true
      description: Reseller email address registered in WHMCS
      schema:
        type: string
        format: email
        example: reseller@example.com
    TokenHeader:
      name: token
      in: header
      required: true
      description: >-
        HMAC-SHA256 authentication token.


        PHP formula: `base64_encode(hash_hmac('sha256', $apiKey, $email . ':' .
        gmdate('y-m-d H')))`


        **Important**: `hash_hmac` **without** the 3rd parameter `true` (returns
        hex, not binary), then `base64_encode` of the hex result. The token is
        88 characters long.


        An optional `timestamp` header (Unix timestamp, 60-second tolerance) can
        be sent to synchronize time.
      schema:
        type: string
        example: YTk4YjRmNjI...
  schemas:
    DnsRecord:
      type: object
      description: DNS record
      properties:
        hostname:
          type: string
          description: Hostname
          example: www
        type:
          type: string
          description: Record type
          enum:
            - A
            - AAAA
            - CNAME
            - MX
            - TXT
            - SRV
            - NS
          example: A
        address:
          type: string
          description: Record value/address
          example: 192.0.2.1
        priority:
          type: string
          description: Priority (for MX, SRV records)
          example: '10'
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
      example:
        error: Invalid API Token provided

````