Parse a zone file into an import preview
const url = 'https://api.nsin.ir/domains/example.com/records/import/parse';const form = new FormData();form.append('file', 'file');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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=@fileAccepts 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.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The domain name (for example example.com) — not a numeric id.
Example
example.comRequest Body required
Section titled “Request Body required ”object
The zone file to parse. At most 2 MB.
Responses
Section titled “ Responses ”Import preview.
object
object
The record’s value.
TTL the record would be created with (120).
MX priority. MX only.
Whether the record would be proxied.
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.
Set when status is overwrite.
Why an entry is unsupported.
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.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
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.)
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "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.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
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.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}The key exceeded its request budget (300 requests per minute by default).
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "rate limit exceeded"}