nsindocs Search the docs⌘K
  1. Docs
  2. API reference
  3. DNS Records

Parse a zone file into an import preview

posthttps://api.nsin.ir/domains/{domain}/records/import/parse

Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… — see API keys.

Accepts a BIND-style zone file, uploaded as the multipart form field file (at most 2 MB), and returns what would be imported, with each entry marked new, overwrite (a record with the same name and type exists — existing_id; TXT records never overwrite, and MX, NS, SRV, CAA, TLSA, SSHFP and URI only overwrite a record with the same value) or unsupported. Nothing is written — pass the entries you want to POST .../records/import. Requires domain.view.

The SOA and the apex NS records are skipped. Each entry keeps the file's own TTL (a line with none takes $TTL, else 3600), capped at 604800 (one week). A TTL of 1 — how a Cloudflare export writes its automatic TTL — or 0 becomes 120, NSIN's Auto, and a proxied entry always gets 120, as a proxied record created by hand does. A line carrying Cloudflare's cf-proxied:true comment, or the nsin-proxied:true comment NSIN's own export writes, is previewed with proxied: true, unless the type cannot be proxied or the origin is an address the edge refuses to proxy to (then reason says so). A CNAME at the apex is previewed as ANAME — that is how NSIN's export writes an apex alias and how Cloudflare exports a flattened apex.

Path parameters

  • domainstringrequiredpath

    The domain name (for example example.com) — not a numeric id.

Request body

Content type: multipart/form-data · required

  • filestring (binary)required

    The zone file to parse. At most 2 MB.

Responses

200Import preview.

Content type: application/json

  • recordsarray of ImportPreviewRecord
    Item fields
    • namestring
    • typestring
      One of: "A" "AAAA" "CNAME" "ANAME" "NS" "TXT" "MX" "SRV" "PTR" "CAA" "TLSA" "SSHFP" "URI"
    • destinationstring

      The record's value.

    • ttlinteger

      TTL the record would be created with (120).

    • mx_priorityinteger

      MX priority. MX only.

    • proxiedboolean

      Whether the record would be proxied.

    • statusstring

      overwrite means an NSIN record with the same name and type (for MX, NS, SRV, CAA, TLSA, SSHFP and URI: and the same value) already exists and would be replaced.

      One of: "new" "overwrite" "unsupported"
    • existing_idinteger

      Set when status is overwrite.

    • reasonstring

      Why an entry is unsupported.

json
{
  "records": [
    {
      "name": "string",
      "type": "A",
      "destination": "string",
      "ttl": 0,
      "mx_priority": 0,
      "proxied": true,
      "status": "new",
      "existing_id": 0,
      "reason": "string"
    }
  ]
}
400No file form field, or the file is larger than 2 MB. Lines the parser cannot read are skipped rather than failing the request.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
401Missing, malformed, revoked or expired API key. (A valid key whose account has been deactivated gets 403 account is inactive instead.)

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "invalid API key"
}
403The key is read-only, your role on the domain lacks the required permission, or the domain's plan does not include the feature.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
404No such domain, or it is not visible to this account. Domains you cannot access are reported as not found rather than forbidden.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
429The key exceeded its request budget (300 requests per minute by default).

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "rate limit exceeded"
}

Example request

bash
curl -X POST "https://api.nsin.ir/domains/example.com/records/import/parse" \
  -H "Authorization: Bearer $NSIN_API_KEY" \
  -F "file=@file"
esc