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

Update many records at once

posthttps://api.nsin.ir/domains/{domain}/records/batch-update

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

Applies an update to many records in one request. Each item accepts exactly the same optional fields as a single PUT.

Best-effort: every record is processed independently, so one bad record does not abort the rest. The response always returns 200 with a per-record results array — check it rather than the status code. At most 1000 records per call. The edge is notified once for the whole batch. Requires records.edit.

Path parameters

  • domainstringrequiredpath

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

Request body

Content type: application/json · required

  • updatesarray of objectrequired
    Item fields
    • idintegerrequired

      Id of the record to update.

    • namestring
    • destinationstring

      New value — see destination on Record.

    • mx_priorityinteger

      MX priority. MX only.

    • ttlinteger

      Seconds resolvers may cache this record. Forced to 120 while proxied is true — a proxied record answers with our edge addresses, and traffic can only be moved between edges as fast as the slowest resolver still holding the old answer.

      Default: 120
    • proxiedboolean

      See proxied on RecordCreate.

    • captchaboolean

      Challenge visitors before passing them to the origin.

    • schemestring

      Protocol the edge uses to reach the origin of a proxied record.

      • Https — TLS to port (443 when the port is unset or out of range).
      • Http — plain HTTP to port (80 when unset or out of range).
      • Auto — HTTPS on 443 first, falling back to plain HTTP. The port is always 443.
      • Default — accepted on input, and so are an empty or unrecognised value, but stored as Auto with port 443: a record never reads back as Default.
      One of: "Http" "Https" "Auto" "Default"
    • portinteger

      See port on RecordCreate.

    • host_headerstring

      See host_header on RecordCreate. An empty string removes the override.

    • host_header_modestring

      See host_header_mode on RecordCreate.

      One of: "own" "target"
    • monitorboolean

      Include this record in uptime monitoring.

    • timeoutinteger

      Origin wait before 504, in seconds. Max 1800 (30 minutes).

    • commentstring

      Free-form note. An empty string removes it.

Responses

200Per-record outcome.

Content type: application/json

  • succeededinteger
  • failedinteger
  • resultsarray of BatchItemResult
    Item fields
    • idinteger
    • okboolean
    • errorstring

      Present only when ok is false.

json
{
  "succeeded": 0,
  "failed": 0,
  "results": [
    {
      "id": 0,
      "ok": true,
      "error": "string"
    }
  ]
}
400Malformed body, an empty updates, or more than 1000 records.

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"
}
403The key is read-only, your role on the domain lacks the required permission, or the domain's plan does not include the feature.

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/batch-update" \
  -H "Authorization: Bearer $NSIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "updates": [
    {
      "id": 0,
      "name": "string",
      "destination": "string",
      "mx_priority": 0,
      "ttl": 120,
      "proxied": true,
      "captcha": true,
      "scheme": "Http",
      "port": 0,
      "host_header": "string",
      "host_header_mode": "own",
      "monitor": true,
      "timeout": 0,
      "comment": "string"
    }
  ]
}'
esc