Skip to content
nsin docs

Import records

POST
/domains/{domain}/records/import
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.

domain
required
string

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

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

The record’s value.

string
ttl

TTL in seconds; missing or 0 becomes 120.

integer
mx_priority

MX priority. MX only.

integer
proxied

Proxy the new record. Ignored for a record that already exists (it keeps its setting) and for types that cannot be proxied.

boolean

Import outcome.

Media type application/json
object
created
integer
overwritten
integer
failed
Array<object>
object
name
string
type
string
error
string
Example generated
{
"created": 1,
"overwritten": 1,
"failed": [
{
"name": "example",
"type": "example",
"error": "example"
}
]
}

Malformed request body, or records is empty.

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 domain has no active plan, so no records can be added.

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"
}

Read-only key, insufficient role, or the import would take the domain past its plan’s record allowance (nothing is written).

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 domain is disabled or banned.

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"
}