Import records
const url = 'https://api.nsin.ir/domains/example.com/records/import';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"records":[{"name":"example","type":"A","destination":"example","ttl":1,"mx_priority":1,"proxied":true}]}'};
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 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "records": [ { "name": "example", "type": "A", "destination": "example", "ttl": 1, "mx_priority": 1, "proxied": true } ] }'Creates the supplied records. A non-TXT record whose name and type
already exist overwrites that record’s destination, TTL and MX
priority — its proxied setting is kept, whatever the item says. TXT
records are always added. Best-effort per record — the response counts
what succeeded and lists what failed (a type that is not allowed, an
invalid value, a record that is not editable, or a proxied origin the
edge refuses). A CNAME at @ is refused per row (“use type ANAME for
root”). ttl is kept, capped at 604800; a missing, 0 or 1 (a
Cloudflare export’s automatic TTL) ttl becomes 120, and a proxied
record always gets 120 — on an overwrite, the proxy state the record
keeps decides. On a managed domain the
zone is updated straight away. Requires records.edit; the
new records count against the plan’s record allowance.
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
object
The record’s value.
TTL in seconds; missing or 0 becomes 120.
MX priority. MX only.
Proxy the new record. Ignored for a record that already exists (it keeps its setting) and for types that cannot be proxied.
Responses
Section titled “ Responses ”Import outcome.
object
object
Example generated
{ "created": 1, "overwritten": 1, "failed": [ { "name": "example", "type": "example", "error": "example" } ]}Malformed request body, or records is empty.
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 domain has no active plan, so no records can be added.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}Read-only key, insufficient role, or the import would take the domain past its plan’s record allowance (nothing is written).
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 domain is disabled or banned.
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"}