Skip to content
nsin docs

Parse a zone file into an import preview

POST
/domains/{domain}/records/import/parse
curl --request POST \
--url https://api.nsin.ir/domains/example.com/records/import/parse \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@file

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.

domain
required
string

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

Example
example.com
Media type multipart/form-data
object
file
required

The zone file to parse. At most 2 MB.

string format: binary

Import preview.

Media type application/json
object
records
Array<object>
object
name
string
type
string
Allowed values: A AAAA CNAME ANAME NS TXT MX SRV PTR CAA TLSA SSHFP URI
destination

The record’s value.

string
ttl

TTL the record would be created with (120).

integer
mx_priority

MX priority. MX only.

integer
proxied

Whether the record would be proxied.

boolean
status

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.

string
Allowed values: new overwrite unsupported
existing_id

Set when status is overwrite.

integer
reason

Why an entry is unsupported.

string
Example
{
"records": [
{
"type": "A",
"status": "new"
}
]
}

No file form field, or the file is larger than 2 MB. Lines the parser cannot read are skipped rather than failing the request.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}

Missing, malformed, revoked or expired API key. (A valid key whose account has been deactivated gets 403 account is inactive instead.)

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
Example invalidKey
{
"error": "invalid API key"
}

The key is read-only, your role on the domain lacks the required permission, or the domain’s plan does not include the feature.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}

No such domain, or it is not visible to this account. Domains you cannot access are reported as not found rather than forbidden.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}

The key exceeded its request budget (300 requests per minute by default).

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
Example limited
{
"error": "rate limit exceeded"
}