Update many records at once
const url = 'https://api.nsin.ir/domains/example.com/records/batch-update';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"updates":[{"id":1,"name":"example","destination":"example","mx_priority":1,"ttl":120,"proxied":true,"captcha":true,"scheme":"Http","port":1,"host_header":"example","host_header_mode":"own","monitor":true,"timeout":1,"comment":"example"}]}'};
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/batch-update \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "updates": [ { "id": 1, "name": "example", "destination": "example", "mx_priority": 1, "ttl": 120, "proxied": true, "captcha": true, "scheme": "Http", "port": 1, "host_header": "example", "host_header_mode": "own", "monitor": true, "timeout": 1, "comment": "example" } ] }'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.
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
Id of the record to update.
New value — see destination on Record.
MX priority. MX only.
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.
See proxied on RecordCreate.
Challenge visitors before passing them to the origin.
Protocol the edge uses to reach the origin of a proxied record.
Https— TLS toport(443 when the port is unset or out of range).Http— plain HTTP toport(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 asAutowith port 443: a record never reads back asDefault.
See port on RecordCreate.
See host_header on RecordCreate. An empty string removes the override.
See host_header_mode on RecordCreate.
Include this record in uptime monitoring.
Origin wait before 504, in seconds. Max 1800 (30 minutes).
Free-form note. An empty string removes it.
Responses
Section titled “ Responses ”Per-record outcome.
Outcome of a best-effort bulk operation. The status code is 200 even
when some records failed — inspect results.
object
object
Present only when ok is false.
Example generated
{ "succeeded": 1, "failed": 1, "results": [ { "id": 1, "ok": true, "error": "example" } ]}Malformed body, an empty updates, or more than 1000 records.
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 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"}