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

Import records

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

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

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.

Path parameters

  • domainstringrequiredpath

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

Request body

Content type: application/json · required

  • recordsarray of ImportRecordItemrequired
    Item fields
    • namestringrequired
    • typestringrequired
      One of: "A" "AAAA" "CNAME" "ANAME" "NS" "TXT" "MX" "SRV" "PTR" "CAA" "TLSA" "SSHFP" "URI"
    • destinationstringrequired

      The record's value.

    • ttlinteger

      TTL in seconds; missing or 0 becomes 120.

    • mx_priorityinteger

      MX priority. MX only.

    • proxiedboolean

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

Responses

200Import outcome.

Content type: application/json

  • createdinteger
  • overwritteninteger
  • failedarray of object
    Item fields
    • namestring
    • typestring
    • errorstring
json
{
  "created": 0,
  "overwritten": 0,
  "failed": [
    {
      "name": "string",
      "type": "string",
      "error": "string"
    }
  ]
}
400Malformed request body, or records is empty.

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

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
403Read-only key, insufficient role, or the import would take the domain past its plan's record allowance (nothing is written).

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"
}
409The domain is disabled or banned.

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" \
  -H "Authorization: Bearer $NSIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "records": [
    {
      "name": "string",
      "type": "A",
      "destination": "string",
      "ttl": 0,
      "mx_priority": 0,
      "proxied": true
    }
  ]
}'
esc